From a52474115eb597b9b99499b97e0ff1859ef17b34 Mon Sep 17 00:00:00 2001 From: dazzatronus Date: Wed, 6 May 2026 20:09:22 +1000 Subject: [PATCH] refactor: remove Create API and implement per-API spec splitting --- build-docs.sh | 14 +- build-sdks.sh | 7 - paths/generateasset.yaml | 34 -- paths/generateassetid.yaml | 28 -- schemas/create/didGeneratedAsset.yaml | 18 - schemas/create/didGeneratedAssetOptions.yaml | 17 - schemas/create/didTextToAvatarOptions.yaml | 30 -- schemas/create/elevenlabsGeneratedAsset.yaml | 18 - .../elevenlabsGeneratedAssetOptions.yaml | 17 - .../create/elevenlabsTextToSpeechOptions.yaml | 30 -- schemas/create/generatedAsset.yaml | 15 - schemas/create/heygenGeneratedAsset.yaml | 18 - .../create/heygenGeneratedAssetOptions.yaml | 17 - schemas/create/heygenTextToAvatarOptions.yaml | 267 --------------- schemas/create/openaiGeneratedAsset.yaml | 18 - .../create/openaiGeneratedAssetOptions.yaml | 17 - .../create/openaiTextGeneratorOptions.yaml | 31 -- .../generatedAssetErrorResponse.yaml | 11 - .../generatedAssetErrorResponseData.yaml | 18 - .../responses/generatedAssetResponse.yaml | 12 - .../generatedAssetResponseAttributes.yaml | 46 --- .../responses/generatedAssetResponseData.yaml | 19 -- schemas/create/shotstackGeneratedAsset.yaml | 17 - .../shotstackGeneratedAssetOptions.yaml | 17 - .../create/shotstackImageToVideoOptions.yaml | 30 -- .../create/shotstackTextGeneratorOptions.yaml | 15 - .../create/shotstackTextToImageOptions.yaml | 23 -- .../create/shotstackTextToSpeechOptions.yaml | 312 ------------------ schemas/create/stabilityAiGeneratedAsset.yaml | 18 - .../stabilityAiGeneratedAssetOptions.yaml | 17 - .../create/stabilityAiTextToImageOptions.yaml | 101 ------ scripts/split-by-api.cjs | 59 ++++ 32 files changed, 65 insertions(+), 1246 deletions(-) delete mode 100644 paths/generateasset.yaml delete mode 100644 paths/generateassetid.yaml delete mode 100644 schemas/create/didGeneratedAsset.yaml delete mode 100644 schemas/create/didGeneratedAssetOptions.yaml delete mode 100644 schemas/create/didTextToAvatarOptions.yaml delete mode 100644 schemas/create/elevenlabsGeneratedAsset.yaml delete mode 100644 schemas/create/elevenlabsGeneratedAssetOptions.yaml delete mode 100644 schemas/create/elevenlabsTextToSpeechOptions.yaml delete mode 100644 schemas/create/generatedAsset.yaml delete mode 100644 schemas/create/heygenGeneratedAsset.yaml delete mode 100644 schemas/create/heygenGeneratedAssetOptions.yaml delete mode 100644 schemas/create/heygenTextToAvatarOptions.yaml delete mode 100644 schemas/create/openaiGeneratedAsset.yaml delete mode 100644 schemas/create/openaiGeneratedAssetOptions.yaml delete mode 100644 schemas/create/openaiTextGeneratorOptions.yaml delete mode 100644 schemas/create/responses/generatedAssetErrorResponse.yaml delete mode 100644 schemas/create/responses/generatedAssetErrorResponseData.yaml delete mode 100644 schemas/create/responses/generatedAssetResponse.yaml delete mode 100644 schemas/create/responses/generatedAssetResponseAttributes.yaml delete mode 100644 schemas/create/responses/generatedAssetResponseData.yaml delete mode 100644 schemas/create/shotstackGeneratedAsset.yaml delete mode 100644 schemas/create/shotstackGeneratedAssetOptions.yaml delete mode 100644 schemas/create/shotstackImageToVideoOptions.yaml delete mode 100644 schemas/create/shotstackTextGeneratorOptions.yaml delete mode 100644 schemas/create/shotstackTextToImageOptions.yaml delete mode 100644 schemas/create/shotstackTextToSpeechOptions.yaml delete mode 100644 schemas/create/stabilityAiGeneratedAsset.yaml delete mode 100644 schemas/create/stabilityAiGeneratedAssetOptions.yaml delete mode 100644 schemas/create/stabilityAiTextToImageOptions.yaml create mode 100644 scripts/split-by-api.cjs diff --git a/build-docs.sh b/build-docs.sh index 0041a89..4fe0154 100755 --- a/build-docs.sh +++ b/build-docs.sh @@ -2,14 +2,17 @@ DOCS_DIR=build/docs OAS3_YAML=api.oas3.yaml -OAS3_JSON=api.oas3.json +OAS3_JSON=$DOCS_DIR/api.bundled.json mkdir -p $DOCS_DIR # Validate OpenAPI 3.0 YAML ./node_modules/.bin/swagger-cli validate $OAS3_YAML # Resolve YAML files in to one master JSON file -./node_modules/.bin/swagger-cli bundle -o $OAS3_JSON $OAS3_YAML +./node_modules/.bin/swagger-cli bundle -o $OAS3_JSON $OAS3_YAML -t json + +# Split bundled spec into per-API JSON files (api.edit.json, api.serve.json, api.ingest.json) +node scripts/split-by-api.cjs $OAS3_JSON $DOCS_DIR # Convert OpenAPI to doc to Shins Markdown ./node_modules/.bin/widdershins \ @@ -20,13 +23,9 @@ mkdir -p $DOCS_DIR cp $DOCS_DIR/index.html.md .shins/source/index.html.md -# Replace Create, Serve, Ingest API URL's as overrides do not work +# Replace Serve, Ingest API URL's as overrides do not work sed -i -e 's/https:\/\/api.shotstack.io\/edit\/{version}\/assets/https:\/\/api.shotstack.io\/serve\/{version}\/assets/g' .shins/source/index.html.md sed -i -e 's/https:\/\/api.shotstack.io\/edit\/{version}\/sources/https:\/\/api.shotstack.io\/ingest\/{version}\/sources/g' .shins/source/index.html.md -sed -i -e 's/https:\/\/api.shotstack.io\/edit\/{version}\/createassets/https:\/\/api.shotstack.io\/create\/{version}\/assets/g' .shins/source/index.html.md - -# Openapi doesn't support duplicate path mapping -sed -i -e 's/\/path_alias_createassets/\/assets/g' .shins/source/index.html.md # Build the Shins docs HTML cd .shins @@ -51,4 +50,3 @@ if [ -f .tags ]; then fi rm -f ./$DOCS_DIR/index.html.md -rm -f $OAS3_JSON diff --git a/build-sdks.sh b/build-sdks.sh index 29531a6..d6c6c94 100755 --- a/build-sdks.sh +++ b/build-sdks.sh @@ -101,13 +101,6 @@ $OPENAPI_GENERATOR generate -i $SPEC_FILE_JSON -g python -c $CONFIGS_DIR/python. printf "\n========================================= \n" printf "\nPython SDK Generated\n\n" -# Openapi doesn't support duplicate path mapping -sed -i -e 's/\/path_alias_createassets/\/assets/g' $BUILD_DIR/node/dist/api/CreateApi.js -sed -i -e 's/\/path_alias_createassets/\/assets/g' $BUILD_DIR/typescript/api/createApi.ts -sed -i -e 's/\/path_alias_createassets/\/assets/g' $BUILD_DIR/php/src/Api/CreateApi.php -sed -i -e 's/\/path_alias_createassets/\/assets/g' $BUILD_DIR/python/shotstack_sdk/api/create_api.py -sed -i -e 's/\/path_alias_createassets/\/assets/g' $BUILD_DIR/ruby/lib/shotstack/api/create_api.rb - # Revert back to stable version $OPENAPI_GENERATOR version-manager set $OPENAPI_GENERATOR_VERSION_STABLE diff --git a/paths/generateasset.yaml b/paths/generateasset.yaml deleted file mode 100644 index 4b14864..0000000 --- a/paths/generateasset.yaml +++ /dev/null @@ -1,34 +0,0 @@ -post: - description: | - Generate an asset using a Shotstack or third party provider. Chose the provider, type of asset and provide prompts, - inputs and options to generate the asset. Once generated the asset can be used with the [Edit](#tocs_edit) API or - downloaded. - - **Base URL:** https://api.shotstack.io/create/{version} - summary: Generate Asset - operationId: postGenerateAsset - requestBody: - description: >- - Generate an asset using the specified provider, type and options. - content: - application/json: - schema: - $ref: "../schemas/create/generatedAsset.yaml#/GeneratedAsset" - required: true - responses: - "201": - description: The generated asset details - content: - application/json: - schema: - $ref: "../schemas/create/responses/generatedAssetResponse.yaml#/GeneratedAssetResponse" - "400": - description: A list of validation and other errors - content: - application/json: - schema: - $ref: "../schemas/create/responses/generatedAssetErrorResponse.yaml#/GeneratedAssetErrorResponse" - security: - - DeveloperKey: [] - tags: - - Create diff --git a/paths/generateassetid.yaml b/paths/generateassetid.yaml deleted file mode 100644 index 933af85..0000000 --- a/paths/generateassetid.yaml +++ /dev/null @@ -1,28 +0,0 @@ -get: - description: | - Get the generated assets status, url and details by ID. - - **Base URL:** https://api.shotstack.io/create/{version} - summary: Get Generated Asset - operationId: getGeneratedAsset - responses: - "200": - description: The generated asset details - content: - application/json: - schema: - $ref: "../schemas/create/responses/generatedAssetResponse.yaml#/GeneratedAssetResponse" - security: - - DeveloperKey: [] - tags: - - Create - -parameters: - - name: id - in: path - required: true - schema: - pattern: >- - ^[0-9a-zA-Z]{8}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{12}$ - type: string - description: The id of the source file in [KSUID](https://github.com/segmentio/ksuid#what-is-a-ksuid) format. diff --git a/schemas/create/didGeneratedAsset.yaml b/schemas/create/didGeneratedAsset.yaml deleted file mode 100644 index 3316a21..0000000 --- a/schemas/create/didGeneratedAsset.yaml +++ /dev/null @@ -1,18 +0,0 @@ -DIDGeneratedAsset: - description: >- - Generate assets using D-ID. D-ID provide a text-to-avatar service. The D-ID provider works on a bring-your-own-key - basis, credentials are required and must be added via the - [dashboard](https://dashboard.shotstack.io/integrations/d-id), not in the request. - type: object - properties: - provider: - type: string - description: The name of the provider - set to `d-id` for D-ID. - enum: ["d-id"] - default: d-id - options: - description: Options and configuration for the D-ID text-to-avatar service. - $ref: "./didGeneratedAssetOptions.yaml#/DIDGeneratedAssetOptions" - required: - - provider - - options diff --git a/schemas/create/didGeneratedAssetOptions.yaml b/schemas/create/didGeneratedAssetOptions.yaml deleted file mode 100644 index 8338983..0000000 --- a/schemas/create/didGeneratedAssetOptions.yaml +++ /dev/null @@ -1,17 +0,0 @@ -DIDGeneratedAssetOptions: - type: object - description: >- - Generate assets using the third party D-ID provider AI services. - - - The following AI generation services are available: - - oneOf: - - $ref: "./didTextToAvatarOptions.yaml#/DIDTextToAvatarOptions" - discriminator: - propertyName: type - mapping: - text-to-avatar: "#/components/schemas/DIDTextToAvatarOptions" - additionalProperties: false diff --git a/schemas/create/didTextToAvatarOptions.yaml b/schemas/create/didTextToAvatarOptions.yaml deleted file mode 100644 index 1773627..0000000 --- a/schemas/create/didTextToAvatarOptions.yaml +++ /dev/null @@ -1,30 +0,0 @@ -DIDTextToAvatarOptions: - description: >- - Options for the D-ID text-to-avatar service. Set the text to be converted to an avatar and configure the avatar and - background. The output will be generated as an MP4 video file. - properties: - type: - type: string - description: The type of asset to generate - set to `text-to-avatar` for text-to-avatar. - enum: ["text-to-avatar"] - text: - type: string - description: The text or script that the avatar will narrate. - example: "I am an avatar generated by D-ID using a text prompt" - avatar: - type: string - description: >- - The avatar character to generate. Select from the list of available avatars: - - enum: ["jack", "lana", "lily", "matt", "rian"] - background: - type: string - description: The background color of the video. - example: "#ffffff" - required: ["type", "text", "avatar"] diff --git a/schemas/create/elevenlabsGeneratedAsset.yaml b/schemas/create/elevenlabsGeneratedAsset.yaml deleted file mode 100644 index c0dd517..0000000 --- a/schemas/create/elevenlabsGeneratedAsset.yaml +++ /dev/null @@ -1,18 +0,0 @@ -ElevenLabsGeneratedAsset: - description: >- - Generate assets using ElevenLabs. ElevenLabs provide a text-to-speech service. The ElevenLabs provider works on a - bring-your-own-key basis, credentials are required and must be added via the - [dashboard](https://dashboard.shotstack.io/integrations/elevenlabs), not in the request. - type: object - properties: - provider: - type: string - description: The name of the provider - set to `elevenlabs` for ElevenLabs. - enum: ["elevenlabs"] - default: elevenlabs - options: - description: Options and configuration for the ElevenLabs text-to-speech service. - $ref: "./elevenlabsGeneratedAssetOptions.yaml#/ElevenLabsGeneratedAssetOptions" - required: - - provider - - options \ No newline at end of file diff --git a/schemas/create/elevenlabsGeneratedAssetOptions.yaml b/schemas/create/elevenlabsGeneratedAssetOptions.yaml deleted file mode 100644 index c88b822..0000000 --- a/schemas/create/elevenlabsGeneratedAssetOptions.yaml +++ /dev/null @@ -1,17 +0,0 @@ -ElevenLabsGeneratedAssetOptions: - type: object - description: >- - Generate assets using the third party ElevenLabs provider AI services. - - - The following AI generation services are available: - - oneOf: - - $ref: "./elevenlabsTextToSpeechOptions.yaml#/ElevenLabsTextToSpeechOptions" - discriminator: - propertyName: type - mapping: - text-to-speech: "#/components/schemas/ElevenLabsTextToSpeechOptions" - additionalProperties: false diff --git a/schemas/create/elevenlabsTextToSpeechOptions.yaml b/schemas/create/elevenlabsTextToSpeechOptions.yaml deleted file mode 100644 index 8a98fb1..0000000 --- a/schemas/create/elevenlabsTextToSpeechOptions.yaml +++ /dev/null @@ -1,30 +0,0 @@ -ElevenLabsTextToSpeechOptions: - description: >- - Options for the ElevenLabs text-to-speech service. Set the text to be converted to speech and choose a voice to set - the speaking style. The output will be generated as an MP3 audio file available at the URL returned in the response. - properties: - type: - type: string - description: The type of asset to generate - set to `text-to-speech` for text-to-speech. - enum: ["text-to-speech"] - text: - type: string - description: The text to convert to speech. - example: "This is a text to speech example generated by ElevenLabs" - voice: - type: string - description: >- - The voice to use for the text-to-speech conversion. Select a voice from the list of available voices: - - enum: ["Adam", "Antoni", "Arnold", "Bella", "Domi", "Elli", "Josh", "Rachel", "Sam"] - required: ["type", "text", "voice"] diff --git a/schemas/create/generatedAsset.yaml b/schemas/create/generatedAsset.yaml deleted file mode 100644 index 61b0907..0000000 --- a/schemas/create/generatedAsset.yaml +++ /dev/null @@ -1,15 +0,0 @@ -GeneratedAsset: - type: object - description: >- - A generated asset is a media asset created by the Create API. You can use native or third party providers - to generate video, audio and image files using Generative AI services like text-to-speech and text-to-avatar. - discriminator: - propertyName: provider - oneOf: - - $ref: "./shotstackGeneratedAsset.yaml#/ShotstackGeneratedAsset" - - $ref: "./didGeneratedAsset.yaml#/DIDGeneratedAsset" - - $ref: "./elevenlabsGeneratedAsset.yaml#/ElevenLabsGeneratedAsset" - - $ref: "./heygenGeneratedAsset.yaml#/HeyGenGeneratedAsset" - - $ref: "./openaiGeneratedAsset.yaml#/OpenAiGeneratedAsset" - - $ref: "./stabilityAiGeneratedAsset.yaml#/StabilityAiGeneratedAsset" - additionalProperties: false diff --git a/schemas/create/heygenGeneratedAsset.yaml b/schemas/create/heygenGeneratedAsset.yaml deleted file mode 100644 index 4bc5c34..0000000 --- a/schemas/create/heygenGeneratedAsset.yaml +++ /dev/null @@ -1,18 +0,0 @@ -HeyGenGeneratedAsset: - description: >- - Generate assets using HeyGen. HeyGen provide a text-to-avatar service. The HeyGen provider works on a - bring-your-own-key basis, credentials are required and must be added via the - [dashboard](https://dashboard.shotstack.io/integrations/heygen), not in the request. - type: object - properties: - provider: - type: string - description: The name of the provider - set to `heygen` for HeyGen. - enum: ["heygen"] - default: heygen - options: - description: Options and configuration for the HeyGen text-to-avatar service. - $ref: "./heygenGeneratedAssetOptions.yaml#/HeyGenGeneratedAssetOptions" - required: - - provider - - options diff --git a/schemas/create/heygenGeneratedAssetOptions.yaml b/schemas/create/heygenGeneratedAssetOptions.yaml deleted file mode 100644 index b1158fa..0000000 --- a/schemas/create/heygenGeneratedAssetOptions.yaml +++ /dev/null @@ -1,17 +0,0 @@ -HeyGenGeneratedAssetOptions: - type: object - description: >- - Generate assets using the third party HeyGen provider AI services. - - - The following AI generation services are available: - - oneOf: - - $ref: "./heygenTextToAvatarOptions.yaml#/HeyGenTextToAvatarOptions" - discriminator: - propertyName: type - mapping: - text-to-avatar: "#/components/schemas/HeyGenTextToAvatarOptions" - additionalProperties: false diff --git a/schemas/create/heygenTextToAvatarOptions.yaml b/schemas/create/heygenTextToAvatarOptions.yaml deleted file mode 100644 index 099aa2b..0000000 --- a/schemas/create/heygenTextToAvatarOptions.yaml +++ /dev/null @@ -1,267 +0,0 @@ -HeyGenTextToAvatarOptions: - description: >- - Options for the HeyGen text-to-avatar service. Set the text to be converted to an avatar and configure the avatars - voice, speaking style, appearance and background. The output will be generated as an MP4 video file available at the - URL returned in the response. - properties: - type: - type: string - description: The type of asset to generate - set to `text-to-avatar` for text-to-avatar. - enum: ["text-to-avatar"] - text: - type: string - description: The text or script that the avatar will narrate. - example: "I am an avatar generated by HeyGen using a text prompt" - avatar: - type: string - description: >- - The avatar character to generate. Select from the list of available avatars: - - enum: - [ - "Angela", - "Bill", - "Daisy", - "Derek", - "Eva", - "Jake", - "Jeff", - "Jerome", - "Joon", - "Kayla", - "Kent", - "Luna", - "Mark", - "Matthew", - "Monica", - "Peter", - "Selina", - "Tanya", - "Thomas", - "Tina", - "Tyler", - "Vanessa", - "Vera", - "Wilson", - "Zoey", - ] - voice: - type: string - description: >- - The avatars voice and speaking style. Select from the list of available voices: - - enum: - [ - "Abbi - Natural", - "Adam - Natural", - "Aiston - Friendly", - "Alice - Newscaster", - "Alison - Cheerful", - "Amber - Friendly", - "Amy - Warm", - "Ana - Cheerful", - "Antoni - Friendly", - "Aria - Newscaster", - "Arnold - Cheerful", - "Arthur - Natural", - "Bella - Friendly", - "Belle - Natural", - "Brandon - Warm", - "Brian - Natural", - "Bruce - Natural", - "Cerise - Cheerful", - "Christopher - Calm", - "Clara - Professional", - "Connor - Natural", - "Dahlia - Friendly", - "Davis - Professional", - "Dean - Natural", - "Delbert - Cheerful", - "Edward - Friendly", - "Elaine - Calm", - "Emily - Natural", - "Emma - Newscaster", - "Eric - Newscaster", - "Grace - Natural", - "Hailey - Calm", - "Indira - Cheerful", - "Isabella - Cheerful", - "Jacob - Natural", - "Jahmai - Friendly", - "Jane - Serious", - "Jason - Serious", - "Jelle - Friendly", - "Jen - Natural", - "Jenny - Professional", - "Jodi - Cheerful", - "Joey - Calm", - "Johan - Friendly", - "Josie - Cheerful", - "Keanan - Natural", - "Keith - Cheerful", - "Kellie - Friendly", - "Lauren - Friendly", - "Leah - Natural", - "Liam - Professional", - "Libby - Natural", - "Lily - Professional", - "Lucas - Natural", - "Luke - Professional", - "Luna - Natural", - "Marieke - Natural", - "Matthew - Professional", - "Michelle - Natural", - "Mitchell - Natural", - "Molly - Newscaster", - "Monica - Calm", - "Natasha - Professional", - "Neerja - Newscaster", - "Noah - Serious", - "Oliver - Newscaster", - "Olivia - Calm", - "Paul - Natural", - "Prabhat - Natural", - "Raveena - Natural", - "Rudi - Friendly", - "Ryan - Professional", - "Sam - Natural", - "Sara - Cheerful", - "Sherry - Friendly", - "Sonia - Warm", - "Thomas - Natural", - "Todd - Professional", - "Tony - Professional", - "Tracy - Cheerful", - "Wayne - Natural", - "Wilder - Natural", - "Wille - Natural", - "William - Friendly", - ] - avatarStyle: - type: string - description: The display style of the avatar, a rectangle `normal` or circular `circle` background. Defaults to `normal`. - enum: ["normal", "circle"] - background: - type: string - description: The background color of the video. Defaults to `#ffffff`. - example: "#ffffff" - ratio: - type: string - description: The aspect ratio of the video, `16:9` horizontal or `9:16` vertical. Defaults to `16:9`. - enum: ["16:9", "9:16"] - test: - type: boolean - description: A boolean flag indicating whether the video is for testing purposes. See the "test" parameter in [HeyGen](https://docs.heygen.com/reference/generate-video) for more details. - example: true - required: ["type", "text", "avatar", "voice"] diff --git a/schemas/create/openaiGeneratedAsset.yaml b/schemas/create/openaiGeneratedAsset.yaml deleted file mode 100644 index 1b4b581..0000000 --- a/schemas/create/openaiGeneratedAsset.yaml +++ /dev/null @@ -1,18 +0,0 @@ -OpenAiGeneratedAsset: - description: >- - Generate assets using OpenAI. OpenAI provide a text generation service using ChatGPT 3.5 and 4. The OpenAI provider - works on a bring-your-own-key basis, credentials are required and must be added via the - [dashboard](https://dashboard.shotstack.io/integrations/openai), not in the request. - type: object - properties: - provider: - type: string - description: The name of the provider - set to `openai` for OpenAI. - enum: ["openai"] - default: openai - options: - description: Options and configuration for the OpenAI text-generator service. - $ref: "./openaiGeneratedAssetOptions.yaml#/OpenAiGeneratedAssetOptions" - required: - - provider - - options diff --git a/schemas/create/openaiGeneratedAssetOptions.yaml b/schemas/create/openaiGeneratedAssetOptions.yaml deleted file mode 100644 index 104e5de..0000000 --- a/schemas/create/openaiGeneratedAssetOptions.yaml +++ /dev/null @@ -1,17 +0,0 @@ -OpenAiGeneratedAssetOptions: - type: object - description: >- - Generate assets using OpenAI provider AI services. - - - The following AI generation services are available: - - oneOf: - - $ref: "./openaiTextGeneratorOptions.yaml#/OpenAiTextGeneratorOptions" - discriminator: - propertyName: type - mapping: - text-generator: "#/components/schemas/OpenAiTextGeneratorOptions" - additionalProperties: false diff --git a/schemas/create/openaiTextGeneratorOptions.yaml b/schemas/create/openaiTextGeneratorOptions.yaml deleted file mode 100644 index d014cdf..0000000 --- a/schemas/create/openaiTextGeneratorOptions.yaml +++ /dev/null @@ -1,31 +0,0 @@ -OpenAiTextGeneratorOptions: - description: >- - Options for the OpenAI text-generator service. Set a text prompt that will be used to generate a new body of - text. The output will be generated as a text (txt) file available at the URL returned in the response. - properties: - type: - type: string - description: The type of asset to generate - set to `text-generator` for text generation. - enum: ["text-generator"] - default: text-generator - prompt: - type: string - description: The text prompt to generate text from. - example: Generate a short script for a 15 second video describing the benefits of the Shotstack API - model: - type: string - description: >- - The model to use for generating the text. Select from the list of available models: - - enum: ['gpt-3.5-turbo', 'gpt-4'] - example: gpt-4 - systemPrompt: - type: string - description: >- - The system prompt to use for generating the text. This is an optional prompt that can be used to provide context - or additional information to the model. - example: You are a professional script writer and film maker - required: ["type", "prompt", "model"] diff --git a/schemas/create/responses/generatedAssetErrorResponse.yaml b/schemas/create/responses/generatedAssetErrorResponse.yaml deleted file mode 100644 index e50ed35..0000000 --- a/schemas/create/responses/generatedAssetErrorResponse.yaml +++ /dev/null @@ -1,11 +0,0 @@ -GeneratedAssetErrorResponse: - type: object - description: >- - Error response data for validation and other errors returned by the Create API. - properties: - errors: - description: An array of errors. - type: array - items: - $ref: "./generatedAssetErrorResponseData.yaml#/GeneratedAssetErrorResponseData" - required: ["errors"] diff --git a/schemas/create/responses/generatedAssetErrorResponseData.yaml b/schemas/create/responses/generatedAssetErrorResponseData.yaml deleted file mode 100644 index 1f8d918..0000000 --- a/schemas/create/responses/generatedAssetErrorResponseData.yaml +++ /dev/null @@ -1,18 +0,0 @@ -GeneratedAssetErrorResponseData: - type: object - description: >- - Individual errors returned by the Create API. - properties: - status: - description: The http status code. - type: string - example: 400 - title: - description: A short summary of the error. - type: string - example: 'Bad Request' - detail: - description: A detailed description of the error. - type: string - example: "\"body/options/text\" is required." - required: ["status", "title", "detail"] diff --git a/schemas/create/responses/generatedAssetResponse.yaml b/schemas/create/responses/generatedAssetResponse.yaml deleted file mode 100644 index 62bf565..0000000 --- a/schemas/create/responses/generatedAssetResponse.yaml +++ /dev/null @@ -1,12 +0,0 @@ -GeneratedAssetResponse: - description: >- - The response returned by the Create API [generate asset](#generate-asset) and - [get generated asset](#get-generated-asset) requests. Includes status and details of the generated asset. The - response follows the [json:api](https://jsonapi.org/) specification. - properties: - data: - description: A generated asset resource. - $ref: "./generatedAssetResponseData.yaml#/GeneratedAssetResponseData" - required: - - data - type: object diff --git a/schemas/create/responses/generatedAssetResponseAttributes.yaml b/schemas/create/responses/generatedAssetResponseAttributes.yaml deleted file mode 100644 index 748cf7c..0000000 --- a/schemas/create/responses/generatedAssetResponseAttributes.yaml +++ /dev/null @@ -1,46 +0,0 @@ -GeneratedAssetResponseAttributes: - description: The id and attributes of the generated asset. - properties: - owner: - description: The owner id of the asset. - type: string - example: 5ca6hu7s9k - provider: - description: >- - The native or third party provider that generated the asset, `shotstack`, `elevenlabs`, `heygen` or - `d-id`. - type: string - enum: ["shotstack", "elevenlabs", "heygen", "d-id"] - type: - description: The type of service used to generate the asset, `text-to-speech` or `text-to-avatar`. - type: string - enum: ["text-to-speech", "text-to-avatar"] - url: - description: >- - The URL of the asset file hosted by Shotstack. The file at the URL can be used by the Edit API. Generated asset - file URL's consist of a base URL (AWS bucket), owner id, asset id and extension. The extension varies depending - on the type of file generated. - type: string - example: https://shotstack-create-api-v1-assets.s3.amazonaws.com/5ca6hu7s9k/01gz0-tj679-xj30t-hr8zk-3hasvk.mp3 - status: - description: >- - The status of the asset file generation task. - - type: string - enum: ["queued", "processing", "saving", "done", "failed"] - example: done - created: - description: The time the generate asset task was initially queued. - type: string - example: "2023-01-02T01:47:18.973Z" - updated: - description: The time the asset status was last updated. - type: string - example: "2023-01-02T01:47:37.260Z" - required: ["owner", "provider", "type", "status", "created", "updated"] diff --git a/schemas/create/responses/generatedAssetResponseData.yaml b/schemas/create/responses/generatedAssetResponseData.yaml deleted file mode 100644 index 36a3585..0000000 --- a/schemas/create/responses/generatedAssetResponseData.yaml +++ /dev/null @@ -1,19 +0,0 @@ -GeneratedAssetResponseData: - description: The type of resource (an asset), it's id and attributes of the generated file. - properties: - type: - description: The type of resource, in this case it is an asset. - type: string - example: asset - id: - description: The generated asset id. - type: string - example: 01gz0-tj679-xj30t-hr8zk-3hasvk - attributes: - description: The generated asset attributes including its url, status, provider, type, etc... - $ref: "./generatedAssetResponseAttributes.yaml#/GeneratedAssetResponseAttributes" - required: - - type - - id - - attributes - type: object diff --git a/schemas/create/shotstackGeneratedAsset.yaml b/schemas/create/shotstackGeneratedAsset.yaml deleted file mode 100644 index 8607cd9..0000000 --- a/schemas/create/shotstackGeneratedAsset.yaml +++ /dev/null @@ -1,17 +0,0 @@ -ShotstackGeneratedAsset: - description: >- - Generate assets using the native Shotstack provider. Shotstack provides a text-to-speech and a text-to-image service. - The Shotstack provider works natively with your existing API key, no additional credentials are required. - type: object - properties: - provider: - type: string - description: The name of the provider - set to `shotstack` for Shotstack. - enum: ["shotstack"] - default: shotstack - options: - description: Options and configuration for the native Shotstack services. - $ref: "./shotstackGeneratedAssetOptions.yaml#/ShotstackGeneratedAssetOptions" - required: - - provider - - options diff --git a/schemas/create/shotstackGeneratedAssetOptions.yaml b/schemas/create/shotstackGeneratedAssetOptions.yaml deleted file mode 100644 index 016c358..0000000 --- a/schemas/create/shotstackGeneratedAssetOptions.yaml +++ /dev/null @@ -1,17 +0,0 @@ -ShotstackGeneratedAssetOptions: - type: object - description: >- - Generate assets using the native Shotstack provider AI services. - oneOf: - - $ref: "./shotstackTextToSpeechOptions.yaml#/ShotstackTextToSpeechOptions" - - $ref: "./shotstackTextToImageOptions.yaml#/ShotstackTextToImageOptions" - - $ref: "./shotstackTextGeneratorOptions.yaml#/ShotstackTextGeneratorOptions" - - $ref: "./shotstackImageToVideoOptions.yaml#/ShotstackImageToVideoOptions" - discriminator: - propertyName: type - mapping: - text-to-speech: "#/components/schemas/ShotstackTextToSpeechOptions" - text-to-image: "#/components/schemas/ShotstackTextToImageOptions" - image-to-video: "#/components/schemas/ShotstackImageToVideoOptions" - text-generator: "#/components/schemas/ShotstackTextToImageOptions" - additionalProperties: false diff --git a/schemas/create/shotstackImageToVideoOptions.yaml b/schemas/create/shotstackImageToVideoOptions.yaml deleted file mode 100644 index 65668bc..0000000 --- a/schemas/create/shotstackImageToVideoOptions.yaml +++ /dev/null @@ -1,30 +0,0 @@ -ShotstackImageToVideoOptions: - description: >- - Options for the Shotstack image-to-video service. Set the URL of an image to convert in to a video. The output will - be generated as an MP4 file available at the URL returned in the response. - properties: - type: - type: string - description: The type of asset to generate - set to `image-to-video` for image-to-video. - enum: ["image-to-video"] - default: image-to-video - imageUrl: - type: string - description: >- - The URL of the image to convert to video. The URL must be publicly accessible or include credentials. The image - dimensions must exactly match one of the following: 1024px x 576px, 576px x 1024px or 768px x 768px. - example: https://s3-ap-northeast-1.amazonaws.com/my-bucket/image.jpg - guidanceScale: - type: number - description: >- - The guidance scale determines how closely the generated video will match the image. Lower numbers allow for more - creative freedom. A number between 0 and 10. - example: 1.8 - default: 1.8 - motion: - type: integer - description: >- - The amount of motion in the video. A number between 1 and 255. - example: 127 - default: 127 - required: ["type", "imageUrl"] diff --git a/schemas/create/shotstackTextGeneratorOptions.yaml b/schemas/create/shotstackTextGeneratorOptions.yaml deleted file mode 100644 index d260cb6..0000000 --- a/schemas/create/shotstackTextGeneratorOptions.yaml +++ /dev/null @@ -1,15 +0,0 @@ -ShotstackTextGeneratorOptions: - description: >- - Options for the Shotstack text-generator service. Set a text prompt that will be used to generate a new body of - text. The output will be generated as a text (txt) file available at the URL returned in the response. - properties: - type: - type: string - description: The type of asset to generate - set to `text-generator` for text generation. - enum: ["text-generator"] - default: text-generator - prompt: - type: string - description: The text prompt to generate text from. - example: Generate a short script for a 15 second video describing the benefits of the Shotstack API - required: ["type", "prompt"] diff --git a/schemas/create/shotstackTextToImageOptions.yaml b/schemas/create/shotstackTextToImageOptions.yaml deleted file mode 100644 index 30c9910..0000000 --- a/schemas/create/shotstackTextToImageOptions.yaml +++ /dev/null @@ -1,23 +0,0 @@ -ShotstackTextToImageOptions: - description: >- - Options for the Shotstack text-to-image service. Set a text prompt to generate an image from. The output will be - generated as a PNG file available at the URL returned in the response. - properties: - type: - type: string - description: The type of asset to generate - set to `text-to-image` for text-to-image. - enum: ["text-to-image"] - default: text-to-image - prompt: - type: string - description: The text prompt to generate an image from. - example: A detailed photograph of Mars, showcasing its orange-red surface - width: - type: integer - description: The width of the image in pixels. - example: 512 - height: - type: integer - description: The height of the image in pixels. - example: 512 - required: ["type", "prompt", "width", "height"] diff --git a/schemas/create/shotstackTextToSpeechOptions.yaml b/schemas/create/shotstackTextToSpeechOptions.yaml deleted file mode 100644 index 1db8c9b..0000000 --- a/schemas/create/shotstackTextToSpeechOptions.yaml +++ /dev/null @@ -1,312 +0,0 @@ -ShotstackTextToSpeechOptions: - description: >- - Options for the Shotstack text-to-speech service. Set the text to be converted to speech and choose a voice to set - the speaking style. The output will be generated as an MP3 audio file available at the URL returned in the response. - properties: - type: - type: string - description: The type of asset to generate - set to `text-to-speech` for text-to-speech. - enum: ["text-to-speech"] - default: text-to-speech - text: - type: string - description: The text to convert to speech. - example: "This is a text to speech example generated by Shotstack" - voice: - type: string - description: >- - The voice to use for the text-to-speech conversion. You must pair the correct voice with the correct language. - For each language there is a language code that must be set in the `language` property. The voice must be - available for the language code or the conversion will fail. i.e. To use the voice `Zeina` for Arabic you must - set the `language` to `arb`. - - Select a voice from the list of available voices, the language code is in brackets: - - example: Matthew - enum: - [ - "Hala", - "Lisa", - "Arlet", - "Hiujin", - "Zhiyu", - "Sofie", - "Laura", - "Olivia", - "Amy", - "Emma", - "Brian", - "Arthur", - "Kajal", - "Niamh", - "Aria", - "Ayanda", - "Ivy", - "Joanna", - "Kendra", - "Kimberly", - "Salli", - "Joey", - "Justin", - "Kevin", - "Matthew", - "Ruth", - "Stephen", - "Suvi", - "Léa", - "Rémi", - "Gabrielle", - "Liam", - "Vicki", - "Daniel", - "Hannah", - "Kajal", - "Bianca", - "Adriano", - "Takumi", - "Kazuha", - "Tomoko", - "Seoyeon", - "Ida", - "Ola", - "Camila", - "Vitória", - "Vitoria", - "Thiago", - "Inês", - "Ines", - "Lucia", - "Sergio", - "Mia", - "Andrés", - "Lupe", - "Pedro", - "Elin", - ] - language: - type: string - description: >- - The language code for the text-to-speech conversion. You must pair the correct language with the correct voice - (see voice parameter above). - - Select a language from the list of available languages: - - enum: - [ - "cmn-CN", - "da-DK", - "de-DE", - "en-AU", - "en-GB", - "en-IN", - "en-US", - "es-ES", - "es-MX", - "es-US", - "fr-CA", - "fr-FR", - "it-IT", - "ja-JP", - "hi-IN", - "ko-KR", - "nb-NO", - "nl-NL", - "pl-PL", - "pt-BR", - "pt-PT", - "sv-SE", - "en-NZ", - "en-ZA", - "ca-ES", - "de-AT", - "yue-CN", - "ar-AE", - "fi-FI", - ] - default: "en-US" - newscaster: - type: boolean - description: >- - Set the voice to newscaster mode.

- *Only Matthew and Joanna for US English (en-US), Lupe for US Spanish (es-US), and Amy for British English (en-GB) are available in the newscaster voice. - default: false - required: ["type", "text", "voice"] diff --git a/schemas/create/stabilityAiGeneratedAsset.yaml b/schemas/create/stabilityAiGeneratedAsset.yaml deleted file mode 100644 index 94499c5..0000000 --- a/schemas/create/stabilityAiGeneratedAsset.yaml +++ /dev/null @@ -1,18 +0,0 @@ -StabilityAiGeneratedAsset: - description: >- - Generate assets using Stability AI. Stability AI provide a text-to-image service using Stable Diffusion. The - Stability AI provider works on a bring-your-own-key basis, credentials are required and must be added via the - [dashboard](https://dashboard.shotstack.io/integrations/stability-ai), not in the request. - type: object - properties: - provider: - type: string - description: The name of the provider - set to `stability-ai` for Stability AI. - enum: ["stability-ai"] - default: stability-ai - options: - description: Options and configuration for the Stability AI text-to-image service. - $ref: "./stabilityAiGeneratedAssetOptions.yaml#/StabilityAiGeneratedAssetOptions" - required: - - provider - - options diff --git a/schemas/create/stabilityAiGeneratedAssetOptions.yaml b/schemas/create/stabilityAiGeneratedAssetOptions.yaml deleted file mode 100644 index 51b2378..0000000 --- a/schemas/create/stabilityAiGeneratedAssetOptions.yaml +++ /dev/null @@ -1,17 +0,0 @@ -StabilityAiGeneratedAssetOptions: - type: object - description: >- - Generate assets using Stability AI provider AI services. - - - The following AI generation services are available: - - oneOf: - - $ref: "./stabilityAiTextToImageOptions.yaml#/StabilityAiTextToImageOptions" - discriminator: - propertyName: type - mapping: - text-to-image: "#/components/schemas/StabilityAiTextToImageOptions" - additionalProperties: false diff --git a/schemas/create/stabilityAiTextToImageOptions.yaml b/schemas/create/stabilityAiTextToImageOptions.yaml deleted file mode 100644 index baf7b8e..0000000 --- a/schemas/create/stabilityAiTextToImageOptions.yaml +++ /dev/null @@ -1,101 +0,0 @@ -StabilityAiTextToImageOptions: - description: >- - Options for the Stability AI text-to-image service. Set a text prompt to generate an image from plus other engine - and configuration options. The output will be generated as a JPG file available at the URL returned in the response. - properties: - type: - type: string - description: The type of asset to generate - set to `text-to-image` for text-to-image. - enum: ["text-to-image"] - default: text-to-image - prompt: - type: string - description: The text prompt to generate an image from. - example: A detailed photograph of Mars, showcasing its orange-red surface - engine: - type: string - description: >- - The engine (model) to use for generating the image. Select from the list of available engines: - - enum: [ - 'stable-diffusion-xl-1024-v0-9', - 'stable-diffusion-xl-1024-v1-0', - 'stable-diffusion-v1-6', - 'stable-diffusion-512-v2-1', - 'stable-diffusion-xl-beta-v2-2-2' - ] - default: stable-diffusion-xl-1024-v1-0 - example: stable-diffusion-xl-1024-v1-0 - width: - type: integer - description: The width of the image in pixels. Must be divisible by 64. - example: 512 - height: - type: integer - description: The height of the image in pixels. Must be divisible by 64. - example: 512 - steps: - type: integer - description: The number of iterative diffusion steps to run. A number between 10 and 50. - example: 30 - default: 30 - seed: - type: integer - description: Using the same seed can help you create images that look similar. Set to 0 for a random seed. A number between 0 and 4294967295. - example: 0 - default: 0 - cfgScale: - type: number - description: Determines how closely the generated image will match the prompt. Lower numbers allow for more creative freedom. A number between 0 and 35. - example: 7 - default: 7 - stylePreset: - type: string - description: >- - Apply a preset to generate an image in a particular style. Select from the list of available presets: - - enum: [ - '3d-model', - 'analog-film', - 'anime', - 'cinematic', - 'comic-book', - 'digital-art', - 'enhance', - 'fantasy-art', - 'isometric', - 'line-art', - 'low-poly', - 'modeling-compound', - 'neon-punk', - 'origami', - 'photographic', - 'pixel-art', - 'tile-texture' - ] - example: photographic - required: ["type", "prompt", "width", "height"] diff --git a/scripts/split-by-api.cjs b/scripts/split-by-api.cjs new file mode 100644 index 0000000..a2068a7 --- /dev/null +++ b/scripts/split-by-api.cjs @@ -0,0 +1,59 @@ +#!/usr/bin/env node +/** + * Splits a bundled OpenAPI spec into per-API JSON files by tag. + * + * Usage: node scripts/split-by-api.cjs + * + * Produces api.edit.json, api.serve.json, api.ingest.json — each containing only + * paths/operations tagged for that API, with the servers and tags arrays trimmed + * accordingly. Components are kept whole (no unused-ref pruning) for safety. + */ + +const fs = require('fs'); +const path = require('path'); + +const [, , inputFile, outputDir] = process.argv; +if (!inputFile || !outputDir) { + console.error('Usage: split-by-api.cjs '); + process.exit(1); +} + +const APIS = [ + { tag: 'Edit', file: 'api.edit.json', urlSegment: '/edit/' }, + { tag: 'Serve', file: 'api.serve.json', urlSegment: '/serve/' }, + { tag: 'Ingest', file: 'api.ingest.json', urlSegment: '/ingest/' }, +]; + +const spec = JSON.parse(fs.readFileSync(inputFile, 'utf8')); + +const isOperation = (value) => + value && typeof value === 'object' && Array.isArray(value.tags); + +for (const { tag, file, urlSegment } of APIS) { + const filtered = JSON.parse(JSON.stringify(spec)); + + filtered.paths = Object.fromEntries( + Object.entries(filtered.paths).flatMap(([pathKey, pathItem]) => { + const kept = Object.fromEntries( + Object.entries(pathItem).filter( + ([, op]) => isOperation(op) && op.tags.includes(tag), + ), + ); + return Object.keys(kept).length > 0 ? [[pathKey, kept]] : []; + }), + ); + + if (Array.isArray(filtered.servers)) { + filtered.servers = filtered.servers.filter( + (s) => typeof s.url === 'string' && s.url.includes(urlSegment), + ); + } + + if (Array.isArray(filtered.tags)) { + filtered.tags = filtered.tags.filter((t) => t.name === tag); + } + + const outputPath = path.join(outputDir, file); + fs.writeFileSync(outputPath, JSON.stringify(filtered, null, 2)); + console.log(`Wrote ${file} (${Object.keys(filtered.paths).length} paths)`); +}