diff --git a/estela-api/api/views/auth.py b/estela-api/api/views/auth.py index a14b52e6..9295b705 100644 --- a/estela-api/api/views/auth.py +++ b/estela-api/api/views/auth.py @@ -47,7 +47,9 @@ def retry_send_verification_email(self, user, request): send_verification_email(user, request) @swagger_auto_schema( - methods=["POST"], responses={status.HTTP_200_OK: TokenSerializer()} + methods=["POST"], + responses={status.HTTP_200_OK: TokenSerializer()}, + tags=["auth"], ) @action(methods=["POST"], detail=False) def login(self, request, *args, **kwargs): @@ -70,7 +72,9 @@ def login(self, request, *args, **kwargs): return Response(TokenSerializer(token).data) @swagger_auto_schema( - methods=["POST"], responses={status.HTTP_200_OK: TokenSerializer()} + methods=["POST"], + responses={status.HTTP_200_OK: TokenSerializer()}, + tags=["auth"], ) @action(methods=["POST"], detail=False, serializer_class=UserSerializer) def register(self, request, *args, **kwargs): @@ -93,6 +97,9 @@ def register(self, request, *args, **kwargs): token, _ = Token.objects.get_or_create(user=user) return Response(TokenSerializer(token).data) + @swagger_auto_schema( + tags=["auth"], + ) @action(methods=["GET"], detail=False) def activate(self, request, *args, **kwargs): token = request.query_params.get("token", "") @@ -149,6 +156,7 @@ def get_queryset(self): @swagger_auto_schema( responses={status.HTTP_200_OK: UserProfileSerializer()}, + tags=["auth"], ) def retrieve(self, request, *args, **kwargs): user: User = request.user @@ -172,6 +180,7 @@ def retrieve(self, request, *args, **kwargs): @swagger_auto_schema( responses={status.HTTP_200_OK: UserProfileSerializer()}, + tags=["auth"], ) def update(self, request, *args, **kwargs): username = kwargs.get("username", "") @@ -196,11 +205,41 @@ def update(self, request, *args, **kwargs): serializer.save() return Response(data=serializer.data, status=status.HTTP_200_OK) + @swagger_auto_schema( + tags=["auth"], + ) + def list(self, request, *args, **kwargs): + return super().list(request, *args, **kwargs) + + @swagger_auto_schema( + responses={status.HTTP_201_CREATED: UserProfileSerializer()}, + tags=["auth"], + ) + def create(self, request, *args, **kwargs): + return super().create(request, *args, **kwargs) + + @swagger_auto_schema( + responses={status.HTTP_200_OK: UserProfileSerializer()}, + tags=["auth"], + ) + def partial_update(self, request, *args, **kwargs): + return super().partial_update(request, *args, **kwargs) + + @swagger_auto_schema( + responses={ + status.HTTP_204_NO_CONTENT: openapi.Response("No Content"), + }, + tags=["auth"], + ) + def destroy(self, request, *args, **kwargs): + return super().destroy(request, *args, **kwargs) + class ChangePasswordViewSet(viewsets.GenericViewSet): @swagger_auto_schema( request_body=ChangePasswordSerializer, responses={status.HTTP_200_OK: TokenSerializer()}, + tags=["auth"], ) @action( methods=["PATCH"], @@ -245,14 +284,18 @@ def get_parameters(self, request): return token, user_id @swagger_auto_schema( - methods=["POST"], responses={status.HTTP_200_OK: TokenSerializer()} + operation_id="api_account_resetPassword_request", + methods=["POST"], + responses={status.HTTP_200_OK: TokenSerializer()}, + tags=["auth"], ) @action( methods=["POST"], detail=False, serializer_class=ResetPasswordRequestSerializer, + url_path="request", ) - def request(self, request, *args, **kwargs): + def request_reset(self, request, *args, **kwargs): serializer = ResetPasswordRequestSerializer(data=request.data) serializer.is_valid(raise_exception=True) email = serializer.validated_data["email"] @@ -288,6 +331,7 @@ def request(self, request, *args, **kwargs): }, ), }, + tags=["auth"], ) @action(methods=["GET"], detail=False) def validate(self, request, *args, **kwargs): @@ -318,6 +362,7 @@ def validate(self, request, *args, **kwargs): }, ), }, + tags=["auth"], ) @action( methods=["PATCH"], detail=False, serializer_class=ResetPasswordConfirmSerializer diff --git a/estela-api/api/views/cronjob.py b/estela-api/api/views/cronjob.py index 84ad46ae..8fa3f2a9 100644 --- a/estela-api/api/views/cronjob.py +++ b/estela-api/api/views/cronjob.py @@ -56,6 +56,7 @@ def get_queryset(self): description="Cron job tag.", ), ], + tags=["spider-cronjobs"], ) def list(self, *args, **kwargs): return super(SpiderCronJobViewSet, self).list(*args, **kwargs) @@ -63,6 +64,7 @@ def list(self, *args, **kwargs): @swagger_auto_schema( request_body=SpiderCronJobCreateSerializer, responses={status.HTTP_201_CREATED: SpiderCronJobCreateSerializer()}, + tags=["spider-cronjobs"], ) def create(self, request, *args, **kwargs): spider = get_object_or_404(Spider, sid=self.kwargs["sid"], deleted=False) @@ -101,6 +103,7 @@ def create(self, request, *args, **kwargs): @swagger_auto_schema( request_body=SpiderCronJobUpdateSerializer, responses={status.HTTP_200_OK: SpiderCronJobUpdateSerializer()}, + tags=["spider-cronjobs"], ) def update(self, request, *args, **kwargs): partial = kwargs.pop("partial", False) @@ -118,6 +121,7 @@ def update(self, request, *args, **kwargs): @swagger_auto_schema( responses={status.HTTP_204_NO_CONTENT: "Cronjob deleted"}, + tags=["spider-cronjobs"], ) def destroy(self, request, *args, **kwargs): instance = self.get_object() @@ -131,7 +135,9 @@ def perform_destroy(self, instance): instance.save() @swagger_auto_schema( - methods=["GET"], responses={status.HTTP_200_OK: SpiderCronJobSerializer()} + methods=["GET"], + responses={status.HTTP_200_OK: SpiderCronJobSerializer()}, + tags=["spider-cronjobs"], ) @action(methods=["GET"], detail=True) def run_once(self, request, *args, **kwargs): @@ -142,3 +148,17 @@ def run_once(self, request, *args, **kwargs): run_cronjob_once(cronjob.data) return Response(cronjob.data, status=status.HTTP_200_OK) + + @swagger_auto_schema( + responses={status.HTTP_200_OK: SpiderCronJobSerializer()}, + tags=["spider-cronjobs"], + ) + def retrieve(self, request, *args, **kwargs): + return super().retrieve(request, *args, **kwargs) + + @swagger_auto_schema( + responses={status.HTTP_200_OK: SpiderCronJobSerializer()}, + tags=["spider-cronjobs"], + ) + def partial_update(self, request, *args, **kwargs): + return super().partial_update(request, *args, **kwargs) diff --git a/estela-api/api/views/deploy.py b/estela-api/api/views/deploy.py index 882d09a8..3e7f8d20 100644 --- a/estela-api/api/views/deploy.py +++ b/estela-api/api/views/deploy.py @@ -1,4 +1,5 @@ from django.shortcuts import get_object_or_404 +from drf_yasg import openapi from drf_yasg.utils import swagger_auto_schema from rest_framework import viewsets, status from rest_framework.response import Response @@ -40,6 +41,7 @@ def get_queryset(self): @swagger_auto_schema( request_body=DeployCreateSerializer, responses={status.HTTP_201_CREATED: DeployCreateSerializer()}, + tags=["deploys"], ) def create(self, request, *args, **kwargs): project = get_object_or_404(Project, pid=self.kwargs["pid"]) @@ -74,6 +76,7 @@ def create(self, request, *args, **kwargs): @swagger_auto_schema( request_body=DeployUpdateSerializer, responses={status.HTTP_200_OK: DeployUpdateSerializer()}, + tags=["deploys"], ) def update(self, request, *args, **kwargs): if not request.user.is_superuser: @@ -93,3 +96,32 @@ def update(self, request, *args, **kwargs): headers = self.get_success_headers(serializer.data) return Response(serializer.data, status=status.HTTP_200_OK, headers=headers) + + @swagger_auto_schema( + tags=["deploys"], + ) + def list(self, request, *args, **kwargs): + return super().list(request, *args, **kwargs) + + @swagger_auto_schema( + responses={status.HTTP_200_OK: DeploySerializer()}, + tags=["deploys"], + ) + def retrieve(self, request, *args, **kwargs): + return super().retrieve(request, *args, **kwargs) + + @swagger_auto_schema( + responses={status.HTTP_200_OK: DeploySerializer()}, + tags=["deploys"], + ) + def partial_update(self, request, *args, **kwargs): + return super().partial_update(request, *args, **kwargs) + + @swagger_auto_schema( + responses={ + status.HTTP_204_NO_CONTENT: openapi.Response("No Content"), + }, + tags=["deploys"], + ) + def destroy(self, request, *args, **kwargs): + return super().destroy(request, *args, **kwargs) diff --git a/estela-api/api/views/job.py b/estela-api/api/views/job.py index 14414d4e..5c4f09fa 100644 --- a/estela-api/api/views/job.py +++ b/estela-api/api/views/job.py @@ -1,4 +1,3 @@ -from datetime import date, timedelta from django.shortcuts import get_object_or_404 from django_filters.rest_framework import DjangoFilterBackend from drf_yasg.utils import swagger_auto_schema @@ -80,6 +79,7 @@ def get_queryset(self): description="Job tag.", ), ], + tags=["spider-jobs"], ) def list(self, *args, **kwargs): return super(SpiderJobViewSet, self).list(*args, **kwargs) @@ -95,6 +95,7 @@ def list(self, *args, **kwargs): ], request_body=SpiderJobCreateSerializer, responses={status.HTTP_201_CREATED: SpiderJobCreateSerializer()}, + tags=["spider-jobs"], ) def create(self, request, *args, **kwargs): spider = get_object_or_404(Spider, sid=self.kwargs["sid"], deleted=False) @@ -146,6 +147,7 @@ def create(self, request, *args, **kwargs): @swagger_auto_schema( request_body=SpiderJobUpdateSerializer, responses={status.HTTP_200_OK: SpiderJobUpdateSerializer()}, + tags=["spider-jobs"], ) def update(self, request, *args, **kwargs): partial = kwargs.pop("partial", False) @@ -161,3 +163,17 @@ def update(self, request, *args, **kwargs): headers = self.get_success_headers(serializer.data) return Response(serializer.data, status=status.HTTP_200_OK, headers=headers) + + @swagger_auto_schema( + responses={status.HTTP_200_OK: SpiderJobSerializer()}, + tags=["spider-jobs"], + ) + def retrieve(self, request, *args, **kwargs): + return super().retrieve(request, *args, **kwargs) + + @swagger_auto_schema( + responses={status.HTTP_200_OK: SpiderJobSerializer()}, + tags=["spider-jobs"], + ) + def partial_update(self, request, *args, **kwargs): + return super().partial_update(request, *args, **kwargs) diff --git a/estela-api/api/views/job_data.py b/estela-api/api/views/job_data.py index 2ac03f74..99b3ede4 100644 --- a/estela-api/api/views/job_data.py +++ b/estela-api/api/views/job_data.py @@ -84,6 +84,7 @@ def get_paginated_link(self, page_number): required=False, ), ], + tags=["spider-jobs"], ) def list(self, request, *args, **kwargs): page, data_type, page_size = self.get_parameters(request) @@ -161,6 +162,7 @@ def list(self, request, *args, **kwargs): required=True, ), ], + tags=["spider-jobs"], ) @action(methods=["POST"], detail=False) def delete(self, request, *args, **kwargs): diff --git a/estela-api/api/views/project.py b/estela-api/api/views/project.py index c691604a..36ac2ebe 100644 --- a/estela-api/api/views/project.py +++ b/estela-api/api/views/project.py @@ -74,6 +74,7 @@ def perform_create(self, serializer): @swagger_auto_schema( request_body=ProjectUpdateSerializer, responses={status.HTTP_200_OK: ProjectUpdateSerializer()}, + tags=["projects"], ) def update(self, request, *args, **kwargs): partial = kwargs.pop("partial", False) @@ -137,6 +138,7 @@ def update(self, request, *args, **kwargs): @swagger_auto_schema( responses={status.HTTP_204_NO_CONTENT: "Project deleted"}, + tags=["projects"], ) def destroy(self, request, *args, **kwargs): instance = self.get_object() @@ -166,6 +168,7 @@ def perform_destroy(self, instance): ), ], responses={status.HTTP_200_OK: ProjectJobSerializer()}, + tags=["projects"], ) @action(methods=["GET"], detail=True) def jobs(self, request, *args, **kwargs): @@ -205,6 +208,7 @@ def jobs(self, request, *args, **kwargs): ), ], responses={status.HTTP_200_OK: ProjectCronJobSerializer()}, + tags=["projects"], ) @action(methods=["GET"], detail=True) def cronjobs(self, request, *args, **kwargs): @@ -227,6 +231,7 @@ def cronjobs(self, request, *args, **kwargs): @swagger_auto_schema( methods=["GET"], responses={status.HTTP_200_OK: ProjectUsageSerializer()}, + tags=["projects"], ) @action(methods=["GET"], detail=True) def current_usage(self, request, *args, **kwargs): @@ -258,6 +263,7 @@ def current_usage(self, request, *args, **kwargs): ), ], responses={status.HTTP_200_OK: UsageRecordSerializer(many=True)}, + tags=["projects"], ) @action(methods=["GET"], detail=True) def usage(self, request, *args, **kwargs): @@ -276,3 +282,30 @@ def usage(self, request, *args, **kwargs): serializer.data, status=status.HTTP_200_OK, ) + + @swagger_auto_schema( + tags=["projects"], + ) + def list(self, request, *args, **kwargs): + return super().list(request, *args, **kwargs) + + @swagger_auto_schema( + responses={status.HTTP_200_OK: ProjectSerializer()}, + tags=["projects"], + ) + def retrieve(self, request, *args, **kwargs): + return super().retrieve(request, *args, **kwargs) + + @swagger_auto_schema( + responses={status.HTTP_201_CREATED: ProjectSerializer()}, + tags=["projects"], + ) + def create(self, request, *args, **kwargs): + return super().create(request, *args, **kwargs) + + @swagger_auto_schema( + responses={status.HTTP_200_OK: ProjectSerializer()}, + tags=["projects"], + ) + def partial_update(self, request, *args, **kwargs): + return super().partial_update(request, *args, **kwargs) diff --git a/estela-api/api/views/spider.py b/estela-api/api/views/spider.py index 4479374d..499ea47d 100644 --- a/estela-api/api/views/spider.py +++ b/estela-api/api/views/spider.py @@ -26,6 +26,7 @@ def get_queryset(self): @swagger_auto_schema( request_body=SpiderUpdateSerializer, responses={status.HTTP_200_OK: SpiderUpdateSerializer()}, + tags=["spiders"], ) def update(self, request, *args, **kwargs): partial = kwargs.pop("partial", False) @@ -40,3 +41,23 @@ def update(self, request, *args, **kwargs): instance._prefetched_objects_cache = {} return Response(serializer.data, status=status.HTTP_200_OK) + + @swagger_auto_schema( + tags=["spiders"], + ) + def list(self, request, *args, **kwargs): + return super().list(request, *args, **kwargs) + + @swagger_auto_schema( + responses={status.HTTP_200_OK: SpiderSerializer()}, + tags=["spiders"], + ) + def retrieve(self, request, *args, **kwargs): + return super().retrieve(request, *args, **kwargs) + + @swagger_auto_schema( + responses={status.HTTP_200_OK: SpiderSerializer()}, + tags=["spiders"], + ) + def partial_update(self, request, *args, **kwargs): + return super().partial_update(request, *args, **kwargs) diff --git a/estela-api/api/views/stats.py b/estela-api/api/views/stats.py index 827b39e7..d8e2e676 100644 --- a/estela-api/api/views/stats.py +++ b/estela-api/api/views/stats.py @@ -211,6 +211,7 @@ class GlobalStatsViewSet(BaseViewSet, StatsForDashboardMixin, mixins.ListModelMi schema=ListSerializer(child=GlobalStatsSerializer()), ), }, + tags=["stats"], ) def list(self, request, *args, **kwargs): start_date, end_date = self.get_parameters(request) @@ -277,6 +278,7 @@ class SpidersJobsStatsViewSet( schema=ListSerializer(child=SpidersJobsStatsSerializer()), ), }, + tags=["stats"], ) def list(self, request, *args, **kwargs): start_date, end_date = self.get_parameters(request) diff --git a/estela-api/docs/api.yaml b/estela-api/docs/api.yaml index cf2aad9e..b62fef6c 100644 --- a/estela-api/docs/api.yaml +++ b/estela-api/docs/api.yaml @@ -33,7 +33,7 @@ paths: schema: $ref: '#/definitions/Token' tags: - - api + - auth parameters: [] /api/account/resetPassword/confirm: patch: @@ -68,7 +68,7 @@ paths: error: type: string tags: - - api + - auth parameters: [] /api/account/resetPassword/request: post: @@ -81,12 +81,12 @@ paths: schema: $ref: '#/definitions/ResetPasswordRequest' responses: - '201': + '200': description: '' schema: - $ref: '#/definitions/ResetPasswordRequest' + $ref: '#/definitions/Token' tags: - - api + - auth parameters: [] /api/account/resetPassword/validate: get: @@ -119,7 +119,7 @@ paths: message: type: string tags: - - api + - auth parameters: [] /api/auth/activate: get: @@ -134,7 +134,7 @@ paths: items: $ref: '#/definitions/AuthToken' tags: - - api + - auth parameters: [] /api/auth/login: post: @@ -152,7 +152,7 @@ paths: schema: $ref: '#/definitions/Token' tags: - - api + - auth parameters: [] /api/auth/profile: get: @@ -167,7 +167,7 @@ paths: items: $ref: '#/definitions/UserProfile' tags: - - api + - auth post: operationId: api_auth_profile_create description: '' @@ -183,7 +183,7 @@ paths: schema: $ref: '#/definitions/UserProfile' tags: - - api + - auth parameters: [] /api/auth/profile/{username}: get: @@ -196,7 +196,7 @@ paths: schema: $ref: '#/definitions/UserProfile' tags: - - api + - auth put: operationId: api_auth_profile_update description: '' @@ -212,7 +212,7 @@ paths: schema: $ref: '#/definitions/UserProfile' tags: - - api + - auth patch: operationId: api_auth_profile_partial_update description: '' @@ -228,16 +228,16 @@ paths: schema: $ref: '#/definitions/UserProfile' tags: - - api + - auth delete: operationId: api_auth_profile_delete description: '' parameters: [] responses: '204': - description: '' + description: No Content tags: - - api + - auth parameters: - name: username in: path @@ -262,7 +262,7 @@ paths: schema: $ref: '#/definitions/Token' tags: - - api + - auth parameters: [] /api/projects: get: @@ -303,7 +303,7 @@ paths: items: $ref: '#/definitions/Project' tags: - - api + - projects post: operationId: api_projects_create description: '' @@ -319,7 +319,7 @@ paths: schema: $ref: '#/definitions/Project' tags: - - api + - projects parameters: [] /api/projects/{pid}: get: @@ -332,7 +332,7 @@ paths: schema: $ref: '#/definitions/Project' tags: - - api + - projects put: operationId: api_projects_update description: '' @@ -348,7 +348,7 @@ paths: schema: $ref: '#/definitions/ProjectUpdate' tags: - - api + - projects patch: operationId: api_projects_partial_update description: '' @@ -364,7 +364,7 @@ paths: schema: $ref: '#/definitions/Project' tags: - - api + - projects delete: operationId: api_projects_delete description: '' @@ -373,7 +373,7 @@ paths: '204': description: Project deleted tags: - - api + - projects parameters: - name: pid in: path @@ -402,7 +402,7 @@ paths: schema: $ref: '#/definitions/ProjectCronJob' tags: - - api + - projects parameters: - name: pid in: path @@ -421,7 +421,7 @@ paths: schema: $ref: '#/definitions/ProjectUsage' tags: - - api + - projects parameters: - name: pid in: path @@ -468,7 +468,7 @@ paths: items: $ref: '#/definitions/Deploy' tags: - - api + - deploys post: operationId: api_projects_deploys_create description: '' @@ -484,7 +484,7 @@ paths: schema: $ref: '#/definitions/DeployCreate' tags: - - api + - deploys parameters: - name: pid in: path @@ -501,7 +501,7 @@ paths: schema: $ref: '#/definitions/Deploy' tags: - - api + - deploys put: operationId: api_projects_deploys_update description: '' @@ -517,7 +517,7 @@ paths: schema: $ref: '#/definitions/DeployUpdate' tags: - - api + - deploys patch: operationId: api_projects_deploys_partial_update description: '' @@ -533,16 +533,16 @@ paths: schema: $ref: '#/definitions/Deploy' tags: - - api + - deploys delete: operationId: api_projects_deploys_delete description: '' parameters: [] responses: '204': - description: '' + description: No Content tags: - - api + - deploys parameters: - name: did in: path @@ -574,7 +574,7 @@ paths: schema: $ref: '#/definitions/ProjectJob' tags: - - api + - projects parameters: - name: pid in: path @@ -621,7 +621,7 @@ paths: items: $ref: '#/definitions/Spider' tags: - - api + - spiders parameters: - name: pid in: path @@ -638,7 +638,7 @@ paths: schema: $ref: '#/definitions/Spider' tags: - - api + - spiders put: operationId: api_projects_spiders_update description: '' @@ -654,7 +654,7 @@ paths: schema: $ref: '#/definitions/SpiderUpdate' tags: - - api + - spiders patch: operationId: api_projects_spiders_partial_update description: '' @@ -670,7 +670,7 @@ paths: schema: $ref: '#/definitions/Spider' tags: - - api + - spiders parameters: - name: pid in: path @@ -725,7 +725,7 @@ paths: items: $ref: '#/definitions/SpiderCronJob' tags: - - api + - spider-cronjobs post: operationId: api_projects_spiders_cronjobs_create description: '' @@ -741,7 +741,7 @@ paths: schema: $ref: '#/definitions/SpiderCronJobCreate' tags: - - api + - spider-cronjobs parameters: - name: pid in: path @@ -762,7 +762,7 @@ paths: schema: $ref: '#/definitions/SpiderCronJob' tags: - - api + - spider-cronjobs put: operationId: api_projects_spiders_cronjobs_update description: '' @@ -778,7 +778,7 @@ paths: schema: $ref: '#/definitions/SpiderCronJobUpdate' tags: - - api + - spider-cronjobs patch: operationId: api_projects_spiders_cronjobs_partial_update description: '' @@ -794,7 +794,7 @@ paths: schema: $ref: '#/definitions/SpiderCronJob' tags: - - api + - spider-cronjobs delete: operationId: api_projects_spiders_cronjobs_delete description: '' @@ -803,7 +803,7 @@ paths: '204': description: Cronjob deleted tags: - - api + - spider-cronjobs parameters: - name: cjid in: path @@ -829,7 +829,7 @@ paths: schema: $ref: '#/definitions/SpiderCronJob' tags: - - api + - spider-cronjobs parameters: - name: cjid in: path @@ -898,7 +898,7 @@ paths: items: $ref: '#/definitions/SpiderJob' tags: - - api + - spider-jobs post: operationId: api_projects_spiders_jobs_create description: '' @@ -918,7 +918,7 @@ paths: schema: $ref: '#/definitions/SpiderJobCreate' tags: - - api + - spider-jobs parameters: - name: pid in: path @@ -939,7 +939,7 @@ paths: schema: $ref: '#/definitions/SpiderJob' tags: - - api + - spider-jobs put: operationId: api_projects_spiders_jobs_update description: '' @@ -955,7 +955,7 @@ paths: schema: $ref: '#/definitions/SpiderJobUpdate' tags: - - api + - spider-jobs patch: operationId: api_projects_spiders_jobs_partial_update description: '' @@ -971,7 +971,7 @@ paths: schema: $ref: '#/definitions/SpiderJob' tags: - - api + - spider-jobs parameters: - name: jid in: path @@ -1034,7 +1034,7 @@ paths: items: type: object tags: - - api + - spider-jobs parameters: - name: jid in: path @@ -1064,7 +1064,7 @@ paths: schema: $ref: '#/definitions/DeleteJobData' tags: - - api + - spider-jobs parameters: - name: jid in: path @@ -1112,7 +1112,7 @@ paths: items: $ref: '#/definitions/GlobalStats' tags: - - api + - stats parameters: - name: pid in: path @@ -1152,7 +1152,7 @@ paths: items: $ref: '#/definitions/SpidersJobsStats' tags: - - api + - stats parameters: - name: pid in: path @@ -1185,7 +1185,7 @@ paths: items: $ref: '#/definitions/UsageRecord' tags: - - api + - projects parameters: - name: pid in: path diff --git a/estela-web/src/services/api/generated-api/.openapi-generator/FILES b/estela-web/src/services/api/generated-api/.openapi-generator/FILES index fe2060c5..69389e7f 100644 --- a/estela-web/src/services/api/generated-api/.openapi-generator/FILES +++ b/estela-web/src/services/api/generated-api/.openapi-generator/FILES @@ -1,5 +1,11 @@ .openapi-generator-ignore -apis/ApiApi.ts +apis/AuthApi.ts +apis/DeploysApi.ts +apis/ProjectsApi.ts +apis/SpiderCronjobsApi.ts +apis/SpiderJobsApi.ts +apis/SpidersApi.ts +apis/StatsApi.ts apis/index.ts index.ts models/AuthToken.ts diff --git a/estela-web/src/services/api/generated-api/apis/ApiApi.ts b/estela-web/src/services/api/generated-api/apis/ApiApi.ts deleted file mode 100644 index 5a6033d5..00000000 --- a/estela-web/src/services/api/generated-api/apis/ApiApi.ts +++ /dev/null @@ -1,2341 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * estela API v1.0 Documentation - * estela API Swagger Specification - * - * The version of the OpenAPI document: v1 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -import * as runtime from '../runtime'; -import { - AuthToken, - AuthTokenFromJSON, - AuthTokenToJSON, - ChangePassword, - ChangePasswordFromJSON, - ChangePasswordToJSON, - DeleteJobData, - DeleteJobDataFromJSON, - DeleteJobDataToJSON, - Deploy, - DeployFromJSON, - DeployToJSON, - DeployCreate, - DeployCreateFromJSON, - DeployCreateToJSON, - DeployUpdate, - DeployUpdateFromJSON, - DeployUpdateToJSON, - GlobalStats, - GlobalStatsFromJSON, - GlobalStatsToJSON, - InlineResponse200, - InlineResponse200FromJSON, - InlineResponse200ToJSON, - InlineResponse2001, - InlineResponse2001FromJSON, - InlineResponse2001ToJSON, - InlineResponse2002, - InlineResponse2002FromJSON, - InlineResponse2002ToJSON, - InlineResponse2003, - InlineResponse2003FromJSON, - InlineResponse2003ToJSON, - InlineResponse2004, - InlineResponse2004FromJSON, - InlineResponse2004ToJSON, - InlineResponse2005, - InlineResponse2005FromJSON, - InlineResponse2005ToJSON, - InlineResponse2006, - InlineResponse2006FromJSON, - InlineResponse2006ToJSON, - InlineResponse401, - InlineResponse401FromJSON, - InlineResponse401ToJSON, - Project, - ProjectFromJSON, - ProjectToJSON, - ProjectCronJob, - ProjectCronJobFromJSON, - ProjectCronJobToJSON, - ProjectJob, - ProjectJobFromJSON, - ProjectJobToJSON, - ProjectUpdate, - ProjectUpdateFromJSON, - ProjectUpdateToJSON, - ProjectUsage, - ProjectUsageFromJSON, - ProjectUsageToJSON, - ResetPasswordConfirm, - ResetPasswordConfirmFromJSON, - ResetPasswordConfirmToJSON, - ResetPasswordRequest, - ResetPasswordRequestFromJSON, - ResetPasswordRequestToJSON, - Spider, - SpiderFromJSON, - SpiderToJSON, - SpiderCronJob, - SpiderCronJobFromJSON, - SpiderCronJobToJSON, - SpiderCronJobCreate, - SpiderCronJobCreateFromJSON, - SpiderCronJobCreateToJSON, - SpiderCronJobUpdate, - SpiderCronJobUpdateFromJSON, - SpiderCronJobUpdateToJSON, - SpiderJob, - SpiderJobFromJSON, - SpiderJobToJSON, - SpiderJobCreate, - SpiderJobCreateFromJSON, - SpiderJobCreateToJSON, - SpiderJobUpdate, - SpiderJobUpdateFromJSON, - SpiderJobUpdateToJSON, - SpiderUpdate, - SpiderUpdateFromJSON, - SpiderUpdateToJSON, - SpidersJobsStats, - SpidersJobsStatsFromJSON, - SpidersJobsStatsToJSON, - Token, - TokenFromJSON, - TokenToJSON, - UsageRecord, - UsageRecordFromJSON, - UsageRecordToJSON, - User, - UserFromJSON, - UserToJSON, - UserProfile, - UserProfileFromJSON, - UserProfileToJSON, -} from '../models'; - -export interface ApiAccountChangePasswordChangeRequest { - data: ChangePassword; -} - -export interface ApiAccountResetPasswordConfirmRequest { - token: string; - pair: string; - data: ResetPasswordConfirm; -} - -export interface ApiAccountResetPasswordRequestRequest { - data: ResetPasswordRequest; -} - -export interface ApiAccountResetPasswordValidateRequest { - token: string; - pair: string; -} - -export interface ApiAuthLoginRequest { - data: AuthToken; -} - -export interface ApiAuthProfileCreateRequest { - data: UserProfile; -} - -export interface ApiAuthProfileDeleteRequest { - username: string; -} - -export interface ApiAuthProfilePartialUpdateRequest { - username: string; - data: UserProfile; -} - -export interface ApiAuthProfileReadRequest { - username: string; -} - -export interface ApiAuthProfileUpdateRequest { - username: string; - data: UserProfile; -} - -export interface ApiAuthRegisterRequest { - data: User; -} - -export interface ApiProjectsCreateRequest { - data: Project; -} - -export interface ApiProjectsCronjobsRequest { - pid: string; - page?: number; - pageSize?: number; -} - -export interface ApiProjectsCurrentUsageRequest { - pid: string; -} - -export interface ApiProjectsDeleteRequest { - pid: string; -} - -export interface ApiProjectsDeploysCreateRequest { - pid: string; - data: DeployCreate; -} - -export interface ApiProjectsDeploysDeleteRequest { - did: number; - pid: string; -} - -export interface ApiProjectsDeploysListRequest { - pid: string; - page?: number; - pageSize?: number; -} - -export interface ApiProjectsDeploysPartialUpdateRequest { - did: number; - pid: string; - data: Deploy; -} - -export interface ApiProjectsDeploysReadRequest { - did: number; - pid: string; -} - -export interface ApiProjectsDeploysUpdateRequest { - did: number; - pid: string; - data: DeployUpdate; -} - -export interface ApiProjectsJobsRequest { - pid: string; - page?: number; - pageSize?: number; -} - -export interface ApiProjectsListRequest { - page?: number; - pageSize?: number; -} - -export interface ApiProjectsPartialUpdateRequest { - pid: string; - data: Project; -} - -export interface ApiProjectsReadRequest { - pid: string; -} - -export interface ApiProjectsSpidersCronjobsCreateRequest { - pid: string; - sid: string; - data: SpiderCronJobCreate; -} - -export interface ApiProjectsSpidersCronjobsDeleteRequest { - cjid: number; - pid: string; - sid: string; -} - -export interface ApiProjectsSpidersCronjobsListRequest { - pid: string; - sid: string; - tag?: string; - page?: number; - pageSize?: number; -} - -export interface ApiProjectsSpidersCronjobsPartialUpdateRequest { - cjid: number; - pid: string; - sid: string; - data: SpiderCronJob; -} - -export interface ApiProjectsSpidersCronjobsReadRequest { - cjid: number; - pid: string; - sid: string; -} - -export interface ApiProjectsSpidersCronjobsRunOnceRequest { - cjid: number; - pid: string; - sid: string; -} - -export interface ApiProjectsSpidersCronjobsUpdateRequest { - cjid: number; - pid: string; - sid: string; - data: SpiderCronJobUpdate; -} - -export interface ApiProjectsSpidersJobsCreateRequest { - pid: string; - sid: string; - data: SpiderJobCreate; - async?: boolean; -} - -export interface ApiProjectsSpidersJobsDataDeleteRequest { - jid: string; - pid: string; - sid: string; - type: string; -} - -export interface ApiProjectsSpidersJobsDataListRequest { - jid: string; - pid: string; - sid: string; - page?: number; - pageSize?: number; - type?: string; -} - -export interface ApiProjectsSpidersJobsListRequest { - pid: string; - sid: string; - cronjob?: number; - status?: string; - tag?: string; - page?: number; - pageSize?: number; -} - -export interface ApiProjectsSpidersJobsPartialUpdateRequest { - jid: number; - pid: string; - sid: string; - data: SpiderJob; -} - -export interface ApiProjectsSpidersJobsReadRequest { - jid: number; - pid: string; - sid: string; -} - -export interface ApiProjectsSpidersJobsUpdateRequest { - jid: number; - pid: string; - sid: string; - data: SpiderJobUpdate; -} - -export interface ApiProjectsSpidersListRequest { - pid: string; - page?: number; - pageSize?: number; -} - -export interface ApiProjectsSpidersPartialUpdateRequest { - pid: string; - sid: number; - data: Spider; -} - -export interface ApiProjectsSpidersReadRequest { - pid: string; - sid: number; -} - -export interface ApiProjectsSpidersUpdateRequest { - pid: string; - sid: number; - data: SpiderUpdate; -} - -export interface ApiProjectsStatsListRequest { - pid: string; - startDate: string; - endDate: string; - page?: number; - pageSize?: number; -} - -export interface ApiProjectsStatsSpidersListRequest { - pid: string; - sid: string; - startDate: string; - endDate: string; - page?: number; - pageSize?: number; -} - -export interface ApiProjectsUpdateRequest { - pid: string; - data: ProjectUpdate; -} - -export interface ApiProjectsUsageRequest { - pid: string; - startDate?: string; - endDate?: string; -} - -/** - * - */ -export class ApiApi extends runtime.BaseAPI { - - /** - */ - async apiAccountChangePasswordChangeRaw(requestParameters: ApiAccountChangePasswordChangeRequest): Promise> { - if (requestParameters.data === null || requestParameters.data === undefined) { - throw new runtime.RequiredError('data','Required parameter requestParameters.data was null or undefined when calling apiAccountChangePasswordChange.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - const response = await this.request({ - path: `/api/account/changePassword/change`, - method: 'PATCH', - headers: headerParameters, - query: queryParameters, - body: ChangePasswordToJSON(requestParameters.data), - }); - - return new runtime.JSONApiResponse(response, (jsonValue) => TokenFromJSON(jsonValue)); - } - - /** - */ - async apiAccountChangePasswordChange(requestParameters: ApiAccountChangePasswordChangeRequest): Promise { - const response = await this.apiAccountChangePasswordChangeRaw(requestParameters); - return await response.value(); - } - - /** - */ - async apiAccountResetPasswordConfirmRaw(requestParameters: ApiAccountResetPasswordConfirmRequest): Promise> { - if (requestParameters.token === null || requestParameters.token === undefined) { - throw new runtime.RequiredError('token','Required parameter requestParameters.token was null or undefined when calling apiAccountResetPasswordConfirm.'); - } - - if (requestParameters.pair === null || requestParameters.pair === undefined) { - throw new runtime.RequiredError('pair','Required parameter requestParameters.pair was null or undefined when calling apiAccountResetPasswordConfirm.'); - } - - if (requestParameters.data === null || requestParameters.data === undefined) { - throw new runtime.RequiredError('data','Required parameter requestParameters.data was null or undefined when calling apiAccountResetPasswordConfirm.'); - } - - const queryParameters: any = {}; - - if (requestParameters.token !== undefined) { - queryParameters['token'] = requestParameters.token; - } - - if (requestParameters.pair !== undefined) { - queryParameters['pair'] = requestParameters.pair; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - const response = await this.request({ - path: `/api/account/resetPassword/confirm`, - method: 'PATCH', - headers: headerParameters, - query: queryParameters, - body: ResetPasswordConfirmToJSON(requestParameters.data), - }); - - return new runtime.JSONApiResponse(response, (jsonValue) => TokenFromJSON(jsonValue)); - } - - /** - */ - async apiAccountResetPasswordConfirm(requestParameters: ApiAccountResetPasswordConfirmRequest): Promise { - const response = await this.apiAccountResetPasswordConfirmRaw(requestParameters); - return await response.value(); - } - - /** - */ - async apiAccountResetPasswordRequestRaw(requestParameters: ApiAccountResetPasswordRequestRequest): Promise> { - if (requestParameters.data === null || requestParameters.data === undefined) { - throw new runtime.RequiredError('data','Required parameter requestParameters.data was null or undefined when calling apiAccountResetPasswordRequest.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - const response = await this.request({ - path: `/api/account/resetPassword/request`, - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: ResetPasswordRequestToJSON(requestParameters.data), - }); - - return new runtime.JSONApiResponse(response, (jsonValue) => ResetPasswordRequestFromJSON(jsonValue)); - } - - /** - */ - async apiAccountResetPasswordRequest(requestParameters: ApiAccountResetPasswordRequestRequest): Promise { - const response = await this.apiAccountResetPasswordRequestRaw(requestParameters); - return await response.value(); - } - - /** - */ - async apiAccountResetPasswordValidateRaw(requestParameters: ApiAccountResetPasswordValidateRequest): Promise> { - if (requestParameters.token === null || requestParameters.token === undefined) { - throw new runtime.RequiredError('token','Required parameter requestParameters.token was null or undefined when calling apiAccountResetPasswordValidate.'); - } - - if (requestParameters.pair === null || requestParameters.pair === undefined) { - throw new runtime.RequiredError('pair','Required parameter requestParameters.pair was null or undefined when calling apiAccountResetPasswordValidate.'); - } - - const queryParameters: any = {}; - - if (requestParameters.token !== undefined) { - queryParameters['token'] = requestParameters.token; - } - - if (requestParameters.pair !== undefined) { - queryParameters['pair'] = requestParameters.pair; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - const response = await this.request({ - path: `/api/account/resetPassword/validate`, - method: 'GET', - headers: headerParameters, - query: queryParameters, - }); - - return new runtime.JSONApiResponse(response, (jsonValue) => InlineResponse200FromJSON(jsonValue)); - } - - /** - */ - async apiAccountResetPasswordValidate(requestParameters: ApiAccountResetPasswordValidateRequest): Promise { - const response = await this.apiAccountResetPasswordValidateRaw(requestParameters); - return await response.value(); - } - - /** - */ - async apiAuthActivateRaw(): Promise>> { - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - const response = await this.request({ - path: `/api/auth/activate`, - method: 'GET', - headers: headerParameters, - query: queryParameters, - }); - - return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(AuthTokenFromJSON)); - } - - /** - */ - async apiAuthActivate(): Promise> { - const response = await this.apiAuthActivateRaw(); - return await response.value(); - } - - /** - */ - async apiAuthLoginRaw(requestParameters: ApiAuthLoginRequest): Promise> { - if (requestParameters.data === null || requestParameters.data === undefined) { - throw new runtime.RequiredError('data','Required parameter requestParameters.data was null or undefined when calling apiAuthLogin.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - const response = await this.request({ - path: `/api/auth/login`, - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: AuthTokenToJSON(requestParameters.data), - }); - - return new runtime.JSONApiResponse(response, (jsonValue) => TokenFromJSON(jsonValue)); - } - - /** - */ - async apiAuthLogin(requestParameters: ApiAuthLoginRequest): Promise { - const response = await this.apiAuthLoginRaw(requestParameters); - return await response.value(); - } - - /** - */ - async apiAuthProfileCreateRaw(requestParameters: ApiAuthProfileCreateRequest): Promise> { - if (requestParameters.data === null || requestParameters.data === undefined) { - throw new runtime.RequiredError('data','Required parameter requestParameters.data was null or undefined when calling apiAuthProfileCreate.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - const response = await this.request({ - path: `/api/auth/profile`, - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: UserProfileToJSON(requestParameters.data), - }); - - return new runtime.JSONApiResponse(response, (jsonValue) => UserProfileFromJSON(jsonValue)); - } - - /** - */ - async apiAuthProfileCreate(requestParameters: ApiAuthProfileCreateRequest): Promise { - const response = await this.apiAuthProfileCreateRaw(requestParameters); - return await response.value(); - } - - /** - */ - async apiAuthProfileDeleteRaw(requestParameters: ApiAuthProfileDeleteRequest): Promise> { - if (requestParameters.username === null || requestParameters.username === undefined) { - throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling apiAuthProfileDelete.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - const response = await this.request({ - path: `/api/auth/profile/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters.username))), - method: 'DELETE', - headers: headerParameters, - query: queryParameters, - }); - - return new runtime.VoidApiResponse(response); - } - - /** - */ - async apiAuthProfileDelete(requestParameters: ApiAuthProfileDeleteRequest): Promise { - await this.apiAuthProfileDeleteRaw(requestParameters); - } - - /** - */ - async apiAuthProfileListRaw(): Promise>> { - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - const response = await this.request({ - path: `/api/auth/profile`, - method: 'GET', - headers: headerParameters, - query: queryParameters, - }); - - return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(UserProfileFromJSON)); - } - - /** - */ - async apiAuthProfileList(): Promise> { - const response = await this.apiAuthProfileListRaw(); - return await response.value(); - } - - /** - */ - async apiAuthProfilePartialUpdateRaw(requestParameters: ApiAuthProfilePartialUpdateRequest): Promise> { - if (requestParameters.username === null || requestParameters.username === undefined) { - throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling apiAuthProfilePartialUpdate.'); - } - - if (requestParameters.data === null || requestParameters.data === undefined) { - throw new runtime.RequiredError('data','Required parameter requestParameters.data was null or undefined when calling apiAuthProfilePartialUpdate.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - const response = await this.request({ - path: `/api/auth/profile/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters.username))), - method: 'PATCH', - headers: headerParameters, - query: queryParameters, - body: UserProfileToJSON(requestParameters.data), - }); - - return new runtime.JSONApiResponse(response, (jsonValue) => UserProfileFromJSON(jsonValue)); - } - - /** - */ - async apiAuthProfilePartialUpdate(requestParameters: ApiAuthProfilePartialUpdateRequest): Promise { - const response = await this.apiAuthProfilePartialUpdateRaw(requestParameters); - return await response.value(); - } - - /** - */ - async apiAuthProfileReadRaw(requestParameters: ApiAuthProfileReadRequest): Promise> { - if (requestParameters.username === null || requestParameters.username === undefined) { - throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling apiAuthProfileRead.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - const response = await this.request({ - path: `/api/auth/profile/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters.username))), - method: 'GET', - headers: headerParameters, - query: queryParameters, - }); - - return new runtime.JSONApiResponse(response, (jsonValue) => UserProfileFromJSON(jsonValue)); - } - - /** - */ - async apiAuthProfileRead(requestParameters: ApiAuthProfileReadRequest): Promise { - const response = await this.apiAuthProfileReadRaw(requestParameters); - return await response.value(); - } - - /** - */ - async apiAuthProfileUpdateRaw(requestParameters: ApiAuthProfileUpdateRequest): Promise> { - if (requestParameters.username === null || requestParameters.username === undefined) { - throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling apiAuthProfileUpdate.'); - } - - if (requestParameters.data === null || requestParameters.data === undefined) { - throw new runtime.RequiredError('data','Required parameter requestParameters.data was null or undefined when calling apiAuthProfileUpdate.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - const response = await this.request({ - path: `/api/auth/profile/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters.username))), - method: 'PUT', - headers: headerParameters, - query: queryParameters, - body: UserProfileToJSON(requestParameters.data), - }); - - return new runtime.JSONApiResponse(response, (jsonValue) => UserProfileFromJSON(jsonValue)); - } - - /** - */ - async apiAuthProfileUpdate(requestParameters: ApiAuthProfileUpdateRequest): Promise { - const response = await this.apiAuthProfileUpdateRaw(requestParameters); - return await response.value(); - } - - /** - */ - async apiAuthRegisterRaw(requestParameters: ApiAuthRegisterRequest): Promise> { - if (requestParameters.data === null || requestParameters.data === undefined) { - throw new runtime.RequiredError('data','Required parameter requestParameters.data was null or undefined when calling apiAuthRegister.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - const response = await this.request({ - path: `/api/auth/register`, - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: UserToJSON(requestParameters.data), - }); - - return new runtime.JSONApiResponse(response, (jsonValue) => TokenFromJSON(jsonValue)); - } - - /** - */ - async apiAuthRegister(requestParameters: ApiAuthRegisterRequest): Promise { - const response = await this.apiAuthRegisterRaw(requestParameters); - return await response.value(); - } - - /** - */ - async apiProjectsCreateRaw(requestParameters: ApiProjectsCreateRequest): Promise> { - if (requestParameters.data === null || requestParameters.data === undefined) { - throw new runtime.RequiredError('data','Required parameter requestParameters.data was null or undefined when calling apiProjectsCreate.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - const response = await this.request({ - path: `/api/projects`, - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: ProjectToJSON(requestParameters.data), - }); - - return new runtime.JSONApiResponse(response, (jsonValue) => ProjectFromJSON(jsonValue)); - } - - /** - */ - async apiProjectsCreate(requestParameters: ApiProjectsCreateRequest): Promise { - const response = await this.apiProjectsCreateRaw(requestParameters); - return await response.value(); - } - - /** - */ - async apiProjectsCronjobsRaw(requestParameters: ApiProjectsCronjobsRequest): Promise> { - if (requestParameters.pid === null || requestParameters.pid === undefined) { - throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsCronjobs.'); - } - - const queryParameters: any = {}; - - if (requestParameters.page !== undefined) { - queryParameters['page'] = requestParameters.page; - } - - if (requestParameters.pageSize !== undefined) { - queryParameters['page_size'] = requestParameters.pageSize; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - const response = await this.request({ - path: `/api/projects/{pid}/cronjobs`.replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))), - method: 'GET', - headers: headerParameters, - query: queryParameters, - }); - - return new runtime.JSONApiResponse(response, (jsonValue) => ProjectCronJobFromJSON(jsonValue)); - } - - /** - */ - async apiProjectsCronjobs(requestParameters: ApiProjectsCronjobsRequest): Promise { - const response = await this.apiProjectsCronjobsRaw(requestParameters); - return await response.value(); - } - - /** - */ - async apiProjectsCurrentUsageRaw(requestParameters: ApiProjectsCurrentUsageRequest): Promise> { - if (requestParameters.pid === null || requestParameters.pid === undefined) { - throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsCurrentUsage.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - const response = await this.request({ - path: `/api/projects/{pid}/current_usage`.replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))), - method: 'GET', - headers: headerParameters, - query: queryParameters, - }); - - return new runtime.JSONApiResponse(response, (jsonValue) => ProjectUsageFromJSON(jsonValue)); - } - - /** - */ - async apiProjectsCurrentUsage(requestParameters: ApiProjectsCurrentUsageRequest): Promise { - const response = await this.apiProjectsCurrentUsageRaw(requestParameters); - return await response.value(); - } - - /** - */ - async apiProjectsDeleteRaw(requestParameters: ApiProjectsDeleteRequest): Promise> { - if (requestParameters.pid === null || requestParameters.pid === undefined) { - throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsDelete.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - const response = await this.request({ - path: `/api/projects/{pid}`.replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))), - method: 'DELETE', - headers: headerParameters, - query: queryParameters, - }); - - return new runtime.VoidApiResponse(response); - } - - /** - */ - async apiProjectsDelete(requestParameters: ApiProjectsDeleteRequest): Promise { - await this.apiProjectsDeleteRaw(requestParameters); - } - - /** - */ - async apiProjectsDeploysCreateRaw(requestParameters: ApiProjectsDeploysCreateRequest): Promise> { - if (requestParameters.pid === null || requestParameters.pid === undefined) { - throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsDeploysCreate.'); - } - - if (requestParameters.data === null || requestParameters.data === undefined) { - throw new runtime.RequiredError('data','Required parameter requestParameters.data was null or undefined when calling apiProjectsDeploysCreate.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - const response = await this.request({ - path: `/api/projects/{pid}/deploys`.replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))), - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: DeployCreateToJSON(requestParameters.data), - }); - - return new runtime.JSONApiResponse(response, (jsonValue) => DeployCreateFromJSON(jsonValue)); - } - - /** - */ - async apiProjectsDeploysCreate(requestParameters: ApiProjectsDeploysCreateRequest): Promise { - const response = await this.apiProjectsDeploysCreateRaw(requestParameters); - return await response.value(); - } - - /** - */ - async apiProjectsDeploysDeleteRaw(requestParameters: ApiProjectsDeploysDeleteRequest): Promise> { - if (requestParameters.did === null || requestParameters.did === undefined) { - throw new runtime.RequiredError('did','Required parameter requestParameters.did was null or undefined when calling apiProjectsDeploysDelete.'); - } - - if (requestParameters.pid === null || requestParameters.pid === undefined) { - throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsDeploysDelete.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - const response = await this.request({ - path: `/api/projects/{pid}/deploys/{did}`.replace(`{${"did"}}`, encodeURIComponent(String(requestParameters.did))).replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))), - method: 'DELETE', - headers: headerParameters, - query: queryParameters, - }); - - return new runtime.VoidApiResponse(response); - } - - /** - */ - async apiProjectsDeploysDelete(requestParameters: ApiProjectsDeploysDeleteRequest): Promise { - await this.apiProjectsDeploysDeleteRaw(requestParameters); - } - - /** - */ - async apiProjectsDeploysListRaw(requestParameters: ApiProjectsDeploysListRequest): Promise> { - if (requestParameters.pid === null || requestParameters.pid === undefined) { - throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsDeploysList.'); - } - - const queryParameters: any = {}; - - if (requestParameters.page !== undefined) { - queryParameters['page'] = requestParameters.page; - } - - if (requestParameters.pageSize !== undefined) { - queryParameters['page_size'] = requestParameters.pageSize; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - const response = await this.request({ - path: `/api/projects/{pid}/deploys`.replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))), - method: 'GET', - headers: headerParameters, - query: queryParameters, - }); - - return new runtime.JSONApiResponse(response, (jsonValue) => InlineResponse2002FromJSON(jsonValue)); - } - - /** - */ - async apiProjectsDeploysList(requestParameters: ApiProjectsDeploysListRequest): Promise { - const response = await this.apiProjectsDeploysListRaw(requestParameters); - return await response.value(); - } - - /** - */ - async apiProjectsDeploysPartialUpdateRaw(requestParameters: ApiProjectsDeploysPartialUpdateRequest): Promise> { - if (requestParameters.did === null || requestParameters.did === undefined) { - throw new runtime.RequiredError('did','Required parameter requestParameters.did was null or undefined when calling apiProjectsDeploysPartialUpdate.'); - } - - if (requestParameters.pid === null || requestParameters.pid === undefined) { - throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsDeploysPartialUpdate.'); - } - - if (requestParameters.data === null || requestParameters.data === undefined) { - throw new runtime.RequiredError('data','Required parameter requestParameters.data was null or undefined when calling apiProjectsDeploysPartialUpdate.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - const response = await this.request({ - path: `/api/projects/{pid}/deploys/{did}`.replace(`{${"did"}}`, encodeURIComponent(String(requestParameters.did))).replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))), - method: 'PATCH', - headers: headerParameters, - query: queryParameters, - body: DeployToJSON(requestParameters.data), - }); - - return new runtime.JSONApiResponse(response, (jsonValue) => DeployFromJSON(jsonValue)); - } - - /** - */ - async apiProjectsDeploysPartialUpdate(requestParameters: ApiProjectsDeploysPartialUpdateRequest): Promise { - const response = await this.apiProjectsDeploysPartialUpdateRaw(requestParameters); - return await response.value(); - } - - /** - */ - async apiProjectsDeploysReadRaw(requestParameters: ApiProjectsDeploysReadRequest): Promise> { - if (requestParameters.did === null || requestParameters.did === undefined) { - throw new runtime.RequiredError('did','Required parameter requestParameters.did was null or undefined when calling apiProjectsDeploysRead.'); - } - - if (requestParameters.pid === null || requestParameters.pid === undefined) { - throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsDeploysRead.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - const response = await this.request({ - path: `/api/projects/{pid}/deploys/{did}`.replace(`{${"did"}}`, encodeURIComponent(String(requestParameters.did))).replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))), - method: 'GET', - headers: headerParameters, - query: queryParameters, - }); - - return new runtime.JSONApiResponse(response, (jsonValue) => DeployFromJSON(jsonValue)); - } - - /** - */ - async apiProjectsDeploysRead(requestParameters: ApiProjectsDeploysReadRequest): Promise { - const response = await this.apiProjectsDeploysReadRaw(requestParameters); - return await response.value(); - } - - /** - */ - async apiProjectsDeploysUpdateRaw(requestParameters: ApiProjectsDeploysUpdateRequest): Promise> { - if (requestParameters.did === null || requestParameters.did === undefined) { - throw new runtime.RequiredError('did','Required parameter requestParameters.did was null or undefined when calling apiProjectsDeploysUpdate.'); - } - - if (requestParameters.pid === null || requestParameters.pid === undefined) { - throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsDeploysUpdate.'); - } - - if (requestParameters.data === null || requestParameters.data === undefined) { - throw new runtime.RequiredError('data','Required parameter requestParameters.data was null or undefined when calling apiProjectsDeploysUpdate.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - const response = await this.request({ - path: `/api/projects/{pid}/deploys/{did}`.replace(`{${"did"}}`, encodeURIComponent(String(requestParameters.did))).replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))), - method: 'PUT', - headers: headerParameters, - query: queryParameters, - body: DeployUpdateToJSON(requestParameters.data), - }); - - return new runtime.JSONApiResponse(response, (jsonValue) => DeployUpdateFromJSON(jsonValue)); - } - - /** - */ - async apiProjectsDeploysUpdate(requestParameters: ApiProjectsDeploysUpdateRequest): Promise { - const response = await this.apiProjectsDeploysUpdateRaw(requestParameters); - return await response.value(); - } - - /** - */ - async apiProjectsJobsRaw(requestParameters: ApiProjectsJobsRequest): Promise> { - if (requestParameters.pid === null || requestParameters.pid === undefined) { - throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsJobs.'); - } - - const queryParameters: any = {}; - - if (requestParameters.page !== undefined) { - queryParameters['page'] = requestParameters.page; - } - - if (requestParameters.pageSize !== undefined) { - queryParameters['page_size'] = requestParameters.pageSize; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - const response = await this.request({ - path: `/api/projects/{pid}/jobs`.replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))), - method: 'GET', - headers: headerParameters, - query: queryParameters, - }); - - return new runtime.JSONApiResponse(response, (jsonValue) => ProjectJobFromJSON(jsonValue)); - } - - /** - */ - async apiProjectsJobs(requestParameters: ApiProjectsJobsRequest): Promise { - const response = await this.apiProjectsJobsRaw(requestParameters); - return await response.value(); - } - - /** - */ - async apiProjectsListRaw(requestParameters: ApiProjectsListRequest): Promise> { - const queryParameters: any = {}; - - if (requestParameters.page !== undefined) { - queryParameters['page'] = requestParameters.page; - } - - if (requestParameters.pageSize !== undefined) { - queryParameters['page_size'] = requestParameters.pageSize; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - const response = await this.request({ - path: `/api/projects`, - method: 'GET', - headers: headerParameters, - query: queryParameters, - }); - - return new runtime.JSONApiResponse(response, (jsonValue) => InlineResponse2001FromJSON(jsonValue)); - } - - /** - */ - async apiProjectsList(requestParameters: ApiProjectsListRequest): Promise { - const response = await this.apiProjectsListRaw(requestParameters); - return await response.value(); - } - - /** - */ - async apiProjectsPartialUpdateRaw(requestParameters: ApiProjectsPartialUpdateRequest): Promise> { - if (requestParameters.pid === null || requestParameters.pid === undefined) { - throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsPartialUpdate.'); - } - - if (requestParameters.data === null || requestParameters.data === undefined) { - throw new runtime.RequiredError('data','Required parameter requestParameters.data was null or undefined when calling apiProjectsPartialUpdate.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - const response = await this.request({ - path: `/api/projects/{pid}`.replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))), - method: 'PATCH', - headers: headerParameters, - query: queryParameters, - body: ProjectToJSON(requestParameters.data), - }); - - return new runtime.JSONApiResponse(response, (jsonValue) => ProjectFromJSON(jsonValue)); - } - - /** - */ - async apiProjectsPartialUpdate(requestParameters: ApiProjectsPartialUpdateRequest): Promise { - const response = await this.apiProjectsPartialUpdateRaw(requestParameters); - return await response.value(); - } - - /** - */ - async apiProjectsReadRaw(requestParameters: ApiProjectsReadRequest): Promise> { - if (requestParameters.pid === null || requestParameters.pid === undefined) { - throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsRead.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - const response = await this.request({ - path: `/api/projects/{pid}`.replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))), - method: 'GET', - headers: headerParameters, - query: queryParameters, - }); - - return new runtime.JSONApiResponse(response, (jsonValue) => ProjectFromJSON(jsonValue)); - } - - /** - */ - async apiProjectsRead(requestParameters: ApiProjectsReadRequest): Promise { - const response = await this.apiProjectsReadRaw(requestParameters); - return await response.value(); - } - - /** - */ - async apiProjectsSpidersCronjobsCreateRaw(requestParameters: ApiProjectsSpidersCronjobsCreateRequest): Promise> { - if (requestParameters.pid === null || requestParameters.pid === undefined) { - throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsSpidersCronjobsCreate.'); - } - - if (requestParameters.sid === null || requestParameters.sid === undefined) { - throw new runtime.RequiredError('sid','Required parameter requestParameters.sid was null or undefined when calling apiProjectsSpidersCronjobsCreate.'); - } - - if (requestParameters.data === null || requestParameters.data === undefined) { - throw new runtime.RequiredError('data','Required parameter requestParameters.data was null or undefined when calling apiProjectsSpidersCronjobsCreate.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - const response = await this.request({ - path: `/api/projects/{pid}/spiders/{sid}/cronjobs`.replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))).replace(`{${"sid"}}`, encodeURIComponent(String(requestParameters.sid))), - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: SpiderCronJobCreateToJSON(requestParameters.data), - }); - - return new runtime.JSONApiResponse(response, (jsonValue) => SpiderCronJobCreateFromJSON(jsonValue)); - } - - /** - */ - async apiProjectsSpidersCronjobsCreate(requestParameters: ApiProjectsSpidersCronjobsCreateRequest): Promise { - const response = await this.apiProjectsSpidersCronjobsCreateRaw(requestParameters); - return await response.value(); - } - - /** - */ - async apiProjectsSpidersCronjobsDeleteRaw(requestParameters: ApiProjectsSpidersCronjobsDeleteRequest): Promise> { - if (requestParameters.cjid === null || requestParameters.cjid === undefined) { - throw new runtime.RequiredError('cjid','Required parameter requestParameters.cjid was null or undefined when calling apiProjectsSpidersCronjobsDelete.'); - } - - if (requestParameters.pid === null || requestParameters.pid === undefined) { - throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsSpidersCronjobsDelete.'); - } - - if (requestParameters.sid === null || requestParameters.sid === undefined) { - throw new runtime.RequiredError('sid','Required parameter requestParameters.sid was null or undefined when calling apiProjectsSpidersCronjobsDelete.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - const response = await this.request({ - path: `/api/projects/{pid}/spiders/{sid}/cronjobs/{cjid}`.replace(`{${"cjid"}}`, encodeURIComponent(String(requestParameters.cjid))).replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))).replace(`{${"sid"}}`, encodeURIComponent(String(requestParameters.sid))), - method: 'DELETE', - headers: headerParameters, - query: queryParameters, - }); - - return new runtime.VoidApiResponse(response); - } - - /** - */ - async apiProjectsSpidersCronjobsDelete(requestParameters: ApiProjectsSpidersCronjobsDeleteRequest): Promise { - await this.apiProjectsSpidersCronjobsDeleteRaw(requestParameters); - } - - /** - */ - async apiProjectsSpidersCronjobsListRaw(requestParameters: ApiProjectsSpidersCronjobsListRequest): Promise> { - if (requestParameters.pid === null || requestParameters.pid === undefined) { - throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsSpidersCronjobsList.'); - } - - if (requestParameters.sid === null || requestParameters.sid === undefined) { - throw new runtime.RequiredError('sid','Required parameter requestParameters.sid was null or undefined when calling apiProjectsSpidersCronjobsList.'); - } - - const queryParameters: any = {}; - - if (requestParameters.tag !== undefined) { - queryParameters['tag'] = requestParameters.tag; - } - - if (requestParameters.page !== undefined) { - queryParameters['page'] = requestParameters.page; - } - - if (requestParameters.pageSize !== undefined) { - queryParameters['page_size'] = requestParameters.pageSize; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - const response = await this.request({ - path: `/api/projects/{pid}/spiders/{sid}/cronjobs`.replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))).replace(`{${"sid"}}`, encodeURIComponent(String(requestParameters.sid))), - method: 'GET', - headers: headerParameters, - query: queryParameters, - }); - - return new runtime.JSONApiResponse(response, (jsonValue) => InlineResponse2004FromJSON(jsonValue)); - } - - /** - */ - async apiProjectsSpidersCronjobsList(requestParameters: ApiProjectsSpidersCronjobsListRequest): Promise { - const response = await this.apiProjectsSpidersCronjobsListRaw(requestParameters); - return await response.value(); - } - - /** - */ - async apiProjectsSpidersCronjobsPartialUpdateRaw(requestParameters: ApiProjectsSpidersCronjobsPartialUpdateRequest): Promise> { - if (requestParameters.cjid === null || requestParameters.cjid === undefined) { - throw new runtime.RequiredError('cjid','Required parameter requestParameters.cjid was null or undefined when calling apiProjectsSpidersCronjobsPartialUpdate.'); - } - - if (requestParameters.pid === null || requestParameters.pid === undefined) { - throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsSpidersCronjobsPartialUpdate.'); - } - - if (requestParameters.sid === null || requestParameters.sid === undefined) { - throw new runtime.RequiredError('sid','Required parameter requestParameters.sid was null or undefined when calling apiProjectsSpidersCronjobsPartialUpdate.'); - } - - if (requestParameters.data === null || requestParameters.data === undefined) { - throw new runtime.RequiredError('data','Required parameter requestParameters.data was null or undefined when calling apiProjectsSpidersCronjobsPartialUpdate.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - const response = await this.request({ - path: `/api/projects/{pid}/spiders/{sid}/cronjobs/{cjid}`.replace(`{${"cjid"}}`, encodeURIComponent(String(requestParameters.cjid))).replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))).replace(`{${"sid"}}`, encodeURIComponent(String(requestParameters.sid))), - method: 'PATCH', - headers: headerParameters, - query: queryParameters, - body: SpiderCronJobToJSON(requestParameters.data), - }); - - return new runtime.JSONApiResponse(response, (jsonValue) => SpiderCronJobFromJSON(jsonValue)); - } - - /** - */ - async apiProjectsSpidersCronjobsPartialUpdate(requestParameters: ApiProjectsSpidersCronjobsPartialUpdateRequest): Promise { - const response = await this.apiProjectsSpidersCronjobsPartialUpdateRaw(requestParameters); - return await response.value(); - } - - /** - */ - async apiProjectsSpidersCronjobsReadRaw(requestParameters: ApiProjectsSpidersCronjobsReadRequest): Promise> { - if (requestParameters.cjid === null || requestParameters.cjid === undefined) { - throw new runtime.RequiredError('cjid','Required parameter requestParameters.cjid was null or undefined when calling apiProjectsSpidersCronjobsRead.'); - } - - if (requestParameters.pid === null || requestParameters.pid === undefined) { - throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsSpidersCronjobsRead.'); - } - - if (requestParameters.sid === null || requestParameters.sid === undefined) { - throw new runtime.RequiredError('sid','Required parameter requestParameters.sid was null or undefined when calling apiProjectsSpidersCronjobsRead.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - const response = await this.request({ - path: `/api/projects/{pid}/spiders/{sid}/cronjobs/{cjid}`.replace(`{${"cjid"}}`, encodeURIComponent(String(requestParameters.cjid))).replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))).replace(`{${"sid"}}`, encodeURIComponent(String(requestParameters.sid))), - method: 'GET', - headers: headerParameters, - query: queryParameters, - }); - - return new runtime.JSONApiResponse(response, (jsonValue) => SpiderCronJobFromJSON(jsonValue)); - } - - /** - */ - async apiProjectsSpidersCronjobsRead(requestParameters: ApiProjectsSpidersCronjobsReadRequest): Promise { - const response = await this.apiProjectsSpidersCronjobsReadRaw(requestParameters); - return await response.value(); - } - - /** - */ - async apiProjectsSpidersCronjobsRunOnceRaw(requestParameters: ApiProjectsSpidersCronjobsRunOnceRequest): Promise> { - if (requestParameters.cjid === null || requestParameters.cjid === undefined) { - throw new runtime.RequiredError('cjid','Required parameter requestParameters.cjid was null or undefined when calling apiProjectsSpidersCronjobsRunOnce.'); - } - - if (requestParameters.pid === null || requestParameters.pid === undefined) { - throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsSpidersCronjobsRunOnce.'); - } - - if (requestParameters.sid === null || requestParameters.sid === undefined) { - throw new runtime.RequiredError('sid','Required parameter requestParameters.sid was null or undefined when calling apiProjectsSpidersCronjobsRunOnce.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - const response = await this.request({ - path: `/api/projects/{pid}/spiders/{sid}/cronjobs/{cjid}/run_once`.replace(`{${"cjid"}}`, encodeURIComponent(String(requestParameters.cjid))).replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))).replace(`{${"sid"}}`, encodeURIComponent(String(requestParameters.sid))), - method: 'GET', - headers: headerParameters, - query: queryParameters, - }); - - return new runtime.JSONApiResponse(response, (jsonValue) => SpiderCronJobFromJSON(jsonValue)); - } - - /** - */ - async apiProjectsSpidersCronjobsRunOnce(requestParameters: ApiProjectsSpidersCronjobsRunOnceRequest): Promise { - const response = await this.apiProjectsSpidersCronjobsRunOnceRaw(requestParameters); - return await response.value(); - } - - /** - */ - async apiProjectsSpidersCronjobsUpdateRaw(requestParameters: ApiProjectsSpidersCronjobsUpdateRequest): Promise> { - if (requestParameters.cjid === null || requestParameters.cjid === undefined) { - throw new runtime.RequiredError('cjid','Required parameter requestParameters.cjid was null or undefined when calling apiProjectsSpidersCronjobsUpdate.'); - } - - if (requestParameters.pid === null || requestParameters.pid === undefined) { - throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsSpidersCronjobsUpdate.'); - } - - if (requestParameters.sid === null || requestParameters.sid === undefined) { - throw new runtime.RequiredError('sid','Required parameter requestParameters.sid was null or undefined when calling apiProjectsSpidersCronjobsUpdate.'); - } - - if (requestParameters.data === null || requestParameters.data === undefined) { - throw new runtime.RequiredError('data','Required parameter requestParameters.data was null or undefined when calling apiProjectsSpidersCronjobsUpdate.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - const response = await this.request({ - path: `/api/projects/{pid}/spiders/{sid}/cronjobs/{cjid}`.replace(`{${"cjid"}}`, encodeURIComponent(String(requestParameters.cjid))).replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))).replace(`{${"sid"}}`, encodeURIComponent(String(requestParameters.sid))), - method: 'PUT', - headers: headerParameters, - query: queryParameters, - body: SpiderCronJobUpdateToJSON(requestParameters.data), - }); - - return new runtime.JSONApiResponse(response, (jsonValue) => SpiderCronJobUpdateFromJSON(jsonValue)); - } - - /** - */ - async apiProjectsSpidersCronjobsUpdate(requestParameters: ApiProjectsSpidersCronjobsUpdateRequest): Promise { - const response = await this.apiProjectsSpidersCronjobsUpdateRaw(requestParameters); - return await response.value(); - } - - /** - */ - async apiProjectsSpidersJobsCreateRaw(requestParameters: ApiProjectsSpidersJobsCreateRequest): Promise> { - if (requestParameters.pid === null || requestParameters.pid === undefined) { - throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsSpidersJobsCreate.'); - } - - if (requestParameters.sid === null || requestParameters.sid === undefined) { - throw new runtime.RequiredError('sid','Required parameter requestParameters.sid was null or undefined when calling apiProjectsSpidersJobsCreate.'); - } - - if (requestParameters.data === null || requestParameters.data === undefined) { - throw new runtime.RequiredError('data','Required parameter requestParameters.data was null or undefined when calling apiProjectsSpidersJobsCreate.'); - } - - const queryParameters: any = {}; - - if (requestParameters.async !== undefined) { - queryParameters['async'] = requestParameters.async; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - const response = await this.request({ - path: `/api/projects/{pid}/spiders/{sid}/jobs`.replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))).replace(`{${"sid"}}`, encodeURIComponent(String(requestParameters.sid))), - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: SpiderJobCreateToJSON(requestParameters.data), - }); - - return new runtime.JSONApiResponse(response, (jsonValue) => SpiderJobCreateFromJSON(jsonValue)); - } - - /** - */ - async apiProjectsSpidersJobsCreate(requestParameters: ApiProjectsSpidersJobsCreateRequest): Promise { - const response = await this.apiProjectsSpidersJobsCreateRaw(requestParameters); - return await response.value(); - } - - /** - */ - async apiProjectsSpidersJobsDataDeleteRaw(requestParameters: ApiProjectsSpidersJobsDataDeleteRequest): Promise> { - if (requestParameters.jid === null || requestParameters.jid === undefined) { - throw new runtime.RequiredError('jid','Required parameter requestParameters.jid was null or undefined when calling apiProjectsSpidersJobsDataDelete.'); - } - - if (requestParameters.pid === null || requestParameters.pid === undefined) { - throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsSpidersJobsDataDelete.'); - } - - if (requestParameters.sid === null || requestParameters.sid === undefined) { - throw new runtime.RequiredError('sid','Required parameter requestParameters.sid was null or undefined when calling apiProjectsSpidersJobsDataDelete.'); - } - - if (requestParameters.type === null || requestParameters.type === undefined) { - throw new runtime.RequiredError('type','Required parameter requestParameters.type was null or undefined when calling apiProjectsSpidersJobsDataDelete.'); - } - - const queryParameters: any = {}; - - if (requestParameters.type !== undefined) { - queryParameters['type'] = requestParameters.type; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - const response = await this.request({ - path: `/api/projects/{pid}/spiders/{sid}/jobs/{jid}/data/delete`.replace(`{${"jid"}}`, encodeURIComponent(String(requestParameters.jid))).replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))).replace(`{${"sid"}}`, encodeURIComponent(String(requestParameters.sid))), - method: 'POST', - headers: headerParameters, - query: queryParameters, - }); - - return new runtime.JSONApiResponse(response, (jsonValue) => DeleteJobDataFromJSON(jsonValue)); - } - - /** - */ - async apiProjectsSpidersJobsDataDelete(requestParameters: ApiProjectsSpidersJobsDataDeleteRequest): Promise { - const response = await this.apiProjectsSpidersJobsDataDeleteRaw(requestParameters); - return await response.value(); - } - - /** - */ - async apiProjectsSpidersJobsDataListRaw(requestParameters: ApiProjectsSpidersJobsDataListRequest): Promise> { - if (requestParameters.jid === null || requestParameters.jid === undefined) { - throw new runtime.RequiredError('jid','Required parameter requestParameters.jid was null or undefined when calling apiProjectsSpidersJobsDataList.'); - } - - if (requestParameters.pid === null || requestParameters.pid === undefined) { - throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsSpidersJobsDataList.'); - } - - if (requestParameters.sid === null || requestParameters.sid === undefined) { - throw new runtime.RequiredError('sid','Required parameter requestParameters.sid was null or undefined when calling apiProjectsSpidersJobsDataList.'); - } - - const queryParameters: any = {}; - - if (requestParameters.page !== undefined) { - queryParameters['page'] = requestParameters.page; - } - - if (requestParameters.pageSize !== undefined) { - queryParameters['page_size'] = requestParameters.pageSize; - } - - if (requestParameters.type !== undefined) { - queryParameters['type'] = requestParameters.type; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - const response = await this.request({ - path: `/api/projects/{pid}/spiders/{sid}/jobs/{jid}/data`.replace(`{${"jid"}}`, encodeURIComponent(String(requestParameters.jid))).replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))).replace(`{${"sid"}}`, encodeURIComponent(String(requestParameters.sid))), - method: 'GET', - headers: headerParameters, - query: queryParameters, - }); - - return new runtime.JSONApiResponse(response, (jsonValue) => InlineResponse2006FromJSON(jsonValue)); - } - - /** - */ - async apiProjectsSpidersJobsDataList(requestParameters: ApiProjectsSpidersJobsDataListRequest): Promise { - const response = await this.apiProjectsSpidersJobsDataListRaw(requestParameters); - return await response.value(); - } - - /** - */ - async apiProjectsSpidersJobsListRaw(requestParameters: ApiProjectsSpidersJobsListRequest): Promise> { - if (requestParameters.pid === null || requestParameters.pid === undefined) { - throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsSpidersJobsList.'); - } - - if (requestParameters.sid === null || requestParameters.sid === undefined) { - throw new runtime.RequiredError('sid','Required parameter requestParameters.sid was null or undefined when calling apiProjectsSpidersJobsList.'); - } - - const queryParameters: any = {}; - - if (requestParameters.cronjob !== undefined) { - queryParameters['cronjob'] = requestParameters.cronjob; - } - - if (requestParameters.status !== undefined) { - queryParameters['status'] = requestParameters.status; - } - - if (requestParameters.tag !== undefined) { - queryParameters['tag'] = requestParameters.tag; - } - - if (requestParameters.page !== undefined) { - queryParameters['page'] = requestParameters.page; - } - - if (requestParameters.pageSize !== undefined) { - queryParameters['page_size'] = requestParameters.pageSize; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - const response = await this.request({ - path: `/api/projects/{pid}/spiders/{sid}/jobs`.replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))).replace(`{${"sid"}}`, encodeURIComponent(String(requestParameters.sid))), - method: 'GET', - headers: headerParameters, - query: queryParameters, - }); - - return new runtime.JSONApiResponse(response, (jsonValue) => InlineResponse2005FromJSON(jsonValue)); - } - - /** - */ - async apiProjectsSpidersJobsList(requestParameters: ApiProjectsSpidersJobsListRequest): Promise { - const response = await this.apiProjectsSpidersJobsListRaw(requestParameters); - return await response.value(); - } - - /** - */ - async apiProjectsSpidersJobsPartialUpdateRaw(requestParameters: ApiProjectsSpidersJobsPartialUpdateRequest): Promise> { - if (requestParameters.jid === null || requestParameters.jid === undefined) { - throw new runtime.RequiredError('jid','Required parameter requestParameters.jid was null or undefined when calling apiProjectsSpidersJobsPartialUpdate.'); - } - - if (requestParameters.pid === null || requestParameters.pid === undefined) { - throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsSpidersJobsPartialUpdate.'); - } - - if (requestParameters.sid === null || requestParameters.sid === undefined) { - throw new runtime.RequiredError('sid','Required parameter requestParameters.sid was null or undefined when calling apiProjectsSpidersJobsPartialUpdate.'); - } - - if (requestParameters.data === null || requestParameters.data === undefined) { - throw new runtime.RequiredError('data','Required parameter requestParameters.data was null or undefined when calling apiProjectsSpidersJobsPartialUpdate.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - const response = await this.request({ - path: `/api/projects/{pid}/spiders/{sid}/jobs/{jid}`.replace(`{${"jid"}}`, encodeURIComponent(String(requestParameters.jid))).replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))).replace(`{${"sid"}}`, encodeURIComponent(String(requestParameters.sid))), - method: 'PATCH', - headers: headerParameters, - query: queryParameters, - body: SpiderJobToJSON(requestParameters.data), - }); - - return new runtime.JSONApiResponse(response, (jsonValue) => SpiderJobFromJSON(jsonValue)); - } - - /** - */ - async apiProjectsSpidersJobsPartialUpdate(requestParameters: ApiProjectsSpidersJobsPartialUpdateRequest): Promise { - const response = await this.apiProjectsSpidersJobsPartialUpdateRaw(requestParameters); - return await response.value(); - } - - /** - */ - async apiProjectsSpidersJobsReadRaw(requestParameters: ApiProjectsSpidersJobsReadRequest): Promise> { - if (requestParameters.jid === null || requestParameters.jid === undefined) { - throw new runtime.RequiredError('jid','Required parameter requestParameters.jid was null or undefined when calling apiProjectsSpidersJobsRead.'); - } - - if (requestParameters.pid === null || requestParameters.pid === undefined) { - throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsSpidersJobsRead.'); - } - - if (requestParameters.sid === null || requestParameters.sid === undefined) { - throw new runtime.RequiredError('sid','Required parameter requestParameters.sid was null or undefined when calling apiProjectsSpidersJobsRead.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - const response = await this.request({ - path: `/api/projects/{pid}/spiders/{sid}/jobs/{jid}`.replace(`{${"jid"}}`, encodeURIComponent(String(requestParameters.jid))).replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))).replace(`{${"sid"}}`, encodeURIComponent(String(requestParameters.sid))), - method: 'GET', - headers: headerParameters, - query: queryParameters, - }); - - return new runtime.JSONApiResponse(response, (jsonValue) => SpiderJobFromJSON(jsonValue)); - } - - /** - */ - async apiProjectsSpidersJobsRead(requestParameters: ApiProjectsSpidersJobsReadRequest): Promise { - const response = await this.apiProjectsSpidersJobsReadRaw(requestParameters); - return await response.value(); - } - - /** - */ - async apiProjectsSpidersJobsUpdateRaw(requestParameters: ApiProjectsSpidersJobsUpdateRequest): Promise> { - if (requestParameters.jid === null || requestParameters.jid === undefined) { - throw new runtime.RequiredError('jid','Required parameter requestParameters.jid was null or undefined when calling apiProjectsSpidersJobsUpdate.'); - } - - if (requestParameters.pid === null || requestParameters.pid === undefined) { - throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsSpidersJobsUpdate.'); - } - - if (requestParameters.sid === null || requestParameters.sid === undefined) { - throw new runtime.RequiredError('sid','Required parameter requestParameters.sid was null or undefined when calling apiProjectsSpidersJobsUpdate.'); - } - - if (requestParameters.data === null || requestParameters.data === undefined) { - throw new runtime.RequiredError('data','Required parameter requestParameters.data was null or undefined when calling apiProjectsSpidersJobsUpdate.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - const response = await this.request({ - path: `/api/projects/{pid}/spiders/{sid}/jobs/{jid}`.replace(`{${"jid"}}`, encodeURIComponent(String(requestParameters.jid))).replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))).replace(`{${"sid"}}`, encodeURIComponent(String(requestParameters.sid))), - method: 'PUT', - headers: headerParameters, - query: queryParameters, - body: SpiderJobUpdateToJSON(requestParameters.data), - }); - - return new runtime.JSONApiResponse(response, (jsonValue) => SpiderJobUpdateFromJSON(jsonValue)); - } - - /** - */ - async apiProjectsSpidersJobsUpdate(requestParameters: ApiProjectsSpidersJobsUpdateRequest): Promise { - const response = await this.apiProjectsSpidersJobsUpdateRaw(requestParameters); - return await response.value(); - } - - /** - */ - async apiProjectsSpidersListRaw(requestParameters: ApiProjectsSpidersListRequest): Promise> { - if (requestParameters.pid === null || requestParameters.pid === undefined) { - throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsSpidersList.'); - } - - const queryParameters: any = {}; - - if (requestParameters.page !== undefined) { - queryParameters['page'] = requestParameters.page; - } - - if (requestParameters.pageSize !== undefined) { - queryParameters['page_size'] = requestParameters.pageSize; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - const response = await this.request({ - path: `/api/projects/{pid}/spiders`.replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))), - method: 'GET', - headers: headerParameters, - query: queryParameters, - }); - - return new runtime.JSONApiResponse(response, (jsonValue) => InlineResponse2003FromJSON(jsonValue)); - } - - /** - */ - async apiProjectsSpidersList(requestParameters: ApiProjectsSpidersListRequest): Promise { - const response = await this.apiProjectsSpidersListRaw(requestParameters); - return await response.value(); - } - - /** - */ - async apiProjectsSpidersPartialUpdateRaw(requestParameters: ApiProjectsSpidersPartialUpdateRequest): Promise> { - if (requestParameters.pid === null || requestParameters.pid === undefined) { - throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsSpidersPartialUpdate.'); - } - - if (requestParameters.sid === null || requestParameters.sid === undefined) { - throw new runtime.RequiredError('sid','Required parameter requestParameters.sid was null or undefined when calling apiProjectsSpidersPartialUpdate.'); - } - - if (requestParameters.data === null || requestParameters.data === undefined) { - throw new runtime.RequiredError('data','Required parameter requestParameters.data was null or undefined when calling apiProjectsSpidersPartialUpdate.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - const response = await this.request({ - path: `/api/projects/{pid}/spiders/{sid}`.replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))).replace(`{${"sid"}}`, encodeURIComponent(String(requestParameters.sid))), - method: 'PATCH', - headers: headerParameters, - query: queryParameters, - body: SpiderToJSON(requestParameters.data), - }); - - return new runtime.JSONApiResponse(response, (jsonValue) => SpiderFromJSON(jsonValue)); - } - - /** - */ - async apiProjectsSpidersPartialUpdate(requestParameters: ApiProjectsSpidersPartialUpdateRequest): Promise { - const response = await this.apiProjectsSpidersPartialUpdateRaw(requestParameters); - return await response.value(); - } - - /** - */ - async apiProjectsSpidersReadRaw(requestParameters: ApiProjectsSpidersReadRequest): Promise> { - if (requestParameters.pid === null || requestParameters.pid === undefined) { - throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsSpidersRead.'); - } - - if (requestParameters.sid === null || requestParameters.sid === undefined) { - throw new runtime.RequiredError('sid','Required parameter requestParameters.sid was null or undefined when calling apiProjectsSpidersRead.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - const response = await this.request({ - path: `/api/projects/{pid}/spiders/{sid}`.replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))).replace(`{${"sid"}}`, encodeURIComponent(String(requestParameters.sid))), - method: 'GET', - headers: headerParameters, - query: queryParameters, - }); - - return new runtime.JSONApiResponse(response, (jsonValue) => SpiderFromJSON(jsonValue)); - } - - /** - */ - async apiProjectsSpidersRead(requestParameters: ApiProjectsSpidersReadRequest): Promise { - const response = await this.apiProjectsSpidersReadRaw(requestParameters); - return await response.value(); - } - - /** - */ - async apiProjectsSpidersUpdateRaw(requestParameters: ApiProjectsSpidersUpdateRequest): Promise> { - if (requestParameters.pid === null || requestParameters.pid === undefined) { - throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsSpidersUpdate.'); - } - - if (requestParameters.sid === null || requestParameters.sid === undefined) { - throw new runtime.RequiredError('sid','Required parameter requestParameters.sid was null or undefined when calling apiProjectsSpidersUpdate.'); - } - - if (requestParameters.data === null || requestParameters.data === undefined) { - throw new runtime.RequiredError('data','Required parameter requestParameters.data was null or undefined when calling apiProjectsSpidersUpdate.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - const response = await this.request({ - path: `/api/projects/{pid}/spiders/{sid}`.replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))).replace(`{${"sid"}}`, encodeURIComponent(String(requestParameters.sid))), - method: 'PUT', - headers: headerParameters, - query: queryParameters, - body: SpiderUpdateToJSON(requestParameters.data), - }); - - return new runtime.JSONApiResponse(response, (jsonValue) => SpiderUpdateFromJSON(jsonValue)); - } - - /** - */ - async apiProjectsSpidersUpdate(requestParameters: ApiProjectsSpidersUpdateRequest): Promise { - const response = await this.apiProjectsSpidersUpdateRaw(requestParameters); - return await response.value(); - } - - /** - * Retrieve stats of all jobs in a range of time, dates must have the format YYYY-mm-dd. - */ - async apiProjectsStatsListRaw(requestParameters: ApiProjectsStatsListRequest): Promise>> { - if (requestParameters.pid === null || requestParameters.pid === undefined) { - throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsStatsList.'); - } - - if (requestParameters.startDate === null || requestParameters.startDate === undefined) { - throw new runtime.RequiredError('startDate','Required parameter requestParameters.startDate was null or undefined when calling apiProjectsStatsList.'); - } - - if (requestParameters.endDate === null || requestParameters.endDate === undefined) { - throw new runtime.RequiredError('endDate','Required parameter requestParameters.endDate was null or undefined when calling apiProjectsStatsList.'); - } - - const queryParameters: any = {}; - - if (requestParameters.page !== undefined) { - queryParameters['page'] = requestParameters.page; - } - - if (requestParameters.pageSize !== undefined) { - queryParameters['page_size'] = requestParameters.pageSize; - } - - if (requestParameters.startDate !== undefined) { - queryParameters['start_date'] = requestParameters.startDate; - } - - if (requestParameters.endDate !== undefined) { - queryParameters['end_date'] = requestParameters.endDate; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - const response = await this.request({ - path: `/api/projects/{pid}/stats`.replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))), - method: 'GET', - headers: headerParameters, - query: queryParameters, - }); - - return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(GlobalStatsFromJSON)); - } - - /** - * Retrieve stats of all jobs in a range of time, dates must have the format YYYY-mm-dd. - */ - async apiProjectsStatsList(requestParameters: ApiProjectsStatsListRequest): Promise> { - const response = await this.apiProjectsStatsListRaw(requestParameters); - return await response.value(); - } - - /** - * Retrieve stats of all jobs of a spider in a range of time, dates must have the format YYYY-mm-dd. - */ - async apiProjectsStatsSpidersListRaw(requestParameters: ApiProjectsStatsSpidersListRequest): Promise>> { - if (requestParameters.pid === null || requestParameters.pid === undefined) { - throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsStatsSpidersList.'); - } - - if (requestParameters.sid === null || requestParameters.sid === undefined) { - throw new runtime.RequiredError('sid','Required parameter requestParameters.sid was null or undefined when calling apiProjectsStatsSpidersList.'); - } - - if (requestParameters.startDate === null || requestParameters.startDate === undefined) { - throw new runtime.RequiredError('startDate','Required parameter requestParameters.startDate was null or undefined when calling apiProjectsStatsSpidersList.'); - } - - if (requestParameters.endDate === null || requestParameters.endDate === undefined) { - throw new runtime.RequiredError('endDate','Required parameter requestParameters.endDate was null or undefined when calling apiProjectsStatsSpidersList.'); - } - - const queryParameters: any = {}; - - if (requestParameters.page !== undefined) { - queryParameters['page'] = requestParameters.page; - } - - if (requestParameters.pageSize !== undefined) { - queryParameters['page_size'] = requestParameters.pageSize; - } - - if (requestParameters.startDate !== undefined) { - queryParameters['start_date'] = requestParameters.startDate; - } - - if (requestParameters.endDate !== undefined) { - queryParameters['end_date'] = requestParameters.endDate; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - const response = await this.request({ - path: `/api/projects/{pid}/stats/spiders/{sid}`.replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))).replace(`{${"sid"}}`, encodeURIComponent(String(requestParameters.sid))), - method: 'GET', - headers: headerParameters, - query: queryParameters, - }); - - return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(SpidersJobsStatsFromJSON)); - } - - /** - * Retrieve stats of all jobs of a spider in a range of time, dates must have the format YYYY-mm-dd. - */ - async apiProjectsStatsSpidersList(requestParameters: ApiProjectsStatsSpidersListRequest): Promise> { - const response = await this.apiProjectsStatsSpidersListRaw(requestParameters); - return await response.value(); - } - - /** - */ - async apiProjectsUpdateRaw(requestParameters: ApiProjectsUpdateRequest): Promise> { - if (requestParameters.pid === null || requestParameters.pid === undefined) { - throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsUpdate.'); - } - - if (requestParameters.data === null || requestParameters.data === undefined) { - throw new runtime.RequiredError('data','Required parameter requestParameters.data was null or undefined when calling apiProjectsUpdate.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - const response = await this.request({ - path: `/api/projects/{pid}`.replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))), - method: 'PUT', - headers: headerParameters, - query: queryParameters, - body: ProjectUpdateToJSON(requestParameters.data), - }); - - return new runtime.JSONApiResponse(response, (jsonValue) => ProjectUpdateFromJSON(jsonValue)); - } - - /** - */ - async apiProjectsUpdate(requestParameters: ApiProjectsUpdateRequest): Promise { - const response = await this.apiProjectsUpdateRaw(requestParameters); - return await response.value(); - } - - /** - */ - async apiProjectsUsageRaw(requestParameters: ApiProjectsUsageRequest): Promise>> { - if (requestParameters.pid === null || requestParameters.pid === undefined) { - throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsUsage.'); - } - - const queryParameters: any = {}; - - if (requestParameters.startDate !== undefined) { - queryParameters['start_date'] = requestParameters.startDate; - } - - if (requestParameters.endDate !== undefined) { - queryParameters['end_date'] = requestParameters.endDate; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - const response = await this.request({ - path: `/api/projects/{pid}/usage`.replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))), - method: 'GET', - headers: headerParameters, - query: queryParameters, - }); - - return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(UsageRecordFromJSON)); - } - - /** - */ - async apiProjectsUsage(requestParameters: ApiProjectsUsageRequest): Promise> { - const response = await this.apiProjectsUsageRaw(requestParameters); - return await response.value(); - } - -} diff --git a/estela-web/src/services/api/generated-api/apis/AuthApi.ts b/estela-web/src/services/api/generated-api/apis/AuthApi.ts new file mode 100644 index 00000000..f7c94559 --- /dev/null +++ b/estela-web/src/services/api/generated-api/apis/AuthApi.ts @@ -0,0 +1,555 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * estela API v1.0 Documentation + * estela API Swagger Specification + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import * as runtime from '../runtime'; +import { + AuthToken, + AuthTokenFromJSON, + AuthTokenToJSON, + ChangePassword, + ChangePasswordFromJSON, + ChangePasswordToJSON, + InlineResponse200, + InlineResponse200FromJSON, + InlineResponse200ToJSON, + InlineResponse401, + InlineResponse401FromJSON, + InlineResponse401ToJSON, + ResetPasswordConfirm, + ResetPasswordConfirmFromJSON, + ResetPasswordConfirmToJSON, + ResetPasswordRequest, + ResetPasswordRequestFromJSON, + ResetPasswordRequestToJSON, + Token, + TokenFromJSON, + TokenToJSON, + User, + UserFromJSON, + UserToJSON, + UserProfile, + UserProfileFromJSON, + UserProfileToJSON, +} from '../models'; + +export interface ApiAccountChangePasswordChangeRequest { + data: ChangePassword; +} + +export interface ApiAccountResetPasswordConfirmRequest { + token: string; + pair: string; + data: ResetPasswordConfirm; +} + +export interface ApiAccountResetPasswordRequestRequest { + data: ResetPasswordRequest; +} + +export interface ApiAccountResetPasswordValidateRequest { + token: string; + pair: string; +} + +export interface ApiAuthLoginRequest { + data: AuthToken; +} + +export interface ApiAuthProfileCreateRequest { + data: UserProfile; +} + +export interface ApiAuthProfileDeleteRequest { + username: string; +} + +export interface ApiAuthProfilePartialUpdateRequest { + username: string; + data: UserProfile; +} + +export interface ApiAuthProfileReadRequest { + username: string; +} + +export interface ApiAuthProfileUpdateRequest { + username: string; + data: UserProfile; +} + +export interface ApiAuthRegisterRequest { + data: User; +} + +/** + * + */ +export class AuthApi extends runtime.BaseAPI { + + /** + */ + async apiAccountChangePasswordChangeRaw(requestParameters: ApiAccountChangePasswordChangeRequest): Promise> { + if (requestParameters.data === null || requestParameters.data === undefined) { + throw new runtime.RequiredError('data','Required parameter requestParameters.data was null or undefined when calling apiAccountChangePasswordChange.'); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + headerParameters['Content-Type'] = 'application/json'; + + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { + headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); + } + const response = await this.request({ + path: `/api/account/changePassword/change`, + method: 'PATCH', + headers: headerParameters, + query: queryParameters, + body: ChangePasswordToJSON(requestParameters.data), + }); + + return new runtime.JSONApiResponse(response, (jsonValue) => TokenFromJSON(jsonValue)); + } + + /** + */ + async apiAccountChangePasswordChange(requestParameters: ApiAccountChangePasswordChangeRequest): Promise { + const response = await this.apiAccountChangePasswordChangeRaw(requestParameters); + return await response.value(); + } + + /** + */ + async apiAccountResetPasswordConfirmRaw(requestParameters: ApiAccountResetPasswordConfirmRequest): Promise> { + if (requestParameters.token === null || requestParameters.token === undefined) { + throw new runtime.RequiredError('token','Required parameter requestParameters.token was null or undefined when calling apiAccountResetPasswordConfirm.'); + } + + if (requestParameters.pair === null || requestParameters.pair === undefined) { + throw new runtime.RequiredError('pair','Required parameter requestParameters.pair was null or undefined when calling apiAccountResetPasswordConfirm.'); + } + + if (requestParameters.data === null || requestParameters.data === undefined) { + throw new runtime.RequiredError('data','Required parameter requestParameters.data was null or undefined when calling apiAccountResetPasswordConfirm.'); + } + + const queryParameters: any = {}; + + if (requestParameters.token !== undefined) { + queryParameters['token'] = requestParameters.token; + } + + if (requestParameters.pair !== undefined) { + queryParameters['pair'] = requestParameters.pair; + } + + const headerParameters: runtime.HTTPHeaders = {}; + + headerParameters['Content-Type'] = 'application/json'; + + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { + headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); + } + const response = await this.request({ + path: `/api/account/resetPassword/confirm`, + method: 'PATCH', + headers: headerParameters, + query: queryParameters, + body: ResetPasswordConfirmToJSON(requestParameters.data), + }); + + return new runtime.JSONApiResponse(response, (jsonValue) => TokenFromJSON(jsonValue)); + } + + /** + */ + async apiAccountResetPasswordConfirm(requestParameters: ApiAccountResetPasswordConfirmRequest): Promise { + const response = await this.apiAccountResetPasswordConfirmRaw(requestParameters); + return await response.value(); + } + + /** + */ + async apiAccountResetPasswordRequestRaw(requestParameters: ApiAccountResetPasswordRequestRequest): Promise> { + if (requestParameters.data === null || requestParameters.data === undefined) { + throw new runtime.RequiredError('data','Required parameter requestParameters.data was null or undefined when calling apiAccountResetPasswordRequest.'); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + headerParameters['Content-Type'] = 'application/json'; + + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { + headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); + } + const response = await this.request({ + path: `/api/account/resetPassword/request`, + method: 'POST', + headers: headerParameters, + query: queryParameters, + body: ResetPasswordRequestToJSON(requestParameters.data), + }); + + return new runtime.JSONApiResponse(response, (jsonValue) => TokenFromJSON(jsonValue)); + } + + /** + */ + async apiAccountResetPasswordRequest(requestParameters: ApiAccountResetPasswordRequestRequest): Promise { + const response = await this.apiAccountResetPasswordRequestRaw(requestParameters); + return await response.value(); + } + + /** + */ + async apiAccountResetPasswordValidateRaw(requestParameters: ApiAccountResetPasswordValidateRequest): Promise> { + if (requestParameters.token === null || requestParameters.token === undefined) { + throw new runtime.RequiredError('token','Required parameter requestParameters.token was null or undefined when calling apiAccountResetPasswordValidate.'); + } + + if (requestParameters.pair === null || requestParameters.pair === undefined) { + throw new runtime.RequiredError('pair','Required parameter requestParameters.pair was null or undefined when calling apiAccountResetPasswordValidate.'); + } + + const queryParameters: any = {}; + + if (requestParameters.token !== undefined) { + queryParameters['token'] = requestParameters.token; + } + + if (requestParameters.pair !== undefined) { + queryParameters['pair'] = requestParameters.pair; + } + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { + headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); + } + const response = await this.request({ + path: `/api/account/resetPassword/validate`, + method: 'GET', + headers: headerParameters, + query: queryParameters, + }); + + return new runtime.JSONApiResponse(response, (jsonValue) => InlineResponse200FromJSON(jsonValue)); + } + + /** + */ + async apiAccountResetPasswordValidate(requestParameters: ApiAccountResetPasswordValidateRequest): Promise { + const response = await this.apiAccountResetPasswordValidateRaw(requestParameters); + return await response.value(); + } + + /** + */ + async apiAuthActivateRaw(): Promise>> { + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { + headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); + } + const response = await this.request({ + path: `/api/auth/activate`, + method: 'GET', + headers: headerParameters, + query: queryParameters, + }); + + return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(AuthTokenFromJSON)); + } + + /** + */ + async apiAuthActivate(): Promise> { + const response = await this.apiAuthActivateRaw(); + return await response.value(); + } + + /** + */ + async apiAuthLoginRaw(requestParameters: ApiAuthLoginRequest): Promise> { + if (requestParameters.data === null || requestParameters.data === undefined) { + throw new runtime.RequiredError('data','Required parameter requestParameters.data was null or undefined when calling apiAuthLogin.'); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + headerParameters['Content-Type'] = 'application/json'; + + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { + headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); + } + const response = await this.request({ + path: `/api/auth/login`, + method: 'POST', + headers: headerParameters, + query: queryParameters, + body: AuthTokenToJSON(requestParameters.data), + }); + + return new runtime.JSONApiResponse(response, (jsonValue) => TokenFromJSON(jsonValue)); + } + + /** + */ + async apiAuthLogin(requestParameters: ApiAuthLoginRequest): Promise { + const response = await this.apiAuthLoginRaw(requestParameters); + return await response.value(); + } + + /** + */ + async apiAuthProfileCreateRaw(requestParameters: ApiAuthProfileCreateRequest): Promise> { + if (requestParameters.data === null || requestParameters.data === undefined) { + throw new runtime.RequiredError('data','Required parameter requestParameters.data was null or undefined when calling apiAuthProfileCreate.'); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + headerParameters['Content-Type'] = 'application/json'; + + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { + headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); + } + const response = await this.request({ + path: `/api/auth/profile`, + method: 'POST', + headers: headerParameters, + query: queryParameters, + body: UserProfileToJSON(requestParameters.data), + }); + + return new runtime.JSONApiResponse(response, (jsonValue) => UserProfileFromJSON(jsonValue)); + } + + /** + */ + async apiAuthProfileCreate(requestParameters: ApiAuthProfileCreateRequest): Promise { + const response = await this.apiAuthProfileCreateRaw(requestParameters); + return await response.value(); + } + + /** + */ + async apiAuthProfileDeleteRaw(requestParameters: ApiAuthProfileDeleteRequest): Promise> { + if (requestParameters.username === null || requestParameters.username === undefined) { + throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling apiAuthProfileDelete.'); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { + headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); + } + const response = await this.request({ + path: `/api/auth/profile/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters.username))), + method: 'DELETE', + headers: headerParameters, + query: queryParameters, + }); + + return new runtime.VoidApiResponse(response); + } + + /** + */ + async apiAuthProfileDelete(requestParameters: ApiAuthProfileDeleteRequest): Promise { + await this.apiAuthProfileDeleteRaw(requestParameters); + } + + /** + */ + async apiAuthProfileListRaw(): Promise>> { + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { + headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); + } + const response = await this.request({ + path: `/api/auth/profile`, + method: 'GET', + headers: headerParameters, + query: queryParameters, + }); + + return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(UserProfileFromJSON)); + } + + /** + */ + async apiAuthProfileList(): Promise> { + const response = await this.apiAuthProfileListRaw(); + return await response.value(); + } + + /** + */ + async apiAuthProfilePartialUpdateRaw(requestParameters: ApiAuthProfilePartialUpdateRequest): Promise> { + if (requestParameters.username === null || requestParameters.username === undefined) { + throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling apiAuthProfilePartialUpdate.'); + } + + if (requestParameters.data === null || requestParameters.data === undefined) { + throw new runtime.RequiredError('data','Required parameter requestParameters.data was null or undefined when calling apiAuthProfilePartialUpdate.'); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + headerParameters['Content-Type'] = 'application/json'; + + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { + headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); + } + const response = await this.request({ + path: `/api/auth/profile/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters.username))), + method: 'PATCH', + headers: headerParameters, + query: queryParameters, + body: UserProfileToJSON(requestParameters.data), + }); + + return new runtime.JSONApiResponse(response, (jsonValue) => UserProfileFromJSON(jsonValue)); + } + + /** + */ + async apiAuthProfilePartialUpdate(requestParameters: ApiAuthProfilePartialUpdateRequest): Promise { + const response = await this.apiAuthProfilePartialUpdateRaw(requestParameters); + return await response.value(); + } + + /** + */ + async apiAuthProfileReadRaw(requestParameters: ApiAuthProfileReadRequest): Promise> { + if (requestParameters.username === null || requestParameters.username === undefined) { + throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling apiAuthProfileRead.'); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { + headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); + } + const response = await this.request({ + path: `/api/auth/profile/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters.username))), + method: 'GET', + headers: headerParameters, + query: queryParameters, + }); + + return new runtime.JSONApiResponse(response, (jsonValue) => UserProfileFromJSON(jsonValue)); + } + + /** + */ + async apiAuthProfileRead(requestParameters: ApiAuthProfileReadRequest): Promise { + const response = await this.apiAuthProfileReadRaw(requestParameters); + return await response.value(); + } + + /** + */ + async apiAuthProfileUpdateRaw(requestParameters: ApiAuthProfileUpdateRequest): Promise> { + if (requestParameters.username === null || requestParameters.username === undefined) { + throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling apiAuthProfileUpdate.'); + } + + if (requestParameters.data === null || requestParameters.data === undefined) { + throw new runtime.RequiredError('data','Required parameter requestParameters.data was null or undefined when calling apiAuthProfileUpdate.'); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + headerParameters['Content-Type'] = 'application/json'; + + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { + headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); + } + const response = await this.request({ + path: `/api/auth/profile/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters.username))), + method: 'PUT', + headers: headerParameters, + query: queryParameters, + body: UserProfileToJSON(requestParameters.data), + }); + + return new runtime.JSONApiResponse(response, (jsonValue) => UserProfileFromJSON(jsonValue)); + } + + /** + */ + async apiAuthProfileUpdate(requestParameters: ApiAuthProfileUpdateRequest): Promise { + const response = await this.apiAuthProfileUpdateRaw(requestParameters); + return await response.value(); + } + + /** + */ + async apiAuthRegisterRaw(requestParameters: ApiAuthRegisterRequest): Promise> { + if (requestParameters.data === null || requestParameters.data === undefined) { + throw new runtime.RequiredError('data','Required parameter requestParameters.data was null or undefined when calling apiAuthRegister.'); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + headerParameters['Content-Type'] = 'application/json'; + + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { + headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); + } + const response = await this.request({ + path: `/api/auth/register`, + method: 'POST', + headers: headerParameters, + query: queryParameters, + body: UserToJSON(requestParameters.data), + }); + + return new runtime.JSONApiResponse(response, (jsonValue) => TokenFromJSON(jsonValue)); + } + + /** + */ + async apiAuthRegister(requestParameters: ApiAuthRegisterRequest): Promise { + const response = await this.apiAuthRegisterRaw(requestParameters); + return await response.value(); + } + +} diff --git a/estela-web/src/services/api/generated-api/apis/DeploysApi.ts b/estela-web/src/services/api/generated-api/apis/DeploysApi.ts new file mode 100644 index 00000000..3a4f1202 --- /dev/null +++ b/estela-web/src/services/api/generated-api/apis/DeploysApi.ts @@ -0,0 +1,300 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * estela API v1.0 Documentation + * estela API Swagger Specification + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import * as runtime from '../runtime'; +import { + Deploy, + DeployFromJSON, + DeployToJSON, + DeployCreate, + DeployCreateFromJSON, + DeployCreateToJSON, + DeployUpdate, + DeployUpdateFromJSON, + DeployUpdateToJSON, + InlineResponse2002, + InlineResponse2002FromJSON, + InlineResponse2002ToJSON, +} from '../models'; + +export interface ApiProjectsDeploysCreateRequest { + pid: string; + data: DeployCreate; +} + +export interface ApiProjectsDeploysDeleteRequest { + did: number; + pid: string; +} + +export interface ApiProjectsDeploysListRequest { + pid: string; + page?: number; + pageSize?: number; +} + +export interface ApiProjectsDeploysPartialUpdateRequest { + did: number; + pid: string; + data: Deploy; +} + +export interface ApiProjectsDeploysReadRequest { + did: number; + pid: string; +} + +export interface ApiProjectsDeploysUpdateRequest { + did: number; + pid: string; + data: DeployUpdate; +} + +/** + * + */ +export class DeploysApi extends runtime.BaseAPI { + + /** + */ + async apiProjectsDeploysCreateRaw(requestParameters: ApiProjectsDeploysCreateRequest): Promise> { + if (requestParameters.pid === null || requestParameters.pid === undefined) { + throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsDeploysCreate.'); + } + + if (requestParameters.data === null || requestParameters.data === undefined) { + throw new runtime.RequiredError('data','Required parameter requestParameters.data was null or undefined when calling apiProjectsDeploysCreate.'); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + headerParameters['Content-Type'] = 'application/json'; + + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { + headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); + } + const response = await this.request({ + path: `/api/projects/{pid}/deploys`.replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))), + method: 'POST', + headers: headerParameters, + query: queryParameters, + body: DeployCreateToJSON(requestParameters.data), + }); + + return new runtime.JSONApiResponse(response, (jsonValue) => DeployCreateFromJSON(jsonValue)); + } + + /** + */ + async apiProjectsDeploysCreate(requestParameters: ApiProjectsDeploysCreateRequest): Promise { + const response = await this.apiProjectsDeploysCreateRaw(requestParameters); + return await response.value(); + } + + /** + */ + async apiProjectsDeploysDeleteRaw(requestParameters: ApiProjectsDeploysDeleteRequest): Promise> { + if (requestParameters.did === null || requestParameters.did === undefined) { + throw new runtime.RequiredError('did','Required parameter requestParameters.did was null or undefined when calling apiProjectsDeploysDelete.'); + } + + if (requestParameters.pid === null || requestParameters.pid === undefined) { + throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsDeploysDelete.'); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { + headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); + } + const response = await this.request({ + path: `/api/projects/{pid}/deploys/{did}`.replace(`{${"did"}}`, encodeURIComponent(String(requestParameters.did))).replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))), + method: 'DELETE', + headers: headerParameters, + query: queryParameters, + }); + + return new runtime.VoidApiResponse(response); + } + + /** + */ + async apiProjectsDeploysDelete(requestParameters: ApiProjectsDeploysDeleteRequest): Promise { + await this.apiProjectsDeploysDeleteRaw(requestParameters); + } + + /** + */ + async apiProjectsDeploysListRaw(requestParameters: ApiProjectsDeploysListRequest): Promise> { + if (requestParameters.pid === null || requestParameters.pid === undefined) { + throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsDeploysList.'); + } + + const queryParameters: any = {}; + + if (requestParameters.page !== undefined) { + queryParameters['page'] = requestParameters.page; + } + + if (requestParameters.pageSize !== undefined) { + queryParameters['page_size'] = requestParameters.pageSize; + } + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { + headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); + } + const response = await this.request({ + path: `/api/projects/{pid}/deploys`.replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))), + method: 'GET', + headers: headerParameters, + query: queryParameters, + }); + + return new runtime.JSONApiResponse(response, (jsonValue) => InlineResponse2002FromJSON(jsonValue)); + } + + /** + */ + async apiProjectsDeploysList(requestParameters: ApiProjectsDeploysListRequest): Promise { + const response = await this.apiProjectsDeploysListRaw(requestParameters); + return await response.value(); + } + + /** + */ + async apiProjectsDeploysPartialUpdateRaw(requestParameters: ApiProjectsDeploysPartialUpdateRequest): Promise> { + if (requestParameters.did === null || requestParameters.did === undefined) { + throw new runtime.RequiredError('did','Required parameter requestParameters.did was null or undefined when calling apiProjectsDeploysPartialUpdate.'); + } + + if (requestParameters.pid === null || requestParameters.pid === undefined) { + throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsDeploysPartialUpdate.'); + } + + if (requestParameters.data === null || requestParameters.data === undefined) { + throw new runtime.RequiredError('data','Required parameter requestParameters.data was null or undefined when calling apiProjectsDeploysPartialUpdate.'); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + headerParameters['Content-Type'] = 'application/json'; + + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { + headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); + } + const response = await this.request({ + path: `/api/projects/{pid}/deploys/{did}`.replace(`{${"did"}}`, encodeURIComponent(String(requestParameters.did))).replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))), + method: 'PATCH', + headers: headerParameters, + query: queryParameters, + body: DeployToJSON(requestParameters.data), + }); + + return new runtime.JSONApiResponse(response, (jsonValue) => DeployFromJSON(jsonValue)); + } + + /** + */ + async apiProjectsDeploysPartialUpdate(requestParameters: ApiProjectsDeploysPartialUpdateRequest): Promise { + const response = await this.apiProjectsDeploysPartialUpdateRaw(requestParameters); + return await response.value(); + } + + /** + */ + async apiProjectsDeploysReadRaw(requestParameters: ApiProjectsDeploysReadRequest): Promise> { + if (requestParameters.did === null || requestParameters.did === undefined) { + throw new runtime.RequiredError('did','Required parameter requestParameters.did was null or undefined when calling apiProjectsDeploysRead.'); + } + + if (requestParameters.pid === null || requestParameters.pid === undefined) { + throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsDeploysRead.'); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { + headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); + } + const response = await this.request({ + path: `/api/projects/{pid}/deploys/{did}`.replace(`{${"did"}}`, encodeURIComponent(String(requestParameters.did))).replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))), + method: 'GET', + headers: headerParameters, + query: queryParameters, + }); + + return new runtime.JSONApiResponse(response, (jsonValue) => DeployFromJSON(jsonValue)); + } + + /** + */ + async apiProjectsDeploysRead(requestParameters: ApiProjectsDeploysReadRequest): Promise { + const response = await this.apiProjectsDeploysReadRaw(requestParameters); + return await response.value(); + } + + /** + */ + async apiProjectsDeploysUpdateRaw(requestParameters: ApiProjectsDeploysUpdateRequest): Promise> { + if (requestParameters.did === null || requestParameters.did === undefined) { + throw new runtime.RequiredError('did','Required parameter requestParameters.did was null or undefined when calling apiProjectsDeploysUpdate.'); + } + + if (requestParameters.pid === null || requestParameters.pid === undefined) { + throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsDeploysUpdate.'); + } + + if (requestParameters.data === null || requestParameters.data === undefined) { + throw new runtime.RequiredError('data','Required parameter requestParameters.data was null or undefined when calling apiProjectsDeploysUpdate.'); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + headerParameters['Content-Type'] = 'application/json'; + + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { + headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); + } + const response = await this.request({ + path: `/api/projects/{pid}/deploys/{did}`.replace(`{${"did"}}`, encodeURIComponent(String(requestParameters.did))).replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))), + method: 'PUT', + headers: headerParameters, + query: queryParameters, + body: DeployUpdateToJSON(requestParameters.data), + }); + + return new runtime.JSONApiResponse(response, (jsonValue) => DeployUpdateFromJSON(jsonValue)); + } + + /** + */ + async apiProjectsDeploysUpdate(requestParameters: ApiProjectsDeploysUpdateRequest): Promise { + const response = await this.apiProjectsDeploysUpdateRaw(requestParameters); + return await response.value(); + } + +} diff --git a/estela-web/src/services/api/generated-api/apis/ProjectsApi.ts b/estela-web/src/services/api/generated-api/apis/ProjectsApi.ts new file mode 100644 index 00000000..06060bc8 --- /dev/null +++ b/estela-web/src/services/api/generated-api/apis/ProjectsApi.ts @@ -0,0 +1,449 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * estela API v1.0 Documentation + * estela API Swagger Specification + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import * as runtime from '../runtime'; +import { + InlineResponse2001, + InlineResponse2001FromJSON, + InlineResponse2001ToJSON, + Project, + ProjectFromJSON, + ProjectToJSON, + ProjectCronJob, + ProjectCronJobFromJSON, + ProjectCronJobToJSON, + ProjectJob, + ProjectJobFromJSON, + ProjectJobToJSON, + ProjectUpdate, + ProjectUpdateFromJSON, + ProjectUpdateToJSON, + ProjectUsage, + ProjectUsageFromJSON, + ProjectUsageToJSON, + UsageRecord, + UsageRecordFromJSON, + UsageRecordToJSON, +} from '../models'; + +export interface ApiProjectsCreateRequest { + data: Project; +} + +export interface ApiProjectsCronjobsRequest { + pid: string; + page?: number; + pageSize?: number; +} + +export interface ApiProjectsCurrentUsageRequest { + pid: string; +} + +export interface ApiProjectsDeleteRequest { + pid: string; +} + +export interface ApiProjectsJobsRequest { + pid: string; + page?: number; + pageSize?: number; +} + +export interface ApiProjectsListRequest { + page?: number; + pageSize?: number; +} + +export interface ApiProjectsPartialUpdateRequest { + pid: string; + data: Project; +} + +export interface ApiProjectsReadRequest { + pid: string; +} + +export interface ApiProjectsUpdateRequest { + pid: string; + data: ProjectUpdate; +} + +export interface ApiProjectsUsageRequest { + pid: string; + startDate?: string; + endDate?: string; +} + +/** + * + */ +export class ProjectsApi extends runtime.BaseAPI { + + /** + */ + async apiProjectsCreateRaw(requestParameters: ApiProjectsCreateRequest): Promise> { + if (requestParameters.data === null || requestParameters.data === undefined) { + throw new runtime.RequiredError('data','Required parameter requestParameters.data was null or undefined when calling apiProjectsCreate.'); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + headerParameters['Content-Type'] = 'application/json'; + + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { + headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); + } + const response = await this.request({ + path: `/api/projects`, + method: 'POST', + headers: headerParameters, + query: queryParameters, + body: ProjectToJSON(requestParameters.data), + }); + + return new runtime.JSONApiResponse(response, (jsonValue) => ProjectFromJSON(jsonValue)); + } + + /** + */ + async apiProjectsCreate(requestParameters: ApiProjectsCreateRequest): Promise { + const response = await this.apiProjectsCreateRaw(requestParameters); + return await response.value(); + } + + /** + */ + async apiProjectsCronjobsRaw(requestParameters: ApiProjectsCronjobsRequest): Promise> { + if (requestParameters.pid === null || requestParameters.pid === undefined) { + throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsCronjobs.'); + } + + const queryParameters: any = {}; + + if (requestParameters.page !== undefined) { + queryParameters['page'] = requestParameters.page; + } + + if (requestParameters.pageSize !== undefined) { + queryParameters['page_size'] = requestParameters.pageSize; + } + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { + headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); + } + const response = await this.request({ + path: `/api/projects/{pid}/cronjobs`.replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))), + method: 'GET', + headers: headerParameters, + query: queryParameters, + }); + + return new runtime.JSONApiResponse(response, (jsonValue) => ProjectCronJobFromJSON(jsonValue)); + } + + /** + */ + async apiProjectsCronjobs(requestParameters: ApiProjectsCronjobsRequest): Promise { + const response = await this.apiProjectsCronjobsRaw(requestParameters); + return await response.value(); + } + + /** + */ + async apiProjectsCurrentUsageRaw(requestParameters: ApiProjectsCurrentUsageRequest): Promise> { + if (requestParameters.pid === null || requestParameters.pid === undefined) { + throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsCurrentUsage.'); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { + headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); + } + const response = await this.request({ + path: `/api/projects/{pid}/current_usage`.replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))), + method: 'GET', + headers: headerParameters, + query: queryParameters, + }); + + return new runtime.JSONApiResponse(response, (jsonValue) => ProjectUsageFromJSON(jsonValue)); + } + + /** + */ + async apiProjectsCurrentUsage(requestParameters: ApiProjectsCurrentUsageRequest): Promise { + const response = await this.apiProjectsCurrentUsageRaw(requestParameters); + return await response.value(); + } + + /** + */ + async apiProjectsDeleteRaw(requestParameters: ApiProjectsDeleteRequest): Promise> { + if (requestParameters.pid === null || requestParameters.pid === undefined) { + throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsDelete.'); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { + headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); + } + const response = await this.request({ + path: `/api/projects/{pid}`.replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))), + method: 'DELETE', + headers: headerParameters, + query: queryParameters, + }); + + return new runtime.VoidApiResponse(response); + } + + /** + */ + async apiProjectsDelete(requestParameters: ApiProjectsDeleteRequest): Promise { + await this.apiProjectsDeleteRaw(requestParameters); + } + + /** + */ + async apiProjectsJobsRaw(requestParameters: ApiProjectsJobsRequest): Promise> { + if (requestParameters.pid === null || requestParameters.pid === undefined) { + throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsJobs.'); + } + + const queryParameters: any = {}; + + if (requestParameters.page !== undefined) { + queryParameters['page'] = requestParameters.page; + } + + if (requestParameters.pageSize !== undefined) { + queryParameters['page_size'] = requestParameters.pageSize; + } + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { + headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); + } + const response = await this.request({ + path: `/api/projects/{pid}/jobs`.replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))), + method: 'GET', + headers: headerParameters, + query: queryParameters, + }); + + return new runtime.JSONApiResponse(response, (jsonValue) => ProjectJobFromJSON(jsonValue)); + } + + /** + */ + async apiProjectsJobs(requestParameters: ApiProjectsJobsRequest): Promise { + const response = await this.apiProjectsJobsRaw(requestParameters); + return await response.value(); + } + + /** + */ + async apiProjectsListRaw(requestParameters: ApiProjectsListRequest): Promise> { + const queryParameters: any = {}; + + if (requestParameters.page !== undefined) { + queryParameters['page'] = requestParameters.page; + } + + if (requestParameters.pageSize !== undefined) { + queryParameters['page_size'] = requestParameters.pageSize; + } + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { + headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); + } + const response = await this.request({ + path: `/api/projects`, + method: 'GET', + headers: headerParameters, + query: queryParameters, + }); + + return new runtime.JSONApiResponse(response, (jsonValue) => InlineResponse2001FromJSON(jsonValue)); + } + + /** + */ + async apiProjectsList(requestParameters: ApiProjectsListRequest): Promise { + const response = await this.apiProjectsListRaw(requestParameters); + return await response.value(); + } + + /** + */ + async apiProjectsPartialUpdateRaw(requestParameters: ApiProjectsPartialUpdateRequest): Promise> { + if (requestParameters.pid === null || requestParameters.pid === undefined) { + throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsPartialUpdate.'); + } + + if (requestParameters.data === null || requestParameters.data === undefined) { + throw new runtime.RequiredError('data','Required parameter requestParameters.data was null or undefined when calling apiProjectsPartialUpdate.'); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + headerParameters['Content-Type'] = 'application/json'; + + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { + headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); + } + const response = await this.request({ + path: `/api/projects/{pid}`.replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))), + method: 'PATCH', + headers: headerParameters, + query: queryParameters, + body: ProjectToJSON(requestParameters.data), + }); + + return new runtime.JSONApiResponse(response, (jsonValue) => ProjectFromJSON(jsonValue)); + } + + /** + */ + async apiProjectsPartialUpdate(requestParameters: ApiProjectsPartialUpdateRequest): Promise { + const response = await this.apiProjectsPartialUpdateRaw(requestParameters); + return await response.value(); + } + + /** + */ + async apiProjectsReadRaw(requestParameters: ApiProjectsReadRequest): Promise> { + if (requestParameters.pid === null || requestParameters.pid === undefined) { + throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsRead.'); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { + headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); + } + const response = await this.request({ + path: `/api/projects/{pid}`.replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))), + method: 'GET', + headers: headerParameters, + query: queryParameters, + }); + + return new runtime.JSONApiResponse(response, (jsonValue) => ProjectFromJSON(jsonValue)); + } + + /** + */ + async apiProjectsRead(requestParameters: ApiProjectsReadRequest): Promise { + const response = await this.apiProjectsReadRaw(requestParameters); + return await response.value(); + } + + /** + */ + async apiProjectsUpdateRaw(requestParameters: ApiProjectsUpdateRequest): Promise> { + if (requestParameters.pid === null || requestParameters.pid === undefined) { + throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsUpdate.'); + } + + if (requestParameters.data === null || requestParameters.data === undefined) { + throw new runtime.RequiredError('data','Required parameter requestParameters.data was null or undefined when calling apiProjectsUpdate.'); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + headerParameters['Content-Type'] = 'application/json'; + + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { + headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); + } + const response = await this.request({ + path: `/api/projects/{pid}`.replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))), + method: 'PUT', + headers: headerParameters, + query: queryParameters, + body: ProjectUpdateToJSON(requestParameters.data), + }); + + return new runtime.JSONApiResponse(response, (jsonValue) => ProjectUpdateFromJSON(jsonValue)); + } + + /** + */ + async apiProjectsUpdate(requestParameters: ApiProjectsUpdateRequest): Promise { + const response = await this.apiProjectsUpdateRaw(requestParameters); + return await response.value(); + } + + /** + */ + async apiProjectsUsageRaw(requestParameters: ApiProjectsUsageRequest): Promise>> { + if (requestParameters.pid === null || requestParameters.pid === undefined) { + throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsUsage.'); + } + + const queryParameters: any = {}; + + if (requestParameters.startDate !== undefined) { + queryParameters['start_date'] = requestParameters.startDate; + } + + if (requestParameters.endDate !== undefined) { + queryParameters['end_date'] = requestParameters.endDate; + } + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { + headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); + } + const response = await this.request({ + path: `/api/projects/{pid}/usage`.replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))), + method: 'GET', + headers: headerParameters, + query: queryParameters, + }); + + return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(UsageRecordFromJSON)); + } + + /** + */ + async apiProjectsUsage(requestParameters: ApiProjectsUsageRequest): Promise> { + const response = await this.apiProjectsUsageRaw(requestParameters); + return await response.value(); + } + +} diff --git a/estela-web/src/services/api/generated-api/apis/SpiderCronjobsApi.ts b/estela-web/src/services/api/generated-api/apis/SpiderCronjobsApi.ts new file mode 100644 index 00000000..b2d09fcf --- /dev/null +++ b/estela-web/src/services/api/generated-api/apis/SpiderCronjobsApi.ts @@ -0,0 +1,380 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * estela API v1.0 Documentation + * estela API Swagger Specification + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import * as runtime from '../runtime'; +import { + InlineResponse2004, + InlineResponse2004FromJSON, + InlineResponse2004ToJSON, + SpiderCronJob, + SpiderCronJobFromJSON, + SpiderCronJobToJSON, + SpiderCronJobCreate, + SpiderCronJobCreateFromJSON, + SpiderCronJobCreateToJSON, + SpiderCronJobUpdate, + SpiderCronJobUpdateFromJSON, + SpiderCronJobUpdateToJSON, +} from '../models'; + +export interface ApiProjectsSpidersCronjobsCreateRequest { + pid: string; + sid: string; + data: SpiderCronJobCreate; +} + +export interface ApiProjectsSpidersCronjobsDeleteRequest { + cjid: number; + pid: string; + sid: string; +} + +export interface ApiProjectsSpidersCronjobsListRequest { + pid: string; + sid: string; + tag?: string; + page?: number; + pageSize?: number; +} + +export interface ApiProjectsSpidersCronjobsPartialUpdateRequest { + cjid: number; + pid: string; + sid: string; + data: SpiderCronJob; +} + +export interface ApiProjectsSpidersCronjobsReadRequest { + cjid: number; + pid: string; + sid: string; +} + +export interface ApiProjectsSpidersCronjobsRunOnceRequest { + cjid: number; + pid: string; + sid: string; +} + +export interface ApiProjectsSpidersCronjobsUpdateRequest { + cjid: number; + pid: string; + sid: string; + data: SpiderCronJobUpdate; +} + +/** + * + */ +export class SpiderCronjobsApi extends runtime.BaseAPI { + + /** + */ + async apiProjectsSpidersCronjobsCreateRaw(requestParameters: ApiProjectsSpidersCronjobsCreateRequest): Promise> { + if (requestParameters.pid === null || requestParameters.pid === undefined) { + throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsSpidersCronjobsCreate.'); + } + + if (requestParameters.sid === null || requestParameters.sid === undefined) { + throw new runtime.RequiredError('sid','Required parameter requestParameters.sid was null or undefined when calling apiProjectsSpidersCronjobsCreate.'); + } + + if (requestParameters.data === null || requestParameters.data === undefined) { + throw new runtime.RequiredError('data','Required parameter requestParameters.data was null or undefined when calling apiProjectsSpidersCronjobsCreate.'); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + headerParameters['Content-Type'] = 'application/json'; + + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { + headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); + } + const response = await this.request({ + path: `/api/projects/{pid}/spiders/{sid}/cronjobs`.replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))).replace(`{${"sid"}}`, encodeURIComponent(String(requestParameters.sid))), + method: 'POST', + headers: headerParameters, + query: queryParameters, + body: SpiderCronJobCreateToJSON(requestParameters.data), + }); + + return new runtime.JSONApiResponse(response, (jsonValue) => SpiderCronJobCreateFromJSON(jsonValue)); + } + + /** + */ + async apiProjectsSpidersCronjobsCreate(requestParameters: ApiProjectsSpidersCronjobsCreateRequest): Promise { + const response = await this.apiProjectsSpidersCronjobsCreateRaw(requestParameters); + return await response.value(); + } + + /** + */ + async apiProjectsSpidersCronjobsDeleteRaw(requestParameters: ApiProjectsSpidersCronjobsDeleteRequest): Promise> { + if (requestParameters.cjid === null || requestParameters.cjid === undefined) { + throw new runtime.RequiredError('cjid','Required parameter requestParameters.cjid was null or undefined when calling apiProjectsSpidersCronjobsDelete.'); + } + + if (requestParameters.pid === null || requestParameters.pid === undefined) { + throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsSpidersCronjobsDelete.'); + } + + if (requestParameters.sid === null || requestParameters.sid === undefined) { + throw new runtime.RequiredError('sid','Required parameter requestParameters.sid was null or undefined when calling apiProjectsSpidersCronjobsDelete.'); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { + headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); + } + const response = await this.request({ + path: `/api/projects/{pid}/spiders/{sid}/cronjobs/{cjid}`.replace(`{${"cjid"}}`, encodeURIComponent(String(requestParameters.cjid))).replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))).replace(`{${"sid"}}`, encodeURIComponent(String(requestParameters.sid))), + method: 'DELETE', + headers: headerParameters, + query: queryParameters, + }); + + return new runtime.VoidApiResponse(response); + } + + /** + */ + async apiProjectsSpidersCronjobsDelete(requestParameters: ApiProjectsSpidersCronjobsDeleteRequest): Promise { + await this.apiProjectsSpidersCronjobsDeleteRaw(requestParameters); + } + + /** + */ + async apiProjectsSpidersCronjobsListRaw(requestParameters: ApiProjectsSpidersCronjobsListRequest): Promise> { + if (requestParameters.pid === null || requestParameters.pid === undefined) { + throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsSpidersCronjobsList.'); + } + + if (requestParameters.sid === null || requestParameters.sid === undefined) { + throw new runtime.RequiredError('sid','Required parameter requestParameters.sid was null or undefined when calling apiProjectsSpidersCronjobsList.'); + } + + const queryParameters: any = {}; + + if (requestParameters.tag !== undefined) { + queryParameters['tag'] = requestParameters.tag; + } + + if (requestParameters.page !== undefined) { + queryParameters['page'] = requestParameters.page; + } + + if (requestParameters.pageSize !== undefined) { + queryParameters['page_size'] = requestParameters.pageSize; + } + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { + headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); + } + const response = await this.request({ + path: `/api/projects/{pid}/spiders/{sid}/cronjobs`.replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))).replace(`{${"sid"}}`, encodeURIComponent(String(requestParameters.sid))), + method: 'GET', + headers: headerParameters, + query: queryParameters, + }); + + return new runtime.JSONApiResponse(response, (jsonValue) => InlineResponse2004FromJSON(jsonValue)); + } + + /** + */ + async apiProjectsSpidersCronjobsList(requestParameters: ApiProjectsSpidersCronjobsListRequest): Promise { + const response = await this.apiProjectsSpidersCronjobsListRaw(requestParameters); + return await response.value(); + } + + /** + */ + async apiProjectsSpidersCronjobsPartialUpdateRaw(requestParameters: ApiProjectsSpidersCronjobsPartialUpdateRequest): Promise> { + if (requestParameters.cjid === null || requestParameters.cjid === undefined) { + throw new runtime.RequiredError('cjid','Required parameter requestParameters.cjid was null or undefined when calling apiProjectsSpidersCronjobsPartialUpdate.'); + } + + if (requestParameters.pid === null || requestParameters.pid === undefined) { + throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsSpidersCronjobsPartialUpdate.'); + } + + if (requestParameters.sid === null || requestParameters.sid === undefined) { + throw new runtime.RequiredError('sid','Required parameter requestParameters.sid was null or undefined when calling apiProjectsSpidersCronjobsPartialUpdate.'); + } + + if (requestParameters.data === null || requestParameters.data === undefined) { + throw new runtime.RequiredError('data','Required parameter requestParameters.data was null or undefined when calling apiProjectsSpidersCronjobsPartialUpdate.'); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + headerParameters['Content-Type'] = 'application/json'; + + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { + headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); + } + const response = await this.request({ + path: `/api/projects/{pid}/spiders/{sid}/cronjobs/{cjid}`.replace(`{${"cjid"}}`, encodeURIComponent(String(requestParameters.cjid))).replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))).replace(`{${"sid"}}`, encodeURIComponent(String(requestParameters.sid))), + method: 'PATCH', + headers: headerParameters, + query: queryParameters, + body: SpiderCronJobToJSON(requestParameters.data), + }); + + return new runtime.JSONApiResponse(response, (jsonValue) => SpiderCronJobFromJSON(jsonValue)); + } + + /** + */ + async apiProjectsSpidersCronjobsPartialUpdate(requestParameters: ApiProjectsSpidersCronjobsPartialUpdateRequest): Promise { + const response = await this.apiProjectsSpidersCronjobsPartialUpdateRaw(requestParameters); + return await response.value(); + } + + /** + */ + async apiProjectsSpidersCronjobsReadRaw(requestParameters: ApiProjectsSpidersCronjobsReadRequest): Promise> { + if (requestParameters.cjid === null || requestParameters.cjid === undefined) { + throw new runtime.RequiredError('cjid','Required parameter requestParameters.cjid was null or undefined when calling apiProjectsSpidersCronjobsRead.'); + } + + if (requestParameters.pid === null || requestParameters.pid === undefined) { + throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsSpidersCronjobsRead.'); + } + + if (requestParameters.sid === null || requestParameters.sid === undefined) { + throw new runtime.RequiredError('sid','Required parameter requestParameters.sid was null or undefined when calling apiProjectsSpidersCronjobsRead.'); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { + headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); + } + const response = await this.request({ + path: `/api/projects/{pid}/spiders/{sid}/cronjobs/{cjid}`.replace(`{${"cjid"}}`, encodeURIComponent(String(requestParameters.cjid))).replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))).replace(`{${"sid"}}`, encodeURIComponent(String(requestParameters.sid))), + method: 'GET', + headers: headerParameters, + query: queryParameters, + }); + + return new runtime.JSONApiResponse(response, (jsonValue) => SpiderCronJobFromJSON(jsonValue)); + } + + /** + */ + async apiProjectsSpidersCronjobsRead(requestParameters: ApiProjectsSpidersCronjobsReadRequest): Promise { + const response = await this.apiProjectsSpidersCronjobsReadRaw(requestParameters); + return await response.value(); + } + + /** + */ + async apiProjectsSpidersCronjobsRunOnceRaw(requestParameters: ApiProjectsSpidersCronjobsRunOnceRequest): Promise> { + if (requestParameters.cjid === null || requestParameters.cjid === undefined) { + throw new runtime.RequiredError('cjid','Required parameter requestParameters.cjid was null or undefined when calling apiProjectsSpidersCronjobsRunOnce.'); + } + + if (requestParameters.pid === null || requestParameters.pid === undefined) { + throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsSpidersCronjobsRunOnce.'); + } + + if (requestParameters.sid === null || requestParameters.sid === undefined) { + throw new runtime.RequiredError('sid','Required parameter requestParameters.sid was null or undefined when calling apiProjectsSpidersCronjobsRunOnce.'); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { + headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); + } + const response = await this.request({ + path: `/api/projects/{pid}/spiders/{sid}/cronjobs/{cjid}/run_once`.replace(`{${"cjid"}}`, encodeURIComponent(String(requestParameters.cjid))).replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))).replace(`{${"sid"}}`, encodeURIComponent(String(requestParameters.sid))), + method: 'GET', + headers: headerParameters, + query: queryParameters, + }); + + return new runtime.JSONApiResponse(response, (jsonValue) => SpiderCronJobFromJSON(jsonValue)); + } + + /** + */ + async apiProjectsSpidersCronjobsRunOnce(requestParameters: ApiProjectsSpidersCronjobsRunOnceRequest): Promise { + const response = await this.apiProjectsSpidersCronjobsRunOnceRaw(requestParameters); + return await response.value(); + } + + /** + */ + async apiProjectsSpidersCronjobsUpdateRaw(requestParameters: ApiProjectsSpidersCronjobsUpdateRequest): Promise> { + if (requestParameters.cjid === null || requestParameters.cjid === undefined) { + throw new runtime.RequiredError('cjid','Required parameter requestParameters.cjid was null or undefined when calling apiProjectsSpidersCronjobsUpdate.'); + } + + if (requestParameters.pid === null || requestParameters.pid === undefined) { + throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsSpidersCronjobsUpdate.'); + } + + if (requestParameters.sid === null || requestParameters.sid === undefined) { + throw new runtime.RequiredError('sid','Required parameter requestParameters.sid was null or undefined when calling apiProjectsSpidersCronjobsUpdate.'); + } + + if (requestParameters.data === null || requestParameters.data === undefined) { + throw new runtime.RequiredError('data','Required parameter requestParameters.data was null or undefined when calling apiProjectsSpidersCronjobsUpdate.'); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + headerParameters['Content-Type'] = 'application/json'; + + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { + headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); + } + const response = await this.request({ + path: `/api/projects/{pid}/spiders/{sid}/cronjobs/{cjid}`.replace(`{${"cjid"}}`, encodeURIComponent(String(requestParameters.cjid))).replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))).replace(`{${"sid"}}`, encodeURIComponent(String(requestParameters.sid))), + method: 'PUT', + headers: headerParameters, + query: queryParameters, + body: SpiderCronJobUpdateToJSON(requestParameters.data), + }); + + return new runtime.JSONApiResponse(response, (jsonValue) => SpiderCronJobUpdateFromJSON(jsonValue)); + } + + /** + */ + async apiProjectsSpidersCronjobsUpdate(requestParameters: ApiProjectsSpidersCronjobsUpdateRequest): Promise { + const response = await this.apiProjectsSpidersCronjobsUpdateRaw(requestParameters); + return await response.value(); + } + +} diff --git a/estela-web/src/services/api/generated-api/apis/SpiderJobsApi.ts b/estela-web/src/services/api/generated-api/apis/SpiderJobsApi.ts new file mode 100644 index 00000000..96cc50bd --- /dev/null +++ b/estela-web/src/services/api/generated-api/apis/SpiderJobsApi.ts @@ -0,0 +1,426 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * estela API v1.0 Documentation + * estela API Swagger Specification + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import * as runtime from '../runtime'; +import { + DeleteJobData, + DeleteJobDataFromJSON, + DeleteJobDataToJSON, + InlineResponse2005, + InlineResponse2005FromJSON, + InlineResponse2005ToJSON, + InlineResponse2006, + InlineResponse2006FromJSON, + InlineResponse2006ToJSON, + SpiderJob, + SpiderJobFromJSON, + SpiderJobToJSON, + SpiderJobCreate, + SpiderJobCreateFromJSON, + SpiderJobCreateToJSON, + SpiderJobUpdate, + SpiderJobUpdateFromJSON, + SpiderJobUpdateToJSON, +} from '../models'; + +export interface ApiProjectsSpidersJobsCreateRequest { + pid: string; + sid: string; + data: SpiderJobCreate; + async?: boolean; +} + +export interface ApiProjectsSpidersJobsDataDeleteRequest { + jid: string; + pid: string; + sid: string; + type: string; +} + +export interface ApiProjectsSpidersJobsDataListRequest { + jid: string; + pid: string; + sid: string; + page?: number; + pageSize?: number; + type?: string; +} + +export interface ApiProjectsSpidersJobsListRequest { + pid: string; + sid: string; + cronjob?: number; + status?: string; + tag?: string; + page?: number; + pageSize?: number; +} + +export interface ApiProjectsSpidersJobsPartialUpdateRequest { + jid: number; + pid: string; + sid: string; + data: SpiderJob; +} + +export interface ApiProjectsSpidersJobsReadRequest { + jid: number; + pid: string; + sid: string; +} + +export interface ApiProjectsSpidersJobsUpdateRequest { + jid: number; + pid: string; + sid: string; + data: SpiderJobUpdate; +} + +/** + * + */ +export class SpiderJobsApi extends runtime.BaseAPI { + + /** + */ + async apiProjectsSpidersJobsCreateRaw(requestParameters: ApiProjectsSpidersJobsCreateRequest): Promise> { + if (requestParameters.pid === null || requestParameters.pid === undefined) { + throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsSpidersJobsCreate.'); + } + + if (requestParameters.sid === null || requestParameters.sid === undefined) { + throw new runtime.RequiredError('sid','Required parameter requestParameters.sid was null or undefined when calling apiProjectsSpidersJobsCreate.'); + } + + if (requestParameters.data === null || requestParameters.data === undefined) { + throw new runtime.RequiredError('data','Required parameter requestParameters.data was null or undefined when calling apiProjectsSpidersJobsCreate.'); + } + + const queryParameters: any = {}; + + if (requestParameters.async !== undefined) { + queryParameters['async'] = requestParameters.async; + } + + const headerParameters: runtime.HTTPHeaders = {}; + + headerParameters['Content-Type'] = 'application/json'; + + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { + headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); + } + const response = await this.request({ + path: `/api/projects/{pid}/spiders/{sid}/jobs`.replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))).replace(`{${"sid"}}`, encodeURIComponent(String(requestParameters.sid))), + method: 'POST', + headers: headerParameters, + query: queryParameters, + body: SpiderJobCreateToJSON(requestParameters.data), + }); + + return new runtime.JSONApiResponse(response, (jsonValue) => SpiderJobCreateFromJSON(jsonValue)); + } + + /** + */ + async apiProjectsSpidersJobsCreate(requestParameters: ApiProjectsSpidersJobsCreateRequest): Promise { + const response = await this.apiProjectsSpidersJobsCreateRaw(requestParameters); + return await response.value(); + } + + /** + */ + async apiProjectsSpidersJobsDataDeleteRaw(requestParameters: ApiProjectsSpidersJobsDataDeleteRequest): Promise> { + if (requestParameters.jid === null || requestParameters.jid === undefined) { + throw new runtime.RequiredError('jid','Required parameter requestParameters.jid was null or undefined when calling apiProjectsSpidersJobsDataDelete.'); + } + + if (requestParameters.pid === null || requestParameters.pid === undefined) { + throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsSpidersJobsDataDelete.'); + } + + if (requestParameters.sid === null || requestParameters.sid === undefined) { + throw new runtime.RequiredError('sid','Required parameter requestParameters.sid was null or undefined when calling apiProjectsSpidersJobsDataDelete.'); + } + + if (requestParameters.type === null || requestParameters.type === undefined) { + throw new runtime.RequiredError('type','Required parameter requestParameters.type was null or undefined when calling apiProjectsSpidersJobsDataDelete.'); + } + + const queryParameters: any = {}; + + if (requestParameters.type !== undefined) { + queryParameters['type'] = requestParameters.type; + } + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { + headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); + } + const response = await this.request({ + path: `/api/projects/{pid}/spiders/{sid}/jobs/{jid}/data/delete`.replace(`{${"jid"}}`, encodeURIComponent(String(requestParameters.jid))).replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))).replace(`{${"sid"}}`, encodeURIComponent(String(requestParameters.sid))), + method: 'POST', + headers: headerParameters, + query: queryParameters, + }); + + return new runtime.JSONApiResponse(response, (jsonValue) => DeleteJobDataFromJSON(jsonValue)); + } + + /** + */ + async apiProjectsSpidersJobsDataDelete(requestParameters: ApiProjectsSpidersJobsDataDeleteRequest): Promise { + const response = await this.apiProjectsSpidersJobsDataDeleteRaw(requestParameters); + return await response.value(); + } + + /** + */ + async apiProjectsSpidersJobsDataListRaw(requestParameters: ApiProjectsSpidersJobsDataListRequest): Promise> { + if (requestParameters.jid === null || requestParameters.jid === undefined) { + throw new runtime.RequiredError('jid','Required parameter requestParameters.jid was null or undefined when calling apiProjectsSpidersJobsDataList.'); + } + + if (requestParameters.pid === null || requestParameters.pid === undefined) { + throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsSpidersJobsDataList.'); + } + + if (requestParameters.sid === null || requestParameters.sid === undefined) { + throw new runtime.RequiredError('sid','Required parameter requestParameters.sid was null or undefined when calling apiProjectsSpidersJobsDataList.'); + } + + const queryParameters: any = {}; + + if (requestParameters.page !== undefined) { + queryParameters['page'] = requestParameters.page; + } + + if (requestParameters.pageSize !== undefined) { + queryParameters['page_size'] = requestParameters.pageSize; + } + + if (requestParameters.type !== undefined) { + queryParameters['type'] = requestParameters.type; + } + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { + headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); + } + const response = await this.request({ + path: `/api/projects/{pid}/spiders/{sid}/jobs/{jid}/data`.replace(`{${"jid"}}`, encodeURIComponent(String(requestParameters.jid))).replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))).replace(`{${"sid"}}`, encodeURIComponent(String(requestParameters.sid))), + method: 'GET', + headers: headerParameters, + query: queryParameters, + }); + + return new runtime.JSONApiResponse(response, (jsonValue) => InlineResponse2006FromJSON(jsonValue)); + } + + /** + */ + async apiProjectsSpidersJobsDataList(requestParameters: ApiProjectsSpidersJobsDataListRequest): Promise { + const response = await this.apiProjectsSpidersJobsDataListRaw(requestParameters); + return await response.value(); + } + + /** + */ + async apiProjectsSpidersJobsListRaw(requestParameters: ApiProjectsSpidersJobsListRequest): Promise> { + if (requestParameters.pid === null || requestParameters.pid === undefined) { + throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsSpidersJobsList.'); + } + + if (requestParameters.sid === null || requestParameters.sid === undefined) { + throw new runtime.RequiredError('sid','Required parameter requestParameters.sid was null or undefined when calling apiProjectsSpidersJobsList.'); + } + + const queryParameters: any = {}; + + if (requestParameters.cronjob !== undefined) { + queryParameters['cronjob'] = requestParameters.cronjob; + } + + if (requestParameters.status !== undefined) { + queryParameters['status'] = requestParameters.status; + } + + if (requestParameters.tag !== undefined) { + queryParameters['tag'] = requestParameters.tag; + } + + if (requestParameters.page !== undefined) { + queryParameters['page'] = requestParameters.page; + } + + if (requestParameters.pageSize !== undefined) { + queryParameters['page_size'] = requestParameters.pageSize; + } + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { + headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); + } + const response = await this.request({ + path: `/api/projects/{pid}/spiders/{sid}/jobs`.replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))).replace(`{${"sid"}}`, encodeURIComponent(String(requestParameters.sid))), + method: 'GET', + headers: headerParameters, + query: queryParameters, + }); + + return new runtime.JSONApiResponse(response, (jsonValue) => InlineResponse2005FromJSON(jsonValue)); + } + + /** + */ + async apiProjectsSpidersJobsList(requestParameters: ApiProjectsSpidersJobsListRequest): Promise { + const response = await this.apiProjectsSpidersJobsListRaw(requestParameters); + return await response.value(); + } + + /** + */ + async apiProjectsSpidersJobsPartialUpdateRaw(requestParameters: ApiProjectsSpidersJobsPartialUpdateRequest): Promise> { + if (requestParameters.jid === null || requestParameters.jid === undefined) { + throw new runtime.RequiredError('jid','Required parameter requestParameters.jid was null or undefined when calling apiProjectsSpidersJobsPartialUpdate.'); + } + + if (requestParameters.pid === null || requestParameters.pid === undefined) { + throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsSpidersJobsPartialUpdate.'); + } + + if (requestParameters.sid === null || requestParameters.sid === undefined) { + throw new runtime.RequiredError('sid','Required parameter requestParameters.sid was null or undefined when calling apiProjectsSpidersJobsPartialUpdate.'); + } + + if (requestParameters.data === null || requestParameters.data === undefined) { + throw new runtime.RequiredError('data','Required parameter requestParameters.data was null or undefined when calling apiProjectsSpidersJobsPartialUpdate.'); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + headerParameters['Content-Type'] = 'application/json'; + + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { + headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); + } + const response = await this.request({ + path: `/api/projects/{pid}/spiders/{sid}/jobs/{jid}`.replace(`{${"jid"}}`, encodeURIComponent(String(requestParameters.jid))).replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))).replace(`{${"sid"}}`, encodeURIComponent(String(requestParameters.sid))), + method: 'PATCH', + headers: headerParameters, + query: queryParameters, + body: SpiderJobToJSON(requestParameters.data), + }); + + return new runtime.JSONApiResponse(response, (jsonValue) => SpiderJobFromJSON(jsonValue)); + } + + /** + */ + async apiProjectsSpidersJobsPartialUpdate(requestParameters: ApiProjectsSpidersJobsPartialUpdateRequest): Promise { + const response = await this.apiProjectsSpidersJobsPartialUpdateRaw(requestParameters); + return await response.value(); + } + + /** + */ + async apiProjectsSpidersJobsReadRaw(requestParameters: ApiProjectsSpidersJobsReadRequest): Promise> { + if (requestParameters.jid === null || requestParameters.jid === undefined) { + throw new runtime.RequiredError('jid','Required parameter requestParameters.jid was null or undefined when calling apiProjectsSpidersJobsRead.'); + } + + if (requestParameters.pid === null || requestParameters.pid === undefined) { + throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsSpidersJobsRead.'); + } + + if (requestParameters.sid === null || requestParameters.sid === undefined) { + throw new runtime.RequiredError('sid','Required parameter requestParameters.sid was null or undefined when calling apiProjectsSpidersJobsRead.'); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { + headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); + } + const response = await this.request({ + path: `/api/projects/{pid}/spiders/{sid}/jobs/{jid}`.replace(`{${"jid"}}`, encodeURIComponent(String(requestParameters.jid))).replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))).replace(`{${"sid"}}`, encodeURIComponent(String(requestParameters.sid))), + method: 'GET', + headers: headerParameters, + query: queryParameters, + }); + + return new runtime.JSONApiResponse(response, (jsonValue) => SpiderJobFromJSON(jsonValue)); + } + + /** + */ + async apiProjectsSpidersJobsRead(requestParameters: ApiProjectsSpidersJobsReadRequest): Promise { + const response = await this.apiProjectsSpidersJobsReadRaw(requestParameters); + return await response.value(); + } + + /** + */ + async apiProjectsSpidersJobsUpdateRaw(requestParameters: ApiProjectsSpidersJobsUpdateRequest): Promise> { + if (requestParameters.jid === null || requestParameters.jid === undefined) { + throw new runtime.RequiredError('jid','Required parameter requestParameters.jid was null or undefined when calling apiProjectsSpidersJobsUpdate.'); + } + + if (requestParameters.pid === null || requestParameters.pid === undefined) { + throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsSpidersJobsUpdate.'); + } + + if (requestParameters.sid === null || requestParameters.sid === undefined) { + throw new runtime.RequiredError('sid','Required parameter requestParameters.sid was null or undefined when calling apiProjectsSpidersJobsUpdate.'); + } + + if (requestParameters.data === null || requestParameters.data === undefined) { + throw new runtime.RequiredError('data','Required parameter requestParameters.data was null or undefined when calling apiProjectsSpidersJobsUpdate.'); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + headerParameters['Content-Type'] = 'application/json'; + + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { + headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); + } + const response = await this.request({ + path: `/api/projects/{pid}/spiders/{sid}/jobs/{jid}`.replace(`{${"jid"}}`, encodeURIComponent(String(requestParameters.jid))).replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))).replace(`{${"sid"}}`, encodeURIComponent(String(requestParameters.sid))), + method: 'PUT', + headers: headerParameters, + query: queryParameters, + body: SpiderJobUpdateToJSON(requestParameters.data), + }); + + return new runtime.JSONApiResponse(response, (jsonValue) => SpiderJobUpdateFromJSON(jsonValue)); + } + + /** + */ + async apiProjectsSpidersJobsUpdate(requestParameters: ApiProjectsSpidersJobsUpdateRequest): Promise { + const response = await this.apiProjectsSpidersJobsUpdateRaw(requestParameters); + return await response.value(); + } + +} diff --git a/estela-web/src/services/api/generated-api/apis/SpidersApi.ts b/estela-web/src/services/api/generated-api/apis/SpidersApi.ts new file mode 100644 index 00000000..f2982589 --- /dev/null +++ b/estela-web/src/services/api/generated-api/apis/SpidersApi.ts @@ -0,0 +1,215 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * estela API v1.0 Documentation + * estela API Swagger Specification + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import * as runtime from '../runtime'; +import { + InlineResponse2003, + InlineResponse2003FromJSON, + InlineResponse2003ToJSON, + Spider, + SpiderFromJSON, + SpiderToJSON, + SpiderUpdate, + SpiderUpdateFromJSON, + SpiderUpdateToJSON, +} from '../models'; + +export interface ApiProjectsSpidersListRequest { + pid: string; + page?: number; + pageSize?: number; +} + +export interface ApiProjectsSpidersPartialUpdateRequest { + pid: string; + sid: number; + data: Spider; +} + +export interface ApiProjectsSpidersReadRequest { + pid: string; + sid: number; +} + +export interface ApiProjectsSpidersUpdateRequest { + pid: string; + sid: number; + data: SpiderUpdate; +} + +/** + * + */ +export class SpidersApi extends runtime.BaseAPI { + + /** + */ + async apiProjectsSpidersListRaw(requestParameters: ApiProjectsSpidersListRequest): Promise> { + if (requestParameters.pid === null || requestParameters.pid === undefined) { + throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsSpidersList.'); + } + + const queryParameters: any = {}; + + if (requestParameters.page !== undefined) { + queryParameters['page'] = requestParameters.page; + } + + if (requestParameters.pageSize !== undefined) { + queryParameters['page_size'] = requestParameters.pageSize; + } + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { + headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); + } + const response = await this.request({ + path: `/api/projects/{pid}/spiders`.replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))), + method: 'GET', + headers: headerParameters, + query: queryParameters, + }); + + return new runtime.JSONApiResponse(response, (jsonValue) => InlineResponse2003FromJSON(jsonValue)); + } + + /** + */ + async apiProjectsSpidersList(requestParameters: ApiProjectsSpidersListRequest): Promise { + const response = await this.apiProjectsSpidersListRaw(requestParameters); + return await response.value(); + } + + /** + */ + async apiProjectsSpidersPartialUpdateRaw(requestParameters: ApiProjectsSpidersPartialUpdateRequest): Promise> { + if (requestParameters.pid === null || requestParameters.pid === undefined) { + throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsSpidersPartialUpdate.'); + } + + if (requestParameters.sid === null || requestParameters.sid === undefined) { + throw new runtime.RequiredError('sid','Required parameter requestParameters.sid was null or undefined when calling apiProjectsSpidersPartialUpdate.'); + } + + if (requestParameters.data === null || requestParameters.data === undefined) { + throw new runtime.RequiredError('data','Required parameter requestParameters.data was null or undefined when calling apiProjectsSpidersPartialUpdate.'); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + headerParameters['Content-Type'] = 'application/json'; + + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { + headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); + } + const response = await this.request({ + path: `/api/projects/{pid}/spiders/{sid}`.replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))).replace(`{${"sid"}}`, encodeURIComponent(String(requestParameters.sid))), + method: 'PATCH', + headers: headerParameters, + query: queryParameters, + body: SpiderToJSON(requestParameters.data), + }); + + return new runtime.JSONApiResponse(response, (jsonValue) => SpiderFromJSON(jsonValue)); + } + + /** + */ + async apiProjectsSpidersPartialUpdate(requestParameters: ApiProjectsSpidersPartialUpdateRequest): Promise { + const response = await this.apiProjectsSpidersPartialUpdateRaw(requestParameters); + return await response.value(); + } + + /** + */ + async apiProjectsSpidersReadRaw(requestParameters: ApiProjectsSpidersReadRequest): Promise> { + if (requestParameters.pid === null || requestParameters.pid === undefined) { + throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsSpidersRead.'); + } + + if (requestParameters.sid === null || requestParameters.sid === undefined) { + throw new runtime.RequiredError('sid','Required parameter requestParameters.sid was null or undefined when calling apiProjectsSpidersRead.'); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { + headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); + } + const response = await this.request({ + path: `/api/projects/{pid}/spiders/{sid}`.replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))).replace(`{${"sid"}}`, encodeURIComponent(String(requestParameters.sid))), + method: 'GET', + headers: headerParameters, + query: queryParameters, + }); + + return new runtime.JSONApiResponse(response, (jsonValue) => SpiderFromJSON(jsonValue)); + } + + /** + */ + async apiProjectsSpidersRead(requestParameters: ApiProjectsSpidersReadRequest): Promise { + const response = await this.apiProjectsSpidersReadRaw(requestParameters); + return await response.value(); + } + + /** + */ + async apiProjectsSpidersUpdateRaw(requestParameters: ApiProjectsSpidersUpdateRequest): Promise> { + if (requestParameters.pid === null || requestParameters.pid === undefined) { + throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsSpidersUpdate.'); + } + + if (requestParameters.sid === null || requestParameters.sid === undefined) { + throw new runtime.RequiredError('sid','Required parameter requestParameters.sid was null or undefined when calling apiProjectsSpidersUpdate.'); + } + + if (requestParameters.data === null || requestParameters.data === undefined) { + throw new runtime.RequiredError('data','Required parameter requestParameters.data was null or undefined when calling apiProjectsSpidersUpdate.'); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + headerParameters['Content-Type'] = 'application/json'; + + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { + headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); + } + const response = await this.request({ + path: `/api/projects/{pid}/spiders/{sid}`.replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))).replace(`{${"sid"}}`, encodeURIComponent(String(requestParameters.sid))), + method: 'PUT', + headers: headerParameters, + query: queryParameters, + body: SpiderUpdateToJSON(requestParameters.data), + }); + + return new runtime.JSONApiResponse(response, (jsonValue) => SpiderUpdateFromJSON(jsonValue)); + } + + /** + */ + async apiProjectsSpidersUpdate(requestParameters: ApiProjectsSpidersUpdateRequest): Promise { + const response = await this.apiProjectsSpidersUpdateRaw(requestParameters); + return await response.value(); + } + +} diff --git a/estela-web/src/services/api/generated-api/apis/StatsApi.ts b/estela-web/src/services/api/generated-api/apis/StatsApi.ts new file mode 100644 index 00000000..f6cb9427 --- /dev/null +++ b/estela-web/src/services/api/generated-api/apis/StatsApi.ts @@ -0,0 +1,166 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * estela API v1.0 Documentation + * estela API Swagger Specification + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import * as runtime from '../runtime'; +import { + GlobalStats, + GlobalStatsFromJSON, + GlobalStatsToJSON, + SpidersJobsStats, + SpidersJobsStatsFromJSON, + SpidersJobsStatsToJSON, +} from '../models'; + +export interface ApiProjectsStatsListRequest { + pid: string; + startDate: string; + endDate: string; + page?: number; + pageSize?: number; +} + +export interface ApiProjectsStatsSpidersListRequest { + pid: string; + sid: string; + startDate: string; + endDate: string; + page?: number; + pageSize?: number; +} + +/** + * + */ +export class StatsApi extends runtime.BaseAPI { + + /** + * Retrieve stats of all jobs in a range of time, dates must have the format YYYY-mm-dd. + */ + async apiProjectsStatsListRaw(requestParameters: ApiProjectsStatsListRequest): Promise>> { + if (requestParameters.pid === null || requestParameters.pid === undefined) { + throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsStatsList.'); + } + + if (requestParameters.startDate === null || requestParameters.startDate === undefined) { + throw new runtime.RequiredError('startDate','Required parameter requestParameters.startDate was null or undefined when calling apiProjectsStatsList.'); + } + + if (requestParameters.endDate === null || requestParameters.endDate === undefined) { + throw new runtime.RequiredError('endDate','Required parameter requestParameters.endDate was null or undefined when calling apiProjectsStatsList.'); + } + + const queryParameters: any = {}; + + if (requestParameters.page !== undefined) { + queryParameters['page'] = requestParameters.page; + } + + if (requestParameters.pageSize !== undefined) { + queryParameters['page_size'] = requestParameters.pageSize; + } + + if (requestParameters.startDate !== undefined) { + queryParameters['start_date'] = requestParameters.startDate; + } + + if (requestParameters.endDate !== undefined) { + queryParameters['end_date'] = requestParameters.endDate; + } + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { + headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); + } + const response = await this.request({ + path: `/api/projects/{pid}/stats`.replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))), + method: 'GET', + headers: headerParameters, + query: queryParameters, + }); + + return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(GlobalStatsFromJSON)); + } + + /** + * Retrieve stats of all jobs in a range of time, dates must have the format YYYY-mm-dd. + */ + async apiProjectsStatsList(requestParameters: ApiProjectsStatsListRequest): Promise> { + const response = await this.apiProjectsStatsListRaw(requestParameters); + return await response.value(); + } + + /** + * Retrieve stats of all jobs of a spider in a range of time, dates must have the format YYYY-mm-dd. + */ + async apiProjectsStatsSpidersListRaw(requestParameters: ApiProjectsStatsSpidersListRequest): Promise>> { + if (requestParameters.pid === null || requestParameters.pid === undefined) { + throw new runtime.RequiredError('pid','Required parameter requestParameters.pid was null or undefined when calling apiProjectsStatsSpidersList.'); + } + + if (requestParameters.sid === null || requestParameters.sid === undefined) { + throw new runtime.RequiredError('sid','Required parameter requestParameters.sid was null or undefined when calling apiProjectsStatsSpidersList.'); + } + + if (requestParameters.startDate === null || requestParameters.startDate === undefined) { + throw new runtime.RequiredError('startDate','Required parameter requestParameters.startDate was null or undefined when calling apiProjectsStatsSpidersList.'); + } + + if (requestParameters.endDate === null || requestParameters.endDate === undefined) { + throw new runtime.RequiredError('endDate','Required parameter requestParameters.endDate was null or undefined when calling apiProjectsStatsSpidersList.'); + } + + const queryParameters: any = {}; + + if (requestParameters.page !== undefined) { + queryParameters['page'] = requestParameters.page; + } + + if (requestParameters.pageSize !== undefined) { + queryParameters['page_size'] = requestParameters.pageSize; + } + + if (requestParameters.startDate !== undefined) { + queryParameters['start_date'] = requestParameters.startDate; + } + + if (requestParameters.endDate !== undefined) { + queryParameters['end_date'] = requestParameters.endDate; + } + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { + headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); + } + const response = await this.request({ + path: `/api/projects/{pid}/stats/spiders/{sid}`.replace(`{${"pid"}}`, encodeURIComponent(String(requestParameters.pid))).replace(`{${"sid"}}`, encodeURIComponent(String(requestParameters.sid))), + method: 'GET', + headers: headerParameters, + query: queryParameters, + }); + + return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(SpidersJobsStatsFromJSON)); + } + + /** + * Retrieve stats of all jobs of a spider in a range of time, dates must have the format YYYY-mm-dd. + */ + async apiProjectsStatsSpidersList(requestParameters: ApiProjectsStatsSpidersListRequest): Promise> { + const response = await this.apiProjectsStatsSpidersListRaw(requestParameters); + return await response.value(); + } + +} diff --git a/estela-web/src/services/api/generated-api/apis/index.ts b/estela-web/src/services/api/generated-api/apis/index.ts index ebde4695..d1b42c3e 100644 --- a/estela-web/src/services/api/generated-api/apis/index.ts +++ b/estela-web/src/services/api/generated-api/apis/index.ts @@ -1 +1,7 @@ -export * from './ApiApi'; +export * from './AuthApi'; +export * from './DeploysApi'; +export * from './ProjectsApi'; +export * from './SpiderCronjobsApi'; +export * from './SpiderJobsApi'; +export * from './SpidersApi'; +export * from './StatsApi';