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 @@ + + + +
+ +Download OpenAPI specification:Download
API documentation for Promises, Tasks, Locks, and Schedules.
+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 + |
id required | string |
timeout required | integer <int64> |
object (PromiseValue) | |
object |
{- "id": "string",
- "timeout": 0,
- "param": {
- "headers": {
- "property1": "string",
- "property2": "string"
}, - "data": "string"
}, - "tags": {
- "property1": "string",
- "property2": "string"
}
}
{- "id": "string",
- "state": "PENDING",
- "param": {
- "headers": {
- "property1": "string",
- "property2": "string"
}, - "data": "string"
}, - "value": {
- "headers": {
- "property1": "string",
- "property2": "string"
}, - "data": "string"
}, - "timeout": 0,
- "idempotencyKeyForCreate": "string",
- "idempotencyKeyForComplete": "string",
- "tags": {
- "property1": "string",
- "property2": "string"
}, - "createdOn": 0,
- "completedOn": 0
}
id | string Search promises for matching IDs, can include wildcards. +For example: +
|
state | string Enum: "pending" "resolved" "rejected" Search promises for matching states + |
object | |
limit | integer Number of results + |
cursor | string Cursor for pagination + |
request-id | string Unique ID for each request + |
{- "cursor": "string",
- "promises": [
- {
- "id": "string",
- "state": "PENDING",
- "param": {
- "headers": {
- "property1": "string",
- "property2": "string"
}, - "data": "string"
}, - "value": {
- "headers": {
- "property1": "string",
- "property2": "string"
}, - "data": "string"
}, - "timeout": 0,
- "idempotencyKeyForCreate": "string",
- "idempotencyKeyForComplete": "string",
- "tags": {
- "property1": "string",
- "property2": "string"
}, - "createdOn": 0,
- "completedOn": 0
}
]
}
id required | string The ID of the resource + |
request-id | string Unique ID for each request + |
{- "id": "string",
- "state": "PENDING",
- "param": {
- "headers": {
- "property1": "string",
- "property2": "string"
}, - "data": "string"
}, - "value": {
- "headers": {
- "property1": "string",
- "property2": "string"
}, - "data": "string"
}, - "timeout": 0,
- "idempotencyKeyForCreate": "string",
- "idempotencyKeyForComplete": "string",
- "tags": {
- "property1": "string",
- "property2": "string"
}, - "createdOn": 0,
- "completedOn": 0
}
id required | string The ID of the resource + |
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 + |
state required | string (PromiseStateComplete) Enum: "RESOLVED" "REJECTED" "REJECTED_CANCELED" |
object (PromiseValue) |
{- "state": "RESOLVED",
- "value": {
- "headers": {
- "property1": "string",
- "property2": "string"
}, - "data": "string"
}
}
{- "id": "string",
- "state": "PENDING",
- "param": {
- "headers": {
- "property1": "string",
- "property2": "string"
}, - "data": "string"
}, - "value": {
- "headers": {
- "property1": "string",
- "property2": "string"
}, - "data": "string"
}, - "timeout": 0,
- "idempotencyKeyForCreate": "string",
- "idempotencyKeyForComplete": "string",
- "tags": {
- "property1": "string",
- "property2": "string"
}, - "createdOn": 0,
- "completedOn": 0
}
Acquire a distributed lock
+resourceId required | string |
processId required | string |
executionId required | string |
expiryInSeconds required | integer <int64> |
{- "resourceId": "string",
- "processId": "string",
- "executionId": "string",
- "expiryInSeconds": 0
}
{- "resourceId": "string",
- "processId": "string",
- "executionId": "string",
- "expiryInSeconds": 0,
- "expiresAt": 0
}
Release a distributed lock
+resourceId required | string |
executionId required | string |
{- "resourceId": "string",
- "executionId": "string"
}
{- "code": 0,
- "message": "string",
- "details": "string"
}
request-id | string Unique ID for each request + |
idempotency-key | string Deduplicates multiple requests + |
id required | string |
description | string |
cron required | string |
object | |
promiseId required | string |
promiseTimeout required | integer <int64> |
object (PromiseValue) | |
object |
{- "id": "string",
- "description": "string",
- "cron": "string",
- "tags": {
- "property1": "string",
- "property2": "string"
}, - "promiseId": "string",
- "promiseTimeout": 0,
- "promiseParam": {
- "headers": {
- "property1": "string",
- "property2": "string"
}, - "data": "string"
}, - "promiseTags": {
- "property1": "string",
- "property2": "string"
}
}
{- "id": "string",
- "description": "string",
- "cron": "string",
- "tags": {
- "property1": "string",
- "property2": "string"
}, - "promiseId": "string",
- "promiseTimeout": 0,
- "promiseParam": {
- "headers": {
- "property1": "string",
- "property2": "string"
}, - "data": "string"
}, - "promiseTags": {
- "property1": "string",
- "property2": "string"
}, - "lastRunTime": 0,
- "nextRunTime": 0,
- "idempotencyKey": "string",
- "createdOn": 0
}
id | string Search schedules for matching IDs, can include wildcards. +For example: +
|
object | |
limit | integer Number of results + |
cursor | string Cursor for pagination + |
request-id | string Unique ID for each request + |
{- "cursor": "string",
- "schedules": [
- {
- "id": "string",
- "description": "string",
- "cron": "string",
- "tags": {
- "property1": "string",
- "property2": "string"
}, - "promiseId": "string",
- "promiseTimeout": 0,
- "promiseParam": {
- "headers": {
- "property1": "string",
- "property2": "string"
}, - "data": "string"
}, - "promiseTags": {
- "property1": "string",
- "property2": "string"
}, - "lastRunTime": 0,
- "nextRunTime": 0,
- "idempotencyKey": "string",
- "createdOn": 0
}
]
}
id required | string The ID of the resource + |
request-id | string Unique ID for each request + |
{- "id": "string",
- "description": "string",
- "cron": "string",
- "tags": {
- "property1": "string",
- "property2": "string"
}, - "promiseId": "string",
- "promiseTimeout": 0,
- "promiseParam": {
- "headers": {
- "property1": "string",
- "property2": "string"
}, - "data": "string"
}, - "promiseTags": {
- "property1": "string",
- "property2": "string"
}, - "lastRunTime": 0,
- "nextRunTime": 0,
- "idempotencyKey": "string",
- "createdOn": 0
}