From 2273d864c9949a293b77765015ffb2a652ee9747 Mon Sep 17 00:00:00 2001 From: jellejurre Date: Sun, 6 Oct 2024 22:11:29 +0200 Subject: [PATCH] Add jams api --- openapi/components/codeSamples/system.yaml | 15 ++++ openapi/components/parameters.yaml | 10 ++- openapi/components/paths.yaml | 6 ++ openapi/components/paths/system.yaml | 69 +++++++++++++++++++ .../responses/system/JamListResponse.yaml | 7 ++ .../responses/system/JamNotFoundError.yaml | 11 +++ .../responses/system/JamResponse.yaml | 5 ++ .../system/SubmissionListResponse.yaml | 7 ++ openapi/components/schemas/Jam.yaml | 67 ++++++++++++++++++ openapi/components/schemas/Submission.yaml | 34 +++++++++ 10 files changed, 230 insertions(+), 1 deletion(-) create mode 100644 openapi/components/responses/system/JamListResponse.yaml create mode 100644 openapi/components/responses/system/JamNotFoundError.yaml create mode 100644 openapi/components/responses/system/JamResponse.yaml create mode 100644 openapi/components/responses/system/SubmissionListResponse.yaml create mode 100644 openapi/components/schemas/Jam.yaml create mode 100644 openapi/components/schemas/Submission.yaml diff --git a/openapi/components/codeSamples/system.yaml b/openapi/components/codeSamples/system.yaml index 0ee65163..f4082445 100644 --- a/openapi/components/codeSamples/system.yaml +++ b/openapi/components/codeSamples/system.yaml @@ -8,6 +8,21 @@ - lang: cURL source: >- curl -X GET "https://vrchat.com/api/1/infoPush?require={string}&include={string}" +/jams: + get: + - lang: cURL + source: >- + curl -X GET "https://vrchat.com/api/1/jams?isActive={bool}&type={string}" +/jams/{jamId}: + get: + - lang: cURL + source: >- + curl -X GET "https://vrchat.com/api/1/jams/{jamId}" +/jams/{jamId}/submissions: + get: + - lang: cURL + source: >- + curl -X GET "https://vrchat.com/api/1/jams/{jamId}/submissions" /css/app.css: get: - lang: cURL diff --git a/openapi/components/parameters.yaml b/openapi/components/parameters.yaml index f1477708..3f7fdd7a 100644 --- a/openapi/components/parameters.yaml +++ b/openapi/components/parameters.yaml @@ -363,4 +363,12 @@ fuzzy: in: query required: false schema: - type: boolean \ No newline at end of file + type: boolean +jamId: + name: jamId + in: path + required: true + schema: + type: string + example: jam_0b7e3f6d-4647-4648-b2a1-1431e76906d9 + description: Must be a valid query ID. \ No newline at end of file diff --git a/openapi/components/paths.yaml b/openapi/components/paths.yaml index cdd2711e..fc7cb0fc 100644 --- a/openapi/components/paths.yaml +++ b/openapi/components/paths.yaml @@ -208,6 +208,12 @@ $ref: "./paths/system.yaml#/paths/~1config" "/infoPush": $ref: "./paths/system.yaml#/paths/~1infoPush" +"/jams": + $ref: "./paths/system.yaml#/paths/~1jams" +"/jams/{jamId}": + $ref: "./paths/system.yaml#/paths/~1jams~1{jamId}" +"/jams/{jamId}/submissions": + $ref: "./paths/system.yaml#/paths/~1jams~1{jamId}~1submissions" "/css/app.css": $ref: "./paths/system.yaml#/paths/~1css~1app.css" "/js/app.js": diff --git a/openapi/components/paths/system.yaml b/openapi/components/paths/system.yaml index 39acd8eb..ffa536aa 100644 --- a/openapi/components/paths/system.yaml +++ b/openapi/components/paths/system.yaml @@ -27,6 +27,75 @@ paths: x-badges: - color: gold label: 'Status: Early Access (Still Under Development)' + /jams: + get: + summary: Show jams list + tags: + - system + x-codeSamples: + $ref: "../codeSamples/system.yaml#/~1jams/get" + responses: + '200': + $ref: ../responses/system/JamListResponse.yaml + security: + - authCookie: [] + operationId: getJams + description: |- + Lists World Jams or Avatar Jams, both currently running and ones that have ended. + + `isActive` is used to select only active or already ended jams. + + `type` is used to select only world or avatar jams, and can only take `world` or `avatar`. + `` + parameters: + - schema: + type: boolean + example: false + in: query + name: isActive + description: 'Only show jams that are currently active or have already ended.' + - schema: + type: string + example: avatar + in: query + name: type + description: 'Only show jams of this type (`avatar` or `world`).' + /jams/{jamId}: + parameters: + - $ref: ../parameters.yaml#/jamId + get: + summary: Show jam information + tags: + - system + x-codeSamples: + $ref: "../codeSamples/system.yaml#/~1jams~1{jamId}/get" + responses: + '200': + $ref: ../responses/system/JamResponse.yaml + '404': + $ref: ../responses/system/JamNotFoundError.yaml + security: + - authCookie: [] + operationId: getJam + description: Returns a jam. + /jams/{jamId}/submissions: + parameters: + - $ref: ../parameters.yaml#/jamId + get: + summary: Show jam submissions + tags: + - system + x-codeSamples: + $ref: "../codeSamples/system.yaml#/~1jams~1{jamId}~1submissions/get" + responses: + '200': + $ref: ../responses/system/SubmissionListResponse.yaml + '404': + $ref: ../responses/system/JamNotFoundError.yaml + security: + - authCookie: [] + operationId: getJamSubmissions + description: Returns all submissions of a jam. /health: get: summary: Check API Health diff --git a/openapi/components/responses/system/JamListResponse.yaml b/openapi/components/responses/system/JamListResponse.yaml new file mode 100644 index 00000000..cb51fb1c --- /dev/null +++ b/openapi/components/responses/system/JamListResponse.yaml @@ -0,0 +1,7 @@ +description: Returns a list of Jam objects. +content: + application/json: + schema: + type: array + items: + $ref: ../../schemas/Jam.yaml \ No newline at end of file diff --git a/openapi/components/responses/system/JamNotFoundError.yaml b/openapi/components/responses/system/JamNotFoundError.yaml new file mode 100644 index 00000000..be5b6ae3 --- /dev/null +++ b/openapi/components/responses/system/JamNotFoundError.yaml @@ -0,0 +1,11 @@ +description: Error response when trying to show information about a non-existent jam. +content: + application/json: + schema: + $ref: ../../schemas/Error.yaml + examples: + 404 Jam not found: + value: + error: + message: "404 id must be an ID˸ 'invalid_id_here'" + status_code: 404 \ No newline at end of file diff --git a/openapi/components/responses/system/JamResponse.yaml b/openapi/components/responses/system/JamResponse.yaml new file mode 100644 index 00000000..e6790e9b --- /dev/null +++ b/openapi/components/responses/system/JamResponse.yaml @@ -0,0 +1,5 @@ +description: Returns a Jam object. +content: + application/json: + schema: + $ref: ../../schemas/Jam.yaml \ No newline at end of file diff --git a/openapi/components/responses/system/SubmissionListResponse.yaml b/openapi/components/responses/system/SubmissionListResponse.yaml new file mode 100644 index 00000000..7e9e1600 --- /dev/null +++ b/openapi/components/responses/system/SubmissionListResponse.yaml @@ -0,0 +1,7 @@ +description: Returns a list of Submission objects. +content: + application/json: + schema: + type: array + items: + $ref: ../../schemas/Submission.yaml \ No newline at end of file diff --git a/openapi/components/schemas/Jam.yaml b/openapi/components/schemas/Jam.yaml new file mode 100644 index 00000000..ac52d8c4 --- /dev/null +++ b/openapi/components/schemas/Jam.yaml @@ -0,0 +1,67 @@ +description: '' +properties: + description: + minLength: 1 + type: string + id: + type: string + minLength: 1 + example: jam_0b7e3f6d-4647-4648-b2a1-1431e76906d9 + isVisible: + type: boolean + moreInfo: + type: string + minLength: 1 + state: + type: string + minLength: 1 + description: |- + One of: + - submissions_open + - closed + stateChangeDates: + type: object + properties: + closed: + type: string + format: date-time + nullable: true + submissionsClosed: + type: string + format: date-time + nullable: true + submissionsOpened: + type: string + format: date-time + nullable: true + winnersSelected: + type: string + format: date-time + nullable: true + example: null + submissionContentGateDate: + type: string + format: date-time + nullable: true + submissionContentGated: + type: boolean + title: + type: string + minLength: 1 + updated_at: + type: string + format: date-time +required: + - description + - id + - isVisible + - moreInfo + - state + - stateChangeDates + - submissionContentGateDate + - submissionContentGated + - title + - type + - updated_at +title: Jam +type: object \ No newline at end of file diff --git a/openapi/components/schemas/Submission.yaml b/openapi/components/schemas/Submission.yaml new file mode 100644 index 00000000..1b12f804 --- /dev/null +++ b/openapi/components/schemas/Submission.yaml @@ -0,0 +1,34 @@ +description: '' +properties: + contentId: + minLength: 1 + type: string + description: Either world ID or avatar ID + created_at: + type: string + format: date-time + description: + type: string + id: + type: string + minLength: 1 + example: jsub_f01f44fa-89fa-443c-ab4c-7fed9245970f + jamId: + type: string + minLength: 1 + example: jam_0b7e3f6d-4647-4648-b2a1-1431e76906d9 + ratingScore: + type: integer + minimum: 0 + submitterId: + $ref: ../schemas/UserID.yaml +required: + - contentId + - created_at + - description + - id + - jamId + - ratingsScore + - submitterId +title: Submission +type: object \ No newline at end of file