From c39050f34ea083681bbc34fd19aa764ec45e9e17 Mon Sep 17 00:00:00 2001 From: Bernard Gawor Date: Mon, 6 Jul 2026 12:56:44 +0200 Subject: [PATCH 1/7] FCE-3523 regenerate fishjam-openapi with typescript-fetch to drop axios --- packages/fishjam-openapi/openapi.sh | 29 +- packages/fishjam-openapi/openapitools.json | 2 +- packages/fishjam-openapi/package.json | 3 - .../fishjam-openapi/src/generated/.gitignore | 4 - .../fishjam-openapi/src/generated/.npmignore | 1 - .../src/generated/.openapi-generator/FILES | 62 +- .../src/generated/.openapi-generator/VERSION | 2 +- packages/fishjam-openapi/src/generated/api.ts | 2811 ----------------- .../src/generated/apis/CredentialsApi.ts | 61 + .../src/generated/apis/MoQApi.ts | 79 + .../src/generated/apis/RoomsApi.ts | 538 ++++ .../src/generated/apis/StreamersApi.ts | 194 ++ .../src/generated/apis/StreamsApi.ts | 222 ++ .../src/generated/apis/TrackForwardingsApi.ts | 91 + .../src/generated/apis/ViewersApi.ts | 194 ++ .../src/generated/apis/index.ts | 9 + .../fishjam-openapi/src/generated/base.ts | 86 - .../fishjam-openapi/src/generated/common.ts | 150 - .../src/generated/configuration.ts | 110 - .../fishjam-openapi/src/generated/git_push.sh | 57 - .../fishjam-openapi/src/generated/index.ts | 19 +- .../src/generated/models/AgentOutput.ts | 90 + .../src/generated/models/AudioFormat.ts | 52 + .../src/generated/models/AudioSampleRate.ts | 53 + .../src/generated/models/CompositionInfo.ts | 83 + .../src/generated/models/ModelError.ts | 66 + .../src/generated/models/MoqAccess.ts | 75 + .../src/generated/models/MoqAccessConfig.ts | 73 + .../src/generated/models/Peer.ts | 158 + .../src/generated/models/PeerConfig.ts | 92 + .../generated/models/PeerDetailsResponse.ts | 74 + .../models/PeerDetailsResponseData.ts | 91 + .../src/generated/models/PeerOptions.ts | 91 + .../src/generated/models/PeerOptionsAgent.ts | 90 + .../src/generated/models/PeerOptionsVapi.ts | 93 + .../src/generated/models/PeerOptionsWebRTC.ts | 83 + .../models/PeerRefreshTokenResponse.ts | 74 + .../models/PeerRefreshTokenResponseData.ts | 66 + .../src/generated/models/PeerStatus.ts | 53 + .../src/generated/models/PeerType.ts | 54 + .../src/generated/models/Room.ts | 114 + .../src/generated/models/RoomConfig.ts | 122 + .../models/RoomCreateDetailsResponse.ts | 74 + .../models/RoomCreateDetailsResponseData.ts | 74 + .../generated/models/RoomDetailsResponse.ts | 74 + .../src/generated/models/RoomType.ts | 57 + .../generated/models/RoomsListingResponse.ts | 74 + .../src/generated/models/Stream.ts | 116 + .../src/generated/models/StreamConfig.ts | 89 + .../generated/models/StreamDetailsResponse.ts | 74 + .../src/generated/models/Streamer.ts | 95 + .../models/StreamerDetailsResponse.ts | 74 + .../src/generated/models/StreamerToken.ts | 66 + .../models/StreamsListingResponse.ts | 74 + .../src/generated/models/SubscribeMode.ts | 53 + .../models/SubscribeTracksRequest.ts | 66 + .../src/generated/models/Subscriptions.ts | 75 + .../src/generated/models/Track.ts | 91 + .../src/generated/models/TrackForwarding.ts | 74 + .../generated/models/TrackForwardingInfo.ts | 91 + .../src/generated/models/TrackType.ts | 53 + .../src/generated/models/VideoCodec.ts | 53 + .../src/generated/models/Viewer.ts | 75 + .../generated/models/ViewerDetailsResponse.ts | 74 + .../src/generated/models/ViewerToken.ts | 66 + .../src/generated/models/index.ts | 46 + .../fishjam-openapi/src/generated/runtime.ts | 432 +++ 67 files changed, 5405 insertions(+), 3256 deletions(-) delete mode 100644 packages/fishjam-openapi/src/generated/.gitignore delete mode 100644 packages/fishjam-openapi/src/generated/.npmignore delete mode 100644 packages/fishjam-openapi/src/generated/api.ts create mode 100644 packages/fishjam-openapi/src/generated/apis/CredentialsApi.ts create mode 100644 packages/fishjam-openapi/src/generated/apis/MoQApi.ts create mode 100644 packages/fishjam-openapi/src/generated/apis/RoomsApi.ts create mode 100644 packages/fishjam-openapi/src/generated/apis/StreamersApi.ts create mode 100644 packages/fishjam-openapi/src/generated/apis/StreamsApi.ts create mode 100644 packages/fishjam-openapi/src/generated/apis/TrackForwardingsApi.ts create mode 100644 packages/fishjam-openapi/src/generated/apis/ViewersApi.ts create mode 100644 packages/fishjam-openapi/src/generated/apis/index.ts delete mode 100644 packages/fishjam-openapi/src/generated/base.ts delete mode 100644 packages/fishjam-openapi/src/generated/common.ts delete mode 100644 packages/fishjam-openapi/src/generated/configuration.ts delete mode 100644 packages/fishjam-openapi/src/generated/git_push.sh create mode 100644 packages/fishjam-openapi/src/generated/models/AgentOutput.ts create mode 100644 packages/fishjam-openapi/src/generated/models/AudioFormat.ts create mode 100644 packages/fishjam-openapi/src/generated/models/AudioSampleRate.ts create mode 100644 packages/fishjam-openapi/src/generated/models/CompositionInfo.ts create mode 100644 packages/fishjam-openapi/src/generated/models/ModelError.ts create mode 100644 packages/fishjam-openapi/src/generated/models/MoqAccess.ts create mode 100644 packages/fishjam-openapi/src/generated/models/MoqAccessConfig.ts create mode 100644 packages/fishjam-openapi/src/generated/models/Peer.ts create mode 100644 packages/fishjam-openapi/src/generated/models/PeerConfig.ts create mode 100644 packages/fishjam-openapi/src/generated/models/PeerDetailsResponse.ts create mode 100644 packages/fishjam-openapi/src/generated/models/PeerDetailsResponseData.ts create mode 100644 packages/fishjam-openapi/src/generated/models/PeerOptions.ts create mode 100644 packages/fishjam-openapi/src/generated/models/PeerOptionsAgent.ts create mode 100644 packages/fishjam-openapi/src/generated/models/PeerOptionsVapi.ts create mode 100644 packages/fishjam-openapi/src/generated/models/PeerOptionsWebRTC.ts create mode 100644 packages/fishjam-openapi/src/generated/models/PeerRefreshTokenResponse.ts create mode 100644 packages/fishjam-openapi/src/generated/models/PeerRefreshTokenResponseData.ts create mode 100644 packages/fishjam-openapi/src/generated/models/PeerStatus.ts create mode 100644 packages/fishjam-openapi/src/generated/models/PeerType.ts create mode 100644 packages/fishjam-openapi/src/generated/models/Room.ts create mode 100644 packages/fishjam-openapi/src/generated/models/RoomConfig.ts create mode 100644 packages/fishjam-openapi/src/generated/models/RoomCreateDetailsResponse.ts create mode 100644 packages/fishjam-openapi/src/generated/models/RoomCreateDetailsResponseData.ts create mode 100644 packages/fishjam-openapi/src/generated/models/RoomDetailsResponse.ts create mode 100644 packages/fishjam-openapi/src/generated/models/RoomType.ts create mode 100644 packages/fishjam-openapi/src/generated/models/RoomsListingResponse.ts create mode 100644 packages/fishjam-openapi/src/generated/models/Stream.ts create mode 100644 packages/fishjam-openapi/src/generated/models/StreamConfig.ts create mode 100644 packages/fishjam-openapi/src/generated/models/StreamDetailsResponse.ts create mode 100644 packages/fishjam-openapi/src/generated/models/Streamer.ts create mode 100644 packages/fishjam-openapi/src/generated/models/StreamerDetailsResponse.ts create mode 100644 packages/fishjam-openapi/src/generated/models/StreamerToken.ts create mode 100644 packages/fishjam-openapi/src/generated/models/StreamsListingResponse.ts create mode 100644 packages/fishjam-openapi/src/generated/models/SubscribeMode.ts create mode 100644 packages/fishjam-openapi/src/generated/models/SubscribeTracksRequest.ts create mode 100644 packages/fishjam-openapi/src/generated/models/Subscriptions.ts create mode 100644 packages/fishjam-openapi/src/generated/models/Track.ts create mode 100644 packages/fishjam-openapi/src/generated/models/TrackForwarding.ts create mode 100644 packages/fishjam-openapi/src/generated/models/TrackForwardingInfo.ts create mode 100644 packages/fishjam-openapi/src/generated/models/TrackType.ts create mode 100644 packages/fishjam-openapi/src/generated/models/VideoCodec.ts create mode 100644 packages/fishjam-openapi/src/generated/models/Viewer.ts create mode 100644 packages/fishjam-openapi/src/generated/models/ViewerDetailsResponse.ts create mode 100644 packages/fishjam-openapi/src/generated/models/ViewerToken.ts create mode 100644 packages/fishjam-openapi/src/generated/models/index.ts create mode 100644 packages/fishjam-openapi/src/generated/runtime.ts diff --git a/packages/fishjam-openapi/openapi.sh b/packages/fishjam-openapi/openapi.sh index b9d14040..b60e8f7d 100755 --- a/packages/fishjam-openapi/openapi.sh +++ b/packages/fishjam-openapi/openapi.sh @@ -1,24 +1,35 @@ #!/bin/sh # Usage: -# sh openapi.sh main -# sh openapi.sh v0.1.0 +# sh openapi.sh main +# sh openapi.sh v0.1.0 +# sh openapi.sh path/to/openapi.yaml set -e ROOTDIR=$(dirname "$(readlink -f $0)") if [ -z "$1" ]; then - echo "Missing a tag or a branch name as the first argument" 1>&2 - exit 1 -elif [ -z "$2" ]; then - echo "Missing github token as as second argument" 1>&2 + echo "Missing a tag/branch name or a local spec file path as the first argument" 1>&2 exit 1 fi -echo "Generating code for $1...\n" + +if [ -f "$1" ]; then + SPEC=$(readlink -f "$1") + echo "Generating code from local spec $SPEC...\n" +else + if [ -z "$2" ]; then + echo "Missing github token as the second argument" 1>&2 + exit 1 + fi + SPEC="https://raw.githubusercontent.com/fishjam-cloud/fishjam/refs/heads/$1/openapi.yaml?token=$2" + echo "Generating code for $1...\n" +fi cd $ROOTDIR \ && npx @openapitools/openapi-generator-cli generate \ - -i https://raw.githubusercontent.com/fishjam-cloud/fishjam/refs/heads/$1/openapi.yaml?token=$2 \ - -g typescript-axios \ + -i "$SPEC" \ + -g typescript-fetch \ + --additional-properties=modelPropertyNaming=original \ + --reserved-words-mappings public=public \ -o ./src/generated diff --git a/packages/fishjam-openapi/openapitools.json b/packages/fishjam-openapi/openapitools.json index f227cf2d..a82623d6 100644 --- a/packages/fishjam-openapi/openapitools.json +++ b/packages/fishjam-openapi/openapitools.json @@ -2,6 +2,6 @@ "$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json", "spaces": 2, "generator-cli": { - "version": "7.7.0" + "version": "7.14.0" } } diff --git a/packages/fishjam-openapi/package.json b/packages/fishjam-openapi/package.json index c90436cc..024515d8 100644 --- a/packages/fishjam-openapi/package.json +++ b/packages/fishjam-openapi/package.json @@ -42,8 +42,5 @@ "@openapitools/openapi-generator-cli": "^2.18.4", "tsup": "^8.4.0" }, - "dependencies": { - "axios": "^1.7.9" - }, "stableVersion": "0.28.1" } diff --git a/packages/fishjam-openapi/src/generated/.gitignore b/packages/fishjam-openapi/src/generated/.gitignore deleted file mode 100644 index 149b5765..00000000 --- a/packages/fishjam-openapi/src/generated/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -wwwroot/*.js -node_modules -typings -dist diff --git a/packages/fishjam-openapi/src/generated/.npmignore b/packages/fishjam-openapi/src/generated/.npmignore deleted file mode 100644 index 999d88df..00000000 --- a/packages/fishjam-openapi/src/generated/.npmignore +++ /dev/null @@ -1 +0,0 @@ -# empty npmignore to ensure all required files (e.g., in the dist folder) are published by npm \ No newline at end of file diff --git a/packages/fishjam-openapi/src/generated/.openapi-generator/FILES b/packages/fishjam-openapi/src/generated/.openapi-generator/FILES index a80cd4f0..10bccc7e 100644 --- a/packages/fishjam-openapi/src/generated/.openapi-generator/FILES +++ b/packages/fishjam-openapi/src/generated/.openapi-generator/FILES @@ -1,8 +1,56 @@ -.gitignore -.npmignore -api.ts -base.ts -common.ts -configuration.ts -git_push.sh +.openapi-generator-ignore +apis/CredentialsApi.ts +apis/MoQApi.ts +apis/RoomsApi.ts +apis/StreamersApi.ts +apis/StreamsApi.ts +apis/TrackForwardingsApi.ts +apis/ViewersApi.ts +apis/index.ts index.ts +models/AgentOutput.ts +models/AudioFormat.ts +models/AudioSampleRate.ts +models/CompositionInfo.ts +models/ModelError.ts +models/MoqAccess.ts +models/MoqAccessConfig.ts +models/Peer.ts +models/PeerConfig.ts +models/PeerDetailsResponse.ts +models/PeerDetailsResponseData.ts +models/PeerOptions.ts +models/PeerOptionsAgent.ts +models/PeerOptionsVapi.ts +models/PeerOptionsWebRTC.ts +models/PeerRefreshTokenResponse.ts +models/PeerRefreshTokenResponseData.ts +models/PeerStatus.ts +models/PeerType.ts +models/Room.ts +models/RoomConfig.ts +models/RoomCreateDetailsResponse.ts +models/RoomCreateDetailsResponseData.ts +models/RoomDetailsResponse.ts +models/RoomType.ts +models/RoomsListingResponse.ts +models/Stream.ts +models/StreamConfig.ts +models/StreamDetailsResponse.ts +models/Streamer.ts +models/StreamerDetailsResponse.ts +models/StreamerToken.ts +models/StreamsListingResponse.ts +models/SubscribeMode.ts +models/SubscribeTracksRequest.ts +models/Subscriptions.ts +models/Track.ts +models/TrackForwarding.ts +models/TrackForwardingInfo.ts +models/TrackType.ts +models/VideoCodec.ts +models/Viewer.ts +models/ViewerDetailsResponse.ts +models/ViewerToken.ts +models/index.ts +runtime.ts diff --git a/packages/fishjam-openapi/src/generated/.openapi-generator/VERSION b/packages/fishjam-openapi/src/generated/.openapi-generator/VERSION index 1985849f..e465da43 100644 --- a/packages/fishjam-openapi/src/generated/.openapi-generator/VERSION +++ b/packages/fishjam-openapi/src/generated/.openapi-generator/VERSION @@ -1 +1 @@ -7.7.0 +7.14.0 diff --git a/packages/fishjam-openapi/src/generated/api.ts b/packages/fishjam-openapi/src/generated/api.ts deleted file mode 100644 index 0bd8c88b..00000000 --- a/packages/fishjam-openapi/src/generated/api.ts +++ /dev/null @@ -1,2811 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Fishjam API - * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) - * - * The version of the OpenAPI document: 0.28.0 - * Contact: contact@fishjam.io - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -import type { Configuration } from './configuration'; -import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios'; -import globalAxios from 'axios'; -// Some imports not used depending on template conditions -// @ts-ignore -import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from './common'; -import type { RequestArgs } from './base'; -// @ts-ignore -import { BASE_PATH, COLLECTION_FORMATS, BaseAPI, RequiredError, operationServerMap } from './base'; - -/** - * Output audio options - * @export - * @interface AgentOutput - */ -export interface AgentOutput { - /** - * - * @type {AudioFormat} - * @memberof AgentOutput - */ - 'audioFormat'?: AudioFormat; - /** - * - * @type {AudioSampleRate} - * @memberof AgentOutput - */ - 'audioSampleRate'?: AudioSampleRate; -} - - -/** - * The format of the output audio - * @export - * @enum {string} - */ - -export const AudioFormat = { - Pcm16: 'pcm16' -} as const; - -export type AudioFormat = typeof AudioFormat[keyof typeof AudioFormat]; - - -/** - * The sample rate of the output audio - * @export - * @enum {string} - */ - -export const AudioSampleRate = { - NUMBER_16000: 16000, - NUMBER_24000: 24000 -} as const; - -export type AudioSampleRate = typeof AudioSampleRate[keyof typeof AudioSampleRate]; - - -/** - * Composition and track forwarding state for the room - * @export - * @interface CompositionInfo - */ -export interface CompositionInfo { - /** - * URL of the active composition - * @type {string} - * @memberof CompositionInfo - */ - 'compositionUrl': string; - /** - * List of active track forwardings - * @type {Array} - * @memberof CompositionInfo - */ - 'forwardings': Array; -} -/** - * Error message - * @export - * @interface ModelError - */ -export interface ModelError { - /** - * Error details - * @type {string} - * @memberof ModelError - */ - 'errors': string; -} -/** - * Connection details for a MoQ relay client - * @export - * @interface MoqAccess - */ -export interface MoqAccess { - /** - * Relay connection URL with the JWT embedded as a `?jwt=` query parameter. Pass directly to a MoQ client SDK. - * @type {string} - * @memberof MoqAccess - */ - 'connection_url': string; - /** - * JWT authorizing the MoQ relay connection, also embedded in `connection_url` - * @type {string} - * @memberof MoqAccess - */ - 'token': string; -} -/** - * MoQ access configuration - * @export - * @interface MoqAccessConfig - */ -export interface MoqAccessConfig { - /** - * Path under the root the token grants publish access to - * @type {string} - * @memberof MoqAccessConfig - */ - 'publishPath'?: string | null; - /** - * Path under the root the token grants subscribe access to - * @type {string} - * @memberof MoqAccessConfig - */ - 'subscribePath'?: string | null; -} -/** - * Describes peer status - * @export - * @interface Peer - */ -export interface Peer { - /** - * Assigned peer id - * @type {string} - * @memberof Peer - */ - 'id': string; - /** - * Custom metadata set by the peer - * @type {object} - * @memberof Peer - */ - 'metadata': object | null; - /** - * - * @type {PeerStatus} - * @memberof Peer - */ - 'status': PeerStatus; - /** - * - * @type {SubscribeMode} - * @memberof Peer - */ - 'subscribeMode': SubscribeMode; - /** - * - * @type {Subscriptions} - * @memberof Peer - */ - 'subscriptions': Subscriptions; - /** - * List of all peer\'s tracks - * @type {Array} - * @memberof Peer - */ - 'tracks': Array; - /** - * - * @type {PeerType} - * @memberof Peer - */ - 'type': PeerType; -} - - -/** - * Peer configuration - * @export - * @interface PeerConfig - */ -export interface PeerConfig { - /** - * - * @type {PeerOptions} - * @memberof PeerConfig - */ - 'options': PeerOptions; - /** - * - * @type {PeerType} - * @memberof PeerConfig - */ - 'type': PeerType; -} - - -/** - * Response containing peer details and their token - * @export - * @interface PeerDetailsResponse - */ -export interface PeerDetailsResponse { - /** - * - * @type {PeerDetailsResponseData} - * @memberof PeerDetailsResponse - */ - 'data': PeerDetailsResponseData; -} -/** - * - * @export - * @interface PeerDetailsResponseData - */ -export interface PeerDetailsResponseData { - /** - * - * @type {Peer} - * @memberof PeerDetailsResponseData - */ - 'peer': Peer; - /** - * Websocket URL to which peer has to connect - * @type {string} - * @memberof PeerDetailsResponseData - */ - 'peer_websocket_url'?: string; - /** - * Token for authorizing websocket connection - * @type {string} - * @memberof PeerDetailsResponseData - */ - 'token': string; -} -/** - * @type PeerOptions - * Peer-specific options - * @export - */ -export type PeerOptions = PeerOptionsAgent | PeerOptionsVapi | PeerOptionsWebRTC; - -/** - * Options specific to the Agent peer - * @export - * @interface PeerOptionsAgent - */ -export interface PeerOptionsAgent { - /** - * - * @type {AgentOutput} - * @memberof PeerOptionsAgent - */ - 'output'?: AgentOutput; - /** - * - * @type {SubscribeMode} - * @memberof PeerOptionsAgent - */ - 'subscribeMode'?: SubscribeMode; -} - - -/** - * Options specific to the VAPI peer - * @export - * @interface PeerOptionsVapi - */ -export interface PeerOptionsVapi { - /** - * VAPI API key - * @type {string} - * @memberof PeerOptionsVapi - */ - 'apiKey': string; - /** - * VAPI call ID - * @type {string} - * @memberof PeerOptionsVapi - */ - 'callId': string; - /** - * - * @type {SubscribeMode} - * @memberof PeerOptionsVapi - */ - 'subscribeMode'?: SubscribeMode; -} - - -/** - * Options specific to the WebRTC peer - * @export - * @interface PeerOptionsWebRTC - */ -export interface PeerOptionsWebRTC { - /** - * Custom peer metadata - * @type {{ [key: string]: any; }} - * @memberof PeerOptionsWebRTC - */ - 'metadata'?: { [key: string]: any; }; - /** - * - * @type {SubscribeMode} - * @memberof PeerOptionsWebRTC - */ - 'subscribeMode'?: SubscribeMode; -} - - -/** - * Response containing new peer token - * @export - * @interface PeerRefreshTokenResponse - */ -export interface PeerRefreshTokenResponse { - /** - * - * @type {PeerRefreshTokenResponseData} - * @memberof PeerRefreshTokenResponse - */ - 'data': PeerRefreshTokenResponseData; -} -/** - * - * @export - * @interface PeerRefreshTokenResponseData - */ -export interface PeerRefreshTokenResponseData { - /** - * Token for authorizing websocket connection - * @type {string} - * @memberof PeerRefreshTokenResponseData - */ - 'token': string; -} -/** - * Informs about the peer status - * @export - * @enum {string} - */ - -export const PeerStatus = { - Connected: 'connected', - Disconnected: 'disconnected' -} as const; - -export type PeerStatus = typeof PeerStatus[keyof typeof PeerStatus]; - - -/** - * Peer type - * @export - * @enum {string} - */ - -export const PeerType = { - Webrtc: 'webrtc', - Agent: 'agent', - Vapi: 'vapi' -} as const; - -export type PeerType = typeof PeerType[keyof typeof PeerType]; - - -/** - * State of a room - * @export - * @interface Room - */ -export interface Room { - /** - * - * @type {CompositionInfo} - * @memberof Room - */ - 'compositionInfo'?: CompositionInfo | null; - /** - * - * @type {RoomConfig} - * @memberof Room - */ - 'config': RoomConfig; - /** - * Room ID - * @type {string} - * @memberof Room - */ - 'id': string; - /** - * List of all peers - * @type {Array} - * @memberof Room - */ - 'peers': Array; -} -/** - * Room configuration - * @export - * @interface RoomConfig - */ -export interface RoomConfig { - /** - * If true, webhook notifications for this room are coalesced into a single NotificationBatch per HTTP send instead of one request per notification. VAD notifications are unaffected. - * @type {boolean} - * @memberof RoomConfig - */ - 'batchWebhookNotifications'?: boolean; - /** - * Maximum amount of peers allowed into the room - * @type {number} - * @memberof RoomConfig - */ - 'maxPeers'?: number | null; - /** - * True if livestream viewers can omit specifying a token. - * @type {boolean} - * @memberof RoomConfig - */ - 'public'?: boolean; - /** - * - * @type {RoomType} - * @memberof RoomConfig - */ - 'roomType'?: RoomType; - /** - * - * @type {VideoCodec} - * @memberof RoomConfig - */ - 'videoCodec'?: VideoCodec; - /** - * URL where Fishjam notifications will be sent - * @type {string} - * @memberof RoomConfig - */ - 'webhookUrl'?: string | null; -} - - -/** - * Response containing room details - * @export - * @interface RoomCreateDetailsResponse - */ -export interface RoomCreateDetailsResponse { - /** - * - * @type {RoomCreateDetailsResponseData} - * @memberof RoomCreateDetailsResponse - */ - 'data': RoomCreateDetailsResponseData; -} -/** - * - * @export - * @interface RoomCreateDetailsResponseData - */ -export interface RoomCreateDetailsResponseData { - /** - * - * @type {Room} - * @memberof RoomCreateDetailsResponseData - */ - 'room': Room; -} -/** - * Response containing room details - * @export - * @interface RoomDetailsResponse - */ -export interface RoomDetailsResponse { - /** - * - * @type {Room} - * @memberof RoomDetailsResponse - */ - 'data': Room; -} -/** - * The use-case of the room. If not provided, this defaults to conference. - * @export - * @enum {string} - */ - -export const RoomType = { - FullFeature: 'full_feature', - AudioOnly: 'audio_only', - Broadcaster: 'broadcaster', - Livestream: 'livestream', - Conference: 'conference', - AudioOnlyLivestream: 'audio_only_livestream' -} as const; - -export type RoomType = typeof RoomType[keyof typeof RoomType]; - - -/** - * Response containing list of all rooms - * @export - * @interface RoomsListingResponse - */ -export interface RoomsListingResponse { - /** - * - * @type {Array} - * @memberof RoomsListingResponse - */ - 'data': Array; -} -/** - * State of a stream - * @export - * @interface Stream - */ -export interface Stream { - /** - * True if stream is restricted to audio only - * @type {boolean} - * @memberof Stream - */ - 'audioOnly'?: boolean; - /** - * Assigned stream id - * @type {string} - * @memberof Stream - */ - 'id': string; - /** - * True if livestream viewers can omit specifying a token. - * @type {boolean} - * @memberof Stream - */ - 'public': boolean; - /** - * List of all streamers - * @type {Array} - * @memberof Stream - */ - 'streamers': Array; - /** - * List of all viewers - * @type {Array} - * @memberof Stream - */ - 'viewers': Array; -} -/** - * Stream configuration - * @export - * @interface StreamConfig - */ -export interface StreamConfig { - /** - * Restrics stream to audio only - * @type {boolean} - * @memberof StreamConfig - */ - 'audioOnly'?: boolean | null; - /** - * If true, webhook notifications for this stream are coalesced into a single NotificationBatch per HTTP send instead of one request per notification. VAD notifications are unaffected. - * @type {boolean} - * @memberof StreamConfig - */ - 'batchWebhookNotifications'?: boolean; - /** - * True if livestream viewers can omit specifying a token. - * @type {boolean} - * @memberof StreamConfig - */ - 'public'?: boolean; - /** - * Webhook URL for receiving server notifications - * @type {string} - * @memberof StreamConfig - */ - 'webhookUrl'?: string | null; -} -/** - * Response containing stream details - * @export - * @interface StreamDetailsResponse - */ -export interface StreamDetailsResponse { - /** - * - * @type {Stream} - * @memberof StreamDetailsResponse - */ - 'data': Stream; -} -/** - * Describes streamer status - * @export - * @interface Streamer - */ -export interface Streamer { - /** - * Assigned streamer id - * @type {string} - * @memberof Streamer - */ - 'id': string; - /** - * Streamer connection status - * @type {string} - * @memberof Streamer - */ - 'status': StreamerStatusEnum; - /** - * Token streamer should authorize with - * @type {string} - * @memberof Streamer - */ - 'token': string; -} - -export const StreamerStatusEnum = { - Connected: 'connected', - Disconnected: 'disconnected' -} as const; - -export type StreamerStatusEnum = typeof StreamerStatusEnum[keyof typeof StreamerStatusEnum]; - -/** - * Response containing streamer details - * @export - * @interface StreamerDetailsResponse - */ -export interface StreamerDetailsResponse { - /** - * - * @type {Streamer} - * @memberof StreamerDetailsResponse - */ - 'data': Streamer; -} -/** - * Streamer authorization token - * @export - * @interface StreamerToken - */ -export interface StreamerToken { - /** - * Token streamer should authorize with - * @type {string} - * @memberof StreamerToken - */ - 'token': string; -} -/** - * Response containing list of all streams - * @export - * @interface StreamsListingResponse - */ -export interface StreamsListingResponse { - /** - * - * @type {Array} - * @memberof StreamsListingResponse - */ - 'data': Array; -} -/** - * Configuration of peer\'s subscribing policy - * @export - * @enum {string} - */ - -export const SubscribeMode = { - Auto: 'auto', - Manual: 'manual' -} as const; - -export type SubscribeMode = typeof SubscribeMode[keyof typeof SubscribeMode]; - - -/** - * - * @export - * @interface SubscribeTracksRequest - */ -export interface SubscribeTracksRequest { - /** - * List of track IDs to subscribe to - * @type {Array} - * @memberof SubscribeTracksRequest - */ - 'track_ids': Array; -} -/** - * Describes peer\'s subscriptions in manual mode - * @export - * @interface Subscriptions - */ -export interface Subscriptions { - /** - * List of peer IDs this peer subscribes to - * @type {Array} - * @memberof Subscriptions - */ - 'peers': Array; - /** - * List of track IDs this peer subscribes to - * @type {Array} - * @memberof Subscriptions - */ - 'tracks': Array; -} -/** - * Media track of a Peer - * @export - * @interface Track - */ -export interface Track { - /** - * Assigned track id - * @type {string} - * @memberof Track - */ - 'id'?: string; - /** - * Metadata attached to the track by the peer - * @type {object} - * @memberof Track - */ - 'metadata'?: object | null; - /** - * - * @type {TrackType} - * @memberof Track - */ - 'type'?: TrackType; -} - - -/** - * Track forwardings for a room - * @export - * @interface TrackForwarding - */ -export interface TrackForwarding { - /** - * URL for the composition - * @type {string} - * @memberof TrackForwarding - */ - 'compositionURL': string; - /** - * Selects tracks that should be forwarded, currently only \"all\" is supported - * @type {string} - * @memberof TrackForwarding - */ - 'selector'?: string; -} -/** - * Information about a track forwarding for a specific peer - * @export - * @interface TrackForwardingInfo - */ -export interface TrackForwardingInfo { - /** - * ID of the forwarded audio track - * @type {string} - * @memberof TrackForwardingInfo - */ - 'audioTrackId'?: string | null; - /** - * Input ID used by the composition - * @type {string} - * @memberof TrackForwardingInfo - */ - 'inputId': string; - /** - * Peer ID - * @type {string} - * @memberof TrackForwardingInfo - */ - 'peerId': string; - /** - * ID of the forwarded video track - * @type {string} - * @memberof TrackForwardingInfo - */ - 'videoTrackId'?: string | null; -} -/** - * Media type carried by the track - * @export - * @enum {string} - */ - -export const TrackType = { - Audio: 'audio', - Video: 'video' -} as const; - -export type TrackType = typeof TrackType[keyof typeof TrackType]; - - -/** - * Enforces video codec for each peer in the room - * @export - * @enum {string} - */ - -export const VideoCodec = { - H264: 'h264', - Vp8: 'vp8' -} as const; - -export type VideoCodec = typeof VideoCodec[keyof typeof VideoCodec]; - - -/** - * Describes viewer status - * @export - * @interface Viewer - */ -export interface Viewer { - /** - * Assigned viewer id - * @type {string} - * @memberof Viewer - */ - 'id': string; - /** - * Token viewer should authorize with - * @type {string} - * @memberof Viewer - */ - 'token': string; -} -/** - * Response containing viewer details - * @export - * @interface ViewerDetailsResponse - */ -export interface ViewerDetailsResponse { - /** - * - * @type {Viewer} - * @memberof ViewerDetailsResponse - */ - 'data': Viewer; -} -/** - * Viewer authorization token - * @export - * @interface ViewerToken - */ -export interface ViewerToken { - /** - * Token viewer should authorize with - * @type {string} - * @memberof ViewerToken - */ - 'token': string; -} - -/** - * CredentialsApi - axios parameter creator - * @export - */ -export const CredentialsApiAxiosParamCreator = function (configuration?: Configuration) { - return { - /** - * Returns 200 if the provided Fishjam Management Token is valid, 404 otherwise. - * @summary Validate Fishjam Management Token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - validateCredentials: async (options: RawAxiosRequestConfig = {}): Promise => { - const localVarPath = `/validate`; - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - let baseOptions; - if (configuration) { - baseOptions = configuration.baseOptions; - } - - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication management_token required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration) - - - - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - } -}; - -/** - * CredentialsApi - functional programming interface - * @export - */ -export const CredentialsApiFp = function(configuration?: Configuration) { - const localVarAxiosParamCreator = CredentialsApiAxiosParamCreator(configuration) - return { - /** - * Returns 200 if the provided Fishjam Management Token is valid, 404 otherwise. - * @summary Validate Fishjam Management Token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async validateCredentials(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.validateCredentials(options); - const localVarOperationServerIndex = configuration?.serverIndex ?? 0; - const localVarOperationServerBasePath = operationServerMap['CredentialsApi.validateCredentials']?.[localVarOperationServerIndex]?.url; - return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); - }, - } -}; - -/** - * CredentialsApi - factory interface - * @export - */ -export const CredentialsApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { - const localVarFp = CredentialsApiFp(configuration) - return { - /** - * Returns 200 if the provided Fishjam Management Token is valid, 404 otherwise. - * @summary Validate Fishjam Management Token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - validateCredentials(options?: any): AxiosPromise { - return localVarFp.validateCredentials(options).then((request) => request(axios, basePath)); - }, - }; -}; - -/** - * CredentialsApi - object-oriented interface - * @export - * @class CredentialsApi - * @extends {BaseAPI} - */ -export class CredentialsApi extends BaseAPI { - /** - * Returns 200 if the provided Fishjam Management Token is valid, 404 otherwise. - * @summary Validate Fishjam Management Token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof CredentialsApi - */ - public validateCredentials(options?: RawAxiosRequestConfig) { - return CredentialsApiFp(this.configuration).validateCredentials(options).then((request) => request(this.axios, this.basePath)); - } -} - - - -/** - * MoQApi - axios parameter creator - * @export - */ -export const MoQApiAxiosParamCreator = function (configuration?: Configuration) { - return { - /** - * Issue a short-lived JWT for a Media over QUIC client. - * @summary Create MoQ access - * @param {MoqAccessConfig} [moqAccessConfig] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - createMoqAccess: async (moqAccessConfig?: MoqAccessConfig, options: RawAxiosRequestConfig = {}): Promise => { - const localVarPath = `/moq/access`; - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - let baseOptions; - if (configuration) { - baseOptions = configuration.baseOptions; - } - - const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication management_token required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration) - - - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - localVarRequestOptions.data = serializeDataIfNeeded(moqAccessConfig, localVarRequestOptions, configuration) - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - } -}; - -/** - * MoQApi - functional programming interface - * @export - */ -export const MoQApiFp = function(configuration?: Configuration) { - const localVarAxiosParamCreator = MoQApiAxiosParamCreator(configuration) - return { - /** - * Issue a short-lived JWT for a Media over QUIC client. - * @summary Create MoQ access - * @param {MoqAccessConfig} [moqAccessConfig] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async createMoqAccess(moqAccessConfig?: MoqAccessConfig, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.createMoqAccess(moqAccessConfig, options); - const localVarOperationServerIndex = configuration?.serverIndex ?? 0; - const localVarOperationServerBasePath = operationServerMap['MoQApi.createMoqAccess']?.[localVarOperationServerIndex]?.url; - return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); - }, - } -}; - -/** - * MoQApi - factory interface - * @export - */ -export const MoQApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { - const localVarFp = MoQApiFp(configuration) - return { - /** - * Issue a short-lived JWT for a Media over QUIC client. - * @summary Create MoQ access - * @param {MoqAccessConfig} [moqAccessConfig] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - createMoqAccess(moqAccessConfig?: MoqAccessConfig, options?: any): AxiosPromise { - return localVarFp.createMoqAccess(moqAccessConfig, options).then((request) => request(axios, basePath)); - }, - }; -}; - -/** - * MoQApi - object-oriented interface - * @export - * @class MoQApi - * @extends {BaseAPI} - */ -export class MoQApi extends BaseAPI { - /** - * Issue a short-lived JWT for a Media over QUIC client. - * @summary Create MoQ access - * @param {MoqAccessConfig} [moqAccessConfig] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof MoQApi - */ - public createMoqAccess(moqAccessConfig?: MoqAccessConfig, options?: RawAxiosRequestConfig) { - return MoQApiFp(this.configuration).createMoqAccess(moqAccessConfig, options).then((request) => request(this.axios, this.basePath)); - } -} - - - -/** - * RoomsApi - axios parameter creator - * @export - */ -export const RoomsApiAxiosParamCreator = function (configuration?: Configuration) { - return { - /** - * Add a peer to a room and return its connection token. - * @summary Create a peer - * @param {string} roomId Room id - * @param {PeerConfig} [peerConfig] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - addPeer: async (roomId: string, peerConfig?: PeerConfig, options: RawAxiosRequestConfig = {}): Promise => { - // verify required parameter 'roomId' is not null or undefined - assertParamExists('addPeer', 'roomId', roomId) - const localVarPath = `/room/{room_id}/peer` - .replace(`{${"room_id"}}`, encodeURIComponent(String(roomId))); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - let baseOptions; - if (configuration) { - baseOptions = configuration.baseOptions; - } - - const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication management_token required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration) - - - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - localVarRequestOptions.data = serializeDataIfNeeded(peerConfig, localVarRequestOptions, configuration) - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Create a new room with the given configuration. - * @summary Create a room - * @param {RoomConfig} [roomConfig] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - createRoom: async (roomConfig?: RoomConfig, options: RawAxiosRequestConfig = {}): Promise => { - const localVarPath = `/room`; - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - let baseOptions; - if (configuration) { - baseOptions = configuration.baseOptions; - } - - const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication management_token required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration) - - - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - localVarRequestOptions.data = serializeDataIfNeeded(roomConfig, localVarRequestOptions, configuration) - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Remove a peer from a room and disconnect it. - * @summary Delete a peer - * @param {string} roomId Room id - * @param {string} id Peer id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - deletePeer: async (roomId: string, id: string, options: RawAxiosRequestConfig = {}): Promise => { - // verify required parameter 'roomId' is not null or undefined - assertParamExists('deletePeer', 'roomId', roomId) - // verify required parameter 'id' is not null or undefined - assertParamExists('deletePeer', 'id', id) - const localVarPath = `/room/{room_id}/peer/{id}` - .replace(`{${"room_id"}}`, encodeURIComponent(String(roomId))) - .replace(`{${"id"}}`, encodeURIComponent(String(id))); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - let baseOptions; - if (configuration) { - baseOptions = configuration.baseOptions; - } - - const localVarRequestOptions = { method: 'DELETE', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication management_token required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration) - - - - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Delete a room by id and disconnect all of its peers. - * @summary Delete a room - * @param {string} roomId Room id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - deleteRoom: async (roomId: string, options: RawAxiosRequestConfig = {}): Promise => { - // verify required parameter 'roomId' is not null or undefined - assertParamExists('deleteRoom', 'roomId', roomId) - const localVarPath = `/room/{room_id}` - .replace(`{${"room_id"}}`, encodeURIComponent(String(roomId))); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - let baseOptions; - if (configuration) { - baseOptions = configuration.baseOptions; - } - - const localVarRequestOptions = { method: 'DELETE', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication management_token required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration) - - - - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * List all rooms and livestreams. - * @summary List all rooms - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getAllRooms: async (options: RawAxiosRequestConfig = {}): Promise => { - const localVarPath = `/room`; - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - let baseOptions; - if (configuration) { - baseOptions = configuration.baseOptions; - } - - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication management_token required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration) - - - - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Get a room by id. - * @summary Get a room - * @param {string} roomId Room ID - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getRoom: async (roomId: string, options: RawAxiosRequestConfig = {}): Promise => { - // verify required parameter 'roomId' is not null or undefined - assertParamExists('getRoom', 'roomId', roomId) - const localVarPath = `/room/{room_id}` - .replace(`{${"room_id"}}`, encodeURIComponent(String(roomId))); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - let baseOptions; - if (configuration) { - baseOptions = configuration.baseOptions; - } - - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication management_token required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration) - - - - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Issue a fresh connection token for an existing peer. - * @summary Refresh a peer token - * @param {string} roomId Room id - * @param {string} id Peer id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - refreshToken: async (roomId: string, id: string, options: RawAxiosRequestConfig = {}): Promise => { - // verify required parameter 'roomId' is not null or undefined - assertParamExists('refreshToken', 'roomId', roomId) - // verify required parameter 'id' is not null or undefined - assertParamExists('refreshToken', 'id', id) - const localVarPath = `/room/{room_id}/peer/{id}/refresh_token` - .replace(`{${"room_id"}}`, encodeURIComponent(String(roomId))) - .replace(`{${"id"}}`, encodeURIComponent(String(id))); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - let baseOptions; - if (configuration) { - baseOptions = configuration.baseOptions; - } - - const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication management_token required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration) - - - - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Subscribe a peer to all current and future tracks published by another peer in the same room. - * @summary Subscribe a peer to another peer\'s tracks - * @param {string} roomId Room id - * @param {string} id Peer id - * @param {string} [peerId] ID of the peer that produces the track - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - subscribePeer: async (roomId: string, id: string, peerId?: string, options: RawAxiosRequestConfig = {}): Promise => { - // verify required parameter 'roomId' is not null or undefined - assertParamExists('subscribePeer', 'roomId', roomId) - // verify required parameter 'id' is not null or undefined - assertParamExists('subscribePeer', 'id', id) - const localVarPath = `/room/{room_id}/peer/{id}/subscribe_peer` - .replace(`{${"room_id"}}`, encodeURIComponent(String(roomId))) - .replace(`{${"id"}}`, encodeURIComponent(String(id))); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - let baseOptions; - if (configuration) { - baseOptions = configuration.baseOptions; - } - - const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication management_token required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration) - - if (peerId !== undefined) { - localVarQueryParameter['peer_id'] = peerId; - } - - - - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Subscribe a peer to a specific list of track IDs in the same room. - * @summary Subscribe a peer to specific tracks - * @param {string} roomId Room id - * @param {string} id Peer id - * @param {SubscribeTracksRequest} [subscribeTracksRequest] Track IDs - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - subscribeTracks: async (roomId: string, id: string, subscribeTracksRequest?: SubscribeTracksRequest, options: RawAxiosRequestConfig = {}): Promise => { - // verify required parameter 'roomId' is not null or undefined - assertParamExists('subscribeTracks', 'roomId', roomId) - // verify required parameter 'id' is not null or undefined - assertParamExists('subscribeTracks', 'id', id) - const localVarPath = `/room/{room_id}/peer/{id}/subscribe_tracks` - .replace(`{${"room_id"}}`, encodeURIComponent(String(roomId))) - .replace(`{${"id"}}`, encodeURIComponent(String(id))); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - let baseOptions; - if (configuration) { - baseOptions = configuration.baseOptions; - } - - const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication management_token required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration) - - - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - localVarRequestOptions.data = serializeDataIfNeeded(subscribeTracksRequest, localVarRequestOptions, configuration) - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - } -}; - -/** - * RoomsApi - functional programming interface - * @export - */ -export const RoomsApiFp = function(configuration?: Configuration) { - const localVarAxiosParamCreator = RoomsApiAxiosParamCreator(configuration) - return { - /** - * Add a peer to a room and return its connection token. - * @summary Create a peer - * @param {string} roomId Room id - * @param {PeerConfig} [peerConfig] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async addPeer(roomId: string, peerConfig?: PeerConfig, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.addPeer(roomId, peerConfig, options); - const localVarOperationServerIndex = configuration?.serverIndex ?? 0; - const localVarOperationServerBasePath = operationServerMap['RoomsApi.addPeer']?.[localVarOperationServerIndex]?.url; - return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); - }, - /** - * Create a new room with the given configuration. - * @summary Create a room - * @param {RoomConfig} [roomConfig] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async createRoom(roomConfig?: RoomConfig, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.createRoom(roomConfig, options); - const localVarOperationServerIndex = configuration?.serverIndex ?? 0; - const localVarOperationServerBasePath = operationServerMap['RoomsApi.createRoom']?.[localVarOperationServerIndex]?.url; - return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); - }, - /** - * Remove a peer from a room and disconnect it. - * @summary Delete a peer - * @param {string} roomId Room id - * @param {string} id Peer id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async deletePeer(roomId: string, id: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.deletePeer(roomId, id, options); - const localVarOperationServerIndex = configuration?.serverIndex ?? 0; - const localVarOperationServerBasePath = operationServerMap['RoomsApi.deletePeer']?.[localVarOperationServerIndex]?.url; - return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); - }, - /** - * Delete a room by id and disconnect all of its peers. - * @summary Delete a room - * @param {string} roomId Room id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async deleteRoom(roomId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.deleteRoom(roomId, options); - const localVarOperationServerIndex = configuration?.serverIndex ?? 0; - const localVarOperationServerBasePath = operationServerMap['RoomsApi.deleteRoom']?.[localVarOperationServerIndex]?.url; - return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); - }, - /** - * List all rooms and livestreams. - * @summary List all rooms - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async getAllRooms(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.getAllRooms(options); - const localVarOperationServerIndex = configuration?.serverIndex ?? 0; - const localVarOperationServerBasePath = operationServerMap['RoomsApi.getAllRooms']?.[localVarOperationServerIndex]?.url; - return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); - }, - /** - * Get a room by id. - * @summary Get a room - * @param {string} roomId Room ID - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async getRoom(roomId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.getRoom(roomId, options); - const localVarOperationServerIndex = configuration?.serverIndex ?? 0; - const localVarOperationServerBasePath = operationServerMap['RoomsApi.getRoom']?.[localVarOperationServerIndex]?.url; - return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); - }, - /** - * Issue a fresh connection token for an existing peer. - * @summary Refresh a peer token - * @param {string} roomId Room id - * @param {string} id Peer id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async refreshToken(roomId: string, id: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.refreshToken(roomId, id, options); - const localVarOperationServerIndex = configuration?.serverIndex ?? 0; - const localVarOperationServerBasePath = operationServerMap['RoomsApi.refreshToken']?.[localVarOperationServerIndex]?.url; - return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); - }, - /** - * Subscribe a peer to all current and future tracks published by another peer in the same room. - * @summary Subscribe a peer to another peer\'s tracks - * @param {string} roomId Room id - * @param {string} id Peer id - * @param {string} [peerId] ID of the peer that produces the track - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async subscribePeer(roomId: string, id: string, peerId?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.subscribePeer(roomId, id, peerId, options); - const localVarOperationServerIndex = configuration?.serverIndex ?? 0; - const localVarOperationServerBasePath = operationServerMap['RoomsApi.subscribePeer']?.[localVarOperationServerIndex]?.url; - return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); - }, - /** - * Subscribe a peer to a specific list of track IDs in the same room. - * @summary Subscribe a peer to specific tracks - * @param {string} roomId Room id - * @param {string} id Peer id - * @param {SubscribeTracksRequest} [subscribeTracksRequest] Track IDs - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async subscribeTracks(roomId: string, id: string, subscribeTracksRequest?: SubscribeTracksRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.subscribeTracks(roomId, id, subscribeTracksRequest, options); - const localVarOperationServerIndex = configuration?.serverIndex ?? 0; - const localVarOperationServerBasePath = operationServerMap['RoomsApi.subscribeTracks']?.[localVarOperationServerIndex]?.url; - return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); - }, - } -}; - -/** - * RoomsApi - factory interface - * @export - */ -export const RoomsApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { - const localVarFp = RoomsApiFp(configuration) - return { - /** - * Add a peer to a room and return its connection token. - * @summary Create a peer - * @param {string} roomId Room id - * @param {PeerConfig} [peerConfig] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - addPeer(roomId: string, peerConfig?: PeerConfig, options?: any): AxiosPromise { - return localVarFp.addPeer(roomId, peerConfig, options).then((request) => request(axios, basePath)); - }, - /** - * Create a new room with the given configuration. - * @summary Create a room - * @param {RoomConfig} [roomConfig] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - createRoom(roomConfig?: RoomConfig, options?: any): AxiosPromise { - return localVarFp.createRoom(roomConfig, options).then((request) => request(axios, basePath)); - }, - /** - * Remove a peer from a room and disconnect it. - * @summary Delete a peer - * @param {string} roomId Room id - * @param {string} id Peer id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - deletePeer(roomId: string, id: string, options?: any): AxiosPromise { - return localVarFp.deletePeer(roomId, id, options).then((request) => request(axios, basePath)); - }, - /** - * Delete a room by id and disconnect all of its peers. - * @summary Delete a room - * @param {string} roomId Room id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - deleteRoom(roomId: string, options?: any): AxiosPromise { - return localVarFp.deleteRoom(roomId, options).then((request) => request(axios, basePath)); - }, - /** - * List all rooms and livestreams. - * @summary List all rooms - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getAllRooms(options?: any): AxiosPromise { - return localVarFp.getAllRooms(options).then((request) => request(axios, basePath)); - }, - /** - * Get a room by id. - * @summary Get a room - * @param {string} roomId Room ID - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getRoom(roomId: string, options?: any): AxiosPromise { - return localVarFp.getRoom(roomId, options).then((request) => request(axios, basePath)); - }, - /** - * Issue a fresh connection token for an existing peer. - * @summary Refresh a peer token - * @param {string} roomId Room id - * @param {string} id Peer id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - refreshToken(roomId: string, id: string, options?: any): AxiosPromise { - return localVarFp.refreshToken(roomId, id, options).then((request) => request(axios, basePath)); - }, - /** - * Subscribe a peer to all current and future tracks published by another peer in the same room. - * @summary Subscribe a peer to another peer\'s tracks - * @param {string} roomId Room id - * @param {string} id Peer id - * @param {string} [peerId] ID of the peer that produces the track - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - subscribePeer(roomId: string, id: string, peerId?: string, options?: any): AxiosPromise { - return localVarFp.subscribePeer(roomId, id, peerId, options).then((request) => request(axios, basePath)); - }, - /** - * Subscribe a peer to a specific list of track IDs in the same room. - * @summary Subscribe a peer to specific tracks - * @param {string} roomId Room id - * @param {string} id Peer id - * @param {SubscribeTracksRequest} [subscribeTracksRequest] Track IDs - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - subscribeTracks(roomId: string, id: string, subscribeTracksRequest?: SubscribeTracksRequest, options?: any): AxiosPromise { - return localVarFp.subscribeTracks(roomId, id, subscribeTracksRequest, options).then((request) => request(axios, basePath)); - }, - }; -}; - -/** - * RoomsApi - object-oriented interface - * @export - * @class RoomsApi - * @extends {BaseAPI} - */ -export class RoomsApi extends BaseAPI { - /** - * Add a peer to a room and return its connection token. - * @summary Create a peer - * @param {string} roomId Room id - * @param {PeerConfig} [peerConfig] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof RoomsApi - */ - public addPeer(roomId: string, peerConfig?: PeerConfig, options?: RawAxiosRequestConfig) { - return RoomsApiFp(this.configuration).addPeer(roomId, peerConfig, options).then((request) => request(this.axios, this.basePath)); - } - - /** - * Create a new room with the given configuration. - * @summary Create a room - * @param {RoomConfig} [roomConfig] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof RoomsApi - */ - public createRoom(roomConfig?: RoomConfig, options?: RawAxiosRequestConfig) { - return RoomsApiFp(this.configuration).createRoom(roomConfig, options).then((request) => request(this.axios, this.basePath)); - } - - /** - * Remove a peer from a room and disconnect it. - * @summary Delete a peer - * @param {string} roomId Room id - * @param {string} id Peer id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof RoomsApi - */ - public deletePeer(roomId: string, id: string, options?: RawAxiosRequestConfig) { - return RoomsApiFp(this.configuration).deletePeer(roomId, id, options).then((request) => request(this.axios, this.basePath)); - } - - /** - * Delete a room by id and disconnect all of its peers. - * @summary Delete a room - * @param {string} roomId Room id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof RoomsApi - */ - public deleteRoom(roomId: string, options?: RawAxiosRequestConfig) { - return RoomsApiFp(this.configuration).deleteRoom(roomId, options).then((request) => request(this.axios, this.basePath)); - } - - /** - * List all rooms and livestreams. - * @summary List all rooms - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof RoomsApi - */ - public getAllRooms(options?: RawAxiosRequestConfig) { - return RoomsApiFp(this.configuration).getAllRooms(options).then((request) => request(this.axios, this.basePath)); - } - - /** - * Get a room by id. - * @summary Get a room - * @param {string} roomId Room ID - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof RoomsApi - */ - public getRoom(roomId: string, options?: RawAxiosRequestConfig) { - return RoomsApiFp(this.configuration).getRoom(roomId, options).then((request) => request(this.axios, this.basePath)); - } - - /** - * Issue a fresh connection token for an existing peer. - * @summary Refresh a peer token - * @param {string} roomId Room id - * @param {string} id Peer id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof RoomsApi - */ - public refreshToken(roomId: string, id: string, options?: RawAxiosRequestConfig) { - return RoomsApiFp(this.configuration).refreshToken(roomId, id, options).then((request) => request(this.axios, this.basePath)); - } - - /** - * Subscribe a peer to all current and future tracks published by another peer in the same room. - * @summary Subscribe a peer to another peer\'s tracks - * @param {string} roomId Room id - * @param {string} id Peer id - * @param {string} [peerId] ID of the peer that produces the track - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof RoomsApi - */ - public subscribePeer(roomId: string, id: string, peerId?: string, options?: RawAxiosRequestConfig) { - return RoomsApiFp(this.configuration).subscribePeer(roomId, id, peerId, options).then((request) => request(this.axios, this.basePath)); - } - - /** - * Subscribe a peer to a specific list of track IDs in the same room. - * @summary Subscribe a peer to specific tracks - * @param {string} roomId Room id - * @param {string} id Peer id - * @param {SubscribeTracksRequest} [subscribeTracksRequest] Track IDs - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof RoomsApi - */ - public subscribeTracks(roomId: string, id: string, subscribeTracksRequest?: SubscribeTracksRequest, options?: RawAxiosRequestConfig) { - return RoomsApiFp(this.configuration).subscribeTracks(roomId, id, subscribeTracksRequest, options).then((request) => request(this.axios, this.basePath)); - } -} - - - -/** - * StreamersApi - axios parameter creator - * @export - */ -export const StreamersApiAxiosParamCreator = function (configuration?: Configuration) { - return { - /** - * Create a streamer for a stream and return its credentials. - * @summary Create a streamer - * @param {string} streamId Stream id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - createStreamer: async (streamId: string, options: RawAxiosRequestConfig = {}): Promise => { - // verify required parameter 'streamId' is not null or undefined - assertParamExists('createStreamer', 'streamId', streamId) - const localVarPath = `/livestream/{stream_id}/streamer` - .replace(`{${"stream_id"}}`, encodeURIComponent(String(streamId))); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - let baseOptions; - if (configuration) { - baseOptions = configuration.baseOptions; - } - - const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication management_token required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration) - - - - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Delete a streamer from a stream and revoke its token. - * @summary Delete a streamer - * @param {string} streamId Stream id - * @param {string} streamerId Streamer id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - deleteStreamer: async (streamId: string, streamerId: string, options: RawAxiosRequestConfig = {}): Promise => { - // verify required parameter 'streamId' is not null or undefined - assertParamExists('deleteStreamer', 'streamId', streamId) - // verify required parameter 'streamerId' is not null or undefined - assertParamExists('deleteStreamer', 'streamerId', streamerId) - const localVarPath = `/livestream/{stream_id}/streamer/{streamer_id}` - .replace(`{${"stream_id"}}`, encodeURIComponent(String(streamId))) - .replace(`{${"streamer_id"}}`, encodeURIComponent(String(streamerId))); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - let baseOptions; - if (configuration) { - baseOptions = configuration.baseOptions; - } - - const localVarRequestOptions = { method: 'DELETE', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication management_token required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration) - - - - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Issue a fresh streamer token. - * @summary Create a streamer token - * @param {string} roomId ID of the stream. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - generateStreamerToken: async (roomId: string, options: RawAxiosRequestConfig = {}): Promise => { - // verify required parameter 'roomId' is not null or undefined - assertParamExists('generateStreamerToken', 'roomId', roomId) - const localVarPath = `/room/{room_id}/streamer` - .replace(`{${"room_id"}}`, encodeURIComponent(String(roomId))); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - let baseOptions; - if (configuration) { - baseOptions = configuration.baseOptions; - } - - const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication management_token required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration) - - - - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - } -}; - -/** - * StreamersApi - functional programming interface - * @export - */ -export const StreamersApiFp = function(configuration?: Configuration) { - const localVarAxiosParamCreator = StreamersApiAxiosParamCreator(configuration) - return { - /** - * Create a streamer for a stream and return its credentials. - * @summary Create a streamer - * @param {string} streamId Stream id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async createStreamer(streamId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.createStreamer(streamId, options); - const localVarOperationServerIndex = configuration?.serverIndex ?? 0; - const localVarOperationServerBasePath = operationServerMap['StreamersApi.createStreamer']?.[localVarOperationServerIndex]?.url; - return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); - }, - /** - * Delete a streamer from a stream and revoke its token. - * @summary Delete a streamer - * @param {string} streamId Stream id - * @param {string} streamerId Streamer id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async deleteStreamer(streamId: string, streamerId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.deleteStreamer(streamId, streamerId, options); - const localVarOperationServerIndex = configuration?.serverIndex ?? 0; - const localVarOperationServerBasePath = operationServerMap['StreamersApi.deleteStreamer']?.[localVarOperationServerIndex]?.url; - return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); - }, - /** - * Issue a fresh streamer token. - * @summary Create a streamer token - * @param {string} roomId ID of the stream. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async generateStreamerToken(roomId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.generateStreamerToken(roomId, options); - const localVarOperationServerIndex = configuration?.serverIndex ?? 0; - const localVarOperationServerBasePath = operationServerMap['StreamersApi.generateStreamerToken']?.[localVarOperationServerIndex]?.url; - return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); - }, - } -}; - -/** - * StreamersApi - factory interface - * @export - */ -export const StreamersApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { - const localVarFp = StreamersApiFp(configuration) - return { - /** - * Create a streamer for a stream and return its credentials. - * @summary Create a streamer - * @param {string} streamId Stream id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - createStreamer(streamId: string, options?: any): AxiosPromise { - return localVarFp.createStreamer(streamId, options).then((request) => request(axios, basePath)); - }, - /** - * Delete a streamer from a stream and revoke its token. - * @summary Delete a streamer - * @param {string} streamId Stream id - * @param {string} streamerId Streamer id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - deleteStreamer(streamId: string, streamerId: string, options?: any): AxiosPromise { - return localVarFp.deleteStreamer(streamId, streamerId, options).then((request) => request(axios, basePath)); - }, - /** - * Issue a fresh streamer token. - * @summary Create a streamer token - * @param {string} roomId ID of the stream. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - generateStreamerToken(roomId: string, options?: any): AxiosPromise { - return localVarFp.generateStreamerToken(roomId, options).then((request) => request(axios, basePath)); - }, - }; -}; - -/** - * StreamersApi - object-oriented interface - * @export - * @class StreamersApi - * @extends {BaseAPI} - */ -export class StreamersApi extends BaseAPI { - /** - * Create a streamer for a stream and return its credentials. - * @summary Create a streamer - * @param {string} streamId Stream id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof StreamersApi - */ - public createStreamer(streamId: string, options?: RawAxiosRequestConfig) { - return StreamersApiFp(this.configuration).createStreamer(streamId, options).then((request) => request(this.axios, this.basePath)); - } - - /** - * Delete a streamer from a stream and revoke its token. - * @summary Delete a streamer - * @param {string} streamId Stream id - * @param {string} streamerId Streamer id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof StreamersApi - */ - public deleteStreamer(streamId: string, streamerId: string, options?: RawAxiosRequestConfig) { - return StreamersApiFp(this.configuration).deleteStreamer(streamId, streamerId, options).then((request) => request(this.axios, this.basePath)); - } - - /** - * Issue a fresh streamer token. - * @summary Create a streamer token - * @param {string} roomId ID of the stream. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof StreamersApi - */ - public generateStreamerToken(roomId: string, options?: RawAxiosRequestConfig) { - return StreamersApiFp(this.configuration).generateStreamerToken(roomId, options).then((request) => request(this.axios, this.basePath)); - } -} - - - -/** - * StreamsApi - axios parameter creator - * @export - */ -export const StreamsApiAxiosParamCreator = function (configuration?: Configuration) { - return { - /** - * Create a new livestream with the given configuration. - * @summary Create a stream - * @param {StreamConfig} [streamConfig] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - createStream: async (streamConfig?: StreamConfig, options: RawAxiosRequestConfig = {}): Promise => { - const localVarPath = `/livestream`; - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - let baseOptions; - if (configuration) { - baseOptions = configuration.baseOptions; - } - - const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication management_token required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration) - - - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - localVarRequestOptions.data = serializeDataIfNeeded(streamConfig, localVarRequestOptions, configuration) - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Delete a stream by id and disconnect all of its streamers and viewers. - * @summary Delete a stream - * @param {string} streamId Stream ID - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - deleteStream: async (streamId: string, options: RawAxiosRequestConfig = {}): Promise => { - // verify required parameter 'streamId' is not null or undefined - assertParamExists('deleteStream', 'streamId', streamId) - const localVarPath = `/livestream/{stream_id}` - .replace(`{${"stream_id"}}`, encodeURIComponent(String(streamId))); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - let baseOptions; - if (configuration) { - baseOptions = configuration.baseOptions; - } - - const localVarRequestOptions = { method: 'DELETE', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication management_token required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration) - - - - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * List all livestreams. - * @summary List all streams - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getAllStreams: async (options: RawAxiosRequestConfig = {}): Promise => { - const localVarPath = `/livestream`; - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - let baseOptions; - if (configuration) { - baseOptions = configuration.baseOptions; - } - - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication management_token required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration) - - - - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Get a stream by id. - * @summary Get a stream - * @param {string} streamId Stream ID - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getStream: async (streamId: string, options: RawAxiosRequestConfig = {}): Promise => { - // verify required parameter 'streamId' is not null or undefined - assertParamExists('getStream', 'streamId', streamId) - const localVarPath = `/livestream/{stream_id}` - .replace(`{${"stream_id"}}`, encodeURIComponent(String(streamId))); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - let baseOptions; - if (configuration) { - baseOptions = configuration.baseOptions; - } - - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication management_token required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration) - - - - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - } -}; - -/** - * StreamsApi - functional programming interface - * @export - */ -export const StreamsApiFp = function(configuration?: Configuration) { - const localVarAxiosParamCreator = StreamsApiAxiosParamCreator(configuration) - return { - /** - * Create a new livestream with the given configuration. - * @summary Create a stream - * @param {StreamConfig} [streamConfig] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async createStream(streamConfig?: StreamConfig, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.createStream(streamConfig, options); - const localVarOperationServerIndex = configuration?.serverIndex ?? 0; - const localVarOperationServerBasePath = operationServerMap['StreamsApi.createStream']?.[localVarOperationServerIndex]?.url; - return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); - }, - /** - * Delete a stream by id and disconnect all of its streamers and viewers. - * @summary Delete a stream - * @param {string} streamId Stream ID - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async deleteStream(streamId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.deleteStream(streamId, options); - const localVarOperationServerIndex = configuration?.serverIndex ?? 0; - const localVarOperationServerBasePath = operationServerMap['StreamsApi.deleteStream']?.[localVarOperationServerIndex]?.url; - return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); - }, - /** - * List all livestreams. - * @summary List all streams - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async getAllStreams(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.getAllStreams(options); - const localVarOperationServerIndex = configuration?.serverIndex ?? 0; - const localVarOperationServerBasePath = operationServerMap['StreamsApi.getAllStreams']?.[localVarOperationServerIndex]?.url; - return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); - }, - /** - * Get a stream by id. - * @summary Get a stream - * @param {string} streamId Stream ID - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async getStream(streamId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.getStream(streamId, options); - const localVarOperationServerIndex = configuration?.serverIndex ?? 0; - const localVarOperationServerBasePath = operationServerMap['StreamsApi.getStream']?.[localVarOperationServerIndex]?.url; - return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); - }, - } -}; - -/** - * StreamsApi - factory interface - * @export - */ -export const StreamsApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { - const localVarFp = StreamsApiFp(configuration) - return { - /** - * Create a new livestream with the given configuration. - * @summary Create a stream - * @param {StreamConfig} [streamConfig] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - createStream(streamConfig?: StreamConfig, options?: any): AxiosPromise { - return localVarFp.createStream(streamConfig, options).then((request) => request(axios, basePath)); - }, - /** - * Delete a stream by id and disconnect all of its streamers and viewers. - * @summary Delete a stream - * @param {string} streamId Stream ID - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - deleteStream(streamId: string, options?: any): AxiosPromise { - return localVarFp.deleteStream(streamId, options).then((request) => request(axios, basePath)); - }, - /** - * List all livestreams. - * @summary List all streams - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getAllStreams(options?: any): AxiosPromise { - return localVarFp.getAllStreams(options).then((request) => request(axios, basePath)); - }, - /** - * Get a stream by id. - * @summary Get a stream - * @param {string} streamId Stream ID - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getStream(streamId: string, options?: any): AxiosPromise { - return localVarFp.getStream(streamId, options).then((request) => request(axios, basePath)); - }, - }; -}; - -/** - * StreamsApi - object-oriented interface - * @export - * @class StreamsApi - * @extends {BaseAPI} - */ -export class StreamsApi extends BaseAPI { - /** - * Create a new livestream with the given configuration. - * @summary Create a stream - * @param {StreamConfig} [streamConfig] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof StreamsApi - */ - public createStream(streamConfig?: StreamConfig, options?: RawAxiosRequestConfig) { - return StreamsApiFp(this.configuration).createStream(streamConfig, options).then((request) => request(this.axios, this.basePath)); - } - - /** - * Delete a stream by id and disconnect all of its streamers and viewers. - * @summary Delete a stream - * @param {string} streamId Stream ID - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof StreamsApi - */ - public deleteStream(streamId: string, options?: RawAxiosRequestConfig) { - return StreamsApiFp(this.configuration).deleteStream(streamId, options).then((request) => request(this.axios, this.basePath)); - } - - /** - * List all livestreams. - * @summary List all streams - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof StreamsApi - */ - public getAllStreams(options?: RawAxiosRequestConfig) { - return StreamsApiFp(this.configuration).getAllStreams(options).then((request) => request(this.axios, this.basePath)); - } - - /** - * Get a stream by id. - * @summary Get a stream - * @param {string} streamId Stream ID - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof StreamsApi - */ - public getStream(streamId: string, options?: RawAxiosRequestConfig) { - return StreamsApiFp(this.configuration).getStream(streamId, options).then((request) => request(this.axios, this.basePath)); - } -} - - - -/** - * TrackForwardingsApi - axios parameter creator - * @export - */ -export const TrackForwardingsApiAxiosParamCreator = function (configuration?: Configuration) { - return { - /** - * Forward a room\'s tracks into an external composition. - * @summary Create a track forwarding - * @param {string} roomId Room id - * @param {TrackForwarding} trackForwarding - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - createTrackForwarding: async (roomId: string, trackForwarding: TrackForwarding, options: RawAxiosRequestConfig = {}): Promise => { - // verify required parameter 'roomId' is not null or undefined - assertParamExists('createTrackForwarding', 'roomId', roomId) - // verify required parameter 'trackForwarding' is not null or undefined - assertParamExists('createTrackForwarding', 'trackForwarding', trackForwarding) - const localVarPath = `/room/{room_id}/track_forwardings` - .replace(`{${"room_id"}}`, encodeURIComponent(String(roomId))); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - let baseOptions; - if (configuration) { - baseOptions = configuration.baseOptions; - } - - const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication management_token required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration) - - - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - localVarRequestOptions.data = serializeDataIfNeeded(trackForwarding, localVarRequestOptions, configuration) - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - } -}; - -/** - * TrackForwardingsApi - functional programming interface - * @export - */ -export const TrackForwardingsApiFp = function(configuration?: Configuration) { - const localVarAxiosParamCreator = TrackForwardingsApiAxiosParamCreator(configuration) - return { - /** - * Forward a room\'s tracks into an external composition. - * @summary Create a track forwarding - * @param {string} roomId Room id - * @param {TrackForwarding} trackForwarding - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async createTrackForwarding(roomId: string, trackForwarding: TrackForwarding, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.createTrackForwarding(roomId, trackForwarding, options); - const localVarOperationServerIndex = configuration?.serverIndex ?? 0; - const localVarOperationServerBasePath = operationServerMap['TrackForwardingsApi.createTrackForwarding']?.[localVarOperationServerIndex]?.url; - return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); - }, - } -}; - -/** - * TrackForwardingsApi - factory interface - * @export - */ -export const TrackForwardingsApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { - const localVarFp = TrackForwardingsApiFp(configuration) - return { - /** - * Forward a room\'s tracks into an external composition. - * @summary Create a track forwarding - * @param {string} roomId Room id - * @param {TrackForwarding} trackForwarding - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - createTrackForwarding(roomId: string, trackForwarding: TrackForwarding, options?: any): AxiosPromise { - return localVarFp.createTrackForwarding(roomId, trackForwarding, options).then((request) => request(axios, basePath)); - }, - }; -}; - -/** - * TrackForwardingsApi - object-oriented interface - * @export - * @class TrackForwardingsApi - * @extends {BaseAPI} - */ -export class TrackForwardingsApi extends BaseAPI { - /** - * Forward a room\'s tracks into an external composition. - * @summary Create a track forwarding - * @param {string} roomId Room id - * @param {TrackForwarding} trackForwarding - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof TrackForwardingsApi - */ - public createTrackForwarding(roomId: string, trackForwarding: TrackForwarding, options?: RawAxiosRequestConfig) { - return TrackForwardingsApiFp(this.configuration).createTrackForwarding(roomId, trackForwarding, options).then((request) => request(this.axios, this.basePath)); - } -} - - - -/** - * ViewersApi - axios parameter creator - * @export - */ -export const ViewersApiAxiosParamCreator = function (configuration?: Configuration) { - return { - /** - * Create a viewer for a stream and return its credentials. - * @summary Create a viewer - * @param {string} streamId Stream id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - createViewer: async (streamId: string, options: RawAxiosRequestConfig = {}): Promise => { - // verify required parameter 'streamId' is not null or undefined - assertParamExists('createViewer', 'streamId', streamId) - const localVarPath = `/livestream/{stream_id}/viewer` - .replace(`{${"stream_id"}}`, encodeURIComponent(String(streamId))); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - let baseOptions; - if (configuration) { - baseOptions = configuration.baseOptions; - } - - const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication management_token required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration) - - - - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Delete a viewer from a stream and revoke its token. - * @summary Delete a viewer - * @param {string} streamId Stream id - * @param {string} viewerId Viewer id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - deleteViewer: async (streamId: string, viewerId: string, options: RawAxiosRequestConfig = {}): Promise => { - // verify required parameter 'streamId' is not null or undefined - assertParamExists('deleteViewer', 'streamId', streamId) - // verify required parameter 'viewerId' is not null or undefined - assertParamExists('deleteViewer', 'viewerId', viewerId) - const localVarPath = `/livestream/{stream_id}/viewer/{viewer_id}` - .replace(`{${"stream_id"}}`, encodeURIComponent(String(streamId))) - .replace(`{${"viewer_id"}}`, encodeURIComponent(String(viewerId))); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - let baseOptions; - if (configuration) { - baseOptions = configuration.baseOptions; - } - - const localVarRequestOptions = { method: 'DELETE', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication management_token required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration) - - - - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Issue a fresh viewer token. - * @summary Create a viewer token - * @param {string} roomId ID of the stream. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - generateViewerToken: async (roomId: string, options: RawAxiosRequestConfig = {}): Promise => { - // verify required parameter 'roomId' is not null or undefined - assertParamExists('generateViewerToken', 'roomId', roomId) - const localVarPath = `/room/{room_id}/viewer` - .replace(`{${"room_id"}}`, encodeURIComponent(String(roomId))); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - let baseOptions; - if (configuration) { - baseOptions = configuration.baseOptions; - } - - const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication management_token required - // http bearer authentication required - await setBearerAuthToObject(localVarHeaderParameter, configuration) - - - - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - } -}; - -/** - * ViewersApi - functional programming interface - * @export - */ -export const ViewersApiFp = function(configuration?: Configuration) { - const localVarAxiosParamCreator = ViewersApiAxiosParamCreator(configuration) - return { - /** - * Create a viewer for a stream and return its credentials. - * @summary Create a viewer - * @param {string} streamId Stream id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async createViewer(streamId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.createViewer(streamId, options); - const localVarOperationServerIndex = configuration?.serverIndex ?? 0; - const localVarOperationServerBasePath = operationServerMap['ViewersApi.createViewer']?.[localVarOperationServerIndex]?.url; - return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); - }, - /** - * Delete a viewer from a stream and revoke its token. - * @summary Delete a viewer - * @param {string} streamId Stream id - * @param {string} viewerId Viewer id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async deleteViewer(streamId: string, viewerId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.deleteViewer(streamId, viewerId, options); - const localVarOperationServerIndex = configuration?.serverIndex ?? 0; - const localVarOperationServerBasePath = operationServerMap['ViewersApi.deleteViewer']?.[localVarOperationServerIndex]?.url; - return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); - }, - /** - * Issue a fresh viewer token. - * @summary Create a viewer token - * @param {string} roomId ID of the stream. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async generateViewerToken(roomId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.generateViewerToken(roomId, options); - const localVarOperationServerIndex = configuration?.serverIndex ?? 0; - const localVarOperationServerBasePath = operationServerMap['ViewersApi.generateViewerToken']?.[localVarOperationServerIndex]?.url; - return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); - }, - } -}; - -/** - * ViewersApi - factory interface - * @export - */ -export const ViewersApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { - const localVarFp = ViewersApiFp(configuration) - return { - /** - * Create a viewer for a stream and return its credentials. - * @summary Create a viewer - * @param {string} streamId Stream id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - createViewer(streamId: string, options?: any): AxiosPromise { - return localVarFp.createViewer(streamId, options).then((request) => request(axios, basePath)); - }, - /** - * Delete a viewer from a stream and revoke its token. - * @summary Delete a viewer - * @param {string} streamId Stream id - * @param {string} viewerId Viewer id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - deleteViewer(streamId: string, viewerId: string, options?: any): AxiosPromise { - return localVarFp.deleteViewer(streamId, viewerId, options).then((request) => request(axios, basePath)); - }, - /** - * Issue a fresh viewer token. - * @summary Create a viewer token - * @param {string} roomId ID of the stream. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - generateViewerToken(roomId: string, options?: any): AxiosPromise { - return localVarFp.generateViewerToken(roomId, options).then((request) => request(axios, basePath)); - }, - }; -}; - -/** - * ViewersApi - object-oriented interface - * @export - * @class ViewersApi - * @extends {BaseAPI} - */ -export class ViewersApi extends BaseAPI { - /** - * Create a viewer for a stream and return its credentials. - * @summary Create a viewer - * @param {string} streamId Stream id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ViewersApi - */ - public createViewer(streamId: string, options?: RawAxiosRequestConfig) { - return ViewersApiFp(this.configuration).createViewer(streamId, options).then((request) => request(this.axios, this.basePath)); - } - - /** - * Delete a viewer from a stream and revoke its token. - * @summary Delete a viewer - * @param {string} streamId Stream id - * @param {string} viewerId Viewer id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ViewersApi - */ - public deleteViewer(streamId: string, viewerId: string, options?: RawAxiosRequestConfig) { - return ViewersApiFp(this.configuration).deleteViewer(streamId, viewerId, options).then((request) => request(this.axios, this.basePath)); - } - - /** - * Issue a fresh viewer token. - * @summary Create a viewer token - * @param {string} roomId ID of the stream. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ViewersApi - */ - public generateViewerToken(roomId: string, options?: RawAxiosRequestConfig) { - return ViewersApiFp(this.configuration).generateViewerToken(roomId, options).then((request) => request(this.axios, this.basePath)); - } -} - - - diff --git a/packages/fishjam-openapi/src/generated/apis/CredentialsApi.ts b/packages/fishjam-openapi/src/generated/apis/CredentialsApi.ts new file mode 100644 index 00000000..f994d74d --- /dev/null +++ b/packages/fishjam-openapi/src/generated/apis/CredentialsApi.ts @@ -0,0 +1,61 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Fishjam API + * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) + * + * The version of the OpenAPI document: 0.28.1 + * Contact: contact@fishjam.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import * as runtime from '../runtime'; + +/** + * + */ +export class CredentialsApi extends runtime.BaseAPI { + + /** + * Returns 200 if the provided Fishjam Management Token is valid, 404 otherwise. + * Validate Fishjam Management Token + */ + async validateCredentialsRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && this.configuration.accessToken) { + const token = this.configuration.accessToken; + const tokenString = await token("management_token", []); + + if (tokenString) { + headerParameters["Authorization"] = `Bearer ${tokenString}`; + } + } + + let urlPath = `/validate`; + + const response = await this.request({ + path: urlPath, + method: 'GET', + headers: headerParameters, + query: queryParameters, + }, initOverrides); + + return new runtime.VoidApiResponse(response); + } + + /** + * Returns 200 if the provided Fishjam Management Token is valid, 404 otherwise. + * Validate Fishjam Management Token + */ + async validateCredentials(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + await this.validateCredentialsRaw(initOverrides); + } + +} diff --git a/packages/fishjam-openapi/src/generated/apis/MoQApi.ts b/packages/fishjam-openapi/src/generated/apis/MoQApi.ts new file mode 100644 index 00000000..a19bda1d --- /dev/null +++ b/packages/fishjam-openapi/src/generated/apis/MoQApi.ts @@ -0,0 +1,79 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Fishjam API + * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) + * + * The version of the OpenAPI document: 0.28.1 + * Contact: contact@fishjam.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import * as runtime from '../runtime'; +import type { + MoqAccess, + MoqAccessConfig, +} from '../models/index'; +import { + MoqAccessFromJSON, + MoqAccessToJSON, + MoqAccessConfigFromJSON, + MoqAccessConfigToJSON, +} from '../models/index'; + +export interface CreateMoqAccessRequest { + moqAccessConfig?: MoqAccessConfig; +} + +/** + * + */ +export class MoQApi extends runtime.BaseAPI { + + /** + * Issue a short-lived JWT for a Media over QUIC client. + * Create MoQ access + */ + async createMoqAccessRaw(requestParameters: CreateMoqAccessRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + headerParameters['Content-Type'] = 'application/json'; + + if (this.configuration && this.configuration.accessToken) { + const token = this.configuration.accessToken; + const tokenString = await token("management_token", []); + + if (tokenString) { + headerParameters["Authorization"] = `Bearer ${tokenString}`; + } + } + + let urlPath = `/moq/access`; + + const response = await this.request({ + path: urlPath, + method: 'POST', + headers: headerParameters, + query: queryParameters, + body: MoqAccessConfigToJSON(requestParameters['moqAccessConfig']), + }, initOverrides); + + return new runtime.JSONApiResponse(response, (jsonValue) => MoqAccessFromJSON(jsonValue)); + } + + /** + * Issue a short-lived JWT for a Media over QUIC client. + * Create MoQ access + */ + async createMoqAccess(requestParameters: CreateMoqAccessRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.createMoqAccessRaw(requestParameters, initOverrides); + return await response.value(); + } + +} diff --git a/packages/fishjam-openapi/src/generated/apis/RoomsApi.ts b/packages/fishjam-openapi/src/generated/apis/RoomsApi.ts new file mode 100644 index 00000000..942f5792 --- /dev/null +++ b/packages/fishjam-openapi/src/generated/apis/RoomsApi.ts @@ -0,0 +1,538 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Fishjam API + * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) + * + * The version of the OpenAPI document: 0.28.1 + * Contact: contact@fishjam.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import * as runtime from '../runtime'; +import type { + PeerConfig, + PeerDetailsResponse, + PeerRefreshTokenResponse, + RoomConfig, + RoomCreateDetailsResponse, + RoomDetailsResponse, + RoomsListingResponse, + SubscribeTracksRequest, +} from '../models/index'; +import { + PeerConfigFromJSON, + PeerConfigToJSON, + PeerDetailsResponseFromJSON, + PeerDetailsResponseToJSON, + PeerRefreshTokenResponseFromJSON, + PeerRefreshTokenResponseToJSON, + RoomConfigFromJSON, + RoomConfigToJSON, + RoomCreateDetailsResponseFromJSON, + RoomCreateDetailsResponseToJSON, + RoomDetailsResponseFromJSON, + RoomDetailsResponseToJSON, + RoomsListingResponseFromJSON, + RoomsListingResponseToJSON, + SubscribeTracksRequestFromJSON, + SubscribeTracksRequestToJSON, +} from '../models/index'; + +export interface AddPeerRequest { + roomId: string; + peerConfig?: PeerConfig; +} + +export interface CreateRoomRequest { + roomConfig?: RoomConfig; +} + +export interface DeletePeerRequest { + roomId: string; + id: string; +} + +export interface DeleteRoomRequest { + roomId: string; +} + +export interface GetRoomRequest { + roomId: string; +} + +export interface RefreshTokenRequest { + roomId: string; + id: string; +} + +export interface SubscribePeerRequest { + roomId: string; + id: string; + peerId?: string; +} + +export interface SubscribeTracksOperationRequest { + roomId: string; + id: string; + subscribeTracksRequest?: SubscribeTracksRequest; +} + +/** + * + */ +export class RoomsApi extends runtime.BaseAPI { + + /** + * Add a peer to a room and return its connection token. + * Create a peer + */ + async addPeerRaw(requestParameters: AddPeerRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters['roomId'] == null) { + throw new runtime.RequiredError( + 'roomId', + 'Required parameter "roomId" was null or undefined when calling addPeer().' + ); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + headerParameters['Content-Type'] = 'application/json'; + + if (this.configuration && this.configuration.accessToken) { + const token = this.configuration.accessToken; + const tokenString = await token("management_token", []); + + if (tokenString) { + headerParameters["Authorization"] = `Bearer ${tokenString}`; + } + } + + let urlPath = `/room/{room_id}/peer`; + urlPath = urlPath.replace(`{${"room_id"}}`, encodeURIComponent(String(requestParameters['roomId']))); + + const response = await this.request({ + path: urlPath, + method: 'POST', + headers: headerParameters, + query: queryParameters, + body: PeerConfigToJSON(requestParameters['peerConfig']), + }, initOverrides); + + return new runtime.JSONApiResponse(response, (jsonValue) => PeerDetailsResponseFromJSON(jsonValue)); + } + + /** + * Add a peer to a room and return its connection token. + * Create a peer + */ + async addPeer(requestParameters: AddPeerRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.addPeerRaw(requestParameters, initOverrides); + return await response.value(); + } + + /** + * Create a new room with the given configuration. + * Create a room + */ + async createRoomRaw(requestParameters: CreateRoomRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + headerParameters['Content-Type'] = 'application/json'; + + if (this.configuration && this.configuration.accessToken) { + const token = this.configuration.accessToken; + const tokenString = await token("management_token", []); + + if (tokenString) { + headerParameters["Authorization"] = `Bearer ${tokenString}`; + } + } + + let urlPath = `/room`; + + const response = await this.request({ + path: urlPath, + method: 'POST', + headers: headerParameters, + query: queryParameters, + body: RoomConfigToJSON(requestParameters['roomConfig']), + }, initOverrides); + + return new runtime.JSONApiResponse(response, (jsonValue) => RoomCreateDetailsResponseFromJSON(jsonValue)); + } + + /** + * Create a new room with the given configuration. + * Create a room + */ + async createRoom(requestParameters: CreateRoomRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.createRoomRaw(requestParameters, initOverrides); + return await response.value(); + } + + /** + * Remove a peer from a room and disconnect it. + * Delete a peer + */ + async deletePeerRaw(requestParameters: DeletePeerRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters['roomId'] == null) { + throw new runtime.RequiredError( + 'roomId', + 'Required parameter "roomId" was null or undefined when calling deletePeer().' + ); + } + + if (requestParameters['id'] == null) { + throw new runtime.RequiredError( + 'id', + 'Required parameter "id" was null or undefined when calling deletePeer().' + ); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && this.configuration.accessToken) { + const token = this.configuration.accessToken; + const tokenString = await token("management_token", []); + + if (tokenString) { + headerParameters["Authorization"] = `Bearer ${tokenString}`; + } + } + + let urlPath = `/room/{room_id}/peer/{id}`; + urlPath = urlPath.replace(`{${"room_id"}}`, encodeURIComponent(String(requestParameters['roomId']))); + urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))); + + const response = await this.request({ + path: urlPath, + method: 'DELETE', + headers: headerParameters, + query: queryParameters, + }, initOverrides); + + return new runtime.VoidApiResponse(response); + } + + /** + * Remove a peer from a room and disconnect it. + * Delete a peer + */ + async deletePeer(requestParameters: DeletePeerRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + await this.deletePeerRaw(requestParameters, initOverrides); + } + + /** + * Delete a room by id and disconnect all of its peers. + * Delete a room + */ + async deleteRoomRaw(requestParameters: DeleteRoomRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters['roomId'] == null) { + throw new runtime.RequiredError( + 'roomId', + 'Required parameter "roomId" was null or undefined when calling deleteRoom().' + ); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && this.configuration.accessToken) { + const token = this.configuration.accessToken; + const tokenString = await token("management_token", []); + + if (tokenString) { + headerParameters["Authorization"] = `Bearer ${tokenString}`; + } + } + + let urlPath = `/room/{room_id}`; + urlPath = urlPath.replace(`{${"room_id"}}`, encodeURIComponent(String(requestParameters['roomId']))); + + const response = await this.request({ + path: urlPath, + method: 'DELETE', + headers: headerParameters, + query: queryParameters, + }, initOverrides); + + return new runtime.VoidApiResponse(response); + } + + /** + * Delete a room by id and disconnect all of its peers. + * Delete a room + */ + async deleteRoom(requestParameters: DeleteRoomRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + await this.deleteRoomRaw(requestParameters, initOverrides); + } + + /** + * List all rooms and livestreams. + * List all rooms + */ + async getAllRoomsRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && this.configuration.accessToken) { + const token = this.configuration.accessToken; + const tokenString = await token("management_token", []); + + if (tokenString) { + headerParameters["Authorization"] = `Bearer ${tokenString}`; + } + } + + let urlPath = `/room`; + + const response = await this.request({ + path: urlPath, + method: 'GET', + headers: headerParameters, + query: queryParameters, + }, initOverrides); + + return new runtime.JSONApiResponse(response, (jsonValue) => RoomsListingResponseFromJSON(jsonValue)); + } + + /** + * List all rooms and livestreams. + * List all rooms + */ + async getAllRooms(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.getAllRoomsRaw(initOverrides); + return await response.value(); + } + + /** + * Get a room by id. + * Get a room + */ + async getRoomRaw(requestParameters: GetRoomRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters['roomId'] == null) { + throw new runtime.RequiredError( + 'roomId', + 'Required parameter "roomId" was null or undefined when calling getRoom().' + ); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && this.configuration.accessToken) { + const token = this.configuration.accessToken; + const tokenString = await token("management_token", []); + + if (tokenString) { + headerParameters["Authorization"] = `Bearer ${tokenString}`; + } + } + + let urlPath = `/room/{room_id}`; + urlPath = urlPath.replace(`{${"room_id"}}`, encodeURIComponent(String(requestParameters['roomId']))); + + const response = await this.request({ + path: urlPath, + method: 'GET', + headers: headerParameters, + query: queryParameters, + }, initOverrides); + + return new runtime.JSONApiResponse(response, (jsonValue) => RoomDetailsResponseFromJSON(jsonValue)); + } + + /** + * Get a room by id. + * Get a room + */ + async getRoom(requestParameters: GetRoomRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.getRoomRaw(requestParameters, initOverrides); + return await response.value(); + } + + /** + * Issue a fresh connection token for an existing peer. + * Refresh a peer token + */ + async refreshTokenRaw(requestParameters: RefreshTokenRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters['roomId'] == null) { + throw new runtime.RequiredError( + 'roomId', + 'Required parameter "roomId" was null or undefined when calling refreshToken().' + ); + } + + if (requestParameters['id'] == null) { + throw new runtime.RequiredError( + 'id', + 'Required parameter "id" was null or undefined when calling refreshToken().' + ); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && this.configuration.accessToken) { + const token = this.configuration.accessToken; + const tokenString = await token("management_token", []); + + if (tokenString) { + headerParameters["Authorization"] = `Bearer ${tokenString}`; + } + } + + let urlPath = `/room/{room_id}/peer/{id}/refresh_token`; + urlPath = urlPath.replace(`{${"room_id"}}`, encodeURIComponent(String(requestParameters['roomId']))); + urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))); + + const response = await this.request({ + path: urlPath, + method: 'POST', + headers: headerParameters, + query: queryParameters, + }, initOverrides); + + return new runtime.JSONApiResponse(response, (jsonValue) => PeerRefreshTokenResponseFromJSON(jsonValue)); + } + + /** + * Issue a fresh connection token for an existing peer. + * Refresh a peer token + */ + async refreshToken(requestParameters: RefreshTokenRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.refreshTokenRaw(requestParameters, initOverrides); + return await response.value(); + } + + /** + * Subscribe a peer to all current and future tracks published by another peer in the same room. + * Subscribe a peer to another peer\'s tracks + */ + async subscribePeerRaw(requestParameters: SubscribePeerRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters['roomId'] == null) { + throw new runtime.RequiredError( + 'roomId', + 'Required parameter "roomId" was null or undefined when calling subscribePeer().' + ); + } + + if (requestParameters['id'] == null) { + throw new runtime.RequiredError( + 'id', + 'Required parameter "id" was null or undefined when calling subscribePeer().' + ); + } + + const queryParameters: any = {}; + + if (requestParameters['peerId'] != null) { + queryParameters['peer_id'] = requestParameters['peerId']; + } + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && this.configuration.accessToken) { + const token = this.configuration.accessToken; + const tokenString = await token("management_token", []); + + if (tokenString) { + headerParameters["Authorization"] = `Bearer ${tokenString}`; + } + } + + let urlPath = `/room/{room_id}/peer/{id}/subscribe_peer`; + urlPath = urlPath.replace(`{${"room_id"}}`, encodeURIComponent(String(requestParameters['roomId']))); + urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))); + + const response = await this.request({ + path: urlPath, + method: 'POST', + headers: headerParameters, + query: queryParameters, + }, initOverrides); + + return new runtime.VoidApiResponse(response); + } + + /** + * Subscribe a peer to all current and future tracks published by another peer in the same room. + * Subscribe a peer to another peer\'s tracks + */ + async subscribePeer(requestParameters: SubscribePeerRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + await this.subscribePeerRaw(requestParameters, initOverrides); + } + + /** + * Subscribe a peer to a specific list of track IDs in the same room. + * Subscribe a peer to specific tracks + */ + async subscribeTracksRaw(requestParameters: SubscribeTracksOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters['roomId'] == null) { + throw new runtime.RequiredError( + 'roomId', + 'Required parameter "roomId" was null or undefined when calling subscribeTracks().' + ); + } + + if (requestParameters['id'] == null) { + throw new runtime.RequiredError( + 'id', + 'Required parameter "id" was null or undefined when calling subscribeTracks().' + ); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + headerParameters['Content-Type'] = 'application/json'; + + if (this.configuration && this.configuration.accessToken) { + const token = this.configuration.accessToken; + const tokenString = await token("management_token", []); + + if (tokenString) { + headerParameters["Authorization"] = `Bearer ${tokenString}`; + } + } + + let urlPath = `/room/{room_id}/peer/{id}/subscribe_tracks`; + urlPath = urlPath.replace(`{${"room_id"}}`, encodeURIComponent(String(requestParameters['roomId']))); + urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))); + + const response = await this.request({ + path: urlPath, + method: 'POST', + headers: headerParameters, + query: queryParameters, + body: SubscribeTracksRequestToJSON(requestParameters['subscribeTracksRequest']), + }, initOverrides); + + return new runtime.VoidApiResponse(response); + } + + /** + * Subscribe a peer to a specific list of track IDs in the same room. + * Subscribe a peer to specific tracks + */ + async subscribeTracks(requestParameters: SubscribeTracksOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + await this.subscribeTracksRaw(requestParameters, initOverrides); + } + +} diff --git a/packages/fishjam-openapi/src/generated/apis/StreamersApi.ts b/packages/fishjam-openapi/src/generated/apis/StreamersApi.ts new file mode 100644 index 00000000..4526add6 --- /dev/null +++ b/packages/fishjam-openapi/src/generated/apis/StreamersApi.ts @@ -0,0 +1,194 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Fishjam API + * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) + * + * The version of the OpenAPI document: 0.28.1 + * Contact: contact@fishjam.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import * as runtime from '../runtime'; +import type { + StreamerDetailsResponse, + StreamerToken, +} from '../models/index'; +import { + StreamerDetailsResponseFromJSON, + StreamerDetailsResponseToJSON, + StreamerTokenFromJSON, + StreamerTokenToJSON, +} from '../models/index'; + +export interface CreateStreamerRequest { + streamId: string; +} + +export interface DeleteStreamerRequest { + streamId: string; + streamerId: string; +} + +export interface GenerateStreamerTokenRequest { + roomId: string; +} + +/** + * + */ +export class StreamersApi extends runtime.BaseAPI { + + /** + * Create a streamer for a stream and return its credentials. + * Create a streamer + */ + async createStreamerRaw(requestParameters: CreateStreamerRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters['streamId'] == null) { + throw new runtime.RequiredError( + 'streamId', + 'Required parameter "streamId" was null or undefined when calling createStreamer().' + ); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && this.configuration.accessToken) { + const token = this.configuration.accessToken; + const tokenString = await token("management_token", []); + + if (tokenString) { + headerParameters["Authorization"] = `Bearer ${tokenString}`; + } + } + + let urlPath = `/livestream/{stream_id}/streamer`; + urlPath = urlPath.replace(`{${"stream_id"}}`, encodeURIComponent(String(requestParameters['streamId']))); + + const response = await this.request({ + path: urlPath, + method: 'POST', + headers: headerParameters, + query: queryParameters, + }, initOverrides); + + return new runtime.JSONApiResponse(response, (jsonValue) => StreamerDetailsResponseFromJSON(jsonValue)); + } + + /** + * Create a streamer for a stream and return its credentials. + * Create a streamer + */ + async createStreamer(requestParameters: CreateStreamerRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.createStreamerRaw(requestParameters, initOverrides); + return await response.value(); + } + + /** + * Delete a streamer from a stream and revoke its token. + * Delete a streamer + */ + async deleteStreamerRaw(requestParameters: DeleteStreamerRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters['streamId'] == null) { + throw new runtime.RequiredError( + 'streamId', + 'Required parameter "streamId" was null or undefined when calling deleteStreamer().' + ); + } + + if (requestParameters['streamerId'] == null) { + throw new runtime.RequiredError( + 'streamerId', + 'Required parameter "streamerId" was null or undefined when calling deleteStreamer().' + ); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && this.configuration.accessToken) { + const token = this.configuration.accessToken; + const tokenString = await token("management_token", []); + + if (tokenString) { + headerParameters["Authorization"] = `Bearer ${tokenString}`; + } + } + + let urlPath = `/livestream/{stream_id}/streamer/{streamer_id}`; + urlPath = urlPath.replace(`{${"stream_id"}}`, encodeURIComponent(String(requestParameters['streamId']))); + urlPath = urlPath.replace(`{${"streamer_id"}}`, encodeURIComponent(String(requestParameters['streamerId']))); + + const response = await this.request({ + path: urlPath, + method: 'DELETE', + headers: headerParameters, + query: queryParameters, + }, initOverrides); + + return new runtime.VoidApiResponse(response); + } + + /** + * Delete a streamer from a stream and revoke its token. + * Delete a streamer + */ + async deleteStreamer(requestParameters: DeleteStreamerRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + await this.deleteStreamerRaw(requestParameters, initOverrides); + } + + /** + * Issue a fresh streamer token. + * Create a streamer token + */ + async generateStreamerTokenRaw(requestParameters: GenerateStreamerTokenRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters['roomId'] == null) { + throw new runtime.RequiredError( + 'roomId', + 'Required parameter "roomId" was null or undefined when calling generateStreamerToken().' + ); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && this.configuration.accessToken) { + const token = this.configuration.accessToken; + const tokenString = await token("management_token", []); + + if (tokenString) { + headerParameters["Authorization"] = `Bearer ${tokenString}`; + } + } + + let urlPath = `/room/{room_id}/streamer`; + urlPath = urlPath.replace(`{${"room_id"}}`, encodeURIComponent(String(requestParameters['roomId']))); + + const response = await this.request({ + path: urlPath, + method: 'POST', + headers: headerParameters, + query: queryParameters, + }, initOverrides); + + return new runtime.JSONApiResponse(response, (jsonValue) => StreamerTokenFromJSON(jsonValue)); + } + + /** + * Issue a fresh streamer token. + * Create a streamer token + */ + async generateStreamerToken(requestParameters: GenerateStreamerTokenRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.generateStreamerTokenRaw(requestParameters, initOverrides); + return await response.value(); + } + +} diff --git a/packages/fishjam-openapi/src/generated/apis/StreamsApi.ts b/packages/fishjam-openapi/src/generated/apis/StreamsApi.ts new file mode 100644 index 00000000..6f2af38e --- /dev/null +++ b/packages/fishjam-openapi/src/generated/apis/StreamsApi.ts @@ -0,0 +1,222 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Fishjam API + * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) + * + * The version of the OpenAPI document: 0.28.1 + * Contact: contact@fishjam.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import * as runtime from '../runtime'; +import type { + StreamConfig, + StreamDetailsResponse, + StreamsListingResponse, +} from '../models/index'; +import { + StreamConfigFromJSON, + StreamConfigToJSON, + StreamDetailsResponseFromJSON, + StreamDetailsResponseToJSON, + StreamsListingResponseFromJSON, + StreamsListingResponseToJSON, +} from '../models/index'; + +export interface CreateStreamRequest { + streamConfig?: StreamConfig; +} + +export interface DeleteStreamRequest { + streamId: string; +} + +export interface GetStreamRequest { + streamId: string; +} + +/** + * + */ +export class StreamsApi extends runtime.BaseAPI { + + /** + * Create a new livestream with the given configuration. + * Create a stream + */ + async createStreamRaw(requestParameters: CreateStreamRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + headerParameters['Content-Type'] = 'application/json'; + + if (this.configuration && this.configuration.accessToken) { + const token = this.configuration.accessToken; + const tokenString = await token("management_token", []); + + if (tokenString) { + headerParameters["Authorization"] = `Bearer ${tokenString}`; + } + } + + let urlPath = `/livestream`; + + const response = await this.request({ + path: urlPath, + method: 'POST', + headers: headerParameters, + query: queryParameters, + body: StreamConfigToJSON(requestParameters['streamConfig']), + }, initOverrides); + + return new runtime.JSONApiResponse(response, (jsonValue) => StreamDetailsResponseFromJSON(jsonValue)); + } + + /** + * Create a new livestream with the given configuration. + * Create a stream + */ + async createStream(requestParameters: CreateStreamRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.createStreamRaw(requestParameters, initOverrides); + return await response.value(); + } + + /** + * Delete a stream by id and disconnect all of its streamers and viewers. + * Delete a stream + */ + async deleteStreamRaw(requestParameters: DeleteStreamRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters['streamId'] == null) { + throw new runtime.RequiredError( + 'streamId', + 'Required parameter "streamId" was null or undefined when calling deleteStream().' + ); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && this.configuration.accessToken) { + const token = this.configuration.accessToken; + const tokenString = await token("management_token", []); + + if (tokenString) { + headerParameters["Authorization"] = `Bearer ${tokenString}`; + } + } + + let urlPath = `/livestream/{stream_id}`; + urlPath = urlPath.replace(`{${"stream_id"}}`, encodeURIComponent(String(requestParameters['streamId']))); + + const response = await this.request({ + path: urlPath, + method: 'DELETE', + headers: headerParameters, + query: queryParameters, + }, initOverrides); + + return new runtime.VoidApiResponse(response); + } + + /** + * Delete a stream by id and disconnect all of its streamers and viewers. + * Delete a stream + */ + async deleteStream(requestParameters: DeleteStreamRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + await this.deleteStreamRaw(requestParameters, initOverrides); + } + + /** + * List all livestreams. + * List all streams + */ + async getAllStreamsRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && this.configuration.accessToken) { + const token = this.configuration.accessToken; + const tokenString = await token("management_token", []); + + if (tokenString) { + headerParameters["Authorization"] = `Bearer ${tokenString}`; + } + } + + let urlPath = `/livestream`; + + const response = await this.request({ + path: urlPath, + method: 'GET', + headers: headerParameters, + query: queryParameters, + }, initOverrides); + + return new runtime.JSONApiResponse(response, (jsonValue) => StreamsListingResponseFromJSON(jsonValue)); + } + + /** + * List all livestreams. + * List all streams + */ + async getAllStreams(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.getAllStreamsRaw(initOverrides); + return await response.value(); + } + + /** + * Get a stream by id. + * Get a stream + */ + async getStreamRaw(requestParameters: GetStreamRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters['streamId'] == null) { + throw new runtime.RequiredError( + 'streamId', + 'Required parameter "streamId" was null or undefined when calling getStream().' + ); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && this.configuration.accessToken) { + const token = this.configuration.accessToken; + const tokenString = await token("management_token", []); + + if (tokenString) { + headerParameters["Authorization"] = `Bearer ${tokenString}`; + } + } + + let urlPath = `/livestream/{stream_id}`; + urlPath = urlPath.replace(`{${"stream_id"}}`, encodeURIComponent(String(requestParameters['streamId']))); + + const response = await this.request({ + path: urlPath, + method: 'GET', + headers: headerParameters, + query: queryParameters, + }, initOverrides); + + return new runtime.JSONApiResponse(response, (jsonValue) => StreamDetailsResponseFromJSON(jsonValue)); + } + + /** + * Get a stream by id. + * Get a stream + */ + async getStream(requestParameters: GetStreamRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.getStreamRaw(requestParameters, initOverrides); + return await response.value(); + } + +} diff --git a/packages/fishjam-openapi/src/generated/apis/TrackForwardingsApi.ts b/packages/fishjam-openapi/src/generated/apis/TrackForwardingsApi.ts new file mode 100644 index 00000000..3e7dbc4a --- /dev/null +++ b/packages/fishjam-openapi/src/generated/apis/TrackForwardingsApi.ts @@ -0,0 +1,91 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Fishjam API + * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) + * + * The version of the OpenAPI document: 0.28.1 + * Contact: contact@fishjam.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import * as runtime from '../runtime'; +import type { + TrackForwarding, +} from '../models/index'; +import { + TrackForwardingFromJSON, + TrackForwardingToJSON, +} from '../models/index'; + +export interface CreateTrackForwardingRequest { + roomId: string; + trackForwarding: TrackForwarding; +} + +/** + * + */ +export class TrackForwardingsApi extends runtime.BaseAPI { + + /** + * Forward a room\'s tracks into an external composition. + * Create a track forwarding + */ + async createTrackForwardingRaw(requestParameters: CreateTrackForwardingRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters['roomId'] == null) { + throw new runtime.RequiredError( + 'roomId', + 'Required parameter "roomId" was null or undefined when calling createTrackForwarding().' + ); + } + + if (requestParameters['trackForwarding'] == null) { + throw new runtime.RequiredError( + 'trackForwarding', + 'Required parameter "trackForwarding" was null or undefined when calling createTrackForwarding().' + ); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + headerParameters['Content-Type'] = 'application/json'; + + if (this.configuration && this.configuration.accessToken) { + const token = this.configuration.accessToken; + const tokenString = await token("management_token", []); + + if (tokenString) { + headerParameters["Authorization"] = `Bearer ${tokenString}`; + } + } + + let urlPath = `/room/{room_id}/track_forwardings`; + urlPath = urlPath.replace(`{${"room_id"}}`, encodeURIComponent(String(requestParameters['roomId']))); + + const response = await this.request({ + path: urlPath, + method: 'POST', + headers: headerParameters, + query: queryParameters, + body: TrackForwardingToJSON(requestParameters['trackForwarding']), + }, initOverrides); + + return new runtime.VoidApiResponse(response); + } + + /** + * Forward a room\'s tracks into an external composition. + * Create a track forwarding + */ + async createTrackForwarding(requestParameters: CreateTrackForwardingRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + await this.createTrackForwardingRaw(requestParameters, initOverrides); + } + +} diff --git a/packages/fishjam-openapi/src/generated/apis/ViewersApi.ts b/packages/fishjam-openapi/src/generated/apis/ViewersApi.ts new file mode 100644 index 00000000..f46a2f52 --- /dev/null +++ b/packages/fishjam-openapi/src/generated/apis/ViewersApi.ts @@ -0,0 +1,194 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Fishjam API + * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) + * + * The version of the OpenAPI document: 0.28.1 + * Contact: contact@fishjam.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import * as runtime from '../runtime'; +import type { + ViewerDetailsResponse, + ViewerToken, +} from '../models/index'; +import { + ViewerDetailsResponseFromJSON, + ViewerDetailsResponseToJSON, + ViewerTokenFromJSON, + ViewerTokenToJSON, +} from '../models/index'; + +export interface CreateViewerRequest { + streamId: string; +} + +export interface DeleteViewerRequest { + streamId: string; + viewerId: string; +} + +export interface GenerateViewerTokenRequest { + roomId: string; +} + +/** + * + */ +export class ViewersApi extends runtime.BaseAPI { + + /** + * Create a viewer for a stream and return its credentials. + * Create a viewer + */ + async createViewerRaw(requestParameters: CreateViewerRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters['streamId'] == null) { + throw new runtime.RequiredError( + 'streamId', + 'Required parameter "streamId" was null or undefined when calling createViewer().' + ); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && this.configuration.accessToken) { + const token = this.configuration.accessToken; + const tokenString = await token("management_token", []); + + if (tokenString) { + headerParameters["Authorization"] = `Bearer ${tokenString}`; + } + } + + let urlPath = `/livestream/{stream_id}/viewer`; + urlPath = urlPath.replace(`{${"stream_id"}}`, encodeURIComponent(String(requestParameters['streamId']))); + + const response = await this.request({ + path: urlPath, + method: 'POST', + headers: headerParameters, + query: queryParameters, + }, initOverrides); + + return new runtime.JSONApiResponse(response, (jsonValue) => ViewerDetailsResponseFromJSON(jsonValue)); + } + + /** + * Create a viewer for a stream and return its credentials. + * Create a viewer + */ + async createViewer(requestParameters: CreateViewerRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.createViewerRaw(requestParameters, initOverrides); + return await response.value(); + } + + /** + * Delete a viewer from a stream and revoke its token. + * Delete a viewer + */ + async deleteViewerRaw(requestParameters: DeleteViewerRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters['streamId'] == null) { + throw new runtime.RequiredError( + 'streamId', + 'Required parameter "streamId" was null or undefined when calling deleteViewer().' + ); + } + + if (requestParameters['viewerId'] == null) { + throw new runtime.RequiredError( + 'viewerId', + 'Required parameter "viewerId" was null or undefined when calling deleteViewer().' + ); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && this.configuration.accessToken) { + const token = this.configuration.accessToken; + const tokenString = await token("management_token", []); + + if (tokenString) { + headerParameters["Authorization"] = `Bearer ${tokenString}`; + } + } + + let urlPath = `/livestream/{stream_id}/viewer/{viewer_id}`; + urlPath = urlPath.replace(`{${"stream_id"}}`, encodeURIComponent(String(requestParameters['streamId']))); + urlPath = urlPath.replace(`{${"viewer_id"}}`, encodeURIComponent(String(requestParameters['viewerId']))); + + const response = await this.request({ + path: urlPath, + method: 'DELETE', + headers: headerParameters, + query: queryParameters, + }, initOverrides); + + return new runtime.VoidApiResponse(response); + } + + /** + * Delete a viewer from a stream and revoke its token. + * Delete a viewer + */ + async deleteViewer(requestParameters: DeleteViewerRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + await this.deleteViewerRaw(requestParameters, initOverrides); + } + + /** + * Issue a fresh viewer token. + * Create a viewer token + */ + async generateViewerTokenRaw(requestParameters: GenerateViewerTokenRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters['roomId'] == null) { + throw new runtime.RequiredError( + 'roomId', + 'Required parameter "roomId" was null or undefined when calling generateViewerToken().' + ); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && this.configuration.accessToken) { + const token = this.configuration.accessToken; + const tokenString = await token("management_token", []); + + if (tokenString) { + headerParameters["Authorization"] = `Bearer ${tokenString}`; + } + } + + let urlPath = `/room/{room_id}/viewer`; + urlPath = urlPath.replace(`{${"room_id"}}`, encodeURIComponent(String(requestParameters['roomId']))); + + const response = await this.request({ + path: urlPath, + method: 'POST', + headers: headerParameters, + query: queryParameters, + }, initOverrides); + + return new runtime.JSONApiResponse(response, (jsonValue) => ViewerTokenFromJSON(jsonValue)); + } + + /** + * Issue a fresh viewer token. + * Create a viewer token + */ + async generateViewerToken(requestParameters: GenerateViewerTokenRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.generateViewerTokenRaw(requestParameters, initOverrides); + return await response.value(); + } + +} diff --git a/packages/fishjam-openapi/src/generated/apis/index.ts b/packages/fishjam-openapi/src/generated/apis/index.ts new file mode 100644 index 00000000..a19361a9 --- /dev/null +++ b/packages/fishjam-openapi/src/generated/apis/index.ts @@ -0,0 +1,9 @@ +/* tslint:disable */ +/* eslint-disable */ +export * from './CredentialsApi'; +export * from './MoQApi'; +export * from './RoomsApi'; +export * from './StreamersApi'; +export * from './StreamsApi'; +export * from './TrackForwardingsApi'; +export * from './ViewersApi'; diff --git a/packages/fishjam-openapi/src/generated/base.ts b/packages/fishjam-openapi/src/generated/base.ts deleted file mode 100644 index d3d08ae4..00000000 --- a/packages/fishjam-openapi/src/generated/base.ts +++ /dev/null @@ -1,86 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Fishjam API - * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) - * - * The version of the OpenAPI document: 0.28.0 - * Contact: contact@fishjam.io - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -import type { Configuration } from './configuration'; -// Some imports not used depending on template conditions -// @ts-ignore -import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios'; -import globalAxios from 'axios'; - -export const BASE_PATH = "https://fishjam.io/api/v1/connect".replace(/\/+$/, ""); - -/** - * - * @export - */ -export const COLLECTION_FORMATS = { - csv: ",", - ssv: " ", - tsv: "\t", - pipes: "|", -}; - -/** - * - * @export - * @interface RequestArgs - */ -export interface RequestArgs { - url: string; - options: RawAxiosRequestConfig; -} - -/** - * - * @export - * @class BaseAPI - */ -export class BaseAPI { - protected configuration: Configuration | undefined; - - constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) { - if (configuration) { - this.configuration = configuration; - this.basePath = configuration.basePath ?? basePath; - } - } -}; - -/** - * - * @export - * @class RequiredError - * @extends {Error} - */ -export class RequiredError extends Error { - constructor(public field: string, msg?: string) { - super(msg); - this.name = "RequiredError" - } -} - -interface ServerMap { - [key: string]: { - url: string, - description: string, - }[]; -} - -/** - * - * @export - */ -export const operationServerMap: ServerMap = { -} diff --git a/packages/fishjam-openapi/src/generated/common.ts b/packages/fishjam-openapi/src/generated/common.ts deleted file mode 100644 index 36b35abe..00000000 --- a/packages/fishjam-openapi/src/generated/common.ts +++ /dev/null @@ -1,150 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Fishjam API - * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) - * - * The version of the OpenAPI document: 0.28.0 - * Contact: contact@fishjam.io - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -import type { Configuration } from "./configuration"; -import type { RequestArgs } from "./base"; -import type { AxiosInstance, AxiosResponse } from 'axios'; -import { RequiredError } from "./base"; - -/** - * - * @export - */ -export const DUMMY_BASE_URL = 'https://example.com' - -/** - * - * @throws {RequiredError} - * @export - */ -export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) { - if (paramValue === null || paramValue === undefined) { - throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`); - } -} - -/** - * - * @export - */ -export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) { - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = typeof configuration.apiKey === 'function' - ? await configuration.apiKey(keyParamName) - : await configuration.apiKey; - object[keyParamName] = localVarApiKeyValue; - } -} - -/** - * - * @export - */ -export const setBasicAuthToObject = function (object: any, configuration?: Configuration) { - if (configuration && (configuration.username || configuration.password)) { - object["auth"] = { username: configuration.username, password: configuration.password }; - } -} - -/** - * - * @export - */ -export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) { - if (configuration && configuration.accessToken) { - const accessToken = typeof configuration.accessToken === 'function' - ? await configuration.accessToken() - : await configuration.accessToken; - object["Authorization"] = "Bearer " + accessToken; - } -} - -/** - * - * @export - */ -export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) { - if (configuration && configuration.accessToken) { - const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? await configuration.accessToken(name, scopes) - : await configuration.accessToken; - object["Authorization"] = "Bearer " + localVarAccessTokenValue; - } -} - -function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void { - if (parameter == null) return; - if (typeof parameter === "object") { - if (Array.isArray(parameter)) { - (parameter as any[]).forEach(item => setFlattenedQueryParams(urlSearchParams, item, key)); - } - else { - Object.keys(parameter).forEach(currentKey => - setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`) - ); - } - } - else { - if (urlSearchParams.has(key)) { - urlSearchParams.append(key, parameter); - } - else { - urlSearchParams.set(key, parameter); - } - } -} - -/** - * - * @export - */ -export const setSearchParams = function (url: URL, ...objects: any[]) { - const searchParams = new URLSearchParams(url.search); - setFlattenedQueryParams(searchParams, objects); - url.search = searchParams.toString(); -} - -/** - * - * @export - */ -export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) { - const nonString = typeof value !== 'string'; - const needsSerialization = nonString && configuration && configuration.isJsonMime - ? configuration.isJsonMime(requestOptions.headers['Content-Type']) - : nonString; - return needsSerialization - ? JSON.stringify(value !== undefined ? value : {}) - : (value || ""); -} - -/** - * - * @export - */ -export const toPathString = function (url: URL) { - return url.pathname + url.search + url.hash -} - -/** - * - * @export - */ -export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) { - return >(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...axiosArgs.options, url: (axios.defaults.baseURL ? '' : configuration?.basePath ?? basePath) + axiosArgs.url}; - return axios.request(axiosRequestArgs); - }; -} diff --git a/packages/fishjam-openapi/src/generated/configuration.ts b/packages/fishjam-openapi/src/generated/configuration.ts deleted file mode 100644 index 1c28cb69..00000000 --- a/packages/fishjam-openapi/src/generated/configuration.ts +++ /dev/null @@ -1,110 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Fishjam API - * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) - * - * The version of the OpenAPI document: 0.28.0 - * Contact: contact@fishjam.io - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -export interface ConfigurationParameters { - apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); - username?: string; - password?: string; - accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); - basePath?: string; - serverIndex?: number; - baseOptions?: any; - formDataCtor?: new () => any; -} - -export class Configuration { - /** - * parameter for apiKey security - * @param name security name - * @memberof Configuration - */ - apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); - /** - * parameter for basic security - * - * @type {string} - * @memberof Configuration - */ - username?: string; - /** - * parameter for basic security - * - * @type {string} - * @memberof Configuration - */ - password?: string; - /** - * parameter for oauth2 security - * @param name security name - * @param scopes oauth2 scope - * @memberof Configuration - */ - accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); - /** - * override base path - * - * @type {string} - * @memberof Configuration - */ - basePath?: string; - /** - * override server index - * - * @type {number} - * @memberof Configuration - */ - serverIndex?: number; - /** - * base options for axios calls - * - * @type {any} - * @memberof Configuration - */ - baseOptions?: any; - /** - * The FormData constructor that will be used to create multipart form data - * requests. You can inject this here so that execution environments that - * do not support the FormData class can still run the generated client. - * - * @type {new () => FormData} - */ - formDataCtor?: new () => any; - - constructor(param: ConfigurationParameters = {}) { - this.apiKey = param.apiKey; - this.username = param.username; - this.password = param.password; - this.accessToken = param.accessToken; - this.basePath = param.basePath; - this.serverIndex = param.serverIndex; - this.baseOptions = param.baseOptions; - this.formDataCtor = param.formDataCtor; - } - - /** - * Check if the given MIME is a JSON MIME. - * JSON MIME examples: - * application/json - * application/json; charset=UTF8 - * APPLICATION/JSON - * application/vnd.company+json - * @param mime - MIME (Multipurpose Internet Mail Extensions) - * @return True if the given MIME is JSON, false otherwise. - */ - public isJsonMime(mime: string): boolean { - const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i'); - return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json'); - } -} diff --git a/packages/fishjam-openapi/src/generated/git_push.sh b/packages/fishjam-openapi/src/generated/git_push.sh deleted file mode 100644 index f53a75d4..00000000 --- a/packages/fishjam-openapi/src/generated/git_push.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/sh -# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ -# -# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" - -git_user_id=$1 -git_repo_id=$2 -release_note=$3 -git_host=$4 - -if [ "$git_host" = "" ]; then - git_host="github.com" - echo "[INFO] No command line input provided. Set \$git_host to $git_host" -fi - -if [ "$git_user_id" = "" ]; then - git_user_id="GIT_USER_ID" - echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" -fi - -if [ "$git_repo_id" = "" ]; then - git_repo_id="GIT_REPO_ID" - echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" -fi - -if [ "$release_note" = "" ]; then - release_note="Minor update" - echo "[INFO] No command line input provided. Set \$release_note to $release_note" -fi - -# Initialize the local directory as a Git repository -git init - -# Adds the files in the local repository and stages them for commit. -git add . - -# Commits the tracked changes and prepares them to be pushed to a remote repository. -git commit -m "$release_note" - -# Sets the new remote -git_remote=$(git remote) -if [ "$git_remote" = "" ]; then # git remote not defined - - if [ "$GIT_TOKEN" = "" ]; then - echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." - git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git - else - git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git - fi - -fi - -git pull origin master - -# Pushes (Forces) the changes in the local repository up to the remote repository -echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" -git push origin master 2>&1 | grep -v 'To https' diff --git a/packages/fishjam-openapi/src/generated/index.ts b/packages/fishjam-openapi/src/generated/index.ts index 696f1627..bebe8bbb 100644 --- a/packages/fishjam-openapi/src/generated/index.ts +++ b/packages/fishjam-openapi/src/generated/index.ts @@ -1,18 +1,5 @@ /* tslint:disable */ /* eslint-disable */ -/** - * Fishjam API - * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) - * - * The version of the OpenAPI document: 0.28.0 - * Contact: contact@fishjam.io - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -export * from "./api"; -export * from "./configuration"; - +export * from './runtime'; +export * from './apis/index'; +export * from './models/index'; diff --git a/packages/fishjam-openapi/src/generated/models/AgentOutput.ts b/packages/fishjam-openapi/src/generated/models/AgentOutput.ts new file mode 100644 index 00000000..970edde8 --- /dev/null +++ b/packages/fishjam-openapi/src/generated/models/AgentOutput.ts @@ -0,0 +1,90 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Fishjam API + * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) + * + * The version of the OpenAPI document: 0.28.1 + * Contact: contact@fishjam.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +import type { AudioSampleRate } from './AudioSampleRate'; +import { + AudioSampleRateFromJSON, + AudioSampleRateFromJSONTyped, + AudioSampleRateToJSON, + AudioSampleRateToJSONTyped, +} from './AudioSampleRate'; +import type { AudioFormat } from './AudioFormat'; +import { + AudioFormatFromJSON, + AudioFormatFromJSONTyped, + AudioFormatToJSON, + AudioFormatToJSONTyped, +} from './AudioFormat'; + +/** + * Output audio options + * @export + * @interface AgentOutput + */ +export interface AgentOutput { + /** + * + * @type {AudioFormat} + * @memberof AgentOutput + */ + audioFormat?: AudioFormat; + /** + * + * @type {AudioSampleRate} + * @memberof AgentOutput + */ + audioSampleRate?: AudioSampleRate; +} + + + +/** + * Check if a given object implements the AgentOutput interface. + */ +export function instanceOfAgentOutput(value: object): value is AgentOutput { + return true; +} + +export function AgentOutputFromJSON(json: any): AgentOutput { + return AgentOutputFromJSONTyped(json, false); +} + +export function AgentOutputFromJSONTyped(json: any, ignoreDiscriminator: boolean): AgentOutput { + if (json == null) { + return json; + } + return { + + 'audioFormat': json['audioFormat'] == null ? undefined : AudioFormatFromJSON(json['audioFormat']), + 'audioSampleRate': json['audioSampleRate'] == null ? undefined : AudioSampleRateFromJSON(json['audioSampleRate']), + }; +} + +export function AgentOutputToJSON(json: any): AgentOutput { + return AgentOutputToJSONTyped(json, false); +} + +export function AgentOutputToJSONTyped(value?: AgentOutput | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'audioFormat': AudioFormatToJSON(value['audioFormat']), + 'audioSampleRate': AudioSampleRateToJSON(value['audioSampleRate']), + }; +} + diff --git a/packages/fishjam-openapi/src/generated/models/AudioFormat.ts b/packages/fishjam-openapi/src/generated/models/AudioFormat.ts new file mode 100644 index 00000000..cf204c7d --- /dev/null +++ b/packages/fishjam-openapi/src/generated/models/AudioFormat.ts @@ -0,0 +1,52 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Fishjam API + * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) + * + * The version of the OpenAPI document: 0.28.1 + * Contact: contact@fishjam.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** + * The format of the output audio + * @export + */ +export const AudioFormat = { + Pcm16: 'pcm16' +} as const; +export type AudioFormat = typeof AudioFormat[keyof typeof AudioFormat]; + + +export function instanceOfAudioFormat(value: any): boolean { + for (const key in AudioFormat) { + if (Object.prototype.hasOwnProperty.call(AudioFormat, key)) { + if (AudioFormat[key as keyof typeof AudioFormat] === value) { + return true; + } + } + } + return false; +} + +export function AudioFormatFromJSON(json: any): AudioFormat { + return AudioFormatFromJSONTyped(json, false); +} + +export function AudioFormatFromJSONTyped(json: any, ignoreDiscriminator: boolean): AudioFormat { + return json as AudioFormat; +} + +export function AudioFormatToJSON(value?: AudioFormat | null): any { + return value as any; +} + +export function AudioFormatToJSONTyped(value: any, ignoreDiscriminator: boolean): AudioFormat { + return value as AudioFormat; +} + diff --git a/packages/fishjam-openapi/src/generated/models/AudioSampleRate.ts b/packages/fishjam-openapi/src/generated/models/AudioSampleRate.ts new file mode 100644 index 00000000..4faf2ea6 --- /dev/null +++ b/packages/fishjam-openapi/src/generated/models/AudioSampleRate.ts @@ -0,0 +1,53 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Fishjam API + * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) + * + * The version of the OpenAPI document: 0.28.1 + * Contact: contact@fishjam.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** + * The sample rate of the output audio + * @export + */ +export const AudioSampleRate = { + NUMBER_16000: 16000, + NUMBER_24000: 24000 +} as const; +export type AudioSampleRate = typeof AudioSampleRate[keyof typeof AudioSampleRate]; + + +export function instanceOfAudioSampleRate(value: any): boolean { + for (const key in AudioSampleRate) { + if (Object.prototype.hasOwnProperty.call(AudioSampleRate, key)) { + if (AudioSampleRate[key as keyof typeof AudioSampleRate] === value) { + return true; + } + } + } + return false; +} + +export function AudioSampleRateFromJSON(json: any): AudioSampleRate { + return AudioSampleRateFromJSONTyped(json, false); +} + +export function AudioSampleRateFromJSONTyped(json: any, ignoreDiscriminator: boolean): AudioSampleRate { + return json as AudioSampleRate; +} + +export function AudioSampleRateToJSON(value?: AudioSampleRate | null): any { + return value as any; +} + +export function AudioSampleRateToJSONTyped(value: any, ignoreDiscriminator: boolean): AudioSampleRate { + return value as AudioSampleRate; +} + diff --git a/packages/fishjam-openapi/src/generated/models/CompositionInfo.ts b/packages/fishjam-openapi/src/generated/models/CompositionInfo.ts new file mode 100644 index 00000000..d630161b --- /dev/null +++ b/packages/fishjam-openapi/src/generated/models/CompositionInfo.ts @@ -0,0 +1,83 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Fishjam API + * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) + * + * The version of the OpenAPI document: 0.28.1 + * Contact: contact@fishjam.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +import type { TrackForwardingInfo } from './TrackForwardingInfo'; +import { + TrackForwardingInfoFromJSON, + TrackForwardingInfoFromJSONTyped, + TrackForwardingInfoToJSON, + TrackForwardingInfoToJSONTyped, +} from './TrackForwardingInfo'; + +/** + * Composition and track forwarding state for the room + * @export + * @interface CompositionInfo + */ +export interface CompositionInfo { + /** + * URL of the active composition + * @type {string} + * @memberof CompositionInfo + */ + compositionUrl: string; + /** + * List of active track forwardings + * @type {Array} + * @memberof CompositionInfo + */ + forwardings: Array; +} + +/** + * Check if a given object implements the CompositionInfo interface. + */ +export function instanceOfCompositionInfo(value: object): value is CompositionInfo { + if (!('compositionUrl' in value) || value['compositionUrl'] === undefined) return false; + if (!('forwardings' in value) || value['forwardings'] === undefined) return false; + return true; +} + +export function CompositionInfoFromJSON(json: any): CompositionInfo { + return CompositionInfoFromJSONTyped(json, false); +} + +export function CompositionInfoFromJSONTyped(json: any, ignoreDiscriminator: boolean): CompositionInfo { + if (json == null) { + return json; + } + return { + + 'compositionUrl': json['compositionUrl'], + 'forwardings': ((json['forwardings'] as Array).map(TrackForwardingInfoFromJSON)), + }; +} + +export function CompositionInfoToJSON(json: any): CompositionInfo { + return CompositionInfoToJSONTyped(json, false); +} + +export function CompositionInfoToJSONTyped(value?: CompositionInfo | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'compositionUrl': value['compositionUrl'], + 'forwardings': ((value['forwardings'] as Array).map(TrackForwardingInfoToJSON)), + }; +} + diff --git a/packages/fishjam-openapi/src/generated/models/ModelError.ts b/packages/fishjam-openapi/src/generated/models/ModelError.ts new file mode 100644 index 00000000..56020991 --- /dev/null +++ b/packages/fishjam-openapi/src/generated/models/ModelError.ts @@ -0,0 +1,66 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Fishjam API + * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) + * + * The version of the OpenAPI document: 0.28.1 + * Contact: contact@fishjam.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +/** + * Error message + * @export + * @interface ModelError + */ +export interface ModelError { + /** + * Error details + * @type {string} + * @memberof ModelError + */ + errors: string; +} + +/** + * Check if a given object implements the ModelError interface. + */ +export function instanceOfModelError(value: object): value is ModelError { + if (!('errors' in value) || value['errors'] === undefined) return false; + return true; +} + +export function ModelErrorFromJSON(json: any): ModelError { + return ModelErrorFromJSONTyped(json, false); +} + +export function ModelErrorFromJSONTyped(json: any, ignoreDiscriminator: boolean): ModelError { + if (json == null) { + return json; + } + return { + + 'errors': json['errors'], + }; +} + +export function ModelErrorToJSON(json: any): ModelError { + return ModelErrorToJSONTyped(json, false); +} + +export function ModelErrorToJSONTyped(value?: ModelError | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'errors': value['errors'], + }; +} + diff --git a/packages/fishjam-openapi/src/generated/models/MoqAccess.ts b/packages/fishjam-openapi/src/generated/models/MoqAccess.ts new file mode 100644 index 00000000..b901dedd --- /dev/null +++ b/packages/fishjam-openapi/src/generated/models/MoqAccess.ts @@ -0,0 +1,75 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Fishjam API + * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) + * + * The version of the OpenAPI document: 0.28.1 + * Contact: contact@fishjam.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +/** + * Connection details for a MoQ relay client + * @export + * @interface MoqAccess + */ +export interface MoqAccess { + /** + * Relay connection URL with the JWT embedded as a `?jwt=` query parameter. Pass directly to a MoQ client SDK. + * @type {string} + * @memberof MoqAccess + */ + connection_url: string; + /** + * JWT authorizing the MoQ relay connection, also embedded in `connection_url` + * @type {string} + * @memberof MoqAccess + */ + token: string; +} + +/** + * Check if a given object implements the MoqAccess interface. + */ +export function instanceOfMoqAccess(value: object): value is MoqAccess { + if (!('connection_url' in value) || value['connection_url'] === undefined) return false; + if (!('token' in value) || value['token'] === undefined) return false; + return true; +} + +export function MoqAccessFromJSON(json: any): MoqAccess { + return MoqAccessFromJSONTyped(json, false); +} + +export function MoqAccessFromJSONTyped(json: any, ignoreDiscriminator: boolean): MoqAccess { + if (json == null) { + return json; + } + return { + + 'connection_url': json['connection_url'], + 'token': json['token'], + }; +} + +export function MoqAccessToJSON(json: any): MoqAccess { + return MoqAccessToJSONTyped(json, false); +} + +export function MoqAccessToJSONTyped(value?: MoqAccess | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'connection_url': value['connection_url'], + 'token': value['token'], + }; +} + diff --git a/packages/fishjam-openapi/src/generated/models/MoqAccessConfig.ts b/packages/fishjam-openapi/src/generated/models/MoqAccessConfig.ts new file mode 100644 index 00000000..f81e3c5e --- /dev/null +++ b/packages/fishjam-openapi/src/generated/models/MoqAccessConfig.ts @@ -0,0 +1,73 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Fishjam API + * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) + * + * The version of the OpenAPI document: 0.28.1 + * Contact: contact@fishjam.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +/** + * MoQ access configuration + * @export + * @interface MoqAccessConfig + */ +export interface MoqAccessConfig { + /** + * Path under the root the token grants publish access to + * @type {string} + * @memberof MoqAccessConfig + */ + publishPath?: string | null; + /** + * Path under the root the token grants subscribe access to + * @type {string} + * @memberof MoqAccessConfig + */ + subscribePath?: string | null; +} + +/** + * Check if a given object implements the MoqAccessConfig interface. + */ +export function instanceOfMoqAccessConfig(value: object): value is MoqAccessConfig { + return true; +} + +export function MoqAccessConfigFromJSON(json: any): MoqAccessConfig { + return MoqAccessConfigFromJSONTyped(json, false); +} + +export function MoqAccessConfigFromJSONTyped(json: any, ignoreDiscriminator: boolean): MoqAccessConfig { + if (json == null) { + return json; + } + return { + + 'publishPath': json['publishPath'] == null ? undefined : json['publishPath'], + 'subscribePath': json['subscribePath'] == null ? undefined : json['subscribePath'], + }; +} + +export function MoqAccessConfigToJSON(json: any): MoqAccessConfig { + return MoqAccessConfigToJSONTyped(json, false); +} + +export function MoqAccessConfigToJSONTyped(value?: MoqAccessConfig | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'publishPath': value['publishPath'], + 'subscribePath': value['subscribePath'], + }; +} + diff --git a/packages/fishjam-openapi/src/generated/models/Peer.ts b/packages/fishjam-openapi/src/generated/models/Peer.ts new file mode 100644 index 00000000..556dcd56 --- /dev/null +++ b/packages/fishjam-openapi/src/generated/models/Peer.ts @@ -0,0 +1,158 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Fishjam API + * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) + * + * The version of the OpenAPI document: 0.28.1 + * Contact: contact@fishjam.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +import type { Subscriptions } from './Subscriptions'; +import { + SubscriptionsFromJSON, + SubscriptionsFromJSONTyped, + SubscriptionsToJSON, + SubscriptionsToJSONTyped, +} from './Subscriptions'; +import type { PeerStatus } from './PeerStatus'; +import { + PeerStatusFromJSON, + PeerStatusFromJSONTyped, + PeerStatusToJSON, + PeerStatusToJSONTyped, +} from './PeerStatus'; +import type { PeerType } from './PeerType'; +import { + PeerTypeFromJSON, + PeerTypeFromJSONTyped, + PeerTypeToJSON, + PeerTypeToJSONTyped, +} from './PeerType'; +import type { SubscribeMode } from './SubscribeMode'; +import { + SubscribeModeFromJSON, + SubscribeModeFromJSONTyped, + SubscribeModeToJSON, + SubscribeModeToJSONTyped, +} from './SubscribeMode'; +import type { Track } from './Track'; +import { + TrackFromJSON, + TrackFromJSONTyped, + TrackToJSON, + TrackToJSONTyped, +} from './Track'; + +/** + * Describes peer status + * @export + * @interface Peer + */ +export interface Peer { + /** + * Assigned peer id + * @type {string} + * @memberof Peer + */ + id: string; + /** + * Custom metadata set by the peer + * @type {object} + * @memberof Peer + */ + metadata: object | null; + /** + * + * @type {PeerStatus} + * @memberof Peer + */ + status: PeerStatus; + /** + * + * @type {SubscribeMode} + * @memberof Peer + */ + subscribeMode: SubscribeMode; + /** + * + * @type {Subscriptions} + * @memberof Peer + */ + subscriptions: Subscriptions; + /** + * List of all peer's tracks + * @type {Array} + * @memberof Peer + */ + tracks: Array; + /** + * + * @type {PeerType} + * @memberof Peer + */ + type: PeerType; +} + + + +/** + * Check if a given object implements the Peer interface. + */ +export function instanceOfPeer(value: object): value is Peer { + if (!('id' in value) || value['id'] === undefined) return false; + if (!('metadata' in value) || value['metadata'] === undefined) return false; + if (!('status' in value) || value['status'] === undefined) return false; + if (!('subscribeMode' in value) || value['subscribeMode'] === undefined) return false; + if (!('subscriptions' in value) || value['subscriptions'] === undefined) return false; + if (!('tracks' in value) || value['tracks'] === undefined) return false; + if (!('type' in value) || value['type'] === undefined) return false; + return true; +} + +export function PeerFromJSON(json: any): Peer { + return PeerFromJSONTyped(json, false); +} + +export function PeerFromJSONTyped(json: any, ignoreDiscriminator: boolean): Peer { + if (json == null) { + return json; + } + return { + + 'id': json['id'], + 'metadata': json['metadata'], + 'status': PeerStatusFromJSON(json['status']), + 'subscribeMode': SubscribeModeFromJSON(json['subscribeMode']), + 'subscriptions': SubscriptionsFromJSON(json['subscriptions']), + 'tracks': ((json['tracks'] as Array).map(TrackFromJSON)), + 'type': PeerTypeFromJSON(json['type']), + }; +} + +export function PeerToJSON(json: any): Peer { + return PeerToJSONTyped(json, false); +} + +export function PeerToJSONTyped(value?: Peer | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'id': value['id'], + 'metadata': value['metadata'], + 'status': PeerStatusToJSON(value['status']), + 'subscribeMode': SubscribeModeToJSON(value['subscribeMode']), + 'subscriptions': SubscriptionsToJSON(value['subscriptions']), + 'tracks': ((value['tracks'] as Array).map(TrackToJSON)), + 'type': PeerTypeToJSON(value['type']), + }; +} + diff --git a/packages/fishjam-openapi/src/generated/models/PeerConfig.ts b/packages/fishjam-openapi/src/generated/models/PeerConfig.ts new file mode 100644 index 00000000..b8541514 --- /dev/null +++ b/packages/fishjam-openapi/src/generated/models/PeerConfig.ts @@ -0,0 +1,92 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Fishjam API + * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) + * + * The version of the OpenAPI document: 0.28.1 + * Contact: contact@fishjam.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +import type { PeerType } from './PeerType'; +import { + PeerTypeFromJSON, + PeerTypeFromJSONTyped, + PeerTypeToJSON, + PeerTypeToJSONTyped, +} from './PeerType'; +import type { PeerOptions } from './PeerOptions'; +import { + PeerOptionsFromJSON, + PeerOptionsFromJSONTyped, + PeerOptionsToJSON, + PeerOptionsToJSONTyped, +} from './PeerOptions'; + +/** + * Peer configuration + * @export + * @interface PeerConfig + */ +export interface PeerConfig { + /** + * + * @type {PeerOptions} + * @memberof PeerConfig + */ + options: PeerOptions; + /** + * + * @type {PeerType} + * @memberof PeerConfig + */ + type: PeerType; +} + + + +/** + * Check if a given object implements the PeerConfig interface. + */ +export function instanceOfPeerConfig(value: object): value is PeerConfig { + if (!('options' in value) || value['options'] === undefined) return false; + if (!('type' in value) || value['type'] === undefined) return false; + return true; +} + +export function PeerConfigFromJSON(json: any): PeerConfig { + return PeerConfigFromJSONTyped(json, false); +} + +export function PeerConfigFromJSONTyped(json: any, ignoreDiscriminator: boolean): PeerConfig { + if (json == null) { + return json; + } + return { + + 'options': PeerOptionsFromJSON(json['options']), + 'type': PeerTypeFromJSON(json['type']), + }; +} + +export function PeerConfigToJSON(json: any): PeerConfig { + return PeerConfigToJSONTyped(json, false); +} + +export function PeerConfigToJSONTyped(value?: PeerConfig | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'options': PeerOptionsToJSON(value['options']), + 'type': PeerTypeToJSON(value['type']), + }; +} + diff --git a/packages/fishjam-openapi/src/generated/models/PeerDetailsResponse.ts b/packages/fishjam-openapi/src/generated/models/PeerDetailsResponse.ts new file mode 100644 index 00000000..33a710c7 --- /dev/null +++ b/packages/fishjam-openapi/src/generated/models/PeerDetailsResponse.ts @@ -0,0 +1,74 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Fishjam API + * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) + * + * The version of the OpenAPI document: 0.28.1 + * Contact: contact@fishjam.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +import type { PeerDetailsResponseData } from './PeerDetailsResponseData'; +import { + PeerDetailsResponseDataFromJSON, + PeerDetailsResponseDataFromJSONTyped, + PeerDetailsResponseDataToJSON, + PeerDetailsResponseDataToJSONTyped, +} from './PeerDetailsResponseData'; + +/** + * Response containing peer details and their token + * @export + * @interface PeerDetailsResponse + */ +export interface PeerDetailsResponse { + /** + * + * @type {PeerDetailsResponseData} + * @memberof PeerDetailsResponse + */ + data: PeerDetailsResponseData; +} + +/** + * Check if a given object implements the PeerDetailsResponse interface. + */ +export function instanceOfPeerDetailsResponse(value: object): value is PeerDetailsResponse { + if (!('data' in value) || value['data'] === undefined) return false; + return true; +} + +export function PeerDetailsResponseFromJSON(json: any): PeerDetailsResponse { + return PeerDetailsResponseFromJSONTyped(json, false); +} + +export function PeerDetailsResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): PeerDetailsResponse { + if (json == null) { + return json; + } + return { + + 'data': PeerDetailsResponseDataFromJSON(json['data']), + }; +} + +export function PeerDetailsResponseToJSON(json: any): PeerDetailsResponse { + return PeerDetailsResponseToJSONTyped(json, false); +} + +export function PeerDetailsResponseToJSONTyped(value?: PeerDetailsResponse | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'data': PeerDetailsResponseDataToJSON(value['data']), + }; +} + diff --git a/packages/fishjam-openapi/src/generated/models/PeerDetailsResponseData.ts b/packages/fishjam-openapi/src/generated/models/PeerDetailsResponseData.ts new file mode 100644 index 00000000..aa3257f5 --- /dev/null +++ b/packages/fishjam-openapi/src/generated/models/PeerDetailsResponseData.ts @@ -0,0 +1,91 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Fishjam API + * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) + * + * The version of the OpenAPI document: 0.28.1 + * Contact: contact@fishjam.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +import type { Peer } from './Peer'; +import { + PeerFromJSON, + PeerFromJSONTyped, + PeerToJSON, + PeerToJSONTyped, +} from './Peer'; + +/** + * + * @export + * @interface PeerDetailsResponseData + */ +export interface PeerDetailsResponseData { + /** + * + * @type {Peer} + * @memberof PeerDetailsResponseData + */ + peer: Peer; + /** + * Websocket URL to which peer has to connect + * @type {string} + * @memberof PeerDetailsResponseData + */ + peer_websocket_url?: string; + /** + * Token for authorizing websocket connection + * @type {string} + * @memberof PeerDetailsResponseData + */ + token: string; +} + +/** + * Check if a given object implements the PeerDetailsResponseData interface. + */ +export function instanceOfPeerDetailsResponseData(value: object): value is PeerDetailsResponseData { + if (!('peer' in value) || value['peer'] === undefined) return false; + if (!('token' in value) || value['token'] === undefined) return false; + return true; +} + +export function PeerDetailsResponseDataFromJSON(json: any): PeerDetailsResponseData { + return PeerDetailsResponseDataFromJSONTyped(json, false); +} + +export function PeerDetailsResponseDataFromJSONTyped(json: any, ignoreDiscriminator: boolean): PeerDetailsResponseData { + if (json == null) { + return json; + } + return { + + 'peer': PeerFromJSON(json['peer']), + 'peer_websocket_url': json['peer_websocket_url'] == null ? undefined : json['peer_websocket_url'], + 'token': json['token'], + }; +} + +export function PeerDetailsResponseDataToJSON(json: any): PeerDetailsResponseData { + return PeerDetailsResponseDataToJSONTyped(json, false); +} + +export function PeerDetailsResponseDataToJSONTyped(value?: PeerDetailsResponseData | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'peer': PeerToJSON(value['peer']), + 'peer_websocket_url': value['peer_websocket_url'], + 'token': value['token'], + }; +} + diff --git a/packages/fishjam-openapi/src/generated/models/PeerOptions.ts b/packages/fishjam-openapi/src/generated/models/PeerOptions.ts new file mode 100644 index 00000000..6216a755 --- /dev/null +++ b/packages/fishjam-openapi/src/generated/models/PeerOptions.ts @@ -0,0 +1,91 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Fishjam API + * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) + * + * The version of the OpenAPI document: 0.28.1 + * Contact: contact@fishjam.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import type { PeerOptionsAgent } from './PeerOptionsAgent'; +import { + instanceOfPeerOptionsAgent, + PeerOptionsAgentFromJSON, + PeerOptionsAgentFromJSONTyped, + PeerOptionsAgentToJSON, +} from './PeerOptionsAgent'; +import type { PeerOptionsVapi } from './PeerOptionsVapi'; +import { + instanceOfPeerOptionsVapi, + PeerOptionsVapiFromJSON, + PeerOptionsVapiFromJSONTyped, + PeerOptionsVapiToJSON, +} from './PeerOptionsVapi'; +import type { PeerOptionsWebRTC } from './PeerOptionsWebRTC'; +import { + instanceOfPeerOptionsWebRTC, + PeerOptionsWebRTCFromJSON, + PeerOptionsWebRTCFromJSONTyped, + PeerOptionsWebRTCToJSON, +} from './PeerOptionsWebRTC'; + +/** + * @type PeerOptions + * Peer-specific options + * @export + */ +export type PeerOptions = PeerOptionsAgent | PeerOptionsVapi | PeerOptionsWebRTC; + +export function PeerOptionsFromJSON(json: any): PeerOptions { + return PeerOptionsFromJSONTyped(json, false); +} + +export function PeerOptionsFromJSONTyped(json: any, ignoreDiscriminator: boolean): PeerOptions { + if (json == null) { + return json; + } + if (typeof json !== 'object') { + return json; + } + if (instanceOfPeerOptionsAgent(json)) { + return PeerOptionsAgentFromJSONTyped(json, true); + } + if (instanceOfPeerOptionsVapi(json)) { + return PeerOptionsVapiFromJSONTyped(json, true); + } + if (instanceOfPeerOptionsWebRTC(json)) { + return PeerOptionsWebRTCFromJSONTyped(json, true); + } + + return {} as any; +} + +export function PeerOptionsToJSON(json: any): any { + return PeerOptionsToJSONTyped(json, false); +} + +export function PeerOptionsToJSONTyped(value?: PeerOptions | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + if (typeof value !== 'object') { + return value; + } + if (instanceOfPeerOptionsAgent(value)) { + return PeerOptionsAgentToJSON(value as PeerOptionsAgent); + } + if (instanceOfPeerOptionsVapi(value)) { + return PeerOptionsVapiToJSON(value as PeerOptionsVapi); + } + if (instanceOfPeerOptionsWebRTC(value)) { + return PeerOptionsWebRTCToJSON(value as PeerOptionsWebRTC); + } + + return {}; +} + diff --git a/packages/fishjam-openapi/src/generated/models/PeerOptionsAgent.ts b/packages/fishjam-openapi/src/generated/models/PeerOptionsAgent.ts new file mode 100644 index 00000000..3a67cb89 --- /dev/null +++ b/packages/fishjam-openapi/src/generated/models/PeerOptionsAgent.ts @@ -0,0 +1,90 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Fishjam API + * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) + * + * The version of the OpenAPI document: 0.28.1 + * Contact: contact@fishjam.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +import type { AgentOutput } from './AgentOutput'; +import { + AgentOutputFromJSON, + AgentOutputFromJSONTyped, + AgentOutputToJSON, + AgentOutputToJSONTyped, +} from './AgentOutput'; +import type { SubscribeMode } from './SubscribeMode'; +import { + SubscribeModeFromJSON, + SubscribeModeFromJSONTyped, + SubscribeModeToJSON, + SubscribeModeToJSONTyped, +} from './SubscribeMode'; + +/** + * Options specific to the Agent peer + * @export + * @interface PeerOptionsAgent + */ +export interface PeerOptionsAgent { + /** + * + * @type {AgentOutput} + * @memberof PeerOptionsAgent + */ + output?: AgentOutput; + /** + * + * @type {SubscribeMode} + * @memberof PeerOptionsAgent + */ + subscribeMode?: SubscribeMode; +} + + + +/** + * Check if a given object implements the PeerOptionsAgent interface. + */ +export function instanceOfPeerOptionsAgent(value: object): value is PeerOptionsAgent { + return true; +} + +export function PeerOptionsAgentFromJSON(json: any): PeerOptionsAgent { + return PeerOptionsAgentFromJSONTyped(json, false); +} + +export function PeerOptionsAgentFromJSONTyped(json: any, ignoreDiscriminator: boolean): PeerOptionsAgent { + if (json == null) { + return json; + } + return { + + 'output': json['output'] == null ? undefined : AgentOutputFromJSON(json['output']), + 'subscribeMode': json['subscribeMode'] == null ? undefined : SubscribeModeFromJSON(json['subscribeMode']), + }; +} + +export function PeerOptionsAgentToJSON(json: any): PeerOptionsAgent { + return PeerOptionsAgentToJSONTyped(json, false); +} + +export function PeerOptionsAgentToJSONTyped(value?: PeerOptionsAgent | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'output': AgentOutputToJSON(value['output']), + 'subscribeMode': SubscribeModeToJSON(value['subscribeMode']), + }; +} + diff --git a/packages/fishjam-openapi/src/generated/models/PeerOptionsVapi.ts b/packages/fishjam-openapi/src/generated/models/PeerOptionsVapi.ts new file mode 100644 index 00000000..3c59929f --- /dev/null +++ b/packages/fishjam-openapi/src/generated/models/PeerOptionsVapi.ts @@ -0,0 +1,93 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Fishjam API + * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) + * + * The version of the OpenAPI document: 0.28.1 + * Contact: contact@fishjam.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +import type { SubscribeMode } from './SubscribeMode'; +import { + SubscribeModeFromJSON, + SubscribeModeFromJSONTyped, + SubscribeModeToJSON, + SubscribeModeToJSONTyped, +} from './SubscribeMode'; + +/** + * Options specific to the VAPI peer + * @export + * @interface PeerOptionsVapi + */ +export interface PeerOptionsVapi { + /** + * VAPI API key + * @type {string} + * @memberof PeerOptionsVapi + */ + apiKey: string; + /** + * VAPI call ID + * @type {string} + * @memberof PeerOptionsVapi + */ + callId: string; + /** + * + * @type {SubscribeMode} + * @memberof PeerOptionsVapi + */ + subscribeMode?: SubscribeMode; +} + + + +/** + * Check if a given object implements the PeerOptionsVapi interface. + */ +export function instanceOfPeerOptionsVapi(value: object): value is PeerOptionsVapi { + if (!('apiKey' in value) || value['apiKey'] === undefined) return false; + if (!('callId' in value) || value['callId'] === undefined) return false; + return true; +} + +export function PeerOptionsVapiFromJSON(json: any): PeerOptionsVapi { + return PeerOptionsVapiFromJSONTyped(json, false); +} + +export function PeerOptionsVapiFromJSONTyped(json: any, ignoreDiscriminator: boolean): PeerOptionsVapi { + if (json == null) { + return json; + } + return { + + 'apiKey': json['apiKey'], + 'callId': json['callId'], + 'subscribeMode': json['subscribeMode'] == null ? undefined : SubscribeModeFromJSON(json['subscribeMode']), + }; +} + +export function PeerOptionsVapiToJSON(json: any): PeerOptionsVapi { + return PeerOptionsVapiToJSONTyped(json, false); +} + +export function PeerOptionsVapiToJSONTyped(value?: PeerOptionsVapi | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'apiKey': value['apiKey'], + 'callId': value['callId'], + 'subscribeMode': SubscribeModeToJSON(value['subscribeMode']), + }; +} + diff --git a/packages/fishjam-openapi/src/generated/models/PeerOptionsWebRTC.ts b/packages/fishjam-openapi/src/generated/models/PeerOptionsWebRTC.ts new file mode 100644 index 00000000..84a578fa --- /dev/null +++ b/packages/fishjam-openapi/src/generated/models/PeerOptionsWebRTC.ts @@ -0,0 +1,83 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Fishjam API + * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) + * + * The version of the OpenAPI document: 0.28.1 + * Contact: contact@fishjam.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +import type { SubscribeMode } from './SubscribeMode'; +import { + SubscribeModeFromJSON, + SubscribeModeFromJSONTyped, + SubscribeModeToJSON, + SubscribeModeToJSONTyped, +} from './SubscribeMode'; + +/** + * Options specific to the WebRTC peer + * @export + * @interface PeerOptionsWebRTC + */ +export interface PeerOptionsWebRTC { + /** + * Custom peer metadata + * @type {{ [key: string]: any; }} + * @memberof PeerOptionsWebRTC + */ + metadata?: { [key: string]: any; }; + /** + * + * @type {SubscribeMode} + * @memberof PeerOptionsWebRTC + */ + subscribeMode?: SubscribeMode; +} + + + +/** + * Check if a given object implements the PeerOptionsWebRTC interface. + */ +export function instanceOfPeerOptionsWebRTC(value: object): value is PeerOptionsWebRTC { + return true; +} + +export function PeerOptionsWebRTCFromJSON(json: any): PeerOptionsWebRTC { + return PeerOptionsWebRTCFromJSONTyped(json, false); +} + +export function PeerOptionsWebRTCFromJSONTyped(json: any, ignoreDiscriminator: boolean): PeerOptionsWebRTC { + if (json == null) { + return json; + } + return { + + 'metadata': json['metadata'] == null ? undefined : json['metadata'], + 'subscribeMode': json['subscribeMode'] == null ? undefined : SubscribeModeFromJSON(json['subscribeMode']), + }; +} + +export function PeerOptionsWebRTCToJSON(json: any): PeerOptionsWebRTC { + return PeerOptionsWebRTCToJSONTyped(json, false); +} + +export function PeerOptionsWebRTCToJSONTyped(value?: PeerOptionsWebRTC | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'metadata': value['metadata'], + 'subscribeMode': SubscribeModeToJSON(value['subscribeMode']), + }; +} + diff --git a/packages/fishjam-openapi/src/generated/models/PeerRefreshTokenResponse.ts b/packages/fishjam-openapi/src/generated/models/PeerRefreshTokenResponse.ts new file mode 100644 index 00000000..f4f716ed --- /dev/null +++ b/packages/fishjam-openapi/src/generated/models/PeerRefreshTokenResponse.ts @@ -0,0 +1,74 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Fishjam API + * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) + * + * The version of the OpenAPI document: 0.28.1 + * Contact: contact@fishjam.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +import type { PeerRefreshTokenResponseData } from './PeerRefreshTokenResponseData'; +import { + PeerRefreshTokenResponseDataFromJSON, + PeerRefreshTokenResponseDataFromJSONTyped, + PeerRefreshTokenResponseDataToJSON, + PeerRefreshTokenResponseDataToJSONTyped, +} from './PeerRefreshTokenResponseData'; + +/** + * Response containing new peer token + * @export + * @interface PeerRefreshTokenResponse + */ +export interface PeerRefreshTokenResponse { + /** + * + * @type {PeerRefreshTokenResponseData} + * @memberof PeerRefreshTokenResponse + */ + data: PeerRefreshTokenResponseData; +} + +/** + * Check if a given object implements the PeerRefreshTokenResponse interface. + */ +export function instanceOfPeerRefreshTokenResponse(value: object): value is PeerRefreshTokenResponse { + if (!('data' in value) || value['data'] === undefined) return false; + return true; +} + +export function PeerRefreshTokenResponseFromJSON(json: any): PeerRefreshTokenResponse { + return PeerRefreshTokenResponseFromJSONTyped(json, false); +} + +export function PeerRefreshTokenResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): PeerRefreshTokenResponse { + if (json == null) { + return json; + } + return { + + 'data': PeerRefreshTokenResponseDataFromJSON(json['data']), + }; +} + +export function PeerRefreshTokenResponseToJSON(json: any): PeerRefreshTokenResponse { + return PeerRefreshTokenResponseToJSONTyped(json, false); +} + +export function PeerRefreshTokenResponseToJSONTyped(value?: PeerRefreshTokenResponse | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'data': PeerRefreshTokenResponseDataToJSON(value['data']), + }; +} + diff --git a/packages/fishjam-openapi/src/generated/models/PeerRefreshTokenResponseData.ts b/packages/fishjam-openapi/src/generated/models/PeerRefreshTokenResponseData.ts new file mode 100644 index 00000000..0dab4572 --- /dev/null +++ b/packages/fishjam-openapi/src/generated/models/PeerRefreshTokenResponseData.ts @@ -0,0 +1,66 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Fishjam API + * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) + * + * The version of the OpenAPI document: 0.28.1 + * Contact: contact@fishjam.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +/** + * + * @export + * @interface PeerRefreshTokenResponseData + */ +export interface PeerRefreshTokenResponseData { + /** + * Token for authorizing websocket connection + * @type {string} + * @memberof PeerRefreshTokenResponseData + */ + token: string; +} + +/** + * Check if a given object implements the PeerRefreshTokenResponseData interface. + */ +export function instanceOfPeerRefreshTokenResponseData(value: object): value is PeerRefreshTokenResponseData { + if (!('token' in value) || value['token'] === undefined) return false; + return true; +} + +export function PeerRefreshTokenResponseDataFromJSON(json: any): PeerRefreshTokenResponseData { + return PeerRefreshTokenResponseDataFromJSONTyped(json, false); +} + +export function PeerRefreshTokenResponseDataFromJSONTyped(json: any, ignoreDiscriminator: boolean): PeerRefreshTokenResponseData { + if (json == null) { + return json; + } + return { + + 'token': json['token'], + }; +} + +export function PeerRefreshTokenResponseDataToJSON(json: any): PeerRefreshTokenResponseData { + return PeerRefreshTokenResponseDataToJSONTyped(json, false); +} + +export function PeerRefreshTokenResponseDataToJSONTyped(value?: PeerRefreshTokenResponseData | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'token': value['token'], + }; +} + diff --git a/packages/fishjam-openapi/src/generated/models/PeerStatus.ts b/packages/fishjam-openapi/src/generated/models/PeerStatus.ts new file mode 100644 index 00000000..0eaec358 --- /dev/null +++ b/packages/fishjam-openapi/src/generated/models/PeerStatus.ts @@ -0,0 +1,53 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Fishjam API + * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) + * + * The version of the OpenAPI document: 0.28.1 + * Contact: contact@fishjam.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** + * Informs about the peer status + * @export + */ +export const PeerStatus = { + Connected: 'connected', + Disconnected: 'disconnected' +} as const; +export type PeerStatus = typeof PeerStatus[keyof typeof PeerStatus]; + + +export function instanceOfPeerStatus(value: any): boolean { + for (const key in PeerStatus) { + if (Object.prototype.hasOwnProperty.call(PeerStatus, key)) { + if (PeerStatus[key as keyof typeof PeerStatus] === value) { + return true; + } + } + } + return false; +} + +export function PeerStatusFromJSON(json: any): PeerStatus { + return PeerStatusFromJSONTyped(json, false); +} + +export function PeerStatusFromJSONTyped(json: any, ignoreDiscriminator: boolean): PeerStatus { + return json as PeerStatus; +} + +export function PeerStatusToJSON(value?: PeerStatus | null): any { + return value as any; +} + +export function PeerStatusToJSONTyped(value: any, ignoreDiscriminator: boolean): PeerStatus { + return value as PeerStatus; +} + diff --git a/packages/fishjam-openapi/src/generated/models/PeerType.ts b/packages/fishjam-openapi/src/generated/models/PeerType.ts new file mode 100644 index 00000000..43df834a --- /dev/null +++ b/packages/fishjam-openapi/src/generated/models/PeerType.ts @@ -0,0 +1,54 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Fishjam API + * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) + * + * The version of the OpenAPI document: 0.28.1 + * Contact: contact@fishjam.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** + * Peer type + * @export + */ +export const PeerType = { + Webrtc: 'webrtc', + Agent: 'agent', + Vapi: 'vapi' +} as const; +export type PeerType = typeof PeerType[keyof typeof PeerType]; + + +export function instanceOfPeerType(value: any): boolean { + for (const key in PeerType) { + if (Object.prototype.hasOwnProperty.call(PeerType, key)) { + if (PeerType[key as keyof typeof PeerType] === value) { + return true; + } + } + } + return false; +} + +export function PeerTypeFromJSON(json: any): PeerType { + return PeerTypeFromJSONTyped(json, false); +} + +export function PeerTypeFromJSONTyped(json: any, ignoreDiscriminator: boolean): PeerType { + return json as PeerType; +} + +export function PeerTypeToJSON(value?: PeerType | null): any { + return value as any; +} + +export function PeerTypeToJSONTyped(value: any, ignoreDiscriminator: boolean): PeerType { + return value as PeerType; +} + diff --git a/packages/fishjam-openapi/src/generated/models/Room.ts b/packages/fishjam-openapi/src/generated/models/Room.ts new file mode 100644 index 00000000..c499c357 --- /dev/null +++ b/packages/fishjam-openapi/src/generated/models/Room.ts @@ -0,0 +1,114 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Fishjam API + * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) + * + * The version of the OpenAPI document: 0.28.1 + * Contact: contact@fishjam.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +import type { Peer } from './Peer'; +import { + PeerFromJSON, + PeerFromJSONTyped, + PeerToJSON, + PeerToJSONTyped, +} from './Peer'; +import type { CompositionInfo } from './CompositionInfo'; +import { + CompositionInfoFromJSON, + CompositionInfoFromJSONTyped, + CompositionInfoToJSON, + CompositionInfoToJSONTyped, +} from './CompositionInfo'; +import type { RoomConfig } from './RoomConfig'; +import { + RoomConfigFromJSON, + RoomConfigFromJSONTyped, + RoomConfigToJSON, + RoomConfigToJSONTyped, +} from './RoomConfig'; + +/** + * State of a room + * @export + * @interface Room + */ +export interface Room { + /** + * + * @type {CompositionInfo} + * @memberof Room + */ + compositionInfo?: CompositionInfo | null; + /** + * + * @type {RoomConfig} + * @memberof Room + */ + config: RoomConfig; + /** + * Room ID + * @type {string} + * @memberof Room + */ + id: string; + /** + * List of all peers + * @type {Array} + * @memberof Room + */ + peers: Array; +} + +/** + * Check if a given object implements the Room interface. + */ +export function instanceOfRoom(value: object): value is Room { + if (!('config' in value) || value['config'] === undefined) return false; + if (!('id' in value) || value['id'] === undefined) return false; + if (!('peers' in value) || value['peers'] === undefined) return false; + return true; +} + +export function RoomFromJSON(json: any): Room { + return RoomFromJSONTyped(json, false); +} + +export function RoomFromJSONTyped(json: any, ignoreDiscriminator: boolean): Room { + if (json == null) { + return json; + } + return { + + 'compositionInfo': json['compositionInfo'] == null ? undefined : CompositionInfoFromJSON(json['compositionInfo']), + 'config': RoomConfigFromJSON(json['config']), + 'id': json['id'], + 'peers': ((json['peers'] as Array).map(PeerFromJSON)), + }; +} + +export function RoomToJSON(json: any): Room { + return RoomToJSONTyped(json, false); +} + +export function RoomToJSONTyped(value?: Room | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'compositionInfo': CompositionInfoToJSON(value['compositionInfo']), + 'config': RoomConfigToJSON(value['config']), + 'id': value['id'], + 'peers': ((value['peers'] as Array).map(PeerToJSON)), + }; +} + diff --git a/packages/fishjam-openapi/src/generated/models/RoomConfig.ts b/packages/fishjam-openapi/src/generated/models/RoomConfig.ts new file mode 100644 index 00000000..77518824 --- /dev/null +++ b/packages/fishjam-openapi/src/generated/models/RoomConfig.ts @@ -0,0 +1,122 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Fishjam API + * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) + * + * The version of the OpenAPI document: 0.28.1 + * Contact: contact@fishjam.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +import type { RoomType } from './RoomType'; +import { + RoomTypeFromJSON, + RoomTypeFromJSONTyped, + RoomTypeToJSON, + RoomTypeToJSONTyped, +} from './RoomType'; +import type { VideoCodec } from './VideoCodec'; +import { + VideoCodecFromJSON, + VideoCodecFromJSONTyped, + VideoCodecToJSON, + VideoCodecToJSONTyped, +} from './VideoCodec'; + +/** + * Room configuration + * @export + * @interface RoomConfig + */ +export interface RoomConfig { + /** + * If true, webhook notifications for this room are coalesced into a single NotificationBatch per HTTP send instead of one request per notification. VAD notifications are unaffected. + * @type {boolean} + * @memberof RoomConfig + */ + batchWebhookNotifications?: boolean; + /** + * Maximum amount of peers allowed into the room + * @type {number} + * @memberof RoomConfig + */ + maxPeers?: number | null; + /** + * True if livestream viewers can omit specifying a token. + * @type {boolean} + * @memberof RoomConfig + */ + public?: boolean; + /** + * + * @type {RoomType} + * @memberof RoomConfig + */ + roomType?: RoomType; + /** + * + * @type {VideoCodec} + * @memberof RoomConfig + */ + videoCodec?: VideoCodec; + /** + * URL where Fishjam notifications will be sent + * @type {string} + * @memberof RoomConfig + */ + webhookUrl?: string | null; +} + + + +/** + * Check if a given object implements the RoomConfig interface. + */ +export function instanceOfRoomConfig(value: object): value is RoomConfig { + return true; +} + +export function RoomConfigFromJSON(json: any): RoomConfig { + return RoomConfigFromJSONTyped(json, false); +} + +export function RoomConfigFromJSONTyped(json: any, ignoreDiscriminator: boolean): RoomConfig { + if (json == null) { + return json; + } + return { + + 'batchWebhookNotifications': json['batchWebhookNotifications'] == null ? undefined : json['batchWebhookNotifications'], + 'maxPeers': json['maxPeers'] == null ? undefined : json['maxPeers'], + 'public': json['public'] == null ? undefined : json['public'], + 'roomType': json['roomType'] == null ? undefined : RoomTypeFromJSON(json['roomType']), + 'videoCodec': json['videoCodec'] == null ? undefined : VideoCodecFromJSON(json['videoCodec']), + 'webhookUrl': json['webhookUrl'] == null ? undefined : json['webhookUrl'], + }; +} + +export function RoomConfigToJSON(json: any): RoomConfig { + return RoomConfigToJSONTyped(json, false); +} + +export function RoomConfigToJSONTyped(value?: RoomConfig | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'batchWebhookNotifications': value['batchWebhookNotifications'], + 'maxPeers': value['maxPeers'], + 'public': value['public'], + 'roomType': RoomTypeToJSON(value['roomType']), + 'videoCodec': VideoCodecToJSON(value['videoCodec']), + 'webhookUrl': value['webhookUrl'], + }; +} + diff --git a/packages/fishjam-openapi/src/generated/models/RoomCreateDetailsResponse.ts b/packages/fishjam-openapi/src/generated/models/RoomCreateDetailsResponse.ts new file mode 100644 index 00000000..72585c8f --- /dev/null +++ b/packages/fishjam-openapi/src/generated/models/RoomCreateDetailsResponse.ts @@ -0,0 +1,74 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Fishjam API + * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) + * + * The version of the OpenAPI document: 0.28.1 + * Contact: contact@fishjam.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +import type { RoomCreateDetailsResponseData } from './RoomCreateDetailsResponseData'; +import { + RoomCreateDetailsResponseDataFromJSON, + RoomCreateDetailsResponseDataFromJSONTyped, + RoomCreateDetailsResponseDataToJSON, + RoomCreateDetailsResponseDataToJSONTyped, +} from './RoomCreateDetailsResponseData'; + +/** + * Response containing room details + * @export + * @interface RoomCreateDetailsResponse + */ +export interface RoomCreateDetailsResponse { + /** + * + * @type {RoomCreateDetailsResponseData} + * @memberof RoomCreateDetailsResponse + */ + data: RoomCreateDetailsResponseData; +} + +/** + * Check if a given object implements the RoomCreateDetailsResponse interface. + */ +export function instanceOfRoomCreateDetailsResponse(value: object): value is RoomCreateDetailsResponse { + if (!('data' in value) || value['data'] === undefined) return false; + return true; +} + +export function RoomCreateDetailsResponseFromJSON(json: any): RoomCreateDetailsResponse { + return RoomCreateDetailsResponseFromJSONTyped(json, false); +} + +export function RoomCreateDetailsResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): RoomCreateDetailsResponse { + if (json == null) { + return json; + } + return { + + 'data': RoomCreateDetailsResponseDataFromJSON(json['data']), + }; +} + +export function RoomCreateDetailsResponseToJSON(json: any): RoomCreateDetailsResponse { + return RoomCreateDetailsResponseToJSONTyped(json, false); +} + +export function RoomCreateDetailsResponseToJSONTyped(value?: RoomCreateDetailsResponse | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'data': RoomCreateDetailsResponseDataToJSON(value['data']), + }; +} + diff --git a/packages/fishjam-openapi/src/generated/models/RoomCreateDetailsResponseData.ts b/packages/fishjam-openapi/src/generated/models/RoomCreateDetailsResponseData.ts new file mode 100644 index 00000000..5002adce --- /dev/null +++ b/packages/fishjam-openapi/src/generated/models/RoomCreateDetailsResponseData.ts @@ -0,0 +1,74 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Fishjam API + * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) + * + * The version of the OpenAPI document: 0.28.1 + * Contact: contact@fishjam.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +import type { Room } from './Room'; +import { + RoomFromJSON, + RoomFromJSONTyped, + RoomToJSON, + RoomToJSONTyped, +} from './Room'; + +/** + * + * @export + * @interface RoomCreateDetailsResponseData + */ +export interface RoomCreateDetailsResponseData { + /** + * + * @type {Room} + * @memberof RoomCreateDetailsResponseData + */ + room: Room; +} + +/** + * Check if a given object implements the RoomCreateDetailsResponseData interface. + */ +export function instanceOfRoomCreateDetailsResponseData(value: object): value is RoomCreateDetailsResponseData { + if (!('room' in value) || value['room'] === undefined) return false; + return true; +} + +export function RoomCreateDetailsResponseDataFromJSON(json: any): RoomCreateDetailsResponseData { + return RoomCreateDetailsResponseDataFromJSONTyped(json, false); +} + +export function RoomCreateDetailsResponseDataFromJSONTyped(json: any, ignoreDiscriminator: boolean): RoomCreateDetailsResponseData { + if (json == null) { + return json; + } + return { + + 'room': RoomFromJSON(json['room']), + }; +} + +export function RoomCreateDetailsResponseDataToJSON(json: any): RoomCreateDetailsResponseData { + return RoomCreateDetailsResponseDataToJSONTyped(json, false); +} + +export function RoomCreateDetailsResponseDataToJSONTyped(value?: RoomCreateDetailsResponseData | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'room': RoomToJSON(value['room']), + }; +} + diff --git a/packages/fishjam-openapi/src/generated/models/RoomDetailsResponse.ts b/packages/fishjam-openapi/src/generated/models/RoomDetailsResponse.ts new file mode 100644 index 00000000..43207c70 --- /dev/null +++ b/packages/fishjam-openapi/src/generated/models/RoomDetailsResponse.ts @@ -0,0 +1,74 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Fishjam API + * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) + * + * The version of the OpenAPI document: 0.28.1 + * Contact: contact@fishjam.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +import type { Room } from './Room'; +import { + RoomFromJSON, + RoomFromJSONTyped, + RoomToJSON, + RoomToJSONTyped, +} from './Room'; + +/** + * Response containing room details + * @export + * @interface RoomDetailsResponse + */ +export interface RoomDetailsResponse { + /** + * + * @type {Room} + * @memberof RoomDetailsResponse + */ + data: Room; +} + +/** + * Check if a given object implements the RoomDetailsResponse interface. + */ +export function instanceOfRoomDetailsResponse(value: object): value is RoomDetailsResponse { + if (!('data' in value) || value['data'] === undefined) return false; + return true; +} + +export function RoomDetailsResponseFromJSON(json: any): RoomDetailsResponse { + return RoomDetailsResponseFromJSONTyped(json, false); +} + +export function RoomDetailsResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): RoomDetailsResponse { + if (json == null) { + return json; + } + return { + + 'data': RoomFromJSON(json['data']), + }; +} + +export function RoomDetailsResponseToJSON(json: any): RoomDetailsResponse { + return RoomDetailsResponseToJSONTyped(json, false); +} + +export function RoomDetailsResponseToJSONTyped(value?: RoomDetailsResponse | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'data': RoomToJSON(value['data']), + }; +} + diff --git a/packages/fishjam-openapi/src/generated/models/RoomType.ts b/packages/fishjam-openapi/src/generated/models/RoomType.ts new file mode 100644 index 00000000..a2aa28cd --- /dev/null +++ b/packages/fishjam-openapi/src/generated/models/RoomType.ts @@ -0,0 +1,57 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Fishjam API + * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) + * + * The version of the OpenAPI document: 0.28.1 + * Contact: contact@fishjam.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** + * The use-case of the room. If not provided, this defaults to conference. + * @export + */ +export const RoomType = { + FullFeature: 'full_feature', + AudioOnly: 'audio_only', + Broadcaster: 'broadcaster', + Livestream: 'livestream', + Conference: 'conference', + AudioOnlyLivestream: 'audio_only_livestream' +} as const; +export type RoomType = typeof RoomType[keyof typeof RoomType]; + + +export function instanceOfRoomType(value: any): boolean { + for (const key in RoomType) { + if (Object.prototype.hasOwnProperty.call(RoomType, key)) { + if (RoomType[key as keyof typeof RoomType] === value) { + return true; + } + } + } + return false; +} + +export function RoomTypeFromJSON(json: any): RoomType { + return RoomTypeFromJSONTyped(json, false); +} + +export function RoomTypeFromJSONTyped(json: any, ignoreDiscriminator: boolean): RoomType { + return json as RoomType; +} + +export function RoomTypeToJSON(value?: RoomType | null): any { + return value as any; +} + +export function RoomTypeToJSONTyped(value: any, ignoreDiscriminator: boolean): RoomType { + return value as RoomType; +} + diff --git a/packages/fishjam-openapi/src/generated/models/RoomsListingResponse.ts b/packages/fishjam-openapi/src/generated/models/RoomsListingResponse.ts new file mode 100644 index 00000000..20aad7d5 --- /dev/null +++ b/packages/fishjam-openapi/src/generated/models/RoomsListingResponse.ts @@ -0,0 +1,74 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Fishjam API + * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) + * + * The version of the OpenAPI document: 0.28.1 + * Contact: contact@fishjam.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +import type { Room } from './Room'; +import { + RoomFromJSON, + RoomFromJSONTyped, + RoomToJSON, + RoomToJSONTyped, +} from './Room'; + +/** + * Response containing list of all rooms + * @export + * @interface RoomsListingResponse + */ +export interface RoomsListingResponse { + /** + * + * @type {Array} + * @memberof RoomsListingResponse + */ + data: Array; +} + +/** + * Check if a given object implements the RoomsListingResponse interface. + */ +export function instanceOfRoomsListingResponse(value: object): value is RoomsListingResponse { + if (!('data' in value) || value['data'] === undefined) return false; + return true; +} + +export function RoomsListingResponseFromJSON(json: any): RoomsListingResponse { + return RoomsListingResponseFromJSONTyped(json, false); +} + +export function RoomsListingResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): RoomsListingResponse { + if (json == null) { + return json; + } + return { + + 'data': ((json['data'] as Array).map(RoomFromJSON)), + }; +} + +export function RoomsListingResponseToJSON(json: any): RoomsListingResponse { + return RoomsListingResponseToJSONTyped(json, false); +} + +export function RoomsListingResponseToJSONTyped(value?: RoomsListingResponse | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'data': ((value['data'] as Array).map(RoomToJSON)), + }; +} + diff --git a/packages/fishjam-openapi/src/generated/models/Stream.ts b/packages/fishjam-openapi/src/generated/models/Stream.ts new file mode 100644 index 00000000..4654361c --- /dev/null +++ b/packages/fishjam-openapi/src/generated/models/Stream.ts @@ -0,0 +1,116 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Fishjam API + * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) + * + * The version of the OpenAPI document: 0.28.1 + * Contact: contact@fishjam.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +import type { Streamer } from './Streamer'; +import { + StreamerFromJSON, + StreamerFromJSONTyped, + StreamerToJSON, + StreamerToJSONTyped, +} from './Streamer'; +import type { Viewer } from './Viewer'; +import { + ViewerFromJSON, + ViewerFromJSONTyped, + ViewerToJSON, + ViewerToJSONTyped, +} from './Viewer'; + +/** + * State of a stream + * @export + * @interface Stream + */ +export interface Stream { + /** + * True if stream is restricted to audio only + * @type {boolean} + * @memberof Stream + */ + audioOnly?: boolean; + /** + * Assigned stream id + * @type {string} + * @memberof Stream + */ + id: string; + /** + * True if livestream viewers can omit specifying a token. + * @type {boolean} + * @memberof Stream + */ + public: boolean; + /** + * List of all streamers + * @type {Array} + * @memberof Stream + */ + streamers: Array; + /** + * List of all viewers + * @type {Array} + * @memberof Stream + */ + viewers: Array; +} + +/** + * Check if a given object implements the Stream interface. + */ +export function instanceOfStream(value: object): value is Stream { + if (!('id' in value) || value['id'] === undefined) return false; + if (!('public' in value) || value['public'] === undefined) return false; + if (!('streamers' in value) || value['streamers'] === undefined) return false; + if (!('viewers' in value) || value['viewers'] === undefined) return false; + return true; +} + +export function StreamFromJSON(json: any): Stream { + return StreamFromJSONTyped(json, false); +} + +export function StreamFromJSONTyped(json: any, ignoreDiscriminator: boolean): Stream { + if (json == null) { + return json; + } + return { + + 'audioOnly': json['audioOnly'] == null ? undefined : json['audioOnly'], + 'id': json['id'], + 'public': json['public'], + 'streamers': ((json['streamers'] as Array).map(StreamerFromJSON)), + 'viewers': ((json['viewers'] as Array).map(ViewerFromJSON)), + }; +} + +export function StreamToJSON(json: any): Stream { + return StreamToJSONTyped(json, false); +} + +export function StreamToJSONTyped(value?: Stream | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'audioOnly': value['audioOnly'], + 'id': value['id'], + 'public': value['public'], + 'streamers': ((value['streamers'] as Array).map(StreamerToJSON)), + 'viewers': ((value['viewers'] as Array).map(ViewerToJSON)), + }; +} + diff --git a/packages/fishjam-openapi/src/generated/models/StreamConfig.ts b/packages/fishjam-openapi/src/generated/models/StreamConfig.ts new file mode 100644 index 00000000..138fa030 --- /dev/null +++ b/packages/fishjam-openapi/src/generated/models/StreamConfig.ts @@ -0,0 +1,89 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Fishjam API + * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) + * + * The version of the OpenAPI document: 0.28.1 + * Contact: contact@fishjam.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +/** + * Stream configuration + * @export + * @interface StreamConfig + */ +export interface StreamConfig { + /** + * Restrics stream to audio only + * @type {boolean} + * @memberof StreamConfig + */ + audioOnly?: boolean | null; + /** + * If true, webhook notifications for this stream are coalesced into a single NotificationBatch per HTTP send instead of one request per notification. VAD notifications are unaffected. + * @type {boolean} + * @memberof StreamConfig + */ + batchWebhookNotifications?: boolean; + /** + * True if livestream viewers can omit specifying a token. + * @type {boolean} + * @memberof StreamConfig + */ + public?: boolean; + /** + * Webhook URL for receiving server notifications + * @type {string} + * @memberof StreamConfig + */ + webhookUrl?: string | null; +} + +/** + * Check if a given object implements the StreamConfig interface. + */ +export function instanceOfStreamConfig(value: object): value is StreamConfig { + return true; +} + +export function StreamConfigFromJSON(json: any): StreamConfig { + return StreamConfigFromJSONTyped(json, false); +} + +export function StreamConfigFromJSONTyped(json: any, ignoreDiscriminator: boolean): StreamConfig { + if (json == null) { + return json; + } + return { + + 'audioOnly': json['audioOnly'] == null ? undefined : json['audioOnly'], + 'batchWebhookNotifications': json['batchWebhookNotifications'] == null ? undefined : json['batchWebhookNotifications'], + 'public': json['public'] == null ? undefined : json['public'], + 'webhookUrl': json['webhookUrl'] == null ? undefined : json['webhookUrl'], + }; +} + +export function StreamConfigToJSON(json: any): StreamConfig { + return StreamConfigToJSONTyped(json, false); +} + +export function StreamConfigToJSONTyped(value?: StreamConfig | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'audioOnly': value['audioOnly'], + 'batchWebhookNotifications': value['batchWebhookNotifications'], + 'public': value['public'], + 'webhookUrl': value['webhookUrl'], + }; +} + diff --git a/packages/fishjam-openapi/src/generated/models/StreamDetailsResponse.ts b/packages/fishjam-openapi/src/generated/models/StreamDetailsResponse.ts new file mode 100644 index 00000000..8f699907 --- /dev/null +++ b/packages/fishjam-openapi/src/generated/models/StreamDetailsResponse.ts @@ -0,0 +1,74 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Fishjam API + * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) + * + * The version of the OpenAPI document: 0.28.1 + * Contact: contact@fishjam.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +import type { Stream } from './Stream'; +import { + StreamFromJSON, + StreamFromJSONTyped, + StreamToJSON, + StreamToJSONTyped, +} from './Stream'; + +/** + * Response containing stream details + * @export + * @interface StreamDetailsResponse + */ +export interface StreamDetailsResponse { + /** + * + * @type {Stream} + * @memberof StreamDetailsResponse + */ + data: Stream; +} + +/** + * Check if a given object implements the StreamDetailsResponse interface. + */ +export function instanceOfStreamDetailsResponse(value: object): value is StreamDetailsResponse { + if (!('data' in value) || value['data'] === undefined) return false; + return true; +} + +export function StreamDetailsResponseFromJSON(json: any): StreamDetailsResponse { + return StreamDetailsResponseFromJSONTyped(json, false); +} + +export function StreamDetailsResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): StreamDetailsResponse { + if (json == null) { + return json; + } + return { + + 'data': StreamFromJSON(json['data']), + }; +} + +export function StreamDetailsResponseToJSON(json: any): StreamDetailsResponse { + return StreamDetailsResponseToJSONTyped(json, false); +} + +export function StreamDetailsResponseToJSONTyped(value?: StreamDetailsResponse | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'data': StreamToJSON(value['data']), + }; +} + diff --git a/packages/fishjam-openapi/src/generated/models/Streamer.ts b/packages/fishjam-openapi/src/generated/models/Streamer.ts new file mode 100644 index 00000000..1b5aa1b9 --- /dev/null +++ b/packages/fishjam-openapi/src/generated/models/Streamer.ts @@ -0,0 +1,95 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Fishjam API + * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) + * + * The version of the OpenAPI document: 0.28.1 + * Contact: contact@fishjam.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +/** + * Describes streamer status + * @export + * @interface Streamer + */ +export interface Streamer { + /** + * Assigned streamer id + * @type {string} + * @memberof Streamer + */ + id: string; + /** + * Streamer connection status + * @type {string} + * @memberof Streamer + */ + status: StreamerStatusEnum; + /** + * Token streamer should authorize with + * @type {string} + * @memberof Streamer + */ + token: string; +} + + +/** + * @export + */ +export const StreamerStatusEnum = { + Connected: 'connected', + Disconnected: 'disconnected' +} as const; +export type StreamerStatusEnum = typeof StreamerStatusEnum[keyof typeof StreamerStatusEnum]; + + +/** + * Check if a given object implements the Streamer interface. + */ +export function instanceOfStreamer(value: object): value is Streamer { + if (!('id' in value) || value['id'] === undefined) return false; + if (!('status' in value) || value['status'] === undefined) return false; + if (!('token' in value) || value['token'] === undefined) return false; + return true; +} + +export function StreamerFromJSON(json: any): Streamer { + return StreamerFromJSONTyped(json, false); +} + +export function StreamerFromJSONTyped(json: any, ignoreDiscriminator: boolean): Streamer { + if (json == null) { + return json; + } + return { + + 'id': json['id'], + 'status': json['status'], + 'token': json['token'], + }; +} + +export function StreamerToJSON(json: any): Streamer { + return StreamerToJSONTyped(json, false); +} + +export function StreamerToJSONTyped(value?: Streamer | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'id': value['id'], + 'status': value['status'], + 'token': value['token'], + }; +} + diff --git a/packages/fishjam-openapi/src/generated/models/StreamerDetailsResponse.ts b/packages/fishjam-openapi/src/generated/models/StreamerDetailsResponse.ts new file mode 100644 index 00000000..8c04e712 --- /dev/null +++ b/packages/fishjam-openapi/src/generated/models/StreamerDetailsResponse.ts @@ -0,0 +1,74 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Fishjam API + * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) + * + * The version of the OpenAPI document: 0.28.1 + * Contact: contact@fishjam.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +import type { Streamer } from './Streamer'; +import { + StreamerFromJSON, + StreamerFromJSONTyped, + StreamerToJSON, + StreamerToJSONTyped, +} from './Streamer'; + +/** + * Response containing streamer details + * @export + * @interface StreamerDetailsResponse + */ +export interface StreamerDetailsResponse { + /** + * + * @type {Streamer} + * @memberof StreamerDetailsResponse + */ + data: Streamer; +} + +/** + * Check if a given object implements the StreamerDetailsResponse interface. + */ +export function instanceOfStreamerDetailsResponse(value: object): value is StreamerDetailsResponse { + if (!('data' in value) || value['data'] === undefined) return false; + return true; +} + +export function StreamerDetailsResponseFromJSON(json: any): StreamerDetailsResponse { + return StreamerDetailsResponseFromJSONTyped(json, false); +} + +export function StreamerDetailsResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): StreamerDetailsResponse { + if (json == null) { + return json; + } + return { + + 'data': StreamerFromJSON(json['data']), + }; +} + +export function StreamerDetailsResponseToJSON(json: any): StreamerDetailsResponse { + return StreamerDetailsResponseToJSONTyped(json, false); +} + +export function StreamerDetailsResponseToJSONTyped(value?: StreamerDetailsResponse | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'data': StreamerToJSON(value['data']), + }; +} + diff --git a/packages/fishjam-openapi/src/generated/models/StreamerToken.ts b/packages/fishjam-openapi/src/generated/models/StreamerToken.ts new file mode 100644 index 00000000..78221375 --- /dev/null +++ b/packages/fishjam-openapi/src/generated/models/StreamerToken.ts @@ -0,0 +1,66 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Fishjam API + * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) + * + * The version of the OpenAPI document: 0.28.1 + * Contact: contact@fishjam.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +/** + * Streamer authorization token + * @export + * @interface StreamerToken + */ +export interface StreamerToken { + /** + * Token streamer should authorize with + * @type {string} + * @memberof StreamerToken + */ + token: string; +} + +/** + * Check if a given object implements the StreamerToken interface. + */ +export function instanceOfStreamerToken(value: object): value is StreamerToken { + if (!('token' in value) || value['token'] === undefined) return false; + return true; +} + +export function StreamerTokenFromJSON(json: any): StreamerToken { + return StreamerTokenFromJSONTyped(json, false); +} + +export function StreamerTokenFromJSONTyped(json: any, ignoreDiscriminator: boolean): StreamerToken { + if (json == null) { + return json; + } + return { + + 'token': json['token'], + }; +} + +export function StreamerTokenToJSON(json: any): StreamerToken { + return StreamerTokenToJSONTyped(json, false); +} + +export function StreamerTokenToJSONTyped(value?: StreamerToken | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'token': value['token'], + }; +} + diff --git a/packages/fishjam-openapi/src/generated/models/StreamsListingResponse.ts b/packages/fishjam-openapi/src/generated/models/StreamsListingResponse.ts new file mode 100644 index 00000000..790a6c17 --- /dev/null +++ b/packages/fishjam-openapi/src/generated/models/StreamsListingResponse.ts @@ -0,0 +1,74 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Fishjam API + * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) + * + * The version of the OpenAPI document: 0.28.1 + * Contact: contact@fishjam.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +import type { Stream } from './Stream'; +import { + StreamFromJSON, + StreamFromJSONTyped, + StreamToJSON, + StreamToJSONTyped, +} from './Stream'; + +/** + * Response containing list of all streams + * @export + * @interface StreamsListingResponse + */ +export interface StreamsListingResponse { + /** + * + * @type {Array} + * @memberof StreamsListingResponse + */ + data: Array; +} + +/** + * Check if a given object implements the StreamsListingResponse interface. + */ +export function instanceOfStreamsListingResponse(value: object): value is StreamsListingResponse { + if (!('data' in value) || value['data'] === undefined) return false; + return true; +} + +export function StreamsListingResponseFromJSON(json: any): StreamsListingResponse { + return StreamsListingResponseFromJSONTyped(json, false); +} + +export function StreamsListingResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): StreamsListingResponse { + if (json == null) { + return json; + } + return { + + 'data': ((json['data'] as Array).map(StreamFromJSON)), + }; +} + +export function StreamsListingResponseToJSON(json: any): StreamsListingResponse { + return StreamsListingResponseToJSONTyped(json, false); +} + +export function StreamsListingResponseToJSONTyped(value?: StreamsListingResponse | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'data': ((value['data'] as Array).map(StreamToJSON)), + }; +} + diff --git a/packages/fishjam-openapi/src/generated/models/SubscribeMode.ts b/packages/fishjam-openapi/src/generated/models/SubscribeMode.ts new file mode 100644 index 00000000..e1110804 --- /dev/null +++ b/packages/fishjam-openapi/src/generated/models/SubscribeMode.ts @@ -0,0 +1,53 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Fishjam API + * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) + * + * The version of the OpenAPI document: 0.28.1 + * Contact: contact@fishjam.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** + * Configuration of peer's subscribing policy + * @export + */ +export const SubscribeMode = { + Auto: 'auto', + Manual: 'manual' +} as const; +export type SubscribeMode = typeof SubscribeMode[keyof typeof SubscribeMode]; + + +export function instanceOfSubscribeMode(value: any): boolean { + for (const key in SubscribeMode) { + if (Object.prototype.hasOwnProperty.call(SubscribeMode, key)) { + if (SubscribeMode[key as keyof typeof SubscribeMode] === value) { + return true; + } + } + } + return false; +} + +export function SubscribeModeFromJSON(json: any): SubscribeMode { + return SubscribeModeFromJSONTyped(json, false); +} + +export function SubscribeModeFromJSONTyped(json: any, ignoreDiscriminator: boolean): SubscribeMode { + return json as SubscribeMode; +} + +export function SubscribeModeToJSON(value?: SubscribeMode | null): any { + return value as any; +} + +export function SubscribeModeToJSONTyped(value: any, ignoreDiscriminator: boolean): SubscribeMode { + return value as SubscribeMode; +} + diff --git a/packages/fishjam-openapi/src/generated/models/SubscribeTracksRequest.ts b/packages/fishjam-openapi/src/generated/models/SubscribeTracksRequest.ts new file mode 100644 index 00000000..3ab0c2a5 --- /dev/null +++ b/packages/fishjam-openapi/src/generated/models/SubscribeTracksRequest.ts @@ -0,0 +1,66 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Fishjam API + * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) + * + * The version of the OpenAPI document: 0.28.1 + * Contact: contact@fishjam.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +/** + * + * @export + * @interface SubscribeTracksRequest + */ +export interface SubscribeTracksRequest { + /** + * List of track IDs to subscribe to + * @type {Array} + * @memberof SubscribeTracksRequest + */ + track_ids: Array; +} + +/** + * Check if a given object implements the SubscribeTracksRequest interface. + */ +export function instanceOfSubscribeTracksRequest(value: object): value is SubscribeTracksRequest { + if (!('track_ids' in value) || value['track_ids'] === undefined) return false; + return true; +} + +export function SubscribeTracksRequestFromJSON(json: any): SubscribeTracksRequest { + return SubscribeTracksRequestFromJSONTyped(json, false); +} + +export function SubscribeTracksRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): SubscribeTracksRequest { + if (json == null) { + return json; + } + return { + + 'track_ids': json['track_ids'], + }; +} + +export function SubscribeTracksRequestToJSON(json: any): SubscribeTracksRequest { + return SubscribeTracksRequestToJSONTyped(json, false); +} + +export function SubscribeTracksRequestToJSONTyped(value?: SubscribeTracksRequest | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'track_ids': value['track_ids'], + }; +} + diff --git a/packages/fishjam-openapi/src/generated/models/Subscriptions.ts b/packages/fishjam-openapi/src/generated/models/Subscriptions.ts new file mode 100644 index 00000000..f65afbc5 --- /dev/null +++ b/packages/fishjam-openapi/src/generated/models/Subscriptions.ts @@ -0,0 +1,75 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Fishjam API + * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) + * + * The version of the OpenAPI document: 0.28.1 + * Contact: contact@fishjam.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +/** + * Describes peer's subscriptions in manual mode + * @export + * @interface Subscriptions + */ +export interface Subscriptions { + /** + * List of peer IDs this peer subscribes to + * @type {Array} + * @memberof Subscriptions + */ + peers: Array; + /** + * List of track IDs this peer subscribes to + * @type {Array} + * @memberof Subscriptions + */ + tracks: Array; +} + +/** + * Check if a given object implements the Subscriptions interface. + */ +export function instanceOfSubscriptions(value: object): value is Subscriptions { + if (!('peers' in value) || value['peers'] === undefined) return false; + if (!('tracks' in value) || value['tracks'] === undefined) return false; + return true; +} + +export function SubscriptionsFromJSON(json: any): Subscriptions { + return SubscriptionsFromJSONTyped(json, false); +} + +export function SubscriptionsFromJSONTyped(json: any, ignoreDiscriminator: boolean): Subscriptions { + if (json == null) { + return json; + } + return { + + 'peers': json['peers'], + 'tracks': json['tracks'], + }; +} + +export function SubscriptionsToJSON(json: any): Subscriptions { + return SubscriptionsToJSONTyped(json, false); +} + +export function SubscriptionsToJSONTyped(value?: Subscriptions | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'peers': value['peers'], + 'tracks': value['tracks'], + }; +} + diff --git a/packages/fishjam-openapi/src/generated/models/Track.ts b/packages/fishjam-openapi/src/generated/models/Track.ts new file mode 100644 index 00000000..8d63a007 --- /dev/null +++ b/packages/fishjam-openapi/src/generated/models/Track.ts @@ -0,0 +1,91 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Fishjam API + * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) + * + * The version of the OpenAPI document: 0.28.1 + * Contact: contact@fishjam.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +import type { TrackType } from './TrackType'; +import { + TrackTypeFromJSON, + TrackTypeFromJSONTyped, + TrackTypeToJSON, + TrackTypeToJSONTyped, +} from './TrackType'; + +/** + * Media track of a Peer + * @export + * @interface Track + */ +export interface Track { + /** + * Assigned track id + * @type {string} + * @memberof Track + */ + id?: string; + /** + * Metadata attached to the track by the peer + * @type {object} + * @memberof Track + */ + metadata?: object | null; + /** + * + * @type {TrackType} + * @memberof Track + */ + type?: TrackType; +} + + + +/** + * Check if a given object implements the Track interface. + */ +export function instanceOfTrack(value: object): value is Track { + return true; +} + +export function TrackFromJSON(json: any): Track { + return TrackFromJSONTyped(json, false); +} + +export function TrackFromJSONTyped(json: any, ignoreDiscriminator: boolean): Track { + if (json == null) { + return json; + } + return { + + 'id': json['id'] == null ? undefined : json['id'], + 'metadata': json['metadata'] == null ? undefined : json['metadata'], + 'type': json['type'] == null ? undefined : TrackTypeFromJSON(json['type']), + }; +} + +export function TrackToJSON(json: any): Track { + return TrackToJSONTyped(json, false); +} + +export function TrackToJSONTyped(value?: Track | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'id': value['id'], + 'metadata': value['metadata'], + 'type': TrackTypeToJSON(value['type']), + }; +} + diff --git a/packages/fishjam-openapi/src/generated/models/TrackForwarding.ts b/packages/fishjam-openapi/src/generated/models/TrackForwarding.ts new file mode 100644 index 00000000..4f3ac148 --- /dev/null +++ b/packages/fishjam-openapi/src/generated/models/TrackForwarding.ts @@ -0,0 +1,74 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Fishjam API + * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) + * + * The version of the OpenAPI document: 0.28.1 + * Contact: contact@fishjam.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +/** + * Track forwardings for a room + * @export + * @interface TrackForwarding + */ +export interface TrackForwarding { + /** + * URL for the composition + * @type {string} + * @memberof TrackForwarding + */ + compositionURL: string; + /** + * Selects tracks that should be forwarded, currently only "all" is supported + * @type {string} + * @memberof TrackForwarding + */ + selector?: string; +} + +/** + * Check if a given object implements the TrackForwarding interface. + */ +export function instanceOfTrackForwarding(value: object): value is TrackForwarding { + if (!('compositionURL' in value) || value['compositionURL'] === undefined) return false; + return true; +} + +export function TrackForwardingFromJSON(json: any): TrackForwarding { + return TrackForwardingFromJSONTyped(json, false); +} + +export function TrackForwardingFromJSONTyped(json: any, ignoreDiscriminator: boolean): TrackForwarding { + if (json == null) { + return json; + } + return { + + 'compositionURL': json['compositionURL'], + 'selector': json['selector'] == null ? undefined : json['selector'], + }; +} + +export function TrackForwardingToJSON(json: any): TrackForwarding { + return TrackForwardingToJSONTyped(json, false); +} + +export function TrackForwardingToJSONTyped(value?: TrackForwarding | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'compositionURL': value['compositionURL'], + 'selector': value['selector'], + }; +} + diff --git a/packages/fishjam-openapi/src/generated/models/TrackForwardingInfo.ts b/packages/fishjam-openapi/src/generated/models/TrackForwardingInfo.ts new file mode 100644 index 00000000..487a17a5 --- /dev/null +++ b/packages/fishjam-openapi/src/generated/models/TrackForwardingInfo.ts @@ -0,0 +1,91 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Fishjam API + * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) + * + * The version of the OpenAPI document: 0.28.1 + * Contact: contact@fishjam.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +/** + * Information about a track forwarding for a specific peer + * @export + * @interface TrackForwardingInfo + */ +export interface TrackForwardingInfo { + /** + * ID of the forwarded audio track + * @type {string} + * @memberof TrackForwardingInfo + */ + audioTrackId?: string | null; + /** + * Input ID used by the composition + * @type {string} + * @memberof TrackForwardingInfo + */ + inputId: string; + /** + * Peer ID + * @type {string} + * @memberof TrackForwardingInfo + */ + peerId: string; + /** + * ID of the forwarded video track + * @type {string} + * @memberof TrackForwardingInfo + */ + videoTrackId?: string | null; +} + +/** + * Check if a given object implements the TrackForwardingInfo interface. + */ +export function instanceOfTrackForwardingInfo(value: object): value is TrackForwardingInfo { + if (!('inputId' in value) || value['inputId'] === undefined) return false; + if (!('peerId' in value) || value['peerId'] === undefined) return false; + return true; +} + +export function TrackForwardingInfoFromJSON(json: any): TrackForwardingInfo { + return TrackForwardingInfoFromJSONTyped(json, false); +} + +export function TrackForwardingInfoFromJSONTyped(json: any, ignoreDiscriminator: boolean): TrackForwardingInfo { + if (json == null) { + return json; + } + return { + + 'audioTrackId': json['audioTrackId'] == null ? undefined : json['audioTrackId'], + 'inputId': json['inputId'], + 'peerId': json['peerId'], + 'videoTrackId': json['videoTrackId'] == null ? undefined : json['videoTrackId'], + }; +} + +export function TrackForwardingInfoToJSON(json: any): TrackForwardingInfo { + return TrackForwardingInfoToJSONTyped(json, false); +} + +export function TrackForwardingInfoToJSONTyped(value?: TrackForwardingInfo | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'audioTrackId': value['audioTrackId'], + 'inputId': value['inputId'], + 'peerId': value['peerId'], + 'videoTrackId': value['videoTrackId'], + }; +} + diff --git a/packages/fishjam-openapi/src/generated/models/TrackType.ts b/packages/fishjam-openapi/src/generated/models/TrackType.ts new file mode 100644 index 00000000..b4ab2793 --- /dev/null +++ b/packages/fishjam-openapi/src/generated/models/TrackType.ts @@ -0,0 +1,53 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Fishjam API + * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) + * + * The version of the OpenAPI document: 0.28.1 + * Contact: contact@fishjam.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** + * Media type carried by the track + * @export + */ +export const TrackType = { + Audio: 'audio', + Video: 'video' +} as const; +export type TrackType = typeof TrackType[keyof typeof TrackType]; + + +export function instanceOfTrackType(value: any): boolean { + for (const key in TrackType) { + if (Object.prototype.hasOwnProperty.call(TrackType, key)) { + if (TrackType[key as keyof typeof TrackType] === value) { + return true; + } + } + } + return false; +} + +export function TrackTypeFromJSON(json: any): TrackType { + return TrackTypeFromJSONTyped(json, false); +} + +export function TrackTypeFromJSONTyped(json: any, ignoreDiscriminator: boolean): TrackType { + return json as TrackType; +} + +export function TrackTypeToJSON(value?: TrackType | null): any { + return value as any; +} + +export function TrackTypeToJSONTyped(value: any, ignoreDiscriminator: boolean): TrackType { + return value as TrackType; +} + diff --git a/packages/fishjam-openapi/src/generated/models/VideoCodec.ts b/packages/fishjam-openapi/src/generated/models/VideoCodec.ts new file mode 100644 index 00000000..3d4fe508 --- /dev/null +++ b/packages/fishjam-openapi/src/generated/models/VideoCodec.ts @@ -0,0 +1,53 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Fishjam API + * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) + * + * The version of the OpenAPI document: 0.28.1 + * Contact: contact@fishjam.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** + * Enforces video codec for each peer in the room + * @export + */ +export const VideoCodec = { + H264: 'h264', + Vp8: 'vp8' +} as const; +export type VideoCodec = typeof VideoCodec[keyof typeof VideoCodec]; + + +export function instanceOfVideoCodec(value: any): boolean { + for (const key in VideoCodec) { + if (Object.prototype.hasOwnProperty.call(VideoCodec, key)) { + if (VideoCodec[key as keyof typeof VideoCodec] === value) { + return true; + } + } + } + return false; +} + +export function VideoCodecFromJSON(json: any): VideoCodec { + return VideoCodecFromJSONTyped(json, false); +} + +export function VideoCodecFromJSONTyped(json: any, ignoreDiscriminator: boolean): VideoCodec { + return json as VideoCodec; +} + +export function VideoCodecToJSON(value?: VideoCodec | null): any { + return value as any; +} + +export function VideoCodecToJSONTyped(value: any, ignoreDiscriminator: boolean): VideoCodec { + return value as VideoCodec; +} + diff --git a/packages/fishjam-openapi/src/generated/models/Viewer.ts b/packages/fishjam-openapi/src/generated/models/Viewer.ts new file mode 100644 index 00000000..554bf59e --- /dev/null +++ b/packages/fishjam-openapi/src/generated/models/Viewer.ts @@ -0,0 +1,75 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Fishjam API + * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) + * + * The version of the OpenAPI document: 0.28.1 + * Contact: contact@fishjam.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +/** + * Describes viewer status + * @export + * @interface Viewer + */ +export interface Viewer { + /** + * Assigned viewer id + * @type {string} + * @memberof Viewer + */ + id: string; + /** + * Token viewer should authorize with + * @type {string} + * @memberof Viewer + */ + token: string; +} + +/** + * Check if a given object implements the Viewer interface. + */ +export function instanceOfViewer(value: object): value is Viewer { + if (!('id' in value) || value['id'] === undefined) return false; + if (!('token' in value) || value['token'] === undefined) return false; + return true; +} + +export function ViewerFromJSON(json: any): Viewer { + return ViewerFromJSONTyped(json, false); +} + +export function ViewerFromJSONTyped(json: any, ignoreDiscriminator: boolean): Viewer { + if (json == null) { + return json; + } + return { + + 'id': json['id'], + 'token': json['token'], + }; +} + +export function ViewerToJSON(json: any): Viewer { + return ViewerToJSONTyped(json, false); +} + +export function ViewerToJSONTyped(value?: Viewer | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'id': value['id'], + 'token': value['token'], + }; +} + diff --git a/packages/fishjam-openapi/src/generated/models/ViewerDetailsResponse.ts b/packages/fishjam-openapi/src/generated/models/ViewerDetailsResponse.ts new file mode 100644 index 00000000..b0bb051b --- /dev/null +++ b/packages/fishjam-openapi/src/generated/models/ViewerDetailsResponse.ts @@ -0,0 +1,74 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Fishjam API + * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) + * + * The version of the OpenAPI document: 0.28.1 + * Contact: contact@fishjam.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +import type { Viewer } from './Viewer'; +import { + ViewerFromJSON, + ViewerFromJSONTyped, + ViewerToJSON, + ViewerToJSONTyped, +} from './Viewer'; + +/** + * Response containing viewer details + * @export + * @interface ViewerDetailsResponse + */ +export interface ViewerDetailsResponse { + /** + * + * @type {Viewer} + * @memberof ViewerDetailsResponse + */ + data: Viewer; +} + +/** + * Check if a given object implements the ViewerDetailsResponse interface. + */ +export function instanceOfViewerDetailsResponse(value: object): value is ViewerDetailsResponse { + if (!('data' in value) || value['data'] === undefined) return false; + return true; +} + +export function ViewerDetailsResponseFromJSON(json: any): ViewerDetailsResponse { + return ViewerDetailsResponseFromJSONTyped(json, false); +} + +export function ViewerDetailsResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): ViewerDetailsResponse { + if (json == null) { + return json; + } + return { + + 'data': ViewerFromJSON(json['data']), + }; +} + +export function ViewerDetailsResponseToJSON(json: any): ViewerDetailsResponse { + return ViewerDetailsResponseToJSONTyped(json, false); +} + +export function ViewerDetailsResponseToJSONTyped(value?: ViewerDetailsResponse | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'data': ViewerToJSON(value['data']), + }; +} + diff --git a/packages/fishjam-openapi/src/generated/models/ViewerToken.ts b/packages/fishjam-openapi/src/generated/models/ViewerToken.ts new file mode 100644 index 00000000..787cf42f --- /dev/null +++ b/packages/fishjam-openapi/src/generated/models/ViewerToken.ts @@ -0,0 +1,66 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Fishjam API + * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) + * + * The version of the OpenAPI document: 0.28.1 + * Contact: contact@fishjam.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +/** + * Viewer authorization token + * @export + * @interface ViewerToken + */ +export interface ViewerToken { + /** + * Token viewer should authorize with + * @type {string} + * @memberof ViewerToken + */ + token: string; +} + +/** + * Check if a given object implements the ViewerToken interface. + */ +export function instanceOfViewerToken(value: object): value is ViewerToken { + if (!('token' in value) || value['token'] === undefined) return false; + return true; +} + +export function ViewerTokenFromJSON(json: any): ViewerToken { + return ViewerTokenFromJSONTyped(json, false); +} + +export function ViewerTokenFromJSONTyped(json: any, ignoreDiscriminator: boolean): ViewerToken { + if (json == null) { + return json; + } + return { + + 'token': json['token'], + }; +} + +export function ViewerTokenToJSON(json: any): ViewerToken { + return ViewerTokenToJSONTyped(json, false); +} + +export function ViewerTokenToJSONTyped(value?: ViewerToken | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'token': value['token'], + }; +} + diff --git a/packages/fishjam-openapi/src/generated/models/index.ts b/packages/fishjam-openapi/src/generated/models/index.ts new file mode 100644 index 00000000..f1254602 --- /dev/null +++ b/packages/fishjam-openapi/src/generated/models/index.ts @@ -0,0 +1,46 @@ +/* tslint:disable */ +/* eslint-disable */ +export * from './AgentOutput'; +export * from './AudioFormat'; +export * from './AudioSampleRate'; +export * from './CompositionInfo'; +export * from './ModelError'; +export * from './MoqAccess'; +export * from './MoqAccessConfig'; +export * from './Peer'; +export * from './PeerConfig'; +export * from './PeerDetailsResponse'; +export * from './PeerDetailsResponseData'; +export * from './PeerOptions'; +export * from './PeerOptionsAgent'; +export * from './PeerOptionsVapi'; +export * from './PeerOptionsWebRTC'; +export * from './PeerRefreshTokenResponse'; +export * from './PeerRefreshTokenResponseData'; +export * from './PeerStatus'; +export * from './PeerType'; +export * from './Room'; +export * from './RoomConfig'; +export * from './RoomCreateDetailsResponse'; +export * from './RoomCreateDetailsResponseData'; +export * from './RoomDetailsResponse'; +export * from './RoomType'; +export * from './RoomsListingResponse'; +export * from './Stream'; +export * from './StreamConfig'; +export * from './StreamDetailsResponse'; +export * from './Streamer'; +export * from './StreamerDetailsResponse'; +export * from './StreamerToken'; +export * from './StreamsListingResponse'; +export * from './SubscribeMode'; +export * from './SubscribeTracksRequest'; +export * from './Subscriptions'; +export * from './Track'; +export * from './TrackForwarding'; +export * from './TrackForwardingInfo'; +export * from './TrackType'; +export * from './VideoCodec'; +export * from './Viewer'; +export * from './ViewerDetailsResponse'; +export * from './ViewerToken'; diff --git a/packages/fishjam-openapi/src/generated/runtime.ts b/packages/fishjam-openapi/src/generated/runtime.ts new file mode 100644 index 00000000..d8907bde --- /dev/null +++ b/packages/fishjam-openapi/src/generated/runtime.ts @@ -0,0 +1,432 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Fishjam API + * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) + * + * The version of the OpenAPI document: 0.28.1 + * Contact: contact@fishjam.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export const BASE_PATH = "https://fishjam.io/api/v1/connect".replace(/\/+$/, ""); + +export interface ConfigurationParameters { + basePath?: string; // override base path + fetchApi?: FetchAPI; // override for fetch implementation + middleware?: Middleware[]; // middleware to apply before/after fetch requests + queryParamsStringify?: (params: HTTPQuery) => string; // stringify function for query strings + username?: string; // parameter for basic security + password?: string; // parameter for basic security + apiKey?: string | Promise | ((name: string) => string | Promise); // parameter for apiKey security + accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string | Promise); // parameter for oauth2 security + headers?: HTTPHeaders; //header params we want to use on every request + credentials?: RequestCredentials; //value for the credentials param we want to use on each request +} + +export class Configuration { + constructor(private configuration: ConfigurationParameters = {}) {} + + set config(configuration: Configuration) { + this.configuration = configuration; + } + + get basePath(): string { + return this.configuration.basePath != null ? this.configuration.basePath : BASE_PATH; + } + + get fetchApi(): FetchAPI | undefined { + return this.configuration.fetchApi; + } + + get middleware(): Middleware[] { + return this.configuration.middleware || []; + } + + get queryParamsStringify(): (params: HTTPQuery) => string { + return this.configuration.queryParamsStringify || querystring; + } + + get username(): string | undefined { + return this.configuration.username; + } + + get password(): string | undefined { + return this.configuration.password; + } + + get apiKey(): ((name: string) => string | Promise) | undefined { + const apiKey = this.configuration.apiKey; + if (apiKey) { + return typeof apiKey === 'function' ? apiKey : () => apiKey; + } + return undefined; + } + + get accessToken(): ((name?: string, scopes?: string[]) => string | Promise) | undefined { + const accessToken = this.configuration.accessToken; + if (accessToken) { + return typeof accessToken === 'function' ? accessToken : async () => accessToken; + } + return undefined; + } + + get headers(): HTTPHeaders | undefined { + return this.configuration.headers; + } + + get credentials(): RequestCredentials | undefined { + return this.configuration.credentials; + } +} + +export const DefaultConfig = new Configuration(); + +/** + * This is the base class for all generated API classes. + */ +export class BaseAPI { + + private static readonly jsonRegex = new RegExp('^(:?application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$', 'i'); + private middleware: Middleware[]; + + constructor(protected configuration = DefaultConfig) { + this.middleware = configuration.middleware; + } + + withMiddleware(this: T, ...middlewares: Middleware[]) { + const next = this.clone(); + next.middleware = next.middleware.concat(...middlewares); + return next; + } + + withPreMiddleware(this: T, ...preMiddlewares: Array) { + const middlewares = preMiddlewares.map((pre) => ({ pre })); + return this.withMiddleware(...middlewares); + } + + withPostMiddleware(this: T, ...postMiddlewares: Array) { + const middlewares = postMiddlewares.map((post) => ({ post })); + return this.withMiddleware(...middlewares); + } + + /** + * Check if the given MIME is a JSON MIME. + * JSON MIME examples: + * application/json + * application/json; charset=UTF8 + * APPLICATION/JSON + * application/vnd.company+json + * @param mime - MIME (Multipurpose Internet Mail Extensions) + * @return True if the given MIME is JSON, false otherwise. + */ + protected isJsonMime(mime: string | null | undefined): boolean { + if (!mime) { + return false; + } + return BaseAPI.jsonRegex.test(mime); + } + + protected async request(context: RequestOpts, initOverrides?: RequestInit | InitOverrideFunction): Promise { + const { url, init } = await this.createFetchParams(context, initOverrides); + const response = await this.fetchApi(url, init); + if (response && (response.status >= 200 && response.status < 300)) { + return response; + } + throw new ResponseError(response, 'Response returned an error code'); + } + + private async createFetchParams(context: RequestOpts, initOverrides?: RequestInit | InitOverrideFunction) { + let url = this.configuration.basePath + context.path; + if (context.query !== undefined && Object.keys(context.query).length !== 0) { + // only add the querystring to the URL if there are query parameters. + // this is done to avoid urls ending with a "?" character which buggy webservers + // do not handle correctly sometimes. + url += '?' + this.configuration.queryParamsStringify(context.query); + } + + const headers = Object.assign({}, this.configuration.headers, context.headers); + Object.keys(headers).forEach(key => headers[key] === undefined ? delete headers[key] : {}); + + const initOverrideFn = + typeof initOverrides === "function" + ? initOverrides + : async () => initOverrides; + + const initParams = { + method: context.method, + headers, + body: context.body, + credentials: this.configuration.credentials, + }; + + const overriddenInit: RequestInit = { + ...initParams, + ...(await initOverrideFn({ + init: initParams, + context, + })) + }; + + let body: any; + if (isFormData(overriddenInit.body) + || (overriddenInit.body instanceof URLSearchParams) + || isBlob(overriddenInit.body)) { + body = overriddenInit.body; + } else if (this.isJsonMime(headers['Content-Type'])) { + body = JSON.stringify(overriddenInit.body); + } else { + body = overriddenInit.body; + } + + const init: RequestInit = { + ...overriddenInit, + body + }; + + return { url, init }; + } + + private fetchApi = async (url: string, init: RequestInit) => { + let fetchParams = { url, init }; + for (const middleware of this.middleware) { + if (middleware.pre) { + fetchParams = await middleware.pre({ + fetch: this.fetchApi, + ...fetchParams, + }) || fetchParams; + } + } + let response: Response | undefined = undefined; + try { + response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init); + } catch (e) { + for (const middleware of this.middleware) { + if (middleware.onError) { + response = await middleware.onError({ + fetch: this.fetchApi, + url: fetchParams.url, + init: fetchParams.init, + error: e, + response: response ? response.clone() : undefined, + }) || response; + } + } + if (response === undefined) { + if (e instanceof Error) { + throw new FetchError(e, 'The request failed and the interceptors did not return an alternative response'); + } else { + throw e; + } + } + } + for (const middleware of this.middleware) { + if (middleware.post) { + response = await middleware.post({ + fetch: this.fetchApi, + url: fetchParams.url, + init: fetchParams.init, + response: response.clone(), + }) || response; + } + } + return response; + } + + /** + * Create a shallow clone of `this` by constructing a new instance + * and then shallow cloning data members. + */ + private clone(this: T): T { + const constructor = this.constructor as any; + const next = new constructor(this.configuration); + next.middleware = this.middleware.slice(); + return next; + } +}; + +function isBlob(value: any): value is Blob { + return typeof Blob !== 'undefined' && value instanceof Blob; +} + +function isFormData(value: any): value is FormData { + return typeof FormData !== "undefined" && value instanceof FormData; +} + +export class ResponseError extends Error { + override name: "ResponseError" = "ResponseError"; + constructor(public response: Response, msg?: string) { + super(msg); + } +} + +export class FetchError extends Error { + override name: "FetchError" = "FetchError"; + constructor(public cause: Error, msg?: string) { + super(msg); + } +} + +export class RequiredError extends Error { + override name: "RequiredError" = "RequiredError"; + constructor(public field: string, msg?: string) { + super(msg); + } +} + +export const COLLECTION_FORMATS = { + csv: ",", + ssv: " ", + tsv: "\t", + pipes: "|", +}; + +export type FetchAPI = WindowOrWorkerGlobalScope['fetch']; + +export type Json = any; +export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD'; +export type HTTPHeaders = { [key: string]: string }; +export type HTTPQuery = { [key: string]: string | number | null | boolean | Array | Set | HTTPQuery }; +export type HTTPBody = Json | FormData | URLSearchParams; +export type HTTPRequestInit = { headers?: HTTPHeaders; method: HTTPMethod; credentials?: RequestCredentials; body?: HTTPBody }; +export type ModelPropertyNaming = 'camelCase' | 'snake_case' | 'PascalCase' | 'original'; + +export type InitOverrideFunction = (requestContext: { init: HTTPRequestInit, context: RequestOpts }) => Promise + +export interface FetchParams { + url: string; + init: RequestInit; +} + +export interface RequestOpts { + path: string; + method: HTTPMethod; + headers: HTTPHeaders; + query?: HTTPQuery; + body?: HTTPBody; +} + +export function querystring(params: HTTPQuery, prefix: string = ''): string { + return Object.keys(params) + .map(key => querystringSingleKey(key, params[key], prefix)) + .filter(part => part.length > 0) + .join('&'); +} + +function querystringSingleKey(key: string, value: string | number | null | undefined | boolean | Array | Set | HTTPQuery, keyPrefix: string = ''): string { + const fullKey = keyPrefix + (keyPrefix.length ? `[${key}]` : key); + if (value instanceof Array) { + const multiValue = value.map(singleValue => encodeURIComponent(String(singleValue))) + .join(`&${encodeURIComponent(fullKey)}=`); + return `${encodeURIComponent(fullKey)}=${multiValue}`; + } + if (value instanceof Set) { + const valueAsArray = Array.from(value); + return querystringSingleKey(key, valueAsArray, keyPrefix); + } + if (value instanceof Date) { + return `${encodeURIComponent(fullKey)}=${encodeURIComponent(value.toISOString())}`; + } + if (value instanceof Object) { + return querystring(value as HTTPQuery, fullKey); + } + return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`; +} + +export function exists(json: any, key: string) { + const value = json[key]; + return value !== null && value !== undefined; +} + +export function mapValues(data: any, fn: (item: any) => any) { + const result: { [key: string]: any } = {}; + for (const key of Object.keys(data)) { + result[key] = fn(data[key]); + } + return result; +} + +export function canConsumeForm(consumes: Consume[]): boolean { + for (const consume of consumes) { + if ('multipart/form-data' === consume.contentType) { + return true; + } + } + return false; +} + +export interface Consume { + contentType: string; +} + +export interface RequestContext { + fetch: FetchAPI; + url: string; + init: RequestInit; +} + +export interface ResponseContext { + fetch: FetchAPI; + url: string; + init: RequestInit; + response: Response; +} + +export interface ErrorContext { + fetch: FetchAPI; + url: string; + init: RequestInit; + error: unknown; + response?: Response; +} + +export interface Middleware { + pre?(context: RequestContext): Promise; + post?(context: ResponseContext): Promise; + onError?(context: ErrorContext): Promise; +} + +export interface ApiResponse { + raw: Response; + value(): Promise; +} + +export interface ResponseTransformer { + (json: any): T; +} + +export class JSONApiResponse { + constructor(public raw: Response, private transformer: ResponseTransformer = (jsonValue: any) => jsonValue) {} + + async value(): Promise { + return this.transformer(await this.raw.json()); + } +} + +export class VoidApiResponse { + constructor(public raw: Response) {} + + async value(): Promise { + return undefined; + } +} + +export class BlobApiResponse { + constructor(public raw: Response) {} + + async value(): Promise { + return await this.raw.blob(); + }; +} + +export class TextApiResponse { + constructor(public raw: Response) {} + + async value(): Promise { + return await this.raw.text(); + }; +} From 6b0538aba8eb8e5e3e02cd7a59e22752b94aba7e Mon Sep 17 00:00:00 2001 From: Bernard Gawor Date: Mon, 6 Jul 2026 13:05:33 +0200 Subject: [PATCH 2/7] adjust js-server-sdk code to fetch --- packages/js-server-sdk/package.json | 4 +- packages/js-server-sdk/src/client.ts | 140 ++++++++---------- .../js-server-sdk/src/exceptions/index.ts | 18 ++- .../js-server-sdk/src/exceptions/mapper.ts | 75 ++++++---- .../tests/config-validation.test.ts | 19 +-- .../js-server-sdk/tests/exceptions.test.ts | 80 ++++++++++ yarn.lock | 2 - 7 files changed, 206 insertions(+), 132 deletions(-) create mode 100644 packages/js-server-sdk/tests/exceptions.test.ts diff --git a/packages/js-server-sdk/package.json b/packages/js-server-sdk/package.json index c0eb452b..c6a00b2f 100644 --- a/packages/js-server-sdk/package.json +++ b/packages/js-server-sdk/package.json @@ -62,9 +62,11 @@ "outDir": "dist" }, "dependencies": { - "axios": "^1.7.9", "uuid": "^11.1.0" }, + "engines": { + "node": ">=18" + }, "peerDependencies": { "@google/genai": "^1.0.0" }, diff --git a/packages/js-server-sdk/src/client.ts b/packages/js-server-sdk/src/client.ts index 65e4affa..9ca6a0ae 100644 --- a/packages/js-server-sdk/src/client.ts +++ b/packages/js-server-sdk/src/client.ts @@ -1,5 +1,5 @@ -import axios, { RawAxiosResponseHeaders } from 'axios'; import { + Configuration, MoQApi, RoomsApi, ViewersApi, @@ -10,6 +10,7 @@ import { PeerOptionsVapi, PeerOptionsAgent, MoqAccessConfig, + type Middleware, } from '@fishjam-cloud/fishjam-openapi'; import type { AgentCallbacks, FishjamConfig, PeerId, Room, RoomId, Peer } from './types'; import { mapException } from './exceptions/mapper'; @@ -47,25 +48,27 @@ export class FishjamClient { * ``` */ constructor(config: FishjamConfig) { - const client = axios.create({ + const deprecationMiddleware: Middleware = { + post: async ({ response }) => { + this.handleDeprecationHeader(response.headers); + return response; + }, + }; + + const apiConfig = new Configuration({ + basePath: getFishjamUrl(config), headers: { Authorization: `Bearer ${config.managementToken}`, 'x-fishjam-api-client': `js-server/${packageJson.version}`, }, + middleware: [deprecationMiddleware], }); - client.interceptors.response.use((response) => { - this.handleDeprecationHeader(response.headers); - return response; - }); - - const fishjamUrl = getFishjamUrl(config); - - this.moqApi = new MoQApi(undefined, fishjamUrl, client); - this.roomApi = new RoomsApi(undefined, fishjamUrl, client); - this.viewerApi = new ViewersApi(undefined, fishjamUrl, client); - this.streamerApi = new StreamersApi(undefined, fishjamUrl, client); - this.credentialsApi = new CredentialsApi(undefined, fishjamUrl, client); + this.moqApi = new MoQApi(apiConfig); + this.roomApi = new RoomsApi(apiConfig); + this.viewerApi = new ViewersApi(apiConfig); + this.streamerApi = new StreamersApi(apiConfig); + this.credentialsApi = new CredentialsApi(apiConfig); this.fishjamConfig = config; } @@ -100,15 +103,15 @@ export class FishjamClient { try { await this.credentialsApi.validateCredentials(); } catch (error) { - throw mapException(error); + throw await mapException(error, 'credentials'); } } - private handleDeprecationHeader(headers: RawAxiosResponseHeaders): void { + private handleDeprecationHeader(headers: Headers): void { try { - const deprecationHeader = headers['x-fishjam-api-deprecated']; + const deprecationHeader = headers.get('x-fishjam-api-deprecated'); if (!deprecationHeader || this.deprecationWarningShown) return; - const deprecationStatus = JSON.parse(deprecationHeader as string); + const deprecationStatus = JSON.parse(deprecationHeader); if (deprecationStatus.status === 'unsupported') { console.error(deprecationStatus.message); @@ -126,17 +129,10 @@ export class FishjamClient { */ async createRoom(config: RoomConfig = {}): Promise { try { - const response = await this.roomApi.createRoom(config); - - const { - data: { - data: { room }, - }, - } = response; - - return room as Room; + const { data } = await this.roomApi.createRoom({ roomConfig: config }); + return data.room as Room; } catch (error) { - throw mapException(error); + throw await mapException(error); } } @@ -145,9 +141,9 @@ export class FishjamClient { */ async deleteRoom(roomId: RoomId): Promise { try { - await this.roomApi.deleteRoom(roomId); + await this.roomApi.deleteRoom({ roomId }); } catch (error) { - throw mapException(error, 'room'); + throw await mapException(error, 'room'); } } @@ -156,10 +152,10 @@ export class FishjamClient { */ async getAllRooms(): Promise { try { - const getAllRoomsResponse = await this.roomApi.getAllRooms(); - return (getAllRoomsResponse.data.data as Room[]) ?? []; + const { data } = await this.roomApi.getAllRooms(); + return (data as Room[]) ?? []; } catch (error) { - throw mapException(error); + throw await mapException(error); } } @@ -168,18 +164,14 @@ export class FishjamClient { */ async createPeer(roomId: RoomId, options: PeerOptionsWebRTC = {}): Promise<{ peer: Peer; peerToken: string }> { try { - const response = await this.roomApi.addPeer(roomId, { - type: 'webrtc', - options, + const { data } = await this.roomApi.addPeer({ + roomId, + peerConfig: { type: 'webrtc', options }, }); - const { - data: { data }, - } = response; - return { peer: data.peer as Peer, peerToken: data.token }; } catch (error) { - throw mapException(error); + throw await mapException(error); } } @@ -192,20 +184,17 @@ export class FishjamClient { callbacks?: AgentCallbacks ): Promise<{ agent: FishjamAgent; peer: Peer }> { try { - const response = await this.roomApi.addPeer(roomId, { - type: 'agent', - options, + const { data } = await this.roomApi.addPeer({ + roomId, + peerConfig: { type: 'agent', options }, }); - const { - data: { data }, - } = response; const agent = new FishjamAgent(this.fishjamConfig, data.token, callbacks); await agent.awaitConnected(); return { agent: agent, peer: data.peer as Peer }; } catch (error) { - throw mapException(error); + throw await mapException(error); } } @@ -214,18 +203,14 @@ export class FishjamClient { */ async createVapiAgent(roomId: RoomId, options: PeerOptionsVapi): Promise<{ peer: Peer }> { try { - const response = await this.roomApi.addPeer(roomId, { - type: 'vapi', - options, + const { data } = await this.roomApi.addPeer({ + roomId, + peerConfig: { type: 'vapi', options }, }); - const { - data: { data }, - } = response; - return { peer: data.peer as Peer }; } catch (error) { - throw mapException(error); + throw await mapException(error); } } @@ -234,10 +219,10 @@ export class FishjamClient { */ async getRoom(roomId: RoomId): Promise { try { - const getRoomResponse = await this.roomApi.getRoom(roomId); - return getRoomResponse.data.data as Room; + const { data } = await this.roomApi.getRoom({ roomId }); + return data as Room; } catch (error) { - throw mapException(error, 'room'); + throw await mapException(error, 'room'); } } @@ -246,9 +231,9 @@ export class FishjamClient { */ async deletePeer(roomId: RoomId, peerId: PeerId): Promise { try { - await this.roomApi.deletePeer(roomId, peerId); + await this.roomApi.deletePeer({ roomId, id: peerId }); } catch (error) { - throw mapException(error, 'peer'); + throw await mapException(error, 'peer'); } } @@ -258,9 +243,9 @@ export class FishjamClient { */ async subscribePeer(roomId: RoomId, subscriberPeerId: PeerId, publisherPeerId: PeerId): Promise { try { - await this.roomApi.subscribePeer(roomId, subscriberPeerId, publisherPeerId); + await this.roomApi.subscribePeer({ roomId, id: subscriberPeerId, peerId: publisherPeerId }); } catch (error) { - throw mapException(error, 'peer'); + throw await mapException(error, 'peer'); } } @@ -270,9 +255,13 @@ export class FishjamClient { */ async subscribeTracks(roomId: RoomId, subscriberPeerId: PeerId, tracks: TrackId[]): Promise { try { - await this.roomApi.subscribeTracks(roomId, subscriberPeerId, { track_ids: tracks }); + await this.roomApi.subscribeTracks({ + roomId, + id: subscriberPeerId, + subscribeTracksRequest: { track_ids: tracks }, + }); } catch (error) { - throw mapException(error, 'peer'); + throw await mapException(error, 'peer'); } } @@ -283,10 +272,10 @@ export class FishjamClient { */ async refreshPeerToken(roomId: RoomId, peerId: PeerId): Promise { try { - const refreshTokenResponse = await this.roomApi.refreshToken(roomId, peerId); - return refreshTokenResponse.data.data.token; + const { data } = await this.roomApi.refreshToken({ roomId, id: peerId }); + return data.token; } catch (error) { - throw mapException(error, 'peer'); + throw await mapException(error, 'peer'); } } @@ -296,10 +285,9 @@ export class FishjamClient { */ async createLivestreamViewerToken(roomId: RoomId) { try { - const tokenResponse = await this.viewerApi.generateViewerToken(roomId); - return tokenResponse.data; + return await this.viewerApi.generateViewerToken({ roomId }); } catch (error) { - throw mapException(error); + throw await mapException(error); } } @@ -309,10 +297,9 @@ export class FishjamClient { */ async createLivestreamStreamerToken(roomId: RoomId) { try { - const tokenResponse = await this.streamerApi.generateStreamerToken(roomId); - return tokenResponse.data; + return await this.streamerApi.generateStreamerToken({ roomId }); } catch (error) { - throw mapException(error); + throw await mapException(error); } } @@ -322,10 +309,9 @@ export class FishjamClient { */ async createMoqAccess(config?: MoqAccessConfig) { try { - const accessResponse = await this.moqApi.createMoqAccess(config); - return accessResponse.data; + return await this.moqApi.createMoqAccess({ moqAccessConfig: config }); } catch (error) { - throw mapException(error); + throw await mapException(error); } } } diff --git a/packages/js-server-sdk/src/exceptions/index.ts b/packages/js-server-sdk/src/exceptions/index.ts index 8cc003a1..e15d4326 100644 --- a/packages/js-server-sdk/src/exceptions/index.ts +++ b/packages/js-server-sdk/src/exceptions/index.ts @@ -1,20 +1,22 @@ -import type { AxiosError } from 'axios'; - export class MissingFishjamIdException extends Error { constructor() { super('Fishjam ID is required'); } } +export interface FishjamExceptionInfo { + message: string; + statusCode?: number; + details?: string; +} + export class FishjamBaseException extends Error { statusCode: number; - axiosCode?: string; details?: string; - constructor(error: AxiosError>) { - super(error.message); - this.statusCode = error.response?.status ?? 500; - this.axiosCode = error.code; - this.details = error.response?.data['detail'] ?? error.response?.data['errors'] ?? 'Unknown error'; + constructor(info: FishjamExceptionInfo) { + super(info.message); + this.statusCode = info.statusCode ?? 500; + this.details = info.details; } } diff --git a/packages/js-server-sdk/src/exceptions/mapper.ts b/packages/js-server-sdk/src/exceptions/mapper.ts index 225dc16d..04198195 100644 --- a/packages/js-server-sdk/src/exceptions/mapper.ts +++ b/packages/js-server-sdk/src/exceptions/mapper.ts @@ -1,4 +1,4 @@ -import type { AxiosError as BaseAxiosError } from 'axios'; +import { ResponseError, FetchError } from '@fishjam-cloud/fishjam-openapi'; import { BadRequestException, FishjamNotFoundException, @@ -9,41 +9,52 @@ import { ServiceUnavailableException, UnauthorizedException, UnknownException, + type FishjamExceptionInfo, } from '.'; -type AxiosError = BaseAxiosError>; -function isAxiosException(error: unknown): error is AxiosError { - return !!error && typeof error === 'object' && 'isAxiosError' in error && !!error.isAxiosError; -} -export const mapException = (error: unknown, entity?: 'peer' | 'room') => { - if (isAxiosException(error)) { - switch (error.response?.status) { - case 400: - return new BadRequestException(error); - case 402: - return new QuotaExceededException(error); - case 401: - throw new UnauthorizedException(error); - case 404: - if (error.request.path.includes('validate')) { - return new InvalidFishjamCredentialsException(error); - } +type Entity = 'peer' | 'room' | 'credentials'; - switch (entity) { - case 'peer': - return new PeerNotFoundException(error); - case 'room': - return new RoomNotFoundException(error); - default: - return new FishjamNotFoundException(error); - } +const notFoundException = (info: FishjamExceptionInfo, entity?: Entity) => { + switch (entity) { + case 'credentials': + return new InvalidFishjamCredentialsException(info); + case 'peer': + return new PeerNotFoundException(info); + case 'room': + return new RoomNotFoundException(info); + default: + return new FishjamNotFoundException(info); + } +}; - case 503: - return new ServiceUnavailableException(error); - default: - return new UnknownException(error); - } - } else { +export const mapException = async (error: unknown, entity?: Entity): Promise => { + if (error instanceof FetchError) { + return new UnknownException({ message: error.cause.message, statusCode: 500 }); + } + if (!(error instanceof ResponseError)) { return error; } + + const status = error.response.status; + const body = (await error.response.json().catch(() => ({}))) as Record; + const info: FishjamExceptionInfo = { + message: `Request failed with status code ${status}`, + statusCode: status, + details: body['detail'] ?? body['errors'] ?? 'Unknown error', + }; + + switch (status) { + case 400: + return new BadRequestException(info); + case 402: + return new QuotaExceededException(info); + case 401: + return new UnauthorizedException(info); + case 404: + return notFoundException(info, entity); + case 503: + return new ServiceUnavailableException(info); + default: + return new UnknownException(info); + } }; diff --git a/packages/js-server-sdk/tests/config-validation.test.ts b/packages/js-server-sdk/tests/config-validation.test.ts index d0213d6b..6155ab53 100644 --- a/packages/js-server-sdk/tests/config-validation.test.ts +++ b/packages/js-server-sdk/tests/config-validation.test.ts @@ -1,18 +1,13 @@ import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; -import { CredentialsApi } from '@fishjam-cloud/fishjam-openapi'; +import { CredentialsApi, ResponseError } from '@fishjam-cloud/fishjam-openapi'; import { FishjamClient } from '../src/client'; import { InvalidFishjamCredentialsException, MissingFishjamIdException } from '../src/exceptions'; import type { FishjamConfig } from '../src/types'; const VALID_CONFIG: FishjamConfig = { fishjamId: 'fjm_test', managementToken: 'tok_test' }; -const axiosError = (status: number, detail = 'error') => ({ - isAxiosError: true, - request: { path: 'https://fish.jam/api/v1/connect/fishjam_id/validate' }, - message: `Request failed with status code ${status}`, - code: 'ERR_BAD_REQUEST', - response: { status, data: { detail } }, -}); +const responseError = (status: number, detail = 'error') => + new ResponseError(new Response(JSON.stringify({ detail }), { status })); describe('FishjamClient constructor sync validation', () => { it('throws MissingFishjamIdException when fishjamId is empty', () => { @@ -37,13 +32,13 @@ describe('FishjamClient live credential checks (mocked)', () => { }); it('FishjamClient.create rejects with InvalidFishjamCredentialsException on 404', async () => { - validateSpy.mockRejectedValueOnce(axiosError(404, 'Fishjam not found')); + validateSpy.mockRejectedValueOnce(responseError(404, 'Fishjam not found')); await expect(FishjamClient.create(VALID_CONFIG)).rejects.toThrow(InvalidFishjamCredentialsException); }); it('FishjamClient.create resolves and pings backend once on success', async () => { - validateSpy.mockResolvedValueOnce({ data: {} } as never); + validateSpy.mockResolvedValueOnce(undefined as never); const client = await FishjamClient.create(VALID_CONFIG); @@ -52,14 +47,14 @@ describe('FishjamClient live credential checks (mocked)', () => { }); it('checkCredentials throws InvalidFishjamCredentialsException on 404', async () => { - validateSpy.mockRejectedValueOnce(axiosError(404, 'Fishjam not found')); + validateSpy.mockRejectedValueOnce(responseError(404, 'Fishjam not found')); const client = new FishjamClient(VALID_CONFIG); await expect(client.checkCredentials()).rejects.toThrow(InvalidFishjamCredentialsException); }); it('checkCredentials resolves on success', async () => { - validateSpy.mockResolvedValueOnce({ data: {} } as never); + validateSpy.mockResolvedValueOnce(undefined as never); const client = new FishjamClient(VALID_CONFIG); await expect(client.checkCredentials()).resolves.toBeUndefined(); diff --git a/packages/js-server-sdk/tests/exceptions.test.ts b/packages/js-server-sdk/tests/exceptions.test.ts new file mode 100644 index 00000000..5d40c967 --- /dev/null +++ b/packages/js-server-sdk/tests/exceptions.test.ts @@ -0,0 +1,80 @@ +import { describe, it, expect } from 'vitest'; +import { ResponseError, FetchError } from '@fishjam-cloud/fishjam-openapi'; +import { mapException } from '../src/exceptions/mapper'; +import { + BadRequestException, + FishjamBaseException, + FishjamNotFoundException, + InvalidFishjamCredentialsException, + PeerNotFoundException, + QuotaExceededException, + RoomNotFoundException, + ServiceUnavailableException, + UnauthorizedException, + UnknownException, +} from '../src/exceptions'; + +const responseError = (status: number, body?: Record) => + new ResponseError(new Response(body === undefined ? null : JSON.stringify(body), { status })); + +describe('mapException status mapping', () => { + it.each([ + [400, BadRequestException], + [402, QuotaExceededException], + [401, UnauthorizedException], + [503, ServiceUnavailableException], + [418, UnknownException], + ] as const)('maps %i to %o', async (status, exceptionClass) => { + const mapped = await mapException(responseError(status, { detail: 'boom' })); + expect(mapped).toBeInstanceOf(exceptionClass); + }); + + it.each([ + ['credentials', InvalidFishjamCredentialsException], + ['peer', PeerNotFoundException], + ['room', RoomNotFoundException], + [undefined, FishjamNotFoundException], + ] as const)('maps 404 with entity %s to %o', async (entity, exceptionClass) => { + const mapped = await mapException(responseError(404, { detail: 'missing' }), entity); + expect(mapped).toBeInstanceOf(exceptionClass); + }); +}); + +describe('mapException error contents', () => { + it('exposes status code, message and body detail', async () => { + const mapped = (await mapException(responseError(400, { detail: 'bad room config' }))) as FishjamBaseException; + + expect(mapped.statusCode).toBe(400); + expect(mapped.message).toBe('Request failed with status code 400'); + expect(mapped.details).toBe('bad room config'); + }); + + it('falls back to body errors field', async () => { + const mapped = (await mapException(responseError(400, { errors: 'invalid payload' }))) as FishjamBaseException; + + expect(mapped.details).toBe('invalid payload'); + }); + + it('tolerates an unparseable body', async () => { + const mapped = (await mapException(responseError(503))) as FishjamBaseException; + + expect(mapped.statusCode).toBe(503); + expect(mapped.details).toBe('Unknown error'); + }); +}); + +describe('mapException non-response errors', () => { + it('maps FetchError (network failure) to UnknownException with statusCode 500', async () => { + const mapped = (await mapException(new FetchError(new Error('connect ECONNREFUSED')))) as FishjamBaseException; + + expect(mapped).toBeInstanceOf(UnknownException); + expect(mapped.statusCode).toBe(500); + expect(mapped.message).toBe('connect ECONNREFUSED'); + }); + + it('passes non-SDK errors through unchanged', async () => { + const plain = new Error('not ours'); + + await expect(mapException(plain)).resolves.toBe(plain); + }); +}); diff --git a/yarn.lock b/yarn.lock index bc49337f..d00ac0e1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1589,7 +1589,6 @@ __metadata: resolution: "@fishjam-cloud/fishjam-openapi@workspace:packages/fishjam-openapi" dependencies: "@openapitools/openapi-generator-cli": "npm:^2.18.4" - axios: "npm:^1.7.9" tsup: "npm:^8.4.0" languageName: unknown linkType: soft @@ -1613,7 +1612,6 @@ __metadata: "@openapitools/openapi-generator-cli": "npm:^2.18.4" "@types/node": "npm:^22.13.16" "@types/websocket": "npm:^1.0.10" - axios: "npm:^1.7.9" eslint: "npm:^9.33.0" prettier: "npm:^3.6.2" tsup: "npm:^8.4.0" From bb7d9dfae909a80c2e42d6932e4932477175c485 Mon Sep 17 00:00:00 2001 From: Bernard Gawor Date: Mon, 6 Jul 2026 13:14:38 +0200 Subject: [PATCH 3/7] update release automation to use openapi.sh --- release-automation/bump-version.sh | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/release-automation/bump-version.sh b/release-automation/bump-version.sh index da54c93a..ca27a81f 100755 --- a/release-automation/bump-version.sh +++ b/release-automation/bump-version.sh @@ -70,10 +70,7 @@ curl -H "Authorization: token $GH_TOKEN" \ -L "https://raw.githubusercontent.com/fishjam-cloud/fishjam/main/openapi.yaml" \ -o openapi.yaml -npx @openapitools/openapi-generator-cli generate \ --i ./openapi.yaml \ --g typescript-axios \ --o ./src/generated +sh openapi.sh ./openapi.yaml rm openapi.yaml cd ../../ From 64efd1d8cb58d2eeeee2c11c5c5b5ee39eeb9fee Mon Sep 17 00:00:00 2001 From: Bernard Gawor Date: Mon, 6 Jul 2026 13:34:33 +0200 Subject: [PATCH 4/7] FCE-3523 address Copilot review: FetchError details, openapi engines field, tag-compatible spec URL --- packages/fishjam-openapi/openapi.sh | 2 +- packages/fishjam-openapi/package.json | 3 +++ packages/js-server-sdk/src/exceptions/mapper.ts | 2 +- packages/js-server-sdk/tests/exceptions.test.ts | 1 + 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/fishjam-openapi/openapi.sh b/packages/fishjam-openapi/openapi.sh index b60e8f7d..e9711d19 100755 --- a/packages/fishjam-openapi/openapi.sh +++ b/packages/fishjam-openapi/openapi.sh @@ -22,7 +22,7 @@ else echo "Missing github token as the second argument" 1>&2 exit 1 fi - SPEC="https://raw.githubusercontent.com/fishjam-cloud/fishjam/refs/heads/$1/openapi.yaml?token=$2" + SPEC="https://raw.githubusercontent.com/fishjam-cloud/fishjam/$1/openapi.yaml?token=$2" echo "Generating code for $1...\n" fi diff --git a/packages/fishjam-openapi/package.json b/packages/fishjam-openapi/package.json index 024515d8..99fba679 100644 --- a/packages/fishjam-openapi/package.json +++ b/packages/fishjam-openapi/package.json @@ -42,5 +42,8 @@ "@openapitools/openapi-generator-cli": "^2.18.4", "tsup": "^8.4.0" }, + "engines": { + "node": ">=18" + }, "stableVersion": "0.28.1" } diff --git a/packages/js-server-sdk/src/exceptions/mapper.ts b/packages/js-server-sdk/src/exceptions/mapper.ts index 04198195..07c2284d 100644 --- a/packages/js-server-sdk/src/exceptions/mapper.ts +++ b/packages/js-server-sdk/src/exceptions/mapper.ts @@ -29,7 +29,7 @@ const notFoundException = (info: FishjamExceptionInfo, entity?: Entity) => { export const mapException = async (error: unknown, entity?: Entity): Promise => { if (error instanceof FetchError) { - return new UnknownException({ message: error.cause.message, statusCode: 500 }); + return new UnknownException({ message: error.cause.message, statusCode: 500, details: error.cause.message }); } if (!(error instanceof ResponseError)) { return error; diff --git a/packages/js-server-sdk/tests/exceptions.test.ts b/packages/js-server-sdk/tests/exceptions.test.ts index 5d40c967..0a41bcc7 100644 --- a/packages/js-server-sdk/tests/exceptions.test.ts +++ b/packages/js-server-sdk/tests/exceptions.test.ts @@ -70,6 +70,7 @@ describe('mapException non-response errors', () => { expect(mapped).toBeInstanceOf(UnknownException); expect(mapped.statusCode).toBe(500); expect(mapped.message).toBe('connect ECONNREFUSED'); + expect(mapped.details).toBe('connect ECONNREFUSED'); }); it('passes non-SDK errors through unchanged', async () => { From b7cc8b962a084364f5638f18a647537fc5d3e2c6 Mon Sep 17 00:00:00 2001 From: Bernard Gawor Date: Wed, 8 Jul 2026 16:23:03 +0200 Subject: [PATCH 5/7] FCE-3523 regenerate for discriminated PeerConfig, bump openapi-generator to 7.23.0 Fishjam's PeerConfig is now a discriminated oneOf (fishjam-cloud/fishjam#308), which fixes typescript-fetch mis-serializing peer options. Generator 7.14.0 emitted broken code for discriminated oneOf models (missing variant imports, OpenAPITools/openapi-generator#21441); 7.23.0 includes the fix, so no post-processing of generated sources is needed. Docs generation is disabled to keep the generated tree source-only. PeerOptions is no longer generated; the SDK keeps exporting it as an equivalent alias of the variant union. --- packages/fishjam-openapi/openapi.sh | 1 + packages/fishjam-openapi/openapitools.json | 2 +- .../src/generated/.openapi-generator/FILES | 4 +- .../src/generated/.openapi-generator/VERSION | 2 +- .../src/generated/apis/CredentialsApi.ts | 19 +- .../src/generated/apis/MoQApi.ts | 29 ++- .../src/generated/apis/RoomsApi.ts | 219 ++++++++++++------ .../src/generated/apis/StreamersApi.ts | 73 ++++-- .../src/generated/apis/StreamsApi.ts | 91 +++++--- .../src/generated/apis/TrackForwardingsApi.ts | 27 ++- .../src/generated/apis/ViewersApi.ts | 73 ++++-- .../src/generated/models/PeerConfig.ts | 93 ++++---- .../src/generated/models/PeerConfigAgent.ts | 95 ++++++++ .../src/generated/models/PeerConfigVAPI.ts | 95 ++++++++ .../src/generated/models/PeerConfigWebRTC.ts | 95 ++++++++ .../src/generated/models/PeerOptions.ts | 91 -------- .../src/generated/models/Streamer.ts | 2 +- .../src/generated/models/index.ts | 4 +- .../fishjam-openapi/src/generated/runtime.ts | 21 +- packages/js-server-sdk/src/index.ts | 5 +- .../js-server-sdk/tests/serialization.test.ts | 65 ++++++ 21 files changed, 781 insertions(+), 325 deletions(-) create mode 100644 packages/fishjam-openapi/src/generated/models/PeerConfigAgent.ts create mode 100644 packages/fishjam-openapi/src/generated/models/PeerConfigVAPI.ts create mode 100644 packages/fishjam-openapi/src/generated/models/PeerConfigWebRTC.ts delete mode 100644 packages/fishjam-openapi/src/generated/models/PeerOptions.ts create mode 100644 packages/js-server-sdk/tests/serialization.test.ts diff --git a/packages/fishjam-openapi/openapi.sh b/packages/fishjam-openapi/openapi.sh index e9711d19..2235e9e5 100755 --- a/packages/fishjam-openapi/openapi.sh +++ b/packages/fishjam-openapi/openapi.sh @@ -32,4 +32,5 @@ cd $ROOTDIR \ -g typescript-fetch \ --additional-properties=modelPropertyNaming=original \ --reserved-words-mappings public=public \ + --global-property=apiDocs=false,modelDocs=false \ -o ./src/generated diff --git a/packages/fishjam-openapi/openapitools.json b/packages/fishjam-openapi/openapitools.json index a82623d6..f3237adc 100644 --- a/packages/fishjam-openapi/openapitools.json +++ b/packages/fishjam-openapi/openapitools.json @@ -2,6 +2,6 @@ "$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json", "spaces": 2, "generator-cli": { - "version": "7.14.0" + "version": "7.23.0" } } diff --git a/packages/fishjam-openapi/src/generated/.openapi-generator/FILES b/packages/fishjam-openapi/src/generated/.openapi-generator/FILES index 10bccc7e..b64a9f63 100644 --- a/packages/fishjam-openapi/src/generated/.openapi-generator/FILES +++ b/packages/fishjam-openapi/src/generated/.openapi-generator/FILES @@ -17,9 +17,11 @@ models/MoqAccess.ts models/MoqAccessConfig.ts models/Peer.ts models/PeerConfig.ts +models/PeerConfigAgent.ts +models/PeerConfigVAPI.ts +models/PeerConfigWebRTC.ts models/PeerDetailsResponse.ts models/PeerDetailsResponseData.ts -models/PeerOptions.ts models/PeerOptionsAgent.ts models/PeerOptionsVapi.ts models/PeerOptionsWebRTC.ts diff --git a/packages/fishjam-openapi/src/generated/.openapi-generator/VERSION b/packages/fishjam-openapi/src/generated/.openapi-generator/VERSION index e465da43..14d6b5dc 100644 --- a/packages/fishjam-openapi/src/generated/.openapi-generator/VERSION +++ b/packages/fishjam-openapi/src/generated/.openapi-generator/VERSION @@ -1 +1 @@ -7.14.0 +7.23.0 diff --git a/packages/fishjam-openapi/src/generated/apis/CredentialsApi.ts b/packages/fishjam-openapi/src/generated/apis/CredentialsApi.ts index f994d74d..855a6d3d 100644 --- a/packages/fishjam-openapi/src/generated/apis/CredentialsApi.ts +++ b/packages/fishjam-openapi/src/generated/apis/CredentialsApi.ts @@ -12,7 +12,6 @@ * Do not edit the class manually. */ - import * as runtime from '../runtime'; /** @@ -21,10 +20,9 @@ import * as runtime from '../runtime'; export class CredentialsApi extends runtime.BaseAPI { /** - * Returns 200 if the provided Fishjam Management Token is valid, 404 otherwise. - * Validate Fishjam Management Token + * Creates request options for validateCredentials without sending the request */ - async validateCredentialsRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async validateCredentialsRequestOpts(): Promise { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; @@ -40,12 +38,21 @@ export class CredentialsApi extends runtime.BaseAPI { let urlPath = `/validate`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Returns 200 if the provided Fishjam Management Token is valid, 404 otherwise. + * Validate Fishjam Management Token + */ + async validateCredentialsRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.validateCredentialsRequestOpts(); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } diff --git a/packages/fishjam-openapi/src/generated/apis/MoQApi.ts b/packages/fishjam-openapi/src/generated/apis/MoQApi.ts index a19bda1d..d7769a51 100644 --- a/packages/fishjam-openapi/src/generated/apis/MoQApi.ts +++ b/packages/fishjam-openapi/src/generated/apis/MoQApi.ts @@ -12,18 +12,17 @@ * Do not edit the class manually. */ - import * as runtime from '../runtime'; -import type { - MoqAccess, - MoqAccessConfig, -} from '../models/index'; import { + type MoqAccess, MoqAccessFromJSON, MoqAccessToJSON, +} from '../models/MoqAccess'; +import { + type MoqAccessConfig, MoqAccessConfigFromJSON, MoqAccessConfigToJSON, -} from '../models/index'; +} from '../models/MoqAccessConfig'; export interface CreateMoqAccessRequest { moqAccessConfig?: MoqAccessConfig; @@ -35,10 +34,9 @@ export interface CreateMoqAccessRequest { export class MoQApi extends runtime.BaseAPI { /** - * Issue a short-lived JWT for a Media over QUIC client. - * Create MoQ access + * Creates request options for createMoqAccess without sending the request */ - async createMoqAccessRaw(requestParameters: CreateMoqAccessRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async createMoqAccessRequestOpts(requestParameters: CreateMoqAccessRequest): Promise { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; @@ -56,13 +54,22 @@ export class MoQApi extends runtime.BaseAPI { let urlPath = `/moq/access`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: MoqAccessConfigToJSON(requestParameters['moqAccessConfig']), - }, initOverrides); + }; + } + + /** + * Issue a short-lived JWT for a Media over QUIC client. + * Create MoQ access + */ + async createMoqAccessRaw(requestParameters: CreateMoqAccessRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.createMoqAccessRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => MoqAccessFromJSON(jsonValue)); } diff --git a/packages/fishjam-openapi/src/generated/apis/RoomsApi.ts b/packages/fishjam-openapi/src/generated/apis/RoomsApi.ts index 942f5792..793a20d8 100644 --- a/packages/fishjam-openapi/src/generated/apis/RoomsApi.ts +++ b/packages/fishjam-openapi/src/generated/apis/RoomsApi.ts @@ -12,36 +12,47 @@ * Do not edit the class manually. */ - import * as runtime from '../runtime'; -import type { - PeerConfig, - PeerDetailsResponse, - PeerRefreshTokenResponse, - RoomConfig, - RoomCreateDetailsResponse, - RoomDetailsResponse, - RoomsListingResponse, - SubscribeTracksRequest, -} from '../models/index'; import { + type PeerConfig, PeerConfigFromJSON, PeerConfigToJSON, +} from '../models/PeerConfig'; +import { + type PeerDetailsResponse, PeerDetailsResponseFromJSON, PeerDetailsResponseToJSON, +} from '../models/PeerDetailsResponse'; +import { + type PeerRefreshTokenResponse, PeerRefreshTokenResponseFromJSON, PeerRefreshTokenResponseToJSON, +} from '../models/PeerRefreshTokenResponse'; +import { + type RoomConfig, RoomConfigFromJSON, RoomConfigToJSON, +} from '../models/RoomConfig'; +import { + type RoomCreateDetailsResponse, RoomCreateDetailsResponseFromJSON, RoomCreateDetailsResponseToJSON, +} from '../models/RoomCreateDetailsResponse'; +import { + type RoomDetailsResponse, RoomDetailsResponseFromJSON, RoomDetailsResponseToJSON, +} from '../models/RoomDetailsResponse'; +import { + type RoomsListingResponse, RoomsListingResponseFromJSON, RoomsListingResponseToJSON, +} from '../models/RoomsListingResponse'; +import { + type SubscribeTracksRequest, SubscribeTracksRequestFromJSON, SubscribeTracksRequestToJSON, -} from '../models/index'; +} from '../models/SubscribeTracksRequest'; export interface AddPeerRequest { roomId: string; @@ -88,10 +99,9 @@ export interface SubscribeTracksOperationRequest { export class RoomsApi extends runtime.BaseAPI { /** - * Add a peer to a room and return its connection token. - * Create a peer + * Creates request options for addPeer without sending the request */ - async addPeerRaw(requestParameters: AddPeerRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async addPeerRequestOpts(requestParameters: AddPeerRequest): Promise { if (requestParameters['roomId'] == null) { throw new runtime.RequiredError( 'roomId', @@ -115,15 +125,24 @@ export class RoomsApi extends runtime.BaseAPI { } let urlPath = `/room/{room_id}/peer`; - urlPath = urlPath.replace(`{${"room_id"}}`, encodeURIComponent(String(requestParameters['roomId']))); + urlPath = urlPath.replace('{room_id}', encodeURIComponent(String(requestParameters['roomId']))); - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: PeerConfigToJSON(requestParameters['peerConfig']), - }, initOverrides); + }; + } + + /** + * Add a peer to a room and return its connection token. + * Create a peer + */ + async addPeerRaw(requestParameters: AddPeerRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.addPeerRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => PeerDetailsResponseFromJSON(jsonValue)); } @@ -138,10 +157,9 @@ export class RoomsApi extends runtime.BaseAPI { } /** - * Create a new room with the given configuration. - * Create a room + * Creates request options for createRoom without sending the request */ - async createRoomRaw(requestParameters: CreateRoomRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async createRoomRequestOpts(requestParameters: CreateRoomRequest): Promise { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; @@ -159,13 +177,22 @@ export class RoomsApi extends runtime.BaseAPI { let urlPath = `/room`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: RoomConfigToJSON(requestParameters['roomConfig']), - }, initOverrides); + }; + } + + /** + * Create a new room with the given configuration. + * Create a room + */ + async createRoomRaw(requestParameters: CreateRoomRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.createRoomRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => RoomCreateDetailsResponseFromJSON(jsonValue)); } @@ -180,10 +207,9 @@ export class RoomsApi extends runtime.BaseAPI { } /** - * Remove a peer from a room and disconnect it. - * Delete a peer + * Creates request options for deletePeer without sending the request */ - async deletePeerRaw(requestParameters: DeletePeerRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async deletePeerRequestOpts(requestParameters: DeletePeerRequest): Promise { if (requestParameters['roomId'] == null) { throw new runtime.RequiredError( 'roomId', @@ -212,15 +238,24 @@ export class RoomsApi extends runtime.BaseAPI { } let urlPath = `/room/{room_id}/peer/{id}`; - urlPath = urlPath.replace(`{${"room_id"}}`, encodeURIComponent(String(requestParameters['roomId']))); - urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))); + urlPath = urlPath.replace('{room_id}', encodeURIComponent(String(requestParameters['roomId']))); + urlPath = urlPath.replace('{id}', encodeURIComponent(String(requestParameters['id']))); - const response = await this.request({ + return { path: urlPath, method: 'DELETE', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Remove a peer from a room and disconnect it. + * Delete a peer + */ + async deletePeerRaw(requestParameters: DeletePeerRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.deletePeerRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -234,10 +269,9 @@ export class RoomsApi extends runtime.BaseAPI { } /** - * Delete a room by id and disconnect all of its peers. - * Delete a room + * Creates request options for deleteRoom without sending the request */ - async deleteRoomRaw(requestParameters: DeleteRoomRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async deleteRoomRequestOpts(requestParameters: DeleteRoomRequest): Promise { if (requestParameters['roomId'] == null) { throw new runtime.RequiredError( 'roomId', @@ -259,14 +293,23 @@ export class RoomsApi extends runtime.BaseAPI { } let urlPath = `/room/{room_id}`; - urlPath = urlPath.replace(`{${"room_id"}}`, encodeURIComponent(String(requestParameters['roomId']))); + urlPath = urlPath.replace('{room_id}', encodeURIComponent(String(requestParameters['roomId']))); - const response = await this.request({ + return { path: urlPath, method: 'DELETE', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Delete a room by id and disconnect all of its peers. + * Delete a room + */ + async deleteRoomRaw(requestParameters: DeleteRoomRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.deleteRoomRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -280,10 +323,9 @@ export class RoomsApi extends runtime.BaseAPI { } /** - * List all rooms and livestreams. - * List all rooms + * Creates request options for getAllRooms without sending the request */ - async getAllRoomsRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async getAllRoomsRequestOpts(): Promise { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; @@ -299,12 +341,21 @@ export class RoomsApi extends runtime.BaseAPI { let urlPath = `/room`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * List all rooms and livestreams. + * List all rooms + */ + async getAllRoomsRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.getAllRoomsRequestOpts(); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => RoomsListingResponseFromJSON(jsonValue)); } @@ -319,10 +370,9 @@ export class RoomsApi extends runtime.BaseAPI { } /** - * Get a room by id. - * Get a room + * Creates request options for getRoom without sending the request */ - async getRoomRaw(requestParameters: GetRoomRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async getRoomRequestOpts(requestParameters: GetRoomRequest): Promise { if (requestParameters['roomId'] == null) { throw new runtime.RequiredError( 'roomId', @@ -344,14 +394,23 @@ export class RoomsApi extends runtime.BaseAPI { } let urlPath = `/room/{room_id}`; - urlPath = urlPath.replace(`{${"room_id"}}`, encodeURIComponent(String(requestParameters['roomId']))); + urlPath = urlPath.replace('{room_id}', encodeURIComponent(String(requestParameters['roomId']))); - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Get a room by id. + * Get a room + */ + async getRoomRaw(requestParameters: GetRoomRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.getRoomRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => RoomDetailsResponseFromJSON(jsonValue)); } @@ -366,10 +425,9 @@ export class RoomsApi extends runtime.BaseAPI { } /** - * Issue a fresh connection token for an existing peer. - * Refresh a peer token + * Creates request options for refreshToken without sending the request */ - async refreshTokenRaw(requestParameters: RefreshTokenRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async refreshTokenRequestOpts(requestParameters: RefreshTokenRequest): Promise { if (requestParameters['roomId'] == null) { throw new runtime.RequiredError( 'roomId', @@ -398,15 +456,24 @@ export class RoomsApi extends runtime.BaseAPI { } let urlPath = `/room/{room_id}/peer/{id}/refresh_token`; - urlPath = urlPath.replace(`{${"room_id"}}`, encodeURIComponent(String(requestParameters['roomId']))); - urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))); + urlPath = urlPath.replace('{room_id}', encodeURIComponent(String(requestParameters['roomId']))); + urlPath = urlPath.replace('{id}', encodeURIComponent(String(requestParameters['id']))); - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Issue a fresh connection token for an existing peer. + * Refresh a peer token + */ + async refreshTokenRaw(requestParameters: RefreshTokenRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.refreshTokenRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => PeerRefreshTokenResponseFromJSON(jsonValue)); } @@ -421,10 +488,9 @@ export class RoomsApi extends runtime.BaseAPI { } /** - * Subscribe a peer to all current and future tracks published by another peer in the same room. - * Subscribe a peer to another peer\'s tracks + * Creates request options for subscribePeer without sending the request */ - async subscribePeerRaw(requestParameters: SubscribePeerRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async subscribePeerRequestOpts(requestParameters: SubscribePeerRequest): Promise { if (requestParameters['roomId'] == null) { throw new runtime.RequiredError( 'roomId', @@ -457,15 +523,24 @@ export class RoomsApi extends runtime.BaseAPI { } let urlPath = `/room/{room_id}/peer/{id}/subscribe_peer`; - urlPath = urlPath.replace(`{${"room_id"}}`, encodeURIComponent(String(requestParameters['roomId']))); - urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))); + urlPath = urlPath.replace('{room_id}', encodeURIComponent(String(requestParameters['roomId']))); + urlPath = urlPath.replace('{id}', encodeURIComponent(String(requestParameters['id']))); - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Subscribe a peer to all current and future tracks published by another peer in the same room. + * Subscribe a peer to another peer\'s tracks + */ + async subscribePeerRaw(requestParameters: SubscribePeerRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.subscribePeerRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -479,10 +554,9 @@ export class RoomsApi extends runtime.BaseAPI { } /** - * Subscribe a peer to a specific list of track IDs in the same room. - * Subscribe a peer to specific tracks + * Creates request options for subscribeTracks without sending the request */ - async subscribeTracksRaw(requestParameters: SubscribeTracksOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async subscribeTracksRequestOpts(requestParameters: SubscribeTracksOperationRequest): Promise { if (requestParameters['roomId'] == null) { throw new runtime.RequiredError( 'roomId', @@ -513,16 +587,25 @@ export class RoomsApi extends runtime.BaseAPI { } let urlPath = `/room/{room_id}/peer/{id}/subscribe_tracks`; - urlPath = urlPath.replace(`{${"room_id"}}`, encodeURIComponent(String(requestParameters['roomId']))); - urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))); + urlPath = urlPath.replace('{room_id}', encodeURIComponent(String(requestParameters['roomId']))); + urlPath = urlPath.replace('{id}', encodeURIComponent(String(requestParameters['id']))); - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: SubscribeTracksRequestToJSON(requestParameters['subscribeTracksRequest']), - }, initOverrides); + }; + } + + /** + * Subscribe a peer to a specific list of track IDs in the same room. + * Subscribe a peer to specific tracks + */ + async subscribeTracksRaw(requestParameters: SubscribeTracksOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.subscribeTracksRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } diff --git a/packages/fishjam-openapi/src/generated/apis/StreamersApi.ts b/packages/fishjam-openapi/src/generated/apis/StreamersApi.ts index 4526add6..ab504fee 100644 --- a/packages/fishjam-openapi/src/generated/apis/StreamersApi.ts +++ b/packages/fishjam-openapi/src/generated/apis/StreamersApi.ts @@ -12,18 +12,17 @@ * Do not edit the class manually. */ - import * as runtime from '../runtime'; -import type { - StreamerDetailsResponse, - StreamerToken, -} from '../models/index'; import { + type StreamerDetailsResponse, StreamerDetailsResponseFromJSON, StreamerDetailsResponseToJSON, +} from '../models/StreamerDetailsResponse'; +import { + type StreamerToken, StreamerTokenFromJSON, StreamerTokenToJSON, -} from '../models/index'; +} from '../models/StreamerToken'; export interface CreateStreamerRequest { streamId: string; @@ -44,10 +43,9 @@ export interface GenerateStreamerTokenRequest { export class StreamersApi extends runtime.BaseAPI { /** - * Create a streamer for a stream and return its credentials. - * Create a streamer + * Creates request options for createStreamer without sending the request */ - async createStreamerRaw(requestParameters: CreateStreamerRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async createStreamerRequestOpts(requestParameters: CreateStreamerRequest): Promise { if (requestParameters['streamId'] == null) { throw new runtime.RequiredError( 'streamId', @@ -69,14 +67,23 @@ export class StreamersApi extends runtime.BaseAPI { } let urlPath = `/livestream/{stream_id}/streamer`; - urlPath = urlPath.replace(`{${"stream_id"}}`, encodeURIComponent(String(requestParameters['streamId']))); + urlPath = urlPath.replace('{stream_id}', encodeURIComponent(String(requestParameters['streamId']))); - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Create a streamer for a stream and return its credentials. + * Create a streamer + */ + async createStreamerRaw(requestParameters: CreateStreamerRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.createStreamerRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => StreamerDetailsResponseFromJSON(jsonValue)); } @@ -91,10 +98,9 @@ export class StreamersApi extends runtime.BaseAPI { } /** - * Delete a streamer from a stream and revoke its token. - * Delete a streamer + * Creates request options for deleteStreamer without sending the request */ - async deleteStreamerRaw(requestParameters: DeleteStreamerRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async deleteStreamerRequestOpts(requestParameters: DeleteStreamerRequest): Promise { if (requestParameters['streamId'] == null) { throw new runtime.RequiredError( 'streamId', @@ -123,15 +129,24 @@ export class StreamersApi extends runtime.BaseAPI { } let urlPath = `/livestream/{stream_id}/streamer/{streamer_id}`; - urlPath = urlPath.replace(`{${"stream_id"}}`, encodeURIComponent(String(requestParameters['streamId']))); - urlPath = urlPath.replace(`{${"streamer_id"}}`, encodeURIComponent(String(requestParameters['streamerId']))); + urlPath = urlPath.replace('{stream_id}', encodeURIComponent(String(requestParameters['streamId']))); + urlPath = urlPath.replace('{streamer_id}', encodeURIComponent(String(requestParameters['streamerId']))); - const response = await this.request({ + return { path: urlPath, method: 'DELETE', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Delete a streamer from a stream and revoke its token. + * Delete a streamer + */ + async deleteStreamerRaw(requestParameters: DeleteStreamerRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.deleteStreamerRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -145,10 +160,9 @@ export class StreamersApi extends runtime.BaseAPI { } /** - * Issue a fresh streamer token. - * Create a streamer token + * Creates request options for generateStreamerToken without sending the request */ - async generateStreamerTokenRaw(requestParameters: GenerateStreamerTokenRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async generateStreamerTokenRequestOpts(requestParameters: GenerateStreamerTokenRequest): Promise { if (requestParameters['roomId'] == null) { throw new runtime.RequiredError( 'roomId', @@ -170,14 +184,23 @@ export class StreamersApi extends runtime.BaseAPI { } let urlPath = `/room/{room_id}/streamer`; - urlPath = urlPath.replace(`{${"room_id"}}`, encodeURIComponent(String(requestParameters['roomId']))); + urlPath = urlPath.replace('{room_id}', encodeURIComponent(String(requestParameters['roomId']))); - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Issue a fresh streamer token. + * Create a streamer token + */ + async generateStreamerTokenRaw(requestParameters: GenerateStreamerTokenRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.generateStreamerTokenRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => StreamerTokenFromJSON(jsonValue)); } diff --git a/packages/fishjam-openapi/src/generated/apis/StreamsApi.ts b/packages/fishjam-openapi/src/generated/apis/StreamsApi.ts index 6f2af38e..defd58df 100644 --- a/packages/fishjam-openapi/src/generated/apis/StreamsApi.ts +++ b/packages/fishjam-openapi/src/generated/apis/StreamsApi.ts @@ -12,21 +12,22 @@ * Do not edit the class manually. */ - import * as runtime from '../runtime'; -import type { - StreamConfig, - StreamDetailsResponse, - StreamsListingResponse, -} from '../models/index'; import { + type StreamConfig, StreamConfigFromJSON, StreamConfigToJSON, +} from '../models/StreamConfig'; +import { + type StreamDetailsResponse, StreamDetailsResponseFromJSON, StreamDetailsResponseToJSON, +} from '../models/StreamDetailsResponse'; +import { + type StreamsListingResponse, StreamsListingResponseFromJSON, StreamsListingResponseToJSON, -} from '../models/index'; +} from '../models/StreamsListingResponse'; export interface CreateStreamRequest { streamConfig?: StreamConfig; @@ -46,10 +47,9 @@ export interface GetStreamRequest { export class StreamsApi extends runtime.BaseAPI { /** - * Create a new livestream with the given configuration. - * Create a stream + * Creates request options for createStream without sending the request */ - async createStreamRaw(requestParameters: CreateStreamRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async createStreamRequestOpts(requestParameters: CreateStreamRequest): Promise { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; @@ -67,13 +67,22 @@ export class StreamsApi extends runtime.BaseAPI { let urlPath = `/livestream`; - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: StreamConfigToJSON(requestParameters['streamConfig']), - }, initOverrides); + }; + } + + /** + * Create a new livestream with the given configuration. + * Create a stream + */ + async createStreamRaw(requestParameters: CreateStreamRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.createStreamRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => StreamDetailsResponseFromJSON(jsonValue)); } @@ -88,10 +97,9 @@ export class StreamsApi extends runtime.BaseAPI { } /** - * Delete a stream by id and disconnect all of its streamers and viewers. - * Delete a stream + * Creates request options for deleteStream without sending the request */ - async deleteStreamRaw(requestParameters: DeleteStreamRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async deleteStreamRequestOpts(requestParameters: DeleteStreamRequest): Promise { if (requestParameters['streamId'] == null) { throw new runtime.RequiredError( 'streamId', @@ -113,14 +121,23 @@ export class StreamsApi extends runtime.BaseAPI { } let urlPath = `/livestream/{stream_id}`; - urlPath = urlPath.replace(`{${"stream_id"}}`, encodeURIComponent(String(requestParameters['streamId']))); + urlPath = urlPath.replace('{stream_id}', encodeURIComponent(String(requestParameters['streamId']))); - const response = await this.request({ + return { path: urlPath, method: 'DELETE', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Delete a stream by id and disconnect all of its streamers and viewers. + * Delete a stream + */ + async deleteStreamRaw(requestParameters: DeleteStreamRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.deleteStreamRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -134,10 +151,9 @@ export class StreamsApi extends runtime.BaseAPI { } /** - * List all livestreams. - * List all streams + * Creates request options for getAllStreams without sending the request */ - async getAllStreamsRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async getAllStreamsRequestOpts(): Promise { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; @@ -153,12 +169,21 @@ export class StreamsApi extends runtime.BaseAPI { let urlPath = `/livestream`; - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * List all livestreams. + * List all streams + */ + async getAllStreamsRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.getAllStreamsRequestOpts(); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => StreamsListingResponseFromJSON(jsonValue)); } @@ -173,10 +198,9 @@ export class StreamsApi extends runtime.BaseAPI { } /** - * Get a stream by id. - * Get a stream + * Creates request options for getStream without sending the request */ - async getStreamRaw(requestParameters: GetStreamRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async getStreamRequestOpts(requestParameters: GetStreamRequest): Promise { if (requestParameters['streamId'] == null) { throw new runtime.RequiredError( 'streamId', @@ -198,14 +222,23 @@ export class StreamsApi extends runtime.BaseAPI { } let urlPath = `/livestream/{stream_id}`; - urlPath = urlPath.replace(`{${"stream_id"}}`, encodeURIComponent(String(requestParameters['streamId']))); + urlPath = urlPath.replace('{stream_id}', encodeURIComponent(String(requestParameters['streamId']))); - const response = await this.request({ + return { path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Get a stream by id. + * Get a stream + */ + async getStreamRaw(requestParameters: GetStreamRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.getStreamRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => StreamDetailsResponseFromJSON(jsonValue)); } diff --git a/packages/fishjam-openapi/src/generated/apis/TrackForwardingsApi.ts b/packages/fishjam-openapi/src/generated/apis/TrackForwardingsApi.ts index 3e7dbc4a..b3fb1ed2 100644 --- a/packages/fishjam-openapi/src/generated/apis/TrackForwardingsApi.ts +++ b/packages/fishjam-openapi/src/generated/apis/TrackForwardingsApi.ts @@ -12,15 +12,12 @@ * Do not edit the class manually. */ - import * as runtime from '../runtime'; -import type { - TrackForwarding, -} from '../models/index'; import { + type TrackForwarding, TrackForwardingFromJSON, TrackForwardingToJSON, -} from '../models/index'; +} from '../models/TrackForwarding'; export interface CreateTrackForwardingRequest { roomId: string; @@ -33,10 +30,9 @@ export interface CreateTrackForwardingRequest { export class TrackForwardingsApi extends runtime.BaseAPI { /** - * Forward a room\'s tracks into an external composition. - * Create a track forwarding + * Creates request options for createTrackForwarding without sending the request */ - async createTrackForwardingRaw(requestParameters: CreateTrackForwardingRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async createTrackForwardingRequestOpts(requestParameters: CreateTrackForwardingRequest): Promise { if (requestParameters['roomId'] == null) { throw new runtime.RequiredError( 'roomId', @@ -67,15 +63,24 @@ export class TrackForwardingsApi extends runtime.BaseAPI { } let urlPath = `/room/{room_id}/track_forwardings`; - urlPath = urlPath.replace(`{${"room_id"}}`, encodeURIComponent(String(requestParameters['roomId']))); + urlPath = urlPath.replace('{room_id}', encodeURIComponent(String(requestParameters['roomId']))); - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: TrackForwardingToJSON(requestParameters['trackForwarding']), - }, initOverrides); + }; + } + + /** + * Forward a room\'s tracks into an external composition. + * Create a track forwarding + */ + async createTrackForwardingRaw(requestParameters: CreateTrackForwardingRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.createTrackForwardingRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } diff --git a/packages/fishjam-openapi/src/generated/apis/ViewersApi.ts b/packages/fishjam-openapi/src/generated/apis/ViewersApi.ts index f46a2f52..ed610d48 100644 --- a/packages/fishjam-openapi/src/generated/apis/ViewersApi.ts +++ b/packages/fishjam-openapi/src/generated/apis/ViewersApi.ts @@ -12,18 +12,17 @@ * Do not edit the class manually. */ - import * as runtime from '../runtime'; -import type { - ViewerDetailsResponse, - ViewerToken, -} from '../models/index'; import { + type ViewerDetailsResponse, ViewerDetailsResponseFromJSON, ViewerDetailsResponseToJSON, +} from '../models/ViewerDetailsResponse'; +import { + type ViewerToken, ViewerTokenFromJSON, ViewerTokenToJSON, -} from '../models/index'; +} from '../models/ViewerToken'; export interface CreateViewerRequest { streamId: string; @@ -44,10 +43,9 @@ export interface GenerateViewerTokenRequest { export class ViewersApi extends runtime.BaseAPI { /** - * Create a viewer for a stream and return its credentials. - * Create a viewer + * Creates request options for createViewer without sending the request */ - async createViewerRaw(requestParameters: CreateViewerRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async createViewerRequestOpts(requestParameters: CreateViewerRequest): Promise { if (requestParameters['streamId'] == null) { throw new runtime.RequiredError( 'streamId', @@ -69,14 +67,23 @@ export class ViewersApi extends runtime.BaseAPI { } let urlPath = `/livestream/{stream_id}/viewer`; - urlPath = urlPath.replace(`{${"stream_id"}}`, encodeURIComponent(String(requestParameters['streamId']))); + urlPath = urlPath.replace('{stream_id}', encodeURIComponent(String(requestParameters['streamId']))); - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Create a viewer for a stream and return its credentials. + * Create a viewer + */ + async createViewerRaw(requestParameters: CreateViewerRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.createViewerRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ViewerDetailsResponseFromJSON(jsonValue)); } @@ -91,10 +98,9 @@ export class ViewersApi extends runtime.BaseAPI { } /** - * Delete a viewer from a stream and revoke its token. - * Delete a viewer + * Creates request options for deleteViewer without sending the request */ - async deleteViewerRaw(requestParameters: DeleteViewerRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async deleteViewerRequestOpts(requestParameters: DeleteViewerRequest): Promise { if (requestParameters['streamId'] == null) { throw new runtime.RequiredError( 'streamId', @@ -123,15 +129,24 @@ export class ViewersApi extends runtime.BaseAPI { } let urlPath = `/livestream/{stream_id}/viewer/{viewer_id}`; - urlPath = urlPath.replace(`{${"stream_id"}}`, encodeURIComponent(String(requestParameters['streamId']))); - urlPath = urlPath.replace(`{${"viewer_id"}}`, encodeURIComponent(String(requestParameters['viewerId']))); + urlPath = urlPath.replace('{stream_id}', encodeURIComponent(String(requestParameters['streamId']))); + urlPath = urlPath.replace('{viewer_id}', encodeURIComponent(String(requestParameters['viewerId']))); - const response = await this.request({ + return { path: urlPath, method: 'DELETE', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Delete a viewer from a stream and revoke its token. + * Delete a viewer + */ + async deleteViewerRaw(requestParameters: DeleteViewerRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.deleteViewerRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.VoidApiResponse(response); } @@ -145,10 +160,9 @@ export class ViewersApi extends runtime.BaseAPI { } /** - * Issue a fresh viewer token. - * Create a viewer token + * Creates request options for generateViewerToken without sending the request */ - async generateViewerTokenRaw(requestParameters: GenerateViewerTokenRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async generateViewerTokenRequestOpts(requestParameters: GenerateViewerTokenRequest): Promise { if (requestParameters['roomId'] == null) { throw new runtime.RequiredError( 'roomId', @@ -170,14 +184,23 @@ export class ViewersApi extends runtime.BaseAPI { } let urlPath = `/room/{room_id}/viewer`; - urlPath = urlPath.replace(`{${"room_id"}}`, encodeURIComponent(String(requestParameters['roomId']))); + urlPath = urlPath.replace('{room_id}', encodeURIComponent(String(requestParameters['roomId']))); - const response = await this.request({ + return { path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, - }, initOverrides); + }; + } + + /** + * Issue a fresh viewer token. + * Create a viewer token + */ + async generateViewerTokenRaw(requestParameters: GenerateViewerTokenRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const requestOptions = await this.generateViewerTokenRequestOpts(requestParameters); + const response = await this.request(requestOptions, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ViewerTokenFromJSON(jsonValue)); } diff --git a/packages/fishjam-openapi/src/generated/models/PeerConfig.ts b/packages/fishjam-openapi/src/generated/models/PeerConfig.ts index b8541514..940f6201 100644 --- a/packages/fishjam-openapi/src/generated/models/PeerConfig.ts +++ b/packages/fishjam-openapi/src/generated/models/PeerConfig.ts @@ -12,52 +12,34 @@ * Do not edit the class manually. */ -import { mapValues } from '../runtime'; -import type { PeerType } from './PeerType'; +import type { PeerConfigAgent } from './PeerConfigAgent'; import { - PeerTypeFromJSON, - PeerTypeFromJSONTyped, - PeerTypeToJSON, - PeerTypeToJSONTyped, -} from './PeerType'; -import type { PeerOptions } from './PeerOptions'; + instanceOfPeerConfigAgent, + PeerConfigAgentFromJSON, + PeerConfigAgentFromJSONTyped, + PeerConfigAgentToJSON, +} from './PeerConfigAgent'; +import type { PeerConfigVAPI } from './PeerConfigVAPI'; import { - PeerOptionsFromJSON, - PeerOptionsFromJSONTyped, - PeerOptionsToJSON, - PeerOptionsToJSONTyped, -} from './PeerOptions'; + instanceOfPeerConfigVAPI, + PeerConfigVAPIFromJSON, + PeerConfigVAPIFromJSONTyped, + PeerConfigVAPIToJSON, +} from './PeerConfigVAPI'; +import type { PeerConfigWebRTC } from './PeerConfigWebRTC'; +import { + instanceOfPeerConfigWebRTC, + PeerConfigWebRTCFromJSON, + PeerConfigWebRTCFromJSONTyped, + PeerConfigWebRTCToJSON, +} from './PeerConfigWebRTC'; /** + * @type PeerConfig * Peer configuration * @export - * @interface PeerConfig */ -export interface PeerConfig { - /** - * - * @type {PeerOptions} - * @memberof PeerConfig - */ - options: PeerOptions; - /** - * - * @type {PeerType} - * @memberof PeerConfig - */ - type: PeerType; -} - - - -/** - * Check if a given object implements the PeerConfig interface. - */ -export function instanceOfPeerConfig(value: object): value is PeerConfig { - if (!('options' in value) || value['options'] === undefined) return false; - if (!('type' in value) || value['type'] === undefined) return false; - return true; -} +export type PeerConfig = { type: 'agent' } & PeerConfigAgent | { type: 'vapi' } & PeerConfigVAPI | { type: 'webrtc' } & PeerConfigWebRTC; export function PeerConfigFromJSON(json: any): PeerConfig { return PeerConfigFromJSONTyped(json, false); @@ -67,14 +49,19 @@ export function PeerConfigFromJSONTyped(json: any, ignoreDiscriminator: boolean) if (json == null) { return json; } - return { - - 'options': PeerOptionsFromJSON(json['options']), - 'type': PeerTypeFromJSON(json['type']), - }; + switch (json['type']) { + case 'agent': + return Object.assign({}, PeerConfigAgentFromJSONTyped(json, true), { type: 'agent' } as const); + case 'vapi': + return Object.assign({}, PeerConfigVAPIFromJSONTyped(json, true), { type: 'vapi' } as const); + case 'webrtc': + return Object.assign({}, PeerConfigWebRTCFromJSONTyped(json, true), { type: 'webrtc' } as const); + default: + return json; + } } -export function PeerConfigToJSON(json: any): PeerConfig { +export function PeerConfigToJSON(json: any): any { return PeerConfigToJSONTyped(json, false); } @@ -82,11 +69,15 @@ export function PeerConfigToJSONTyped(value?: PeerConfig | null, ignoreDiscrimin if (value == null) { return value; } - - return { - - 'options': PeerOptionsToJSON(value['options']), - 'type': PeerTypeToJSON(value['type']), - }; + switch (value['type']) { + case 'agent': + return Object.assign({}, PeerConfigAgentToJSON(value), { 'type': 'agent' } as const); + case 'vapi': + return Object.assign({}, PeerConfigVAPIToJSON(value), { 'type': 'vapi' } as const); + case 'webrtc': + return Object.assign({}, PeerConfigWebRTCToJSON(value), { 'type': 'webrtc' } as const); + default: + return value; + } } diff --git a/packages/fishjam-openapi/src/generated/models/PeerConfigAgent.ts b/packages/fishjam-openapi/src/generated/models/PeerConfigAgent.ts new file mode 100644 index 00000000..b7c5a282 --- /dev/null +++ b/packages/fishjam-openapi/src/generated/models/PeerConfigAgent.ts @@ -0,0 +1,95 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Fishjam API + * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) + * + * The version of the OpenAPI document: 0.28.1 + * Contact: contact@fishjam.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +import type { PeerOptionsAgent } from './PeerOptionsAgent'; +import { + PeerOptionsAgentFromJSON, + PeerOptionsAgentFromJSONTyped, + PeerOptionsAgentToJSON, + PeerOptionsAgentToJSONTyped, +} from './PeerOptionsAgent'; + +/** + * Configuration of an agent peer + * @export + * @interface PeerConfigAgent + */ +export interface PeerConfigAgent { + /** + * + * @type {PeerOptionsAgent} + * @memberof PeerConfigAgent + */ + options: PeerOptionsAgent; + /** + * Peer type + * @type {PeerConfigAgentTypeEnum} + * @memberof PeerConfigAgent + */ + type: PeerConfigAgentTypeEnum; +} + + +/** + * @export + */ +export const PeerConfigAgentTypeEnum = { + Agent: 'agent' +} as const; +export type PeerConfigAgentTypeEnum = typeof PeerConfigAgentTypeEnum[keyof typeof PeerConfigAgentTypeEnum]; + + +/** + * Check if a given object implements the PeerConfigAgent interface. + */ +export function instanceOfPeerConfigAgent(value: object): value is PeerConfigAgent { + if (!('options' in value) || value['options'] === undefined) return false; + if (!('type' in value) || value['type'] === undefined) return false; + if (value['type'] !== 'agent') return false; + + return true; +} + +export function PeerConfigAgentFromJSON(json: any): PeerConfigAgent { + return PeerConfigAgentFromJSONTyped(json, false); +} + +export function PeerConfigAgentFromJSONTyped(json: any, ignoreDiscriminator: boolean): PeerConfigAgent { + if (json == null) { + return json; + } + return { + + 'options': PeerOptionsAgentFromJSON(json['options']), + 'type': json['type'], + }; +} + +export function PeerConfigAgentToJSON(json: any): PeerConfigAgent { + return PeerConfigAgentToJSONTyped(json, false); +} + +export function PeerConfigAgentToJSONTyped(value?: PeerConfigAgent | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'options': PeerOptionsAgentToJSON(value['options']), + 'type': value['type'], + }; +} + diff --git a/packages/fishjam-openapi/src/generated/models/PeerConfigVAPI.ts b/packages/fishjam-openapi/src/generated/models/PeerConfigVAPI.ts new file mode 100644 index 00000000..259eccf9 --- /dev/null +++ b/packages/fishjam-openapi/src/generated/models/PeerConfigVAPI.ts @@ -0,0 +1,95 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Fishjam API + * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) + * + * The version of the OpenAPI document: 0.28.1 + * Contact: contact@fishjam.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +import type { PeerOptionsVapi } from './PeerOptionsVapi'; +import { + PeerOptionsVapiFromJSON, + PeerOptionsVapiFromJSONTyped, + PeerOptionsVapiToJSON, + PeerOptionsVapiToJSONTyped, +} from './PeerOptionsVapi'; + +/** + * Configuration of a VAPI peer + * @export + * @interface PeerConfigVAPI + */ +export interface PeerConfigVAPI { + /** + * + * @type {PeerOptionsVapi} + * @memberof PeerConfigVAPI + */ + options: PeerOptionsVapi; + /** + * Peer type + * @type {PeerConfigVAPITypeEnum} + * @memberof PeerConfigVAPI + */ + type: PeerConfigVAPITypeEnum; +} + + +/** + * @export + */ +export const PeerConfigVAPITypeEnum = { + Vapi: 'vapi' +} as const; +export type PeerConfigVAPITypeEnum = typeof PeerConfigVAPITypeEnum[keyof typeof PeerConfigVAPITypeEnum]; + + +/** + * Check if a given object implements the PeerConfigVAPI interface. + */ +export function instanceOfPeerConfigVAPI(value: object): value is PeerConfigVAPI { + if (!('options' in value) || value['options'] === undefined) return false; + if (!('type' in value) || value['type'] === undefined) return false; + if (value['type'] !== 'vapi') return false; + + return true; +} + +export function PeerConfigVAPIFromJSON(json: any): PeerConfigVAPI { + return PeerConfigVAPIFromJSONTyped(json, false); +} + +export function PeerConfigVAPIFromJSONTyped(json: any, ignoreDiscriminator: boolean): PeerConfigVAPI { + if (json == null) { + return json; + } + return { + + 'options': PeerOptionsVapiFromJSON(json['options']), + 'type': json['type'], + }; +} + +export function PeerConfigVAPIToJSON(json: any): PeerConfigVAPI { + return PeerConfigVAPIToJSONTyped(json, false); +} + +export function PeerConfigVAPIToJSONTyped(value?: PeerConfigVAPI | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'options': PeerOptionsVapiToJSON(value['options']), + 'type': value['type'], + }; +} + diff --git a/packages/fishjam-openapi/src/generated/models/PeerConfigWebRTC.ts b/packages/fishjam-openapi/src/generated/models/PeerConfigWebRTC.ts new file mode 100644 index 00000000..8f3bed13 --- /dev/null +++ b/packages/fishjam-openapi/src/generated/models/PeerConfigWebRTC.ts @@ -0,0 +1,95 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Fishjam API + * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) + * + * The version of the OpenAPI document: 0.28.1 + * Contact: contact@fishjam.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +import type { PeerOptionsWebRTC } from './PeerOptionsWebRTC'; +import { + PeerOptionsWebRTCFromJSON, + PeerOptionsWebRTCFromJSONTyped, + PeerOptionsWebRTCToJSON, + PeerOptionsWebRTCToJSONTyped, +} from './PeerOptionsWebRTC'; + +/** + * Configuration of a webrtc peer + * @export + * @interface PeerConfigWebRTC + */ +export interface PeerConfigWebRTC { + /** + * + * @type {PeerOptionsWebRTC} + * @memberof PeerConfigWebRTC + */ + options: PeerOptionsWebRTC; + /** + * Peer type + * @type {PeerConfigWebRTCTypeEnum} + * @memberof PeerConfigWebRTC + */ + type: PeerConfigWebRTCTypeEnum; +} + + +/** + * @export + */ +export const PeerConfigWebRTCTypeEnum = { + Webrtc: 'webrtc' +} as const; +export type PeerConfigWebRTCTypeEnum = typeof PeerConfigWebRTCTypeEnum[keyof typeof PeerConfigWebRTCTypeEnum]; + + +/** + * Check if a given object implements the PeerConfigWebRTC interface. + */ +export function instanceOfPeerConfigWebRTC(value: object): value is PeerConfigWebRTC { + if (!('options' in value) || value['options'] === undefined) return false; + if (!('type' in value) || value['type'] === undefined) return false; + if (value['type'] !== 'webrtc') return false; + + return true; +} + +export function PeerConfigWebRTCFromJSON(json: any): PeerConfigWebRTC { + return PeerConfigWebRTCFromJSONTyped(json, false); +} + +export function PeerConfigWebRTCFromJSONTyped(json: any, ignoreDiscriminator: boolean): PeerConfigWebRTC { + if (json == null) { + return json; + } + return { + + 'options': PeerOptionsWebRTCFromJSON(json['options']), + 'type': json['type'], + }; +} + +export function PeerConfigWebRTCToJSON(json: any): PeerConfigWebRTC { + return PeerConfigWebRTCToJSONTyped(json, false); +} + +export function PeerConfigWebRTCToJSONTyped(value?: PeerConfigWebRTC | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'options': PeerOptionsWebRTCToJSON(value['options']), + 'type': value['type'], + }; +} + diff --git a/packages/fishjam-openapi/src/generated/models/PeerOptions.ts b/packages/fishjam-openapi/src/generated/models/PeerOptions.ts deleted file mode 100644 index 6216a755..00000000 --- a/packages/fishjam-openapi/src/generated/models/PeerOptions.ts +++ /dev/null @@ -1,91 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Fishjam API - * API for managing Fishjam real-time media resources. ## Authentication ## Credentials (Fishjam ID, Fishjam Management Token) can be obtained at https://fishjam.io/app. All requests require HTTP Bearer authorization using the Fishjam Management Token. ## Fishjam SDKs ## For TypeScript and Python users, we provide SDKs that simplify using this API. We recommend using them instead of manually consuming the API in these languages. You can learn more about our SDKs in our [SDK Docs](http://fishjam.swmansion.com/docs/how-to/backend/server-setup) - * - * The version of the OpenAPI document: 0.28.1 - * Contact: contact@fishjam.io - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import type { PeerOptionsAgent } from './PeerOptionsAgent'; -import { - instanceOfPeerOptionsAgent, - PeerOptionsAgentFromJSON, - PeerOptionsAgentFromJSONTyped, - PeerOptionsAgentToJSON, -} from './PeerOptionsAgent'; -import type { PeerOptionsVapi } from './PeerOptionsVapi'; -import { - instanceOfPeerOptionsVapi, - PeerOptionsVapiFromJSON, - PeerOptionsVapiFromJSONTyped, - PeerOptionsVapiToJSON, -} from './PeerOptionsVapi'; -import type { PeerOptionsWebRTC } from './PeerOptionsWebRTC'; -import { - instanceOfPeerOptionsWebRTC, - PeerOptionsWebRTCFromJSON, - PeerOptionsWebRTCFromJSONTyped, - PeerOptionsWebRTCToJSON, -} from './PeerOptionsWebRTC'; - -/** - * @type PeerOptions - * Peer-specific options - * @export - */ -export type PeerOptions = PeerOptionsAgent | PeerOptionsVapi | PeerOptionsWebRTC; - -export function PeerOptionsFromJSON(json: any): PeerOptions { - return PeerOptionsFromJSONTyped(json, false); -} - -export function PeerOptionsFromJSONTyped(json: any, ignoreDiscriminator: boolean): PeerOptions { - if (json == null) { - return json; - } - if (typeof json !== 'object') { - return json; - } - if (instanceOfPeerOptionsAgent(json)) { - return PeerOptionsAgentFromJSONTyped(json, true); - } - if (instanceOfPeerOptionsVapi(json)) { - return PeerOptionsVapiFromJSONTyped(json, true); - } - if (instanceOfPeerOptionsWebRTC(json)) { - return PeerOptionsWebRTCFromJSONTyped(json, true); - } - - return {} as any; -} - -export function PeerOptionsToJSON(json: any): any { - return PeerOptionsToJSONTyped(json, false); -} - -export function PeerOptionsToJSONTyped(value?: PeerOptions | null, ignoreDiscriminator: boolean = false): any { - if (value == null) { - return value; - } - if (typeof value !== 'object') { - return value; - } - if (instanceOfPeerOptionsAgent(value)) { - return PeerOptionsAgentToJSON(value as PeerOptionsAgent); - } - if (instanceOfPeerOptionsVapi(value)) { - return PeerOptionsVapiToJSON(value as PeerOptionsVapi); - } - if (instanceOfPeerOptionsWebRTC(value)) { - return PeerOptionsWebRTCToJSON(value as PeerOptionsWebRTC); - } - - return {}; -} - diff --git a/packages/fishjam-openapi/src/generated/models/Streamer.ts b/packages/fishjam-openapi/src/generated/models/Streamer.ts index 1b5aa1b9..ae12ad3d 100644 --- a/packages/fishjam-openapi/src/generated/models/Streamer.ts +++ b/packages/fishjam-openapi/src/generated/models/Streamer.ts @@ -27,7 +27,7 @@ export interface Streamer { id: string; /** * Streamer connection status - * @type {string} + * @type {StreamerStatusEnum} * @memberof Streamer */ status: StreamerStatusEnum; diff --git a/packages/fishjam-openapi/src/generated/models/index.ts b/packages/fishjam-openapi/src/generated/models/index.ts index f1254602..e0944cb9 100644 --- a/packages/fishjam-openapi/src/generated/models/index.ts +++ b/packages/fishjam-openapi/src/generated/models/index.ts @@ -9,9 +9,11 @@ export * from './MoqAccess'; export * from './MoqAccessConfig'; export * from './Peer'; export * from './PeerConfig'; +export * from './PeerConfigAgent'; +export * from './PeerConfigVAPI'; +export * from './PeerConfigWebRTC'; export * from './PeerDetailsResponse'; export * from './PeerDetailsResponseData'; -export * from './PeerOptions'; export * from './PeerOptionsAgent'; export * from './PeerOptionsVapi'; export * from './PeerOptionsWebRTC'; diff --git a/packages/fishjam-openapi/src/generated/runtime.ts b/packages/fishjam-openapi/src/generated/runtime.ts index d8907bde..fa847c1e 100644 --- a/packages/fishjam-openapi/src/generated/runtime.ts +++ b/packages/fishjam-openapi/src/generated/runtime.ts @@ -12,7 +12,6 @@ * Do not edit the class manually. */ - export const BASE_PATH = "https://fishjam.io/api/v1/connect".replace(/\/+$/, ""); export interface ConfigurationParameters { @@ -91,7 +90,7 @@ export const DefaultConfig = new Configuration(); */ export class BaseAPI { - private static readonly jsonRegex = new RegExp('^(:?application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$', 'i'); + private static readonly jsonRegex = /^(:?application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$/i; private middleware: Middleware[]; constructor(protected configuration = DefaultConfig) { @@ -261,6 +260,12 @@ export class ResponseError extends Error { override name: "ResponseError" = "ResponseError"; constructor(public response: Response, msg?: string) { super(msg); + + // restore prototype chain + const actualProto = new.target.prototype; + if (Object.setPrototypeOf) { + Object.setPrototypeOf(this, actualProto); + } } } @@ -268,6 +273,12 @@ export class FetchError extends Error { override name: "FetchError" = "FetchError"; constructor(public cause: Error, msg?: string) { super(msg); + + // restore prototype chain + const actualProto = new.target.prototype; + if (Object.setPrototypeOf) { + Object.setPrototypeOf(this, actualProto); + } } } @@ -275,6 +286,12 @@ export class RequiredError extends Error { override name: "RequiredError" = "RequiredError"; constructor(public field: string, msg?: string) { super(msg); + + // restore prototype chain + const actualProto = new.target.prototype; + if (Object.setPrototypeOf) { + Object.setPrototypeOf(this, actualProto); + } } } diff --git a/packages/js-server-sdk/src/index.ts b/packages/js-server-sdk/src/index.ts index 0360b06a..ad698458 100644 --- a/packages/js-server-sdk/src/index.ts +++ b/packages/js-server-sdk/src/index.ts @@ -3,10 +3,13 @@ * * @packageDocumentation */ +import type { PeerOptionsWebRTC, PeerOptionsAgent, PeerOptionsVapi } from '@fishjam-cloud/fishjam-openapi'; + +export type PeerOptions = PeerOptionsWebRTC | PeerOptionsAgent | PeerOptionsVapi; + export { PeerStatus, RoomConfig, - PeerOptions, PeerOptionsWebRTC, PeerOptionsAgent, PeerOptionsVapi, diff --git a/packages/js-server-sdk/tests/serialization.test.ts b/packages/js-server-sdk/tests/serialization.test.ts new file mode 100644 index 00000000..b3a88e84 --- /dev/null +++ b/packages/js-server-sdk/tests/serialization.test.ts @@ -0,0 +1,65 @@ +import { describe, it, expect, vi, afterEach } from 'vitest'; +import { FishjamClient } from '../src/client'; +import type { RoomId } from '../src/types'; + +const makeClient = () => + new FishjamClient({ fishjamId: 'https://fishjam.test/api/v1/connect/x', managementToken: 'tok' }); + +let capturedBody: { type: string; options: Record }; + +const stubFetch = (responseBody: unknown) => + vi.fn(async (_input: unknown, init?: RequestInit) => { + capturedBody = JSON.parse(String(init?.body)); + return new Response(JSON.stringify(responseBody), { + status: 201, + headers: { 'content-type': 'application/json' }, + }); + }); + +const peerResponse = { + data: { + peer: { + id: 'p1', + metadata: {}, + status: 'disconnected', + subscribeMode: 'auto', + subscriptions: {}, + tracks: [], + type: 'webrtc', + }, + token: 't1', + }, +}; + +describe('addPeer request body serialization', () => { + afterEach(() => { + vi.unstubAllGlobals(); + }); + + it('createPeer sends webrtc metadata on the wire', async () => { + vi.stubGlobal('fetch', stubFetch(peerResponse)); + + await makeClient().createPeer('room-1' as RoomId, { metadata: { role: 'host' } }); + + expect(capturedBody.type).toBe('webrtc'); + expect(capturedBody.options.metadata).toEqual({ role: 'host' }); + }); + + it('createVapiAgent sends apiKey and callId on the wire', async () => { + vi.stubGlobal('fetch', stubFetch(peerResponse)); + + await makeClient().createVapiAgent('room-1' as RoomId, { apiKey: 'vapi-key', callId: 'call-7' }); + + expect(capturedBody.type).toBe('vapi'); + expect(capturedBody.options.apiKey).toBe('vapi-key'); + expect(capturedBody.options.callId).toBe('call-7'); + }); + + it('createPeer sends subscribeMode for webrtc peers', async () => { + vi.stubGlobal('fetch', stubFetch(peerResponse)); + + await makeClient().createPeer('room-1' as RoomId, { subscribeMode: 'manual' }); + + expect(capturedBody.options.subscribeMode).toBe('manual'); + }); +}); From 0a5f640c9639c16a2ab6e1901f16b9b7d92af622 Mon Sep 17 00:00:00 2001 From: Bernard Gawor Date: Wed, 8 Jul 2026 16:39:54 +0200 Subject: [PATCH 6/7] FCE-3523 pass github token via Authorization header in openapi.sh Tokens in URL query strings leak through shell history, process lists, and CI logs, and raw.githubusercontent.com does not accept them anyway. The remote mode now curls the spec with an Authorization header into a temp file, so bump-version.sh can delegate instead of duplicating the download. --- packages/fishjam-openapi/openapi.sh | 8 +++++++- .../src/generated/.openapi-generator/FILES | 1 - release-automation/bump-version.sh | 8 +------- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/packages/fishjam-openapi/openapi.sh b/packages/fishjam-openapi/openapi.sh index 2235e9e5..295bd0aa 100755 --- a/packages/fishjam-openapi/openapi.sh +++ b/packages/fishjam-openapi/openapi.sh @@ -22,7 +22,13 @@ else echo "Missing github token as the second argument" 1>&2 exit 1 fi - SPEC="https://raw.githubusercontent.com/fishjam-cloud/fishjam/$1/openapi.yaml?token=$2" + SPEC=$(mktemp).yaml + trap 'rm -f "$SPEC"' EXIT + curl -sfL \ + -H "Authorization: token $2" \ + -H "Accept: application/vnd.github.v3.raw" \ + "https://raw.githubusercontent.com/fishjam-cloud/fishjam/$1/openapi.yaml" \ + -o "$SPEC" echo "Generating code for $1...\n" fi diff --git a/packages/fishjam-openapi/src/generated/.openapi-generator/FILES b/packages/fishjam-openapi/src/generated/.openapi-generator/FILES index b64a9f63..ed044b7a 100644 --- a/packages/fishjam-openapi/src/generated/.openapi-generator/FILES +++ b/packages/fishjam-openapi/src/generated/.openapi-generator/FILES @@ -1,4 +1,3 @@ -.openapi-generator-ignore apis/CredentialsApi.ts apis/MoQApi.ts apis/RoomsApi.ts diff --git a/release-automation/bump-version.sh b/release-automation/bump-version.sh index ca27a81f..0a2feb6f 100755 --- a/release-automation/bump-version.sh +++ b/release-automation/bump-version.sh @@ -65,14 +65,8 @@ fi # Run openapi codegen in fishjam-openapi cd packages/fishjam-openapi -curl -H "Authorization: token $GH_TOKEN" \ --H "Accept: application/vnd.github.v3.raw" \ --L "https://raw.githubusercontent.com/fishjam-cloud/fishjam/main/openapi.yaml" \ --o openapi.yaml +sh openapi.sh main "$GH_TOKEN" -sh openapi.sh ./openapi.yaml - -rm openapi.yaml cd ../../ echo "✅ Version bump complete for $VERSION" From a26c536a7af20ef494f2fcc7fc5efe52ab108cf1 Mon Sep 17 00:00:00 2001 From: Bernard Gawor Date: Wed, 8 Jul 2026 16:44:53 +0200 Subject: [PATCH 7/7] FCE-3523 fix temp spec leak and silent failure in openapi.sh mktemp created an unused file next to the .yaml path the trap removed, leaking one temp file per remote run; a temp directory removed recursively covers both. A bad ref now prints an error instead of dying silently. --- packages/fishjam-openapi/openapi.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/fishjam-openapi/openapi.sh b/packages/fishjam-openapi/openapi.sh index 295bd0aa..4fa52492 100755 --- a/packages/fishjam-openapi/openapi.sh +++ b/packages/fishjam-openapi/openapi.sh @@ -22,13 +22,15 @@ else echo "Missing github token as the second argument" 1>&2 exit 1 fi - SPEC=$(mktemp).yaml - trap 'rm -f "$SPEC"' EXIT + SPEC_DIR=$(mktemp -d) + trap 'rm -rf "$SPEC_DIR"' EXIT + SPEC="$SPEC_DIR/openapi.yaml" curl -sfL \ -H "Authorization: token $2" \ -H "Accept: application/vnd.github.v3.raw" \ "https://raw.githubusercontent.com/fishjam-cloud/fishjam/$1/openapi.yaml" \ - -o "$SPEC" + -o "$SPEC" \ + || { echo "Failed to download openapi.yaml for ref '$1'" 1>&2; exit 1; } echo "Generating code for $1...\n" fi