From aa2e12f7507bd9c8192ee4bac69d69b3d8d197bc Mon Sep 17 00:00:00 2001 From: ChrisBullOz <116279617+ChrisBullOz@users.noreply.github.com> Date: Tue, 8 Nov 2022 12:58:12 +0100 Subject: [PATCH] added List Workflow Runs endpoint (#23) --- openapi.yaml | 2 +- output.json | 73 ++++++++++++++++ paths/workflow_runs.yaml | 85 ++++++++++++++----- schemas/workflow_runs/workflow_runs_list.yaml | 6 ++ 4 files changed, 144 insertions(+), 22 deletions(-) create mode 100644 schemas/workflow_runs/workflow_runs_list.yaml diff --git a/openapi.yaml b/openapi.yaml index 541bd699..1de5690a 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -78,7 +78,7 @@ paths: $ref: paths/reports.yaml#/cancel # Workflow Runs /workflow_runs: - $ref: paths/workflow_runs.yaml#/workflow_runs + $ref: paths/workflow_runs.yaml#/workflow_run /workflow_runs/{workflow_run_id}: $ref: paths/workflow_runs.yaml#/workflow_runs /workflow_runs/{workflow_run_id}/tasks: diff --git a/output.json b/output.json index 37c0c9f2..2390b6be 100644 --- a/output.json +++ b/output.json @@ -4176,6 +4176,79 @@ "$ref": "#/paths/~1ping/get/responses/default" } } + }, + "get": { + "summary": "List Workflow Runs.", + "operationId": "list_workflow_runs", + "parameters": [ + { + "name": "page", + "in": "query", + "description": "The number of the page to be retrieved. If not specified, defaults to 1.", + "schema": { + "type": "integer", + "default": 1 + } + }, + { + "name": "status", + "in": "query", + "description": "A list of comma separated status values to filter the results. Possible values are 'processing', 'awaiting_input', 'approved', 'declined', 'review', 'abandoned' and 'error'.", + "schema": { + "type": "string" + } + }, + { + "name": "created_at_gt", + "in": "query", + "description": "A ISO-8601 date to filter results with a created date greater than (after) the one provided.", + "schema": { + "type": "string", + "format": "date-time" + } + }, + { + "name": "created_at_lt", + "in": "query", + "description": "A ISO-8601 date to filter results with a created date less than (before) the one provided.", + "schema": { + "type": "string", + "format": "date-time" + } + }, + { + "name": "sort", + "in": "query", + "description": "A string with the value 'desc' or 'asc' that allows to sort the returned list by the completed datetime either descending or ascending, respectively. If not specified, defaults to 'desc'.", + "schema": { + "type": "string", + "default": "desc" + } + } + ], + "responses": { + "200": { + "description": "An array of Workflow Run objects matching the query parameters.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "workflow_runs": { + "type": "array", + "items": { + "$ref": "#/paths/~1workflow_runs/post/responses/201/content/application~1json/schema" + } + } + } + } + } + } + }, + "default": { + "$ref": "#/paths/~1ping/get/responses/default" + } + } } }, "/workflow_runs/{workflow_run_id}": { diff --git a/paths/workflow_runs.yaml b/paths/workflow_runs.yaml index 2cdbc149..a2ab7ad4 100644 --- a/paths/workflow_runs.yaml +++ b/paths/workflow_runs.yaml @@ -1,24 +1,4 @@ - workflow_runs: - get: - summary: A single workflow run can be retrieved by calling this endpoint with the unique identifier of the Workflow Run. - operationId: retrieve_workflow_run - parameters: - - name: workflow_run_id - in: path - required: true - description: The unique identifier of the Workflow Run. - schema: - type: string - responses: - "200": - description: A Workflow Run object. - content: - application/json: - schema: - $ref: ../schemas/workflow_runs/workflow_run.yaml - default: - $ref: ../responses/default_error.yaml - + workflow_run: post: summary: Create a Workflow Run. operationId: create_workflow_run @@ -52,7 +32,70 @@ $ref: ../schemas/workflow_runs/workflow_run.yaml default: $ref: ../responses/default_error.yaml + get: + summary: List Workflow Runs. + operationId: list_workflow_runs + parameters: + - name: page + in: query + description: The number of the page to be retrieved. If not specified, defaults to 1. + schema: + type: integer + default: 1 + - name: status + in: query + description: A list of comma separated status values to filter the results. Possible values are 'processing', 'awaiting_input', 'approved', 'declined', 'review', 'abandoned' and 'error'. + schema: + type: string + - name: created_at_gt + in: query + description: A ISO-8601 date to filter results with a created date greater than (after) the one provided. + schema: + type: string + format: date-time + - name: created_at_lt + in: query + description: A ISO-8601 date to filter results with a created date less than (before) the one provided. + schema: + type: string + format: date-time + - name: sort + in: query + description: A string with the value 'desc' or 'asc' that allows to sort the returned list by the completed datetime either descending or ascending, respectively. If not specified, defaults to 'desc'. + schema: + type: string + default: desc + responses: + "200": + description: An array of Workflow Run objects matching the query parameters. + content: + application/json: + schema: + $ref: ../schemas/workflow_runs/workflow_runs_list.yaml + default: + $ref: ../responses/default_error.yaml + workflow_runs: + get: + summary: A single workflow run can be retrieved by calling this endpoint with the unique identifier of the Workflow Run. + operationId: retrieve_workflow_run + parameters: + - name: workflow_run_id + in: path + required: true + description: The unique identifier of the Workflow Run. + schema: + type: string + responses: + "200": + description: A Workflow Run object. + content: + application/json: + schema: + $ref: ../schemas/workflow_runs/workflow_run.yaml + default: + $ref: ../responses/default_error.yaml + tasks: get: summary: The tasks of a Workflow can be retrieved by calling this endpoint with the unique identifier of the Workflow Run. diff --git a/schemas/workflow_runs/workflow_runs_list.yaml b/schemas/workflow_runs/workflow_runs_list.yaml new file mode 100644 index 00000000..63c519e2 --- /dev/null +++ b/schemas/workflow_runs/workflow_runs_list.yaml @@ -0,0 +1,6 @@ + type: object + properties: + workflow_runs: + type: array + items: + $ref: workflow_run.yaml