hatchet-sdk 0.0.1 โ 0.1.0.pre.alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -2
- data/CLAUDE.md +20 -0
- data/INTEGRATION_TESTING.md +176 -0
- data/LICENSE.txt +1 -1
- data/REST_API_GENERATION.md +257 -0
- data/Rakefile +9 -0
- data/Rakefile.rest +133 -0
- data/config/openapi_generator_config.json +31 -0
- data/lib/hatchet/clients/rest/.gitignore +39 -0
- data/lib/hatchet/clients/rest/.gitlab-ci.yml +26 -0
- data/lib/hatchet/clients/rest/.openapi-generator/FILES +420 -0
- data/lib/hatchet/clients/rest/.openapi-generator/VERSION +1 -0
- data/lib/hatchet/clients/rest/.openapi-generator-ignore +23 -0
- data/lib/hatchet/clients/rest/.rspec +2 -0
- data/lib/hatchet/clients/rest/.rubocop.yml +148 -0
- data/lib/hatchet/clients/rest/.travis.yml +11 -0
- data/lib/hatchet/clients/rest/Gemfile +9 -0
- data/lib/hatchet/clients/rest/README.md +420 -0
- data/lib/hatchet/clients/rest/Rakefile +10 -0
- data/lib/hatchet/clients/rest/docs/APIError.md +24 -0
- data/lib/hatchet/clients/rest/docs/APIErrors.md +18 -0
- data/lib/hatchet/clients/rest/docs/APIMeta.md +30 -0
- data/lib/hatchet/clients/rest/docs/APIMetaAuth.md +18 -0
- data/lib/hatchet/clients/rest/docs/APIMetaIntegration.md +20 -0
- data/lib/hatchet/clients/rest/docs/APIMetaPosthog.md +20 -0
- data/lib/hatchet/clients/rest/docs/APIResourceMeta.md +22 -0
- data/lib/hatchet/clients/rest/docs/APIToken.md +22 -0
- data/lib/hatchet/clients/rest/docs/APITokenApi.md +235 -0
- data/lib/hatchet/clients/rest/docs/AcceptInviteRequest.md +18 -0
- data/lib/hatchet/clients/rest/docs/BulkCreateEventRequest.md +18 -0
- data/lib/hatchet/clients/rest/docs/CancelEventRequest.md +18 -0
- data/lib/hatchet/clients/rest/docs/ConcurrencyLimitStrategy.md +15 -0
- data/lib/hatchet/clients/rest/docs/CreateAPITokenRequest.md +20 -0
- data/lib/hatchet/clients/rest/docs/CreateAPITokenResponse.md +18 -0
- data/lib/hatchet/clients/rest/docs/CreateCronWorkflowTriggerRequest.md +26 -0
- data/lib/hatchet/clients/rest/docs/CreateEventRequest.md +26 -0
- data/lib/hatchet/clients/rest/docs/CreatePullRequestFromStepRun.md +18 -0
- data/lib/hatchet/clients/rest/docs/CreateSNSIntegrationRequest.md +18 -0
- data/lib/hatchet/clients/rest/docs/CreateTenantAlertEmailGroupRequest.md +18 -0
- data/lib/hatchet/clients/rest/docs/CreateTenantInviteRequest.md +20 -0
- data/lib/hatchet/clients/rest/docs/CreateTenantRequest.md +24 -0
- data/lib/hatchet/clients/rest/docs/CronWorkflows.md +40 -0
- data/lib/hatchet/clients/rest/docs/CronWorkflowsList.md +20 -0
- data/lib/hatchet/clients/rest/docs/CronWorkflowsMethod.md +15 -0
- data/lib/hatchet/clients/rest/docs/CronWorkflowsOrderByField.md +15 -0
- data/lib/hatchet/clients/rest/docs/DefaultApi.md +602 -0
- data/lib/hatchet/clients/rest/docs/Event.md +28 -0
- data/lib/hatchet/clients/rest/docs/EventApi.md +809 -0
- data/lib/hatchet/clients/rest/docs/EventData.md +18 -0
- data/lib/hatchet/clients/rest/docs/EventKeyList.md +20 -0
- data/lib/hatchet/clients/rest/docs/EventList.md +20 -0
- data/lib/hatchet/clients/rest/docs/EventOrderByDirection.md +15 -0
- data/lib/hatchet/clients/rest/docs/EventOrderByField.md +15 -0
- data/lib/hatchet/clients/rest/docs/EventUpdateCancel200Response.md +18 -0
- data/lib/hatchet/clients/rest/docs/EventWorkflowRunSummary.md +28 -0
- data/lib/hatchet/clients/rest/docs/Events.md +20 -0
- data/lib/hatchet/clients/rest/docs/FilterApi.md +402 -0
- data/lib/hatchet/clients/rest/docs/GetStepRunDiffResponse.md +18 -0
- data/lib/hatchet/clients/rest/docs/GithubApi.md +73 -0
- data/lib/hatchet/clients/rest/docs/HealthcheckApi.md +129 -0
- data/lib/hatchet/clients/rest/docs/InfoGetVersion200Response.md +18 -0
- data/lib/hatchet/clients/rest/docs/Job.md +30 -0
- data/lib/hatchet/clients/rest/docs/JobRun.md +48 -0
- data/lib/hatchet/clients/rest/docs/JobRunStatus.md +15 -0
- data/lib/hatchet/clients/rest/docs/ListAPITokensResponse.md +20 -0
- data/lib/hatchet/clients/rest/docs/ListPullRequestsResponse.md +18 -0
- data/lib/hatchet/clients/rest/docs/ListSNSIntegrations.md +20 -0
- data/lib/hatchet/clients/rest/docs/ListSlackWebhooks.md +20 -0
- data/lib/hatchet/clients/rest/docs/LogApi.md +171 -0
- data/lib/hatchet/clients/rest/docs/LogLine.md +22 -0
- data/lib/hatchet/clients/rest/docs/LogLineLevel.md +15 -0
- data/lib/hatchet/clients/rest/docs/LogLineList.md +20 -0
- data/lib/hatchet/clients/rest/docs/LogLineOrderByDirection.md +15 -0
- data/lib/hatchet/clients/rest/docs/LogLineOrderByField.md +15 -0
- data/lib/hatchet/clients/rest/docs/MetadataApi.md +203 -0
- data/lib/hatchet/clients/rest/docs/PaginationResponse.md +22 -0
- data/lib/hatchet/clients/rest/docs/PullRequest.md +32 -0
- data/lib/hatchet/clients/rest/docs/PullRequestState.md +15 -0
- data/lib/hatchet/clients/rest/docs/QueueMetrics.md +22 -0
- data/lib/hatchet/clients/rest/docs/RateLimit.md +28 -0
- data/lib/hatchet/clients/rest/docs/RateLimitList.md +20 -0
- data/lib/hatchet/clients/rest/docs/RateLimitOrderByDirection.md +15 -0
- data/lib/hatchet/clients/rest/docs/RateLimitOrderByField.md +15 -0
- data/lib/hatchet/clients/rest/docs/RateLimitsApi.md +94 -0
- data/lib/hatchet/clients/rest/docs/RecentStepRuns.md +30 -0
- data/lib/hatchet/clients/rest/docs/RejectInviteRequest.md +18 -0
- data/lib/hatchet/clients/rest/docs/ReplayEventRequest.md +18 -0
- data/lib/hatchet/clients/rest/docs/ReplayWorkflowRunsRequest.md +18 -0
- data/lib/hatchet/clients/rest/docs/ReplayWorkflowRunsResponse.md +18 -0
- data/lib/hatchet/clients/rest/docs/RerunStepRunRequest.md +18 -0
- data/lib/hatchet/clients/rest/docs/SNSApi.md +235 -0
- data/lib/hatchet/clients/rest/docs/SNSIntegration.md +24 -0
- data/lib/hatchet/clients/rest/docs/ScheduleWorkflowRunRequest.md +24 -0
- data/lib/hatchet/clients/rest/docs/ScheduledRunStatus.md +15 -0
- data/lib/hatchet/clients/rest/docs/ScheduledWorkflows.md +44 -0
- data/lib/hatchet/clients/rest/docs/ScheduledWorkflowsList.md +20 -0
- data/lib/hatchet/clients/rest/docs/ScheduledWorkflowsMethod.md +15 -0
- data/lib/hatchet/clients/rest/docs/ScheduledWorkflowsOrderByField.md +15 -0
- data/lib/hatchet/clients/rest/docs/SemaphoreSlots.md +28 -0
- data/lib/hatchet/clients/rest/docs/SlackApi.md +156 -0
- data/lib/hatchet/clients/rest/docs/SlackWebhook.md +28 -0
- data/lib/hatchet/clients/rest/docs/Step.md +32 -0
- data/lib/hatchet/clients/rest/docs/StepRun.md +68 -0
- data/lib/hatchet/clients/rest/docs/StepRunApi.md +560 -0
- data/lib/hatchet/clients/rest/docs/StepRunArchive.md +50 -0
- data/lib/hatchet/clients/rest/docs/StepRunArchiveList.md +20 -0
- data/lib/hatchet/clients/rest/docs/StepRunDiff.md +22 -0
- data/lib/hatchet/clients/rest/docs/StepRunEvent.md +36 -0
- data/lib/hatchet/clients/rest/docs/StepRunEventList.md +20 -0
- data/lib/hatchet/clients/rest/docs/StepRunEventReason.md +15 -0
- data/lib/hatchet/clients/rest/docs/StepRunEventSeverity.md +15 -0
- data/lib/hatchet/clients/rest/docs/StepRunStatus.md +15 -0
- data/lib/hatchet/clients/rest/docs/TaskApi.md +566 -0
- data/lib/hatchet/clients/rest/docs/Tenant.md +30 -0
- data/lib/hatchet/clients/rest/docs/TenantAlertEmailGroup.md +20 -0
- data/lib/hatchet/clients/rest/docs/TenantAlertEmailGroupList.md +20 -0
- data/lib/hatchet/clients/rest/docs/TenantAlertingSettings.md +30 -0
- data/lib/hatchet/clients/rest/docs/TenantApi.md +1362 -0
- data/lib/hatchet/clients/rest/docs/TenantInvite.md +28 -0
- data/lib/hatchet/clients/rest/docs/TenantInviteList.md +20 -0
- data/lib/hatchet/clients/rest/docs/TenantList.md +20 -0
- data/lib/hatchet/clients/rest/docs/TenantMember.md +24 -0
- data/lib/hatchet/clients/rest/docs/TenantMemberList.md +20 -0
- data/lib/hatchet/clients/rest/docs/TenantMemberRole.md +15 -0
- data/lib/hatchet/clients/rest/docs/TenantQueueMetrics.md +22 -0
- data/lib/hatchet/clients/rest/docs/TenantResource.md +15 -0
- data/lib/hatchet/clients/rest/docs/TenantResourceLimit.md +30 -0
- data/lib/hatchet/clients/rest/docs/TenantResourcePolicy.md +18 -0
- data/lib/hatchet/clients/rest/docs/TenantStepRunQueueMetrics.md +18 -0
- data/lib/hatchet/clients/rest/docs/TenantUIVersion.md +15 -0
- data/lib/hatchet/clients/rest/docs/TenantVersion.md +15 -0
- data/lib/hatchet/clients/rest/docs/TriggerWorkflowRunRequest.md +20 -0
- data/lib/hatchet/clients/rest/docs/UpdateTenantAlertEmailGroupRequest.md +18 -0
- data/lib/hatchet/clients/rest/docs/UpdateTenantInviteRequest.md +18 -0
- data/lib/hatchet/clients/rest/docs/UpdateTenantRequest.md +34 -0
- data/lib/hatchet/clients/rest/docs/UpdateWorkerRequest.md +18 -0
- data/lib/hatchet/clients/rest/docs/User.md +28 -0
- data/lib/hatchet/clients/rest/docs/UserApi.md +805 -0
- data/lib/hatchet/clients/rest/docs/UserChangePasswordRequest.md +20 -0
- data/lib/hatchet/clients/rest/docs/UserLoginRequest.md +20 -0
- data/lib/hatchet/clients/rest/docs/UserRegisterRequest.md +22 -0
- data/lib/hatchet/clients/rest/docs/UserTenantMembershipsList.md +20 -0
- data/lib/hatchet/clients/rest/docs/UserTenantPublic.md +20 -0
- data/lib/hatchet/clients/rest/docs/V1CancelTaskRequest.md +20 -0
- data/lib/hatchet/clients/rest/docs/V1CancelledTasks.md +18 -0
- data/lib/hatchet/clients/rest/docs/V1CreateFilterRequest.md +24 -0
- data/lib/hatchet/clients/rest/docs/V1DagChildren.md +20 -0
- data/lib/hatchet/clients/rest/docs/V1Event.md +36 -0
- data/lib/hatchet/clients/rest/docs/V1EventList.md +20 -0
- data/lib/hatchet/clients/rest/docs/V1EventTriggeredRun.md +20 -0
- data/lib/hatchet/clients/rest/docs/V1EventWorkflowRunSummary.md +26 -0
- data/lib/hatchet/clients/rest/docs/V1Filter.md +28 -0
- data/lib/hatchet/clients/rest/docs/V1FilterList.md +20 -0
- data/lib/hatchet/clients/rest/docs/V1LogLine.md +28 -0
- data/lib/hatchet/clients/rest/docs/V1LogLineLevel.md +15 -0
- data/lib/hatchet/clients/rest/docs/V1LogLineList.md +20 -0
- data/lib/hatchet/clients/rest/docs/V1ReplayTaskRequest.md +20 -0
- data/lib/hatchet/clients/rest/docs/V1ReplayedTasks.md +18 -0
- data/lib/hatchet/clients/rest/docs/V1TaskEvent.md +38 -0
- data/lib/hatchet/clients/rest/docs/V1TaskEventList.md +20 -0
- data/lib/hatchet/clients/rest/docs/V1TaskEventType.md +15 -0
- data/lib/hatchet/clients/rest/docs/V1TaskFilter.md +26 -0
- data/lib/hatchet/clients/rest/docs/V1TaskPointMetric.md +22 -0
- data/lib/hatchet/clients/rest/docs/V1TaskPointMetrics.md +18 -0
- data/lib/hatchet/clients/rest/docs/V1TaskRunMetric.md +20 -0
- data/lib/hatchet/clients/rest/docs/V1TaskRunStatus.md +15 -0
- data/lib/hatchet/clients/rest/docs/V1TaskStatus.md +15 -0
- data/lib/hatchet/clients/rest/docs/V1TaskSummary.md +72 -0
- data/lib/hatchet/clients/rest/docs/V1TaskSummaryList.md +20 -0
- data/lib/hatchet/clients/rest/docs/V1TaskTiming.md +46 -0
- data/lib/hatchet/clients/rest/docs/V1TaskTimingList.md +20 -0
- data/lib/hatchet/clients/rest/docs/V1TriggerWorkflowRunRequest.md +24 -0
- data/lib/hatchet/clients/rest/docs/V1UpdateFilterRequest.md +22 -0
- data/lib/hatchet/clients/rest/docs/V1WorkflowRun.md +46 -0
- data/lib/hatchet/clients/rest/docs/V1WorkflowRunDetails.md +26 -0
- data/lib/hatchet/clients/rest/docs/V1WorkflowRunDisplayName.md +20 -0
- data/lib/hatchet/clients/rest/docs/V1WorkflowRunDisplayNameList.md +20 -0
- data/lib/hatchet/clients/rest/docs/V1WorkflowType.md +15 -0
- data/lib/hatchet/clients/rest/docs/WebhookWorker.md +22 -0
- data/lib/hatchet/clients/rest/docs/WebhookWorkerCreateRequest.md +22 -0
- data/lib/hatchet/clients/rest/docs/WebhookWorkerCreateResponse.md +18 -0
- data/lib/hatchet/clients/rest/docs/WebhookWorkerCreated.md +24 -0
- data/lib/hatchet/clients/rest/docs/WebhookWorkerListResponse.md +20 -0
- data/lib/hatchet/clients/rest/docs/WebhookWorkerRequest.md +22 -0
- data/lib/hatchet/clients/rest/docs/WebhookWorkerRequestListResponse.md +18 -0
- data/lib/hatchet/clients/rest/docs/WebhookWorkerRequestMethod.md +15 -0
- data/lib/hatchet/clients/rest/docs/Worker.md +48 -0
- data/lib/hatchet/clients/rest/docs/WorkerApi.md +234 -0
- data/lib/hatchet/clients/rest/docs/WorkerLabel.md +22 -0
- data/lib/hatchet/clients/rest/docs/WorkerList.md +20 -0
- data/lib/hatchet/clients/rest/docs/WorkerRuntimeInfo.md +26 -0
- data/lib/hatchet/clients/rest/docs/WorkerRuntimeSDKs.md +15 -0
- data/lib/hatchet/clients/rest/docs/WorkerType.md +15 -0
- data/lib/hatchet/clients/rest/docs/Workflow.md +32 -0
- data/lib/hatchet/clients/rest/docs/WorkflowApi.md +1480 -0
- data/lib/hatchet/clients/rest/docs/WorkflowConcurrency.md +22 -0
- data/lib/hatchet/clients/rest/docs/WorkflowKind.md +15 -0
- data/lib/hatchet/clients/rest/docs/WorkflowList.md +22 -0
- data/lib/hatchet/clients/rest/docs/WorkflowMetrics.md +20 -0
- data/lib/hatchet/clients/rest/docs/WorkflowRun.md +48 -0
- data/lib/hatchet/clients/rest/docs/WorkflowRunApi.md +477 -0
- data/lib/hatchet/clients/rest/docs/WorkflowRunList.md +20 -0
- data/lib/hatchet/clients/rest/docs/WorkflowRunOrderByDirection.md +15 -0
- data/lib/hatchet/clients/rest/docs/WorkflowRunOrderByField.md +15 -0
- data/lib/hatchet/clients/rest/docs/WorkflowRunShape.md +50 -0
- data/lib/hatchet/clients/rest/docs/WorkflowRunShapeItemForWorkflowRunDetails.md +24 -0
- data/lib/hatchet/clients/rest/docs/WorkflowRunStatus.md +15 -0
- data/lib/hatchet/clients/rest/docs/WorkflowRunTriggeredBy.md +26 -0
- data/lib/hatchet/clients/rest/docs/WorkflowRunsApi.md +572 -0
- data/lib/hatchet/clients/rest/docs/WorkflowRunsCancelRequest.md +18 -0
- data/lib/hatchet/clients/rest/docs/WorkflowRunsMetrics.md +18 -0
- data/lib/hatchet/clients/rest/docs/WorkflowRunsMetricsCounts.md +28 -0
- data/lib/hatchet/clients/rest/docs/WorkflowTag.md +20 -0
- data/lib/hatchet/clients/rest/docs/WorkflowTriggerCronRef.md +20 -0
- data/lib/hatchet/clients/rest/docs/WorkflowTriggerEventRef.md +20 -0
- data/lib/hatchet/clients/rest/docs/WorkflowTriggers.md +26 -0
- data/lib/hatchet/clients/rest/docs/WorkflowUpdateRequest.md +18 -0
- data/lib/hatchet/clients/rest/docs/WorkflowVersion.md +40 -0
- data/lib/hatchet/clients/rest/docs/WorkflowVersionDefinition.md +18 -0
- data/lib/hatchet/clients/rest/docs/WorkflowVersionMeta.md +26 -0
- data/lib/hatchet/clients/rest/docs/WorkflowWorkersCount.md +22 -0
- data/lib/hatchet/clients/rest/git_push.sh +57 -0
- data/lib/hatchet/clients/rest/hatchet-sdk-rest.gemspec +41 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/api_token_api.rb +242 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/default_api.rb +622 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/event_api.rb +836 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/filter_api.rb +449 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/github_api.rb +107 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/healthcheck_api.rb +132 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/log_api.rb +182 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/metadata_api.rb +193 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/rate_limits_api.rb +108 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/slack_api.rb +164 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/sns_api.rb +242 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/step_run_api.rb +615 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/task_api.rb +599 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/tenant_api.rb +1327 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/user_api.rb +729 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/worker_api.rb +246 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/workflow_api.rb +1654 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/workflow_run_api.rb +540 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api/workflow_runs_api.rb +614 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api_client.rb +437 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/api_error.rb +58 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/configuration.rb +399 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/accept_invite_request.rb +255 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/api_error.rb +268 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/api_errors.rb +239 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/api_meta.rb +279 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/api_meta_auth.rb +223 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/api_meta_integration.rb +265 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/api_meta_posthog.rb +231 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/api_resource_meta.rb +310 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/api_token.rb +300 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/bulk_create_event_request.rb +239 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/cancel_event_request.rb +239 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/concurrency_limit_strategy.rb +42 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/create_api_token_request.rb +257 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/create_api_token_response.rb +238 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/create_cron_workflow_trigger_request.rb +352 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/create_event_request.rb +295 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/create_pull_request_from_step_run.rb +237 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/create_sns_integration_request.rb +238 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/create_tenant_alert_email_group_request.rb +240 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/create_tenant_invite_request.rb +287 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/create_tenant_request.rb +307 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/cron_workflows.rb +509 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/cron_workflows_list.rb +231 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/cron_workflows_method.rb +40 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/cron_workflows_order_by_field.rb +40 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/event.rb +321 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/event_data.rb +238 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/event_key_list.rb +231 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/event_list.rb +231 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/event_order_by_direction.rb +40 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/event_order_by_field.rb +39 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/event_update_cancel200_response.rb +222 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/event_workflow_run_summary.rb +271 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/events.rb +266 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/get_step_run_diff_response.rb +239 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/info_get_version200_response.rb +237 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/job.rb +363 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/job_run.rb +464 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/job_run_status.rb +44 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/list_api_tokens_response.rb +231 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/list_pull_requests_response.rb +239 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/list_slack_webhooks.rb +265 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/list_sns_integrations.rb +265 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/log_line.rb +292 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/log_line_level.rb +42 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/log_line_list.rb +231 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/log_line_order_by_direction.rb +40 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/log_line_order_by_field.rb +39 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/pagination_response.rb +241 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/pull_request.rb +441 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/pull_request_state.rb +40 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/queue_metrics.rb +292 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/rate_limit.rb +373 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/rate_limit_list.rb +231 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/rate_limit_order_by_direction.rb +40 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/rate_limit_order_by_field.rb +41 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/recent_step_runs.rb +365 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/reject_invite_request.rb +255 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/replay_event_request.rb +239 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/replay_workflow_runs_request.rb +239 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/replay_workflow_runs_response.rb +239 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/rerun_step_run_request.rb +237 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/schedule_workflow_run_request.rb +326 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/scheduled_run_status.rb +45 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/scheduled_workflows.rb +538 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/scheduled_workflows_list.rb +231 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/scheduled_workflows_method.rb +40 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/scheduled_workflows_order_by_field.rb +40 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/semaphore_slots.rb +343 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/slack_webhook.rb +372 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/sns_integration.rb +301 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/step.rb +374 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/step_run.rb +556 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/step_run_archive.rb +432 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/step_run_archive_list.rb +231 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/step_run_diff.rb +289 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/step_run_event.rb +442 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/step_run_event_list.rb +231 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/step_run_event_reason.rb +55 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/step_run_event_severity.rb +41 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/step_run_status.rb +47 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/tenant.rb +370 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/tenant_alert_email_group.rb +266 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/tenant_alert_email_group_list.rb +231 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/tenant_alerting_settings.rb +314 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/tenant_invite.rb +377 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/tenant_invite_list.rb +231 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/tenant_list.rb +231 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/tenant_member.rb +323 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/tenant_member_list.rb +231 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/tenant_member_role.rb +41 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/tenant_queue_metrics.rb +243 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/tenant_resource.rb +45 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/tenant_resource_limit.rb +370 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/tenant_resource_policy.rb +240 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/tenant_step_run_queue_metrics.rb +220 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/tenant_ui_version.rb +40 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/tenant_version.rb +40 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/trigger_workflow_run_request.rb +246 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/update_tenant_alert_email_group_request.rb +240 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/update_tenant_invite_request.rb +260 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/update_tenant_request.rb +323 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/update_worker_request.rb +221 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/user.rb +321 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/user_change_password_request.rb +265 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/user_login_request.rb +265 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/user_register_request.rb +292 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/user_tenant_memberships_list.rb +231 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/user_tenant_public.rb +248 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_cancel_task_request.rb +232 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_cancelled_tasks.rb +223 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_create_filter_request.rb +320 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_dag_children.rb +231 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_event.rb +380 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_event_list.rb +231 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_event_triggered_run.rb +266 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_event_workflow_run_summary.rb +346 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_filter.rb +390 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_filter_list.rb +231 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_log_line.rb +344 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_log_line_level.rb +42 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_log_line_list.rb +231 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_replay_task_request.rb +232 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_replayed_tasks.rb +223 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_task_event.rb +419 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_task_event_list.rb +231 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_task_event_type.rb +58 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_task_filter.rb +279 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_task_point_metric.rb +289 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_task_point_metrics.rb +222 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_task_run_metric.rb +285 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_task_run_status.rb +43 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_task_status.rb +43 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_task_summary.rb +812 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_task_summary_list.rb +266 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_task_timing.rb +581 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_task_timing_list.rb +266 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_trigger_workflow_run_request.rb +283 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_update_filter_request.rb +241 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_workflow_run.rb +544 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_workflow_run_details.rb +331 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_workflow_run_display_name.rb +263 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_workflow_run_display_name_list.rb +266 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/v1_workflow_type.rb +40 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/webhook_worker.rb +291 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/webhook_worker_create_request.rb +294 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/webhook_worker_create_response.rb +220 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/webhook_worker_created.rb +318 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/webhook_worker_list_response.rb +231 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/webhook_worker_request.rb +314 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/webhook_worker_request_list_response.rb +223 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/webhook_worker_request_method.rb +41 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/worker.rb +489 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/worker_label.rb +274 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/worker_list.rb +231 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/worker_runtime_info.rb +278 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/worker_runtime_sdks.rb +41 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/worker_type.rb +41 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/workflow.rb +346 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/workflow_concurrency.rb +314 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/workflow_kind.rb +41 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/workflow_list.rb +240 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/workflow_metrics.rb +231 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/workflow_run.rb +524 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/workflow_run_list.rb +231 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/workflow_run_order_by_direction.rb +40 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/workflow_run_order_by_field.rb +42 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/workflow_run_shape.rb +533 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/workflow_run_shape_item_for_workflow_run_details.rb +353 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/workflow_run_status.rb +45 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/workflow_run_triggered_by.rb +273 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/workflow_runs_cancel_request.rb +239 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/workflow_runs_metrics.rb +220 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/workflow_runs_metrics_counts.rb +265 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/workflow_tag.rb +265 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/workflow_trigger_cron_ref.rb +229 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/workflow_trigger_event_ref.rb +229 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/workflow_triggers.rb +260 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/workflow_update_request.rb +221 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/workflow_version.rb +392 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/workflow_version_definition.rb +238 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/workflow_version_meta.rb +325 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/models/workflow_workers_count.rb +238 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest/version.rb +15 -0
- data/lib/hatchet/clients/rest/lib/hatchet-sdk-rest.rb +241 -0
- data/lib/hatchet/clients/rest/spec/spec_helper.rb +111 -0
- data/lib/hatchet/clients/rest.rb +126 -0
- data/lib/hatchet/clients.rb +71 -0
- data/lib/hatchet/config.rb +7 -7
- data/lib/hatchet/features/events.rb +265 -0
- data/lib/hatchet/features/runs.rb +423 -0
- data/lib/hatchet/version.rb +1 -1
- data/lib/hatchet-sdk.rb +21 -0
- data/scripts/generate.sh +167 -0
- data/scripts/generate_api.rb +174 -0
- data/sig/hatchet-sdk.rbs +425 -3
- metadata +490 -1
|
@@ -0,0 +1,423 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'time'
|
|
4
|
+
require 'timeout'
|
|
5
|
+
|
|
6
|
+
module Hatchet
|
|
7
|
+
module Features
|
|
8
|
+
# Filter options for listing task runs
|
|
9
|
+
class RunFilter
|
|
10
|
+
attr_accessor :since, :until_time, :statuses, :workflow_ids, :additional_metadata
|
|
11
|
+
|
|
12
|
+
def initialize(since:, until_time: nil, statuses: nil, workflow_ids: nil, additional_metadata: nil)
|
|
13
|
+
@since = since
|
|
14
|
+
@until_time = until_time
|
|
15
|
+
@statuses = statuses
|
|
16
|
+
@workflow_ids = workflow_ids
|
|
17
|
+
@additional_metadata = additional_metadata
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# Options for bulk cancel and replay operations
|
|
22
|
+
class BulkCancelReplayOpts
|
|
23
|
+
attr_accessor :ids, :filters
|
|
24
|
+
|
|
25
|
+
def initialize(ids: nil, filters: nil)
|
|
26
|
+
raise ArgumentError, "ids or filters must be set" if !ids && !filters
|
|
27
|
+
raise ArgumentError, "ids and filters cannot both be set" if ids && filters
|
|
28
|
+
|
|
29
|
+
@ids = ids
|
|
30
|
+
@filters = filters
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def v1_task_filter
|
|
34
|
+
return nil unless @filters
|
|
35
|
+
|
|
36
|
+
HatchetSdkRest::V1TaskFilter.new(
|
|
37
|
+
since: @filters.since,
|
|
38
|
+
until: @filters.until_time,
|
|
39
|
+
statuses: @filters.statuses,
|
|
40
|
+
workflow_ids: @filters.workflow_ids,
|
|
41
|
+
additional_metadata: maybe_additional_metadata_to_kv(@filters.additional_metadata)
|
|
42
|
+
)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def to_cancel_request
|
|
46
|
+
HatchetSdkRest::V1CancelTaskRequest.new(
|
|
47
|
+
external_ids: @ids,
|
|
48
|
+
filter: v1_task_filter
|
|
49
|
+
)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def to_replay_request
|
|
53
|
+
HatchetSdkRest::V1ReplayTaskRequest.new(
|
|
54
|
+
external_ids: @ids,
|
|
55
|
+
filter: v1_task_filter
|
|
56
|
+
)
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
private
|
|
60
|
+
|
|
61
|
+
def maybe_additional_metadata_to_kv(metadata)
|
|
62
|
+
return nil unless metadata
|
|
63
|
+
metadata.map { |k, v| { key: k.to_s, value: v.to_s } }
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# Runs client for interacting with Hatchet workflow run management API
|
|
68
|
+
#
|
|
69
|
+
# This class provides a high-level interface for creating and managing workflow runs
|
|
70
|
+
# in the Hatchet system. It wraps the generated REST API client with a more
|
|
71
|
+
# convenient Ruby interface.
|
|
72
|
+
#
|
|
73
|
+
# @example Creating a workflow run
|
|
74
|
+
# runs = Features::Runs.new(rest_client, config)
|
|
75
|
+
# response = runs.create(
|
|
76
|
+
# name: "my-workflow",
|
|
77
|
+
# input: { key: "value" },
|
|
78
|
+
# additional_metadata: { source: "api" }
|
|
79
|
+
# )
|
|
80
|
+
#
|
|
81
|
+
# @since 0.1.0
|
|
82
|
+
class Runs
|
|
83
|
+
# Re-export commonly used workflow run classes for convenience
|
|
84
|
+
TriggerWorkflowRunRequest = ::HatchetSdkRest::V1TriggerWorkflowRunRequest
|
|
85
|
+
WorkflowRunDetails = ::HatchetSdkRest::V1WorkflowRunDetails
|
|
86
|
+
TaskSummary = ::HatchetSdkRest::V1TaskSummary
|
|
87
|
+
TaskSummaryList = ::HatchetSdkRest::V1TaskSummaryList
|
|
88
|
+
TaskStatus = ::HatchetSdkRest::V1TaskStatus
|
|
89
|
+
|
|
90
|
+
DEFAULT_SINCE_DAYS = 1
|
|
91
|
+
LARGE_DATE_RANGE_WARNING_DAYS = 7
|
|
92
|
+
|
|
93
|
+
# Initializes a new Runs client instance
|
|
94
|
+
#
|
|
95
|
+
# @param rest_client [Object] The configured REST client for API communication
|
|
96
|
+
# @param config [Hatchet::Config] The Hatchet configuration containing tenant_id and other settings
|
|
97
|
+
# @return [void]
|
|
98
|
+
# @since 0.1.0
|
|
99
|
+
def initialize(rest_client, config)
|
|
100
|
+
@rest_client = rest_client
|
|
101
|
+
@config = config
|
|
102
|
+
@workflow_runs_api = HatchetSdkRest::WorkflowRunsApi.new(rest_client)
|
|
103
|
+
@task_api = HatchetSdkRest::TaskApi.new(rest_client)
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
# Get task run details for a given task run ID
|
|
107
|
+
#
|
|
108
|
+
# @param task_run_id [String] The ID of the task run to retrieve details for
|
|
109
|
+
# @return [HatchetSdkRest::V1TaskSummary] Task run details for the specified task run ID
|
|
110
|
+
# @raise [Hatchet::Error] If the API request fails or returns an error
|
|
111
|
+
def get_task_run(task_run_id)
|
|
112
|
+
@task_api.v1_task_get(task_run_id)
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
# Get workflow run details for a given workflow run ID
|
|
116
|
+
#
|
|
117
|
+
# @param workflow_run_id [String] The ID of the workflow run to retrieve details for
|
|
118
|
+
# @return [HatchetSdkRest::V1WorkflowRunDetails] Workflow run details for the specified workflow run ID
|
|
119
|
+
# @raise [Hatchet::Error] If the API request fails or returns an error
|
|
120
|
+
def get(workflow_run_id)
|
|
121
|
+
@workflow_runs_api.v1_workflow_run_get(workflow_run_id.to_s)
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
# Get workflow run status for a given workflow run ID
|
|
125
|
+
#
|
|
126
|
+
# @param workflow_run_id [String] The ID of the workflow run to retrieve status for
|
|
127
|
+
# @return [HatchetSdkRest::V1TaskStatus] The task status
|
|
128
|
+
# @raise [Hatchet::Error] If the API request fails or returns an error
|
|
129
|
+
def get_status(workflow_run_id)
|
|
130
|
+
@workflow_runs_api.v1_workflow_run_get_status(workflow_run_id)
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
# List task runs according to a set of filters, paginating through days
|
|
134
|
+
#
|
|
135
|
+
# @param since [Time, nil] The start time for filtering task runs
|
|
136
|
+
# @param only_tasks [Boolean] Whether to only list task runs
|
|
137
|
+
# @param offset [Integer, nil] The offset for pagination
|
|
138
|
+
# @param limit [Integer, nil] The maximum number of task runs to return
|
|
139
|
+
# @param statuses [Array<HatchetSdkRest::V1TaskStatus>, nil] The statuses to filter task runs by
|
|
140
|
+
# @param until_time [Time, nil] The end time for filtering task runs
|
|
141
|
+
# @param additional_metadata [Hash<String, String>, nil] Additional metadata to filter task runs by
|
|
142
|
+
# @param workflow_ids [Array<String>, nil] The workflow IDs to filter task runs by
|
|
143
|
+
# @param worker_id [String, nil] The worker ID to filter task runs by
|
|
144
|
+
# @param parent_task_external_id [String, nil] The parent task external ID to filter task runs by
|
|
145
|
+
# @param triggering_event_external_id [String, nil] The event id that triggered the task run
|
|
146
|
+
# @return [Array<HatchetSdkRest::V1TaskSummary>] A list of task runs matching the specified filters
|
|
147
|
+
# @raise [Hatchet::Error] If the API request fails or returns an error
|
|
148
|
+
def list_with_pagination(
|
|
149
|
+
since: nil,
|
|
150
|
+
only_tasks: false,
|
|
151
|
+
offset: nil,
|
|
152
|
+
limit: nil,
|
|
153
|
+
statuses: nil,
|
|
154
|
+
until_time: nil,
|
|
155
|
+
additional_metadata: nil,
|
|
156
|
+
workflow_ids: nil,
|
|
157
|
+
worker_id: nil,
|
|
158
|
+
parent_task_external_id: nil,
|
|
159
|
+
triggering_event_external_id: nil
|
|
160
|
+
)
|
|
161
|
+
date_ranges = partition_date_range(
|
|
162
|
+
since: since || (Time.now - DEFAULT_SINCE_DAYS * 24 * 60 * 60),
|
|
163
|
+
until_time: until_time || Time.now
|
|
164
|
+
)
|
|
165
|
+
|
|
166
|
+
responses = date_ranges.map do |start_time, end_time|
|
|
167
|
+
@workflow_runs_api.v1_workflow_run_list(
|
|
168
|
+
@config.tenant_id,
|
|
169
|
+
start_time.utc.iso8601,
|
|
170
|
+
only_tasks,
|
|
171
|
+
{
|
|
172
|
+
offset: offset,
|
|
173
|
+
limit: limit,
|
|
174
|
+
statuses: statuses,
|
|
175
|
+
until: end_time.utc.iso8601,
|
|
176
|
+
additional_metadata: maybe_additional_metadata_to_kv(additional_metadata),
|
|
177
|
+
workflow_ids: workflow_ids,
|
|
178
|
+
worker_id: worker_id,
|
|
179
|
+
parent_task_external_id: parent_task_external_id,
|
|
180
|
+
triggering_event_external_id: triggering_event_external_id
|
|
181
|
+
}
|
|
182
|
+
)
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
# Hack for uniqueness
|
|
186
|
+
run_id_to_run = {}
|
|
187
|
+
responses.each do |record|
|
|
188
|
+
record.rows.each do |run|
|
|
189
|
+
run_id_to_run[run.metadata.id] = run
|
|
190
|
+
end
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
run_id_to_run.values.sort_by(&:created_at).reverse
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
# List task runs according to a set of filters
|
|
197
|
+
#
|
|
198
|
+
# @param since [Time, nil] The start time for filtering task runs
|
|
199
|
+
# @param only_tasks [Boolean] Whether to only list task runs
|
|
200
|
+
# @param offset [Integer, nil] The offset for pagination
|
|
201
|
+
# @param limit [Integer, nil] The maximum number of task runs to return
|
|
202
|
+
# @param statuses [Array<HatchetSdkRest::V1TaskStatus>, nil] The statuses to filter task runs by
|
|
203
|
+
# @param until_time [Time, nil] The end time for filtering task runs
|
|
204
|
+
# @param additional_metadata [Hash<String, String>, nil] Additional metadata to filter task runs by
|
|
205
|
+
# @param workflow_ids [Array<String>, nil] The workflow IDs to filter task runs by
|
|
206
|
+
# @param worker_id [String, nil] The worker ID to filter task runs by
|
|
207
|
+
# @param parent_task_external_id [String, nil] The parent task external ID to filter task runs by
|
|
208
|
+
# @param triggering_event_external_id [String, nil] The event id that triggered the task run
|
|
209
|
+
# @return [HatchetSdkRest::V1TaskSummaryList] A list of task runs matching the specified filters
|
|
210
|
+
# @raise [Hatchet::Error] If the API request fails or returns an error
|
|
211
|
+
def list(
|
|
212
|
+
since: nil,
|
|
213
|
+
only_tasks: false,
|
|
214
|
+
offset: nil,
|
|
215
|
+
limit: nil,
|
|
216
|
+
statuses: nil,
|
|
217
|
+
until_time: nil,
|
|
218
|
+
additional_metadata: nil,
|
|
219
|
+
workflow_ids: nil,
|
|
220
|
+
worker_id: nil,
|
|
221
|
+
parent_task_external_id: nil,
|
|
222
|
+
triggering_event_external_id: nil
|
|
223
|
+
)
|
|
224
|
+
since = since || (Time.now - DEFAULT_SINCE_DAYS * 24 * 60 * 60)
|
|
225
|
+
until_time = until_time || Time.now
|
|
226
|
+
|
|
227
|
+
if (until_time - since) / (24 * 60 * 60) >= LARGE_DATE_RANGE_WARNING_DAYS
|
|
228
|
+
warn "Listing runs with a date range longer than #{LARGE_DATE_RANGE_WARNING_DAYS} days may result in performance issues. " +
|
|
229
|
+
"Consider using `list_with_pagination` instead."
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
@workflow_runs_api.v1_workflow_run_list(
|
|
233
|
+
@config.tenant_id,
|
|
234
|
+
since.utc.iso8601,
|
|
235
|
+
only_tasks,
|
|
236
|
+
{
|
|
237
|
+
offset: offset,
|
|
238
|
+
limit: limit,
|
|
239
|
+
statuses: statuses,
|
|
240
|
+
until: until_time.utc.iso8601,
|
|
241
|
+
additional_metadata: maybe_additional_metadata_to_kv(additional_metadata),
|
|
242
|
+
workflow_ids: workflow_ids,
|
|
243
|
+
worker_id: worker_id,
|
|
244
|
+
parent_task_external_id: parent_task_external_id,
|
|
245
|
+
triggering_event_external_id: triggering_event_external_id
|
|
246
|
+
}
|
|
247
|
+
)
|
|
248
|
+
end
|
|
249
|
+
|
|
250
|
+
# Creates a new workflow run in the Hatchet system
|
|
251
|
+
#
|
|
252
|
+
# This method triggers a new workflow or task run for the specified workflow using the
|
|
253
|
+
# provided input data. The workflow run will be queued according to the
|
|
254
|
+
# workflow definition on an available worker.
|
|
255
|
+
#
|
|
256
|
+
# IMPORTANT: It's preferable to use `Workflow.run` (and similar) to trigger workflows if possible.
|
|
257
|
+
# This method is intended to be an escape hatch.
|
|
258
|
+
#
|
|
259
|
+
# @param name [String] The name of the workflow to trigger
|
|
260
|
+
# @param input [Hash] The input data for the workflow run
|
|
261
|
+
# @param additional_metadata [Hash, nil] Additional metadata associated with the workflow run
|
|
262
|
+
# @param priority [Integer, nil] The priority of the workflow run
|
|
263
|
+
# @return [HatchetSdkRest::V1WorkflowRunDetails] The details of the triggered workflow run
|
|
264
|
+
# @raise [ArgumentError] If the workflow_name or input parameters are nil or invalid
|
|
265
|
+
# @raise [Hatchet::Error] If the API request fails or returns an error
|
|
266
|
+
# @example Creating a workflow run
|
|
267
|
+
# response = runs.create(
|
|
268
|
+
# name: "simple-workflow",
|
|
269
|
+
# input: { user_id: 123, action: "process_data" },
|
|
270
|
+
# additional_metadata: { source: "api", priority: "high" }
|
|
271
|
+
# )
|
|
272
|
+
def create(name:, input:, additional_metadata: nil, priority: nil)
|
|
273
|
+
trigger_request = HatchetSdkRest::V1TriggerWorkflowRunRequest.new(
|
|
274
|
+
workflow_name: @config.apply_namespace(name),
|
|
275
|
+
input: input,
|
|
276
|
+
additional_metadata: additional_metadata,
|
|
277
|
+
priority: priority
|
|
278
|
+
)
|
|
279
|
+
|
|
280
|
+
run = @workflow_runs_api.v1_workflow_run_create(@config.tenant_id, trigger_request)
|
|
281
|
+
run.run
|
|
282
|
+
end
|
|
283
|
+
|
|
284
|
+
# Replay a task or workflow run
|
|
285
|
+
#
|
|
286
|
+
# @param run_id [String] The external ID of the task or workflow run to replay
|
|
287
|
+
# @return [void]
|
|
288
|
+
# @raise [Hatchet::Error] If the API request fails or returns an error
|
|
289
|
+
def replay(run_id)
|
|
290
|
+
bulk_replay(BulkCancelReplayOpts.new(ids: [run_id]))
|
|
291
|
+
end
|
|
292
|
+
|
|
293
|
+
# Replay task or workflow runs in bulk, according to a set of filters
|
|
294
|
+
#
|
|
295
|
+
# @param opts [BulkCancelReplayOpts] Options for bulk replay, including filters and IDs
|
|
296
|
+
# @return [void]
|
|
297
|
+
# @raise [Hatchet::Error] If the API request fails or returns an error
|
|
298
|
+
def bulk_replay(opts)
|
|
299
|
+
@task_api.v1_task_replay(
|
|
300
|
+
@config.tenant_id,
|
|
301
|
+
opts.to_replay_request
|
|
302
|
+
)
|
|
303
|
+
end
|
|
304
|
+
|
|
305
|
+
# Cancel a task or workflow run
|
|
306
|
+
#
|
|
307
|
+
# @param run_id [String] The external ID of the task or workflow run to cancel
|
|
308
|
+
# @return [void]
|
|
309
|
+
# @raise [Hatchet::Error] If the API request fails or returns an error
|
|
310
|
+
def cancel(run_id)
|
|
311
|
+
bulk_cancel(BulkCancelReplayOpts.new(ids: [run_id]))
|
|
312
|
+
end
|
|
313
|
+
|
|
314
|
+
# Cancel task or workflow runs in bulk, according to a set of filters
|
|
315
|
+
#
|
|
316
|
+
# @param opts [BulkCancelReplayOpts] Options for bulk cancel, including filters and IDs
|
|
317
|
+
# @return [void]
|
|
318
|
+
# @raise [Hatchet::Error] If the API request fails or returns an error
|
|
319
|
+
def bulk_cancel(opts)
|
|
320
|
+
@task_api.v1_task_cancel(
|
|
321
|
+
@config.tenant_id,
|
|
322
|
+
opts.to_cancel_request
|
|
323
|
+
)
|
|
324
|
+
end
|
|
325
|
+
|
|
326
|
+
# Get the result of a workflow run by its external ID
|
|
327
|
+
#
|
|
328
|
+
# @param run_id [String] The external ID of the workflow run to retrieve the result for
|
|
329
|
+
# @return [Hash] The result of the workflow run
|
|
330
|
+
# @raise [Hatchet::Error] If the API request fails or returns an error
|
|
331
|
+
def get_result(run_id)
|
|
332
|
+
details = get(run_id)
|
|
333
|
+
details.run.output
|
|
334
|
+
end
|
|
335
|
+
|
|
336
|
+
# Poll for workflow run completion with configurable interval and timeout
|
|
337
|
+
#
|
|
338
|
+
# This method repeatedly calls `get` until the workflow run reaches a terminal state
|
|
339
|
+
# (succeeded, failed, or cancelled) or the timeout is reached.
|
|
340
|
+
#
|
|
341
|
+
# @param workflow_run_id [String] The ID of the workflow run to poll
|
|
342
|
+
# @param interval [Numeric] The polling interval in seconds (default: 1.0)
|
|
343
|
+
# @param timeout [Numeric, nil] The maximum time to poll in seconds (default: no timeout)
|
|
344
|
+
# @return [HatchetSdkRest::V1WorkflowRunDetails] The final workflow run details
|
|
345
|
+
# @raise [Timeout::Error] If the timeout is reached before completion
|
|
346
|
+
# @raise [Hatchet::Error] If the API request fails or returns an error
|
|
347
|
+
# @example Poll with default settings (1s interval, no timeout)
|
|
348
|
+
# result = runs.poll("workflow-run-123")
|
|
349
|
+
# @example Poll with custom interval and timeout
|
|
350
|
+
# result = runs.poll("workflow-run-123", interval: 2.0, timeout: 30.0)
|
|
351
|
+
# @since 0.1.0
|
|
352
|
+
def poll(workflow_run_id, interval: 1.0, timeout: nil)
|
|
353
|
+
start_time = Time.now
|
|
354
|
+
|
|
355
|
+
loop do
|
|
356
|
+
puts "Polling for completion of run #{workflow_run_id}"
|
|
357
|
+
details = get(workflow_run_id)
|
|
358
|
+
status = details.run.status
|
|
359
|
+
|
|
360
|
+
# Check if workflow run has reached a terminal state
|
|
361
|
+
puts "Run status: #{status}"
|
|
362
|
+
if terminal_status?(status)
|
|
363
|
+
return details
|
|
364
|
+
end
|
|
365
|
+
|
|
366
|
+
# Check timeout
|
|
367
|
+
if timeout && (Time.now - start_time) >= timeout
|
|
368
|
+
raise Timeout::Error, "Polling timed out after #{timeout} seconds"
|
|
369
|
+
end
|
|
370
|
+
|
|
371
|
+
sleep(interval)
|
|
372
|
+
end
|
|
373
|
+
end
|
|
374
|
+
|
|
375
|
+
private
|
|
376
|
+
|
|
377
|
+
# Check if a workflow run status is terminal (completed)
|
|
378
|
+
#
|
|
379
|
+
# @param status [String] The workflow run status
|
|
380
|
+
# @return [Boolean] True if the status is terminal (succeeded, failed, or cancelled)
|
|
381
|
+
def terminal_status?(status)
|
|
382
|
+
case status
|
|
383
|
+
when HatchetSdkRest::WorkflowRunStatus::SUCCEEDED,
|
|
384
|
+
HatchetSdkRest::WorkflowRunStatus::FAILED,
|
|
385
|
+
HatchetSdkRest::WorkflowRunStatus::CANCELLED,
|
|
386
|
+
HatchetSdkRest::V1TaskStatus::COMPLETED,
|
|
387
|
+
HatchetSdkRest::V1TaskStatus::CANCELLED,
|
|
388
|
+
HatchetSdkRest::V1TaskStatus::FAILED
|
|
389
|
+
true
|
|
390
|
+
else
|
|
391
|
+
false
|
|
392
|
+
end
|
|
393
|
+
end
|
|
394
|
+
|
|
395
|
+
# Partition a date range into daily chunks to avoid API limits
|
|
396
|
+
#
|
|
397
|
+
# @param since [Time] Start time
|
|
398
|
+
# @param until_time [Time] End time
|
|
399
|
+
# @return [Array<Array<Time, Time>>] Array of [start_time, end_time] pairs
|
|
400
|
+
def partition_date_range(since:, until_time:)
|
|
401
|
+
ranges = []
|
|
402
|
+
current = since
|
|
403
|
+
|
|
404
|
+
while current < until_time
|
|
405
|
+
next_day = [current + 24 * 60 * 60, until_time].min
|
|
406
|
+
ranges << [current, next_day]
|
|
407
|
+
current = next_day
|
|
408
|
+
end
|
|
409
|
+
|
|
410
|
+
ranges
|
|
411
|
+
end
|
|
412
|
+
|
|
413
|
+
# Convert additional metadata hash to key-value array format expected by API
|
|
414
|
+
#
|
|
415
|
+
# @param metadata [Hash<String, String>, nil] Metadata hash
|
|
416
|
+
# @return [Array<Hash>, nil] Array of {key: string, value: string} objects
|
|
417
|
+
def maybe_additional_metadata_to_kv(metadata)
|
|
418
|
+
return nil unless metadata
|
|
419
|
+
metadata.map { |k, v| { key: k.to_s, value: v.to_s } }
|
|
420
|
+
end
|
|
421
|
+
end
|
|
422
|
+
end
|
|
423
|
+
end
|
data/lib/hatchet/version.rb
CHANGED
data/lib/hatchet-sdk.rb
CHANGED
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
|
|
4
4
|
require_relative "hatchet/version"
|
|
5
5
|
require_relative "hatchet/config"
|
|
6
|
+
require_relative "hatchet/clients"
|
|
7
|
+
require_relative "hatchet/features/events"
|
|
8
|
+
require_relative "hatchet/features/runs"
|
|
6
9
|
|
|
7
10
|
# Ruby SDK for Hatchet workflow engine
|
|
8
11
|
#
|
|
@@ -61,5 +64,23 @@ module Hatchet
|
|
|
61
64
|
def initialize(**options)
|
|
62
65
|
@config = Config.new(**options)
|
|
63
66
|
end
|
|
67
|
+
|
|
68
|
+
def rest_client
|
|
69
|
+
@rest_client ||= Hatchet::Clients.rest_client(@config)
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# Feature Client for interacting with Hatchet events
|
|
73
|
+
# @return [Hatchet::Features::Events] The events client for interacting with Hatchet events
|
|
74
|
+
def events
|
|
75
|
+
# @type [Hatchet::Features::Events]
|
|
76
|
+
@events ||= Hatchet::Features::Events.new(rest_client, @config)
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# Feature Client for interacting with Hatchet workflow runs
|
|
80
|
+
# @return [Hatchet::Features::Runs] The runs client for interacting with Hatchet workflow runs
|
|
81
|
+
def runs
|
|
82
|
+
# @type [Hatchet::Features::Runs]
|
|
83
|
+
@runs ||= Hatchet::Features::Runs.new(rest_client, @config)
|
|
84
|
+
end
|
|
64
85
|
end
|
|
65
86
|
end
|
data/scripts/generate.sh
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Ruby SDK REST API Client Generation Script
|
|
4
|
+
# Similar to the Python SDK's generate.sh
|
|
5
|
+
|
|
6
|
+
set -e
|
|
7
|
+
|
|
8
|
+
# Colors for output
|
|
9
|
+
RED='\033[0;31m'
|
|
10
|
+
GREEN='\033[0;32m'
|
|
11
|
+
YELLOW='\033[1;33m'
|
|
12
|
+
BLUE='\033[0;34m'
|
|
13
|
+
NC='\033[0m' # No Color
|
|
14
|
+
|
|
15
|
+
# Configuration
|
|
16
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
17
|
+
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
|
|
18
|
+
OPENAPI_SPEC="$PROJECT_ROOT/../../../../bin/oas/openapi.yaml"
|
|
19
|
+
OUTPUT_DIR="$PROJECT_ROOT/lib/hatchet/clients/rest"
|
|
20
|
+
CONFIG_FILE="$PROJECT_ROOT/config/openapi_generator_config.json"
|
|
21
|
+
|
|
22
|
+
echo -e "${BLUE}๐ Starting Ruby REST API Client Generation${NC}"
|
|
23
|
+
echo "Project Root: $PROJECT_ROOT"
|
|
24
|
+
|
|
25
|
+
# Function to check if a command exists
|
|
26
|
+
command_exists() {
|
|
27
|
+
command -v "$1" >/dev/null 2>&1
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
# Function to install OpenAPI Generator CLI
|
|
31
|
+
install_openapi_generator() {
|
|
32
|
+
echo -e "${YELLOW}๐ฆ Installing OpenAPI Generator CLI...${NC}"
|
|
33
|
+
|
|
34
|
+
if command_exists npm; then
|
|
35
|
+
npm install -g @openapitools/openapi-generator-cli@7.13.0
|
|
36
|
+
echo -e "${GREEN}โ
OpenAPI Generator CLI installed${NC}"
|
|
37
|
+
else
|
|
38
|
+
echo -e "${RED}โ npm not found. Please install Node.js and npm first.${NC}"
|
|
39
|
+
exit 1
|
|
40
|
+
fi
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
# Function to validate OpenAPI spec
|
|
44
|
+
validate_spec() {
|
|
45
|
+
echo -e "${BLUE}๐ Validating OpenAPI specification...${NC}"
|
|
46
|
+
|
|
47
|
+
if [ ! -f "$OPENAPI_SPEC" ]; then
|
|
48
|
+
echo -e "${RED}โ OpenAPI spec not found at: $OPENAPI_SPEC${NC}"
|
|
49
|
+
exit 1
|
|
50
|
+
fi
|
|
51
|
+
|
|
52
|
+
openapi-generator-cli validate -i "$OPENAPI_SPEC"
|
|
53
|
+
echo -e "${GREEN}โ
OpenAPI specification is valid${NC}"
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
# Function to generate the REST client
|
|
57
|
+
generate_client() {
|
|
58
|
+
echo -e "${BLUE}๐๏ธ Generating Ruby REST client...${NC}"
|
|
59
|
+
|
|
60
|
+
# Create output directory
|
|
61
|
+
mkdir -p "$OUTPUT_DIR"
|
|
62
|
+
|
|
63
|
+
# Additional properties for Ruby generation
|
|
64
|
+
ADDITIONAL_PROPS="gemName=hatchet-sdk-rest,moduleName=Hatchet::Clients::Rest,gemVersion=0.0.1,gemDescription=Ruby REST client for Hatchet API,gemAuthor=Hatchet Team,gemHomepage=https://github.com/hatchet-dev/hatchet,gemLicense=MIT,library=faraday,httpLibrary=faraday"
|
|
65
|
+
|
|
66
|
+
# Generate the client
|
|
67
|
+
openapi-generator-cli generate \
|
|
68
|
+
-i "$OPENAPI_SPEC" \
|
|
69
|
+
-g ruby \
|
|
70
|
+
-o "$OUTPUT_DIR" \
|
|
71
|
+
-c "$CONFIG_FILE" \
|
|
72
|
+
--skip-validate-spec \
|
|
73
|
+
--global-property apiTests=false,modelTests=false,apiDocs=true,modelDocs=true \
|
|
74
|
+
--additional-properties "$ADDITIONAL_PROPS"
|
|
75
|
+
|
|
76
|
+
echo -e "${GREEN}โ
Ruby REST client generated${NC}"
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
# Function to apply custom patches
|
|
80
|
+
apply_patches() {
|
|
81
|
+
echo -e "${BLUE}๐ง Applying custom patches...${NC}"
|
|
82
|
+
|
|
83
|
+
echo -e "${GREEN}โ
Custom patches applied${NC}"
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
# Function to update dependencies
|
|
87
|
+
update_dependencies() {
|
|
88
|
+
echo -e "${BLUE}๐ฆ Updating Ruby dependencies...${NC}"
|
|
89
|
+
|
|
90
|
+
cd "$PROJECT_ROOT"
|
|
91
|
+
|
|
92
|
+
# Add required gems to Gemfile if not present
|
|
93
|
+
if ! grep -q "gem ['\"]faraday['\"]" Gemfile 2>/dev/null; then
|
|
94
|
+
echo "gem 'faraday', '~> 2.0'" >> Gemfile
|
|
95
|
+
fi
|
|
96
|
+
|
|
97
|
+
if ! grep -q "gem ['\"]faraday-multipart['\"]" Gemfile 2>/dev/null; then
|
|
98
|
+
echo "gem 'faraday-multipart'" >> Gemfile
|
|
99
|
+
fi
|
|
100
|
+
|
|
101
|
+
# Install/update dependencies
|
|
102
|
+
bundle install
|
|
103
|
+
|
|
104
|
+
echo -e "${GREEN}โ
Dependencies updated${NC}"
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
# Function to run tests on generated code
|
|
108
|
+
run_tests() {
|
|
109
|
+
echo -e "${BLUE}๐งช Running tests...${NC}"
|
|
110
|
+
|
|
111
|
+
cd "$PROJECT_ROOT"
|
|
112
|
+
|
|
113
|
+
# Run RSpec tests
|
|
114
|
+
bundle exec rspec
|
|
115
|
+
|
|
116
|
+
# Run RuboCop
|
|
117
|
+
bundle exec rubocop --auto-correct
|
|
118
|
+
|
|
119
|
+
echo -e "${GREEN}โ
Tests completed${NC}"
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
# Main execution
|
|
123
|
+
main() {
|
|
124
|
+
echo -e "${BLUE}Starting Ruby REST API generation process...${NC}"
|
|
125
|
+
|
|
126
|
+
# Check if OpenAPI Generator CLI is installed
|
|
127
|
+
if ! command_exists openapi-generator-cli; then
|
|
128
|
+
echo -e "${YELLOW}OpenAPI Generator CLI not found${NC}"
|
|
129
|
+
install_openapi_generator
|
|
130
|
+
else
|
|
131
|
+
echo -e "${GREEN}โ
OpenAPI Generator CLI found${NC}"
|
|
132
|
+
fi
|
|
133
|
+
|
|
134
|
+
# Validate the OpenAPI specification
|
|
135
|
+
validate_spec
|
|
136
|
+
|
|
137
|
+
# Generate the REST client
|
|
138
|
+
generate_client
|
|
139
|
+
|
|
140
|
+
# Apply custom patches
|
|
141
|
+
apply_patches
|
|
142
|
+
|
|
143
|
+
# Update dependencies
|
|
144
|
+
update_dependencies
|
|
145
|
+
|
|
146
|
+
# Run tests (optional, can be disabled with --skip-tests)
|
|
147
|
+
if [[ "$*" != *"--skip-tests"* ]]; then
|
|
148
|
+
run_tests
|
|
149
|
+
fi
|
|
150
|
+
|
|
151
|
+
echo -e "${GREEN}๐ Ruby REST API client generation completed successfully!${NC}"
|
|
152
|
+
echo -e "${BLUE}Generated files are in: $OUTPUT_DIR${NC}"
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
# Handle command line arguments
|
|
156
|
+
case "$1" in
|
|
157
|
+
--help|-h)
|
|
158
|
+
echo "Usage: $0 [OPTIONS]"
|
|
159
|
+
echo "Options:"
|
|
160
|
+
echo " --skip-tests Skip running tests after generation"
|
|
161
|
+
echo " --help, -h Show this help message"
|
|
162
|
+
exit 0
|
|
163
|
+
;;
|
|
164
|
+
*)
|
|
165
|
+
main "$@"
|
|
166
|
+
;;
|
|
167
|
+
esac
|