diff --git a/api/combined-openapi.yml b/api/combined-openapi.yml new file mode 100644 index 00000000..99f06458 --- /dev/null +++ b/api/combined-openapi.yml @@ -0,0 +1,602 @@ +openapi: 3.0.0 +info: + title: Combined API + description: API documentation for Promises, Tasks, Locks, and Schedules. + version: 1.0.0 + license: + name: Apache 2.0 + url: https://opensource.org/license/apache-2-0 +servers: + - url: https://resonatehq.io # Replace with your actual API base URL + description: Website +security: [] # Explicitly state no security is required globally +paths: + /promises: + post: + tags: + - Promises + summary: Create a promise + operationId: createPromise + parameters: + - $ref: "#/components/parameters/RequestIdHeader" + - $ref: "#/components/parameters/IdempotencyKeyHeader" + - $ref: "#/components/parameters/StrictHeader" + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/CreatePromiseReq" + responses: + 200: + description: Operation deduplicated, Promise fetched successfully + content: + application/json: + schema: + $ref: "#/components/schemas/Promise" + 201: + description: Created + content: + application/json: + schema: + $ref: "#/components/schemas/Promise" + 400: + description: Invalid request + 403: + description: Forbidden request + 409: + description: Promise already exists + + get: + tags: + - Promises + summary: Search promises + operationId: searchPromises + parameters: + - $ref: "#/components/parameters/RequestIdHeader" + - name: id + in: query + description: | + Search promises for matching IDs, can include wildcards. + + For example: + - "foo/*" matches all IDs starting with "foo/" + - "*/bar" matches all IDs starting with "bar/" + - "foo/*/bar" matches all IDs starting with "foo/" and ending with "/bar" + schema: + type: string + - name: state + in: query + description: Search promises for matching states + schema: + type: string + enum: + - pending + - resolved + - rejected + - name: tags + in: query + style: deepObject + explode: true + schema: + type: object + additionalProperties: + type: string + - name: limit + in: query + description: Number of results + schema: + type: integer + - name: cursor + in: query + description: Cursor for pagination + schema: + type: string + responses: + 200: + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/SearchPromisesResp" + 400: + description: Invalid request + + /promises/{id}: + get: + tags: + - Promises + summary: Get a promise + operationId: getPromise + parameters: + - $ref: "#/components/parameters/IdPath" + - $ref: "#/components/parameters/RequestIdHeader" + responses: + 200: + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/Promise" + 400: + description: Invalid request + 404: + description: Promise not found + + patch: + tags: + - Promises + summary: Complete a promise + operationId: completePromise + parameters: + - $ref: "#/components/parameters/IdPath" + - $ref: "#/components/parameters/RequestIdHeader" + - $ref: "#/components/parameters/IdempotencyKeyHeader" + - $ref: "#/components/parameters/StrictHeader" + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/CompletePromiseReq" + responses: + 200: + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/Promise" + 400: + description: Invalid request + 403: + description: Forbidden request + 404: + description: Promise not found + + /locks/acquire: + post: + summary: Acquire lock + description: Acquire a distributed lock + operationId: acquireLock + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/Lock" + required: true + responses: + "200": + description: successful operation + content: + application/json: + schema: + $ref: "#/components/schemas/Lock" + "400": + description: Bad request - Invalid input or missing required fields + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + "404": + description: Not found - The specified lock could not be found + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + + /locks/heartbeat: + post: + summary: heartbeat + description: update heartbeat for all locks that match the processId + operationId: heartbeat + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/HeartbeatRequest" + required: true + responses: + "200": + description: successful operation + content: + application/json: + schema: + $ref: "#/components/schemas/HeartbeatResponse" + "400": + description: Bad request - Invalid input or missing required fields + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + "404": + description: Not found - The specified lock could not be found + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + + /locks/release: + post: + summary: Release lock + description: Release a distributed lock + operationId: releaseLock + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/ReleaseLockRequest" + required: true + responses: + "200": + description: successful operation + "400": + description: Bad request - Invalid input or missing required fields + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + "404": + description: Not found - The specified lock could not be found + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + /schedules: + post: + tags: + - Schedules + summary: Create a new schedule + operationId: createSchedule + parameters: + - $ref: "#/components/parameters/RequestIdHeader" + - $ref: "#/components/parameters/IdempotencyKeyHeader" + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/Schedule" + required: true + responses: + 200: + description: Operation deduplicated, Schedule fetched successfully + content: + application/json: + schema: + $ref: "#/components/schemas/Schedule" + 201: + description: Created + content: + application/json: + schema: + $ref: "#/components/schemas/Schedule" + 400: + description: Invalid request + 403: + description: Forbidden request + 409: + description: Schedule already exists + get: + tags: + - Schedules + summary: Search schedules + operationId: searchSchedules + parameters: + - $ref: "#/components/parameters/RequestIdHeader" + - name: id + in: query + description: | + Search schedules for matching IDs, can include wildcards. + + For example: + - "foo/*" matches all IDs starting with "foo/" + - "*/bar" matches all IDs starting with "bar/" + - "foo/*/bar" matches all IDs starting with "foo/" and ending with "/bar" + schema: + type: string + - name: tags + in: query + style: deepObject + explode: true + schema: + type: object + additionalProperties: + type: string + - name: limit + in: query + description: Number of results + schema: + type: integer + - name: cursor + in: query + description: Cursor for pagination + schema: + type: string + responses: + 200: + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/SearchSchedulesResp" + 400: + description: Invalid request + + /schedules/{id}: + get: + tags: + - Schedules + summary: Get a schedule + operationId: getSchedule + parameters: + - $ref: "#/components/parameters/IdPath" + - $ref: "#/components/parameters/RequestIdHeader" + responses: + "200": + description: Successfully retrieved the schedule + content: + application/json: + schema: + $ref: "#/components/schemas/Schedule" + "404": + description: Schedule not found + + delete: + tags: + - Schedules + summary: Delete a schedule + operationId: deleteSchedule + parameters: + - $ref: "#/components/parameters/IdPath" + - $ref: "#/components/parameters/RequestIdHeader" + responses: + "204": + description: Successfully deleted the schedule + "404": + description: Schedule not found + +components: + parameters: + IdPath: + name: id + in: path + required: true + description: The ID of the resource + schema: + type: string + # HEADER PARAMETERS + IdempotencyKeyHeader: + name: idempotency-key + in: header + description: Deduplicates multiple requests + schema: + type: string + RequestIdHeader: + name: request-id + in: header + description: Unique ID for each request + schema: + type: string + StrictHeader: + name: strict + in: header + description: If true, deduplicates only when promise state matches the request + schema: + type: boolean + schemas: + Promise: + type: object + required: + - id + - state + - timeout + - param + - value + - tags + properties: + id: + type: string + state: + $ref: "#/components/schemas/PromiseState" + param: + $ref: "#/components/schemas/PromiseValue" + value: + $ref: "#/components/schemas/PromiseValue" + timeout: + type: integer + format: int64 + idempotencyKeyForCreate: + type: string + readOnly: true + idempotencyKeyForComplete: + type: string + readOnly: true + tags: + type: object + additionalProperties: + type: string + createdOn: + type: integer + readOnly: true + completedOn: + type: integer + readOnly: true + + PromiseState: + type: string + enum: + - PENDING + - RESOLVED + - REJECTED + - REJECTED_CANCELED + - REJECTED_TIMEDOUT + + PromiseStateComplete: + type: string + enum: + - RESOLVED + - REJECTED + - REJECTED_CANCELED + + PromiseValue: + type: object + required: + - headers + properties: + headers: + type: object + additionalProperties: + type: string + data: + type: string + + CreatePromiseReq: + type: object + required: + - id + - timeout + properties: + id: + type: string + timeout: + type: integer + format: int64 + param: + $ref: "#/components/schemas/PromiseValue" + tags: + type: object + additionalProperties: + type: string + + CompletePromiseReq: + type: object + required: + - state + properties: + state: + $ref: "#/components/schemas/PromiseStateComplete" + value: + $ref: "#/components/schemas/PromiseValue" + + SearchPromisesResp: + type: object + properties: + cursor: + type: string + promises: + type: array + items: + $ref: "#/components/schemas/Promise" + + Schedule: + type: object + required: + - id + - cron + - promiseId + - promiseTimeout + properties: + id: + type: string + description: + type: string + cron: + type: string + tags: + type: object + additionalProperties: + type: string + promiseId: + type: string + promiseTimeout: + type: integer + format: int64 + promiseParam: + $ref: "#/components/schemas/PromiseValue" + promiseTags: + type: object + additionalProperties: + type: string + lastRunTime: + type: integer + readOnly: true + format: int64 + nextRunTime: + type: integer + readOnly: true + format: int64 + idempotencyKey: + type: string + readOnly: true + createdOn: + type: integer + readOnly: true + format: int64 + + SearchSchedulesResp: + type: object + properties: + cursor: + type: string + schedules: + type: array + items: + $ref: "#/components/schemas/Schedule" + + Lock: + type: object + properties: + resourceId: + type: string + processId: + type: string + executionId: + type: string + expiryInSeconds: + type: integer + format: int64 + expiresAt: + type: integer + format: int64 + readOnly: true + required: + - resourceId + - processId + - executionId + - expiryInSeconds + + HeartbeatRequest: + type: object + properties: + processId: + type: string + required: + - processId + + HeartbeatResponse: + type: object + properties: + locksAffected: + type: integer + format: int64 + + ReleaseLockRequest: + type: object + properties: + resourceId: + type: string + executionId: + type: string + required: + - resourceId + - executionId + + ErrorResponse: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: string diff --git a/api/combined.html b/api/combined.html new file mode 100644 index 00000000..ee8117a0 --- /dev/null +++ b/api/combined.html @@ -0,0 +1,558 @@ + + + + + + Combined API + + + + + + + + + +

Combined API (1.0.0)

Download OpenAPI specification:Download

License: Apache 2.0

API documentation for Promises, Tasks, Locks, and Schedules.

+

Promises

Create a promise

header Parameters
request-id
string

Unique ID for each request

+
idempotency-key
string

Deduplicates multiple requests

+
strict
boolean

If true, deduplicates only when promise state matches the request

+
Request Body schema: application/json
required
id
required
string
timeout
required
integer <int64>
object (PromiseValue)
object

Responses

Request samples

Content type
application/json
{
  • "id": "string",
  • "timeout": 0,
  • "param": {
    },
  • "tags": {
    }
}

Response samples

Content type
application/json
{
  • "id": "string",
  • "state": "PENDING",
  • "param": {
    },
  • "value": {
    },
  • "timeout": 0,
  • "idempotencyKeyForCreate": "string",
  • "idempotencyKeyForComplete": "string",
  • "tags": {
    },
  • "createdOn": 0,
  • "completedOn": 0
}

Search promises

query Parameters
id
string

Search promises for matching IDs, can include wildcards.

+

For example:

+
    +
  • "foo/*" matches all IDs starting with "foo/"
  • +
  • "*/bar" matches all IDs starting with "bar/"
  • +
  • "foo/*/bar" matches all IDs starting with "foo/" and ending with "/bar"
  • +
+
state
string
Enum: "pending" "resolved" "rejected"

Search promises for matching states

+
object
limit
integer

Number of results

+
cursor
string

Cursor for pagination

+
header Parameters
request-id
string

Unique ID for each request

+

Responses

Response samples

Content type
application/json
{
  • "cursor": "string",
  • "promises": [
    ]
}

Get a promise

path Parameters
id
required
string

The ID of the resource

+
header Parameters
request-id
string

Unique ID for each request

+

Responses

Response samples

Content type
application/json
{
  • "id": "string",
  • "state": "PENDING",
  • "param": {
    },
  • "value": {
    },
  • "timeout": 0,
  • "idempotencyKeyForCreate": "string",
  • "idempotencyKeyForComplete": "string",
  • "tags": {
    },
  • "createdOn": 0,
  • "completedOn": 0
}

Complete a promise

path Parameters
id
required
string

The ID of the resource

+
header Parameters
request-id
string

Unique ID for each request

+
idempotency-key
string

Deduplicates multiple requests

+
strict
boolean

If true, deduplicates only when promise state matches the request

+
Request Body schema: application/json
required
state
required
string (PromiseStateComplete)
Enum: "RESOLVED" "REJECTED" "REJECTED_CANCELED"
object (PromiseValue)

Responses

Request samples

Content type
application/json
{
  • "state": "RESOLVED",
  • "value": {
    }
}

Response samples

Content type
application/json
{
  • "id": "string",
  • "state": "PENDING",
  • "param": {
    },
  • "value": {
    },
  • "timeout": 0,
  • "idempotencyKeyForCreate": "string",
  • "idempotencyKeyForComplete": "string",
  • "tags": {
    },
  • "createdOn": 0,
  • "completedOn": 0
}

Acquire lock

Acquire a distributed lock

+
Request Body schema: application/json
required
resourceId
required
string
processId
required
string
executionId
required
string
expiryInSeconds
required
integer <int64>

Responses

Request samples

Content type
application/json
{
  • "resourceId": "string",
  • "processId": "string",
  • "executionId": "string",
  • "expiryInSeconds": 0
}

Response samples

Content type
application/json
{
  • "resourceId": "string",
  • "processId": "string",
  • "executionId": "string",
  • "expiryInSeconds": 0,
  • "expiresAt": 0
}

heartbeat

update heartbeat for all locks that match the processId

+
Request Body schema: application/json
required
processId
required
string

Responses

Request samples

Content type
application/json
{
  • "processId": "string"
}

Response samples

Content type
application/json
{
  • "locksAffected": 0
}

Release lock

Release a distributed lock

+
Request Body schema: application/json
required
resourceId
required
string
executionId
required
string

Responses

Request samples

Content type
application/json
{
  • "resourceId": "string",
  • "executionId": "string"
}

Response samples

Content type
application/json
{
  • "code": 0,
  • "message": "string",
  • "details": "string"
}

Schedules

Create a new schedule

header Parameters
request-id
string

Unique ID for each request

+
idempotency-key
string

Deduplicates multiple requests

+
Request Body schema: application/json
required
id
required
string
description
string
cron
required
string
object
promiseId
required
string
promiseTimeout
required
integer <int64>
object (PromiseValue)
object

Responses

Request samples

Content type
application/json
{
  • "id": "string",
  • "description": "string",
  • "cron": "string",
  • "tags": {
    },
  • "promiseId": "string",
  • "promiseTimeout": 0,
  • "promiseParam": {
    },
  • "promiseTags": {
    }
}

Response samples

Content type
application/json
{
  • "id": "string",
  • "description": "string",
  • "cron": "string",
  • "tags": {
    },
  • "promiseId": "string",
  • "promiseTimeout": 0,
  • "promiseParam": {
    },
  • "promiseTags": {
    },
  • "lastRunTime": 0,
  • "nextRunTime": 0,
  • "idempotencyKey": "string",
  • "createdOn": 0
}

Search schedules

query Parameters
id
string

Search schedules for matching IDs, can include wildcards.

+

For example:

+
    +
  • "foo/*" matches all IDs starting with "foo/"
  • +
  • "*/bar" matches all IDs starting with "bar/"
  • +
  • "foo/*/bar" matches all IDs starting with "foo/" and ending with "/bar"
  • +
+
object
limit
integer

Number of results

+
cursor
string

Cursor for pagination

+
header Parameters
request-id
string

Unique ID for each request

+

Responses

Response samples

Content type
application/json
{
  • "cursor": "string",
  • "schedules": [
    ]
}

Get a schedule

path Parameters
id
required
string

The ID of the resource

+
header Parameters
request-id
string

Unique ID for each request

+

Responses

Response samples

Content type
application/json
{
  • "id": "string",
  • "description": "string",
  • "cron": "string",
  • "tags": {
    },
  • "promiseId": "string",
  • "promiseTimeout": 0,
  • "promiseParam": {
    },
  • "promiseTags": {
    },
  • "lastRunTime": 0,
  • "nextRunTime": 0,
  • "idempotencyKey": "string",
  • "createdOn": 0
}

Delete a schedule

path Parameters
id
required
string

The ID of the resource

+
header Parameters
request-id
string

Unique ID for each request

+

Responses

+ + + + diff --git a/api/locks-openapi.yml b/api/locks-openapi.yml index 604c7463..a98681e9 100644 --- a/api/locks-openapi.yml +++ b/api/locks-openapi.yml @@ -3,6 +3,13 @@ info: title: Distributed Lock API description: Manage Distributed Locks version: 1.0.0 + license: + name: Apache 2.0 + url: https://opensource.org/license/apache-2-0 +servers: + - url: https://resonatehq.io # Replace with your actual API base URL + description: Website +security: [] # Explicitly state no security is required globally paths: /locks/acquire: post: @@ -22,6 +29,18 @@ paths: application/json: schema: $ref: "#/components/schemas/Lock" + "400": + description: Bad request - Invalid input or missing required fields + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + "404": + description: Not found - The specified lock could not be found + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" /locks/heartbeat: post: @@ -41,6 +60,18 @@ paths: application/json: schema: $ref: "#/components/schemas/HeartbeatResponse" + "400": + description: Bad request - Invalid input or missing required fields + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + "404": + description: Not found - The specified lock could not be found + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" /locks/release: post: @@ -56,6 +87,18 @@ paths: responses: "200": description: successful operation + "400": + description: Bad request - Invalid input or missing required fields + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + "404": + description: Not found - The specified lock could not be found + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" components: schemas: @@ -106,3 +149,14 @@ components: required: - resourceId - executionId + + ErrorResponse: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: string diff --git a/api/promises-openapi.yml b/api/promises-openapi.yml index 3122e5a4..09a85b1d 100644 --- a/api/promises-openapi.yml +++ b/api/promises-openapi.yml @@ -3,6 +3,13 @@ info: title: Promise API description: Manage promises version: 1.0.0 + license: + name: Apache 2.0 + url: https://opensource.org/license/apache-2-0 +servers: + - url: https://resonatehq.io # Replace with your actual API base URL + description: Website +security: [] # Explicitly state no security is required globally paths: /promises: post: @@ -120,6 +127,7 @@ paths: tags: - Promises summary: Complete a promise + operationId: completePromise parameters: - $ref: "#/components/parameters/IdPath" - $ref: "#/components/parameters/RequestIdHeader" diff --git a/api/schedules-openapi.yml b/api/schedules-openapi.yml index 939e6c02..fef17c2e 100644 --- a/api/schedules-openapi.yml +++ b/api/schedules-openapi.yml @@ -2,13 +2,20 @@ openapi: 3.0.0 info: title: Schedules API version: 1.0.0 + license: + name: Apache 2.0 + url: https://opensource.org/license/apache-2-0 +servers: + - url: https://resonatehq.io # Replace with your actual API base URL + description: Website +security: [] # Explicitly state no security is required globally paths: /schedules: post: tags: - Schedules summary: Create a new schedule - operationdId: createSchedule + operationId: createSchedule parameters: - $ref: "#/components/parameters/RequestIdHeader" - $ref: "#/components/parameters/IdempotencyKeyHeader" @@ -88,7 +95,7 @@ paths: tags: - Schedules summary: Get a schedule - operationdId: getSchedule + operationId: getSchedule parameters: - $ref: "#/components/parameters/IdPath" - $ref: "#/components/parameters/RequestIdHeader" @@ -106,7 +113,7 @@ paths: tags: - Schedules summary: Delete a schedule - operationdId: deleteSchedule + operationId: deleteSchedule parameters: - $ref: "#/components/parameters/IdPath" - $ref: "#/components/parameters/RequestIdHeader"