UNPKG

@mikle7/litty-api-client

Version:

TypeScript client for Litty API with clean, semantic type definitions

537 lines (536 loc) 24.9 kB
/* tslint:disable */ /* eslint-disable */ /** * Litty API * Complete API documentation for the Litty platform. ## Authentication Most endpoints require authentication via Supabase JWT tokens. Include the token in the Authorization header: `Bearer <token>` ## API Structure - **Contests**: Create and manage contests, entries, and settlements - **Markets**: Manage prediction markets within contests - **Transactions**: Handle financial transactions for contest entries and rewards - **Wallet**: Manage user wallet balances (cashable, points, tickets) - **Users**: User management and profiles - **Leaderboards**: Competition rankings and scoring - **Uploads**: File upload management - **Shows**: TV show and episode management (admin only) ## Response Formats All endpoints return JSON responses with consistent error handling. Error responses include `statusCode`, `message`, and `error` fields. * * The version of the OpenAPI document: 1.0 * * * 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 { BulkCreateCastMembers201ResponseFromJSON, BulkCreateEpisodes201ResponseFromJSON, BulkCreateSeasons201ResponseFromJSON, CreateShow201ResponseFromJSON, CreateShowWithFullData201ResponseFromJSON, DeleteShow200ResponseFromJSON, GetAllShows200ResponseInnerFromJSON, GetAllShows200ResponseInnerSeasonsInnerCastInnerFromJSON, GetAllShows200ResponseInnerSeasonsInnerEpisodesInnerFromJSON, GetShowById200ResponseFromJSON, GetShowById200ResponseSeasonsInnerFromJSON, } from '../models/index'; /** * */ export class ShowsApi extends runtime.BaseAPI { /** * Add a new cast member to an existing season * Add cast member to season */ async addCastMemberRaw(requestParameters, initOverrides) { if (requestParameters['seasonId'] == null) { throw new runtime.RequiredError('seasonId', 'Required parameter "seasonId" was null or undefined when calling addCastMember().'); } if (requestParameters['body'] == null) { throw new runtime.RequiredError('body', 'Required parameter "body" was null or undefined when calling addCastMember().'); } const queryParameters = {}; const headerParameters = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("JWT-auth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/shows/{showId}/seasons/{seasonId}/cast`.replace(`{${"seasonId"}}`, encodeURIComponent(String(requestParameters['seasonId']))), method: 'POST', headers: headerParameters, query: queryParameters, body: requestParameters['body'], }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => CreateShow201ResponseFromJSON(jsonValue)); } /** * Add a new cast member to an existing season * Add cast member to season */ async addCastMember(requestParameters, initOverrides) { const response = await this.addCastMemberRaw(requestParameters, initOverrides); return await response.value(); } /** * Add a new episode to an existing season * Add episode to season */ async addEpisodeRaw(requestParameters, initOverrides) { if (requestParameters['seasonId'] == null) { throw new runtime.RequiredError('seasonId', 'Required parameter "seasonId" was null or undefined when calling addEpisode().'); } if (requestParameters['body'] == null) { throw new runtime.RequiredError('body', 'Required parameter "body" was null or undefined when calling addEpisode().'); } const queryParameters = {}; const headerParameters = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("JWT-auth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/shows/{showId}/seasons/{seasonId}/episodes`.replace(`{${"seasonId"}}`, encodeURIComponent(String(requestParameters['seasonId']))), method: 'POST', headers: headerParameters, query: queryParameters, body: requestParameters['body'], }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => CreateShow201ResponseFromJSON(jsonValue)); } /** * Add a new episode to an existing season * Add episode to season */ async addEpisode(requestParameters, initOverrides) { const response = await this.addEpisodeRaw(requestParameters, initOverrides); return await response.value(); } /** * Add a new season to an existing show * Add season to show */ async addSeasonRaw(requestParameters, initOverrides) { if (requestParameters['showId'] == null) { throw new runtime.RequiredError('showId', 'Required parameter "showId" was null or undefined when calling addSeason().'); } if (requestParameters['body'] == null) { throw new runtime.RequiredError('body', 'Required parameter "body" was null or undefined when calling addSeason().'); } const queryParameters = {}; const headerParameters = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("JWT-auth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/shows/{showId}/seasons`.replace(`{${"showId"}}`, encodeURIComponent(String(requestParameters['showId']))), method: 'POST', headers: headerParameters, query: queryParameters, body: requestParameters['body'], }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => CreateShow201ResponseFromJSON(jsonValue)); } /** * Add a new season to an existing show * Add season to show */ async addSeason(requestParameters, initOverrides) { const response = await this.addSeasonRaw(requestParameters, initOverrides); return await response.value(); } /** * Create multiple cast members for a season in one operation * Bulk create cast members */ async bulkCreateCastMembersRaw(requestParameters, initOverrides) { if (requestParameters['seasonId'] == null) { throw new runtime.RequiredError('seasonId', 'Required parameter "seasonId" was null or undefined when calling bulkCreateCastMembers().'); } const queryParameters = {}; const headerParameters = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("JWT-auth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/shows/{showId}/seasons/{seasonId}/cast/bulk`.replace(`{${"seasonId"}}`, encodeURIComponent(String(requestParameters['seasonId']))), method: 'POST', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => BulkCreateCastMembers201ResponseFromJSON(jsonValue)); } /** * Create multiple cast members for a season in one operation * Bulk create cast members */ async bulkCreateCastMembers(requestParameters, initOverrides) { const response = await this.bulkCreateCastMembersRaw(requestParameters, initOverrides); return await response.value(); } /** * Create multiple episodes for a season in one operation * Bulk create episodes */ async bulkCreateEpisodesRaw(requestParameters, initOverrides) { if (requestParameters['seasonId'] == null) { throw new runtime.RequiredError('seasonId', 'Required parameter "seasonId" was null or undefined when calling bulkCreateEpisodes().'); } const queryParameters = {}; const headerParameters = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("JWT-auth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/shows/{showId}/seasons/{seasonId}/episodes/bulk`.replace(`{${"seasonId"}}`, encodeURIComponent(String(requestParameters['seasonId']))), method: 'POST', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => BulkCreateEpisodes201ResponseFromJSON(jsonValue)); } /** * Create multiple episodes for a season in one operation * Bulk create episodes */ async bulkCreateEpisodes(requestParameters, initOverrides) { const response = await this.bulkCreateEpisodesRaw(requestParameters, initOverrides); return await response.value(); } /** * Create multiple seasons for a show in one operation * Bulk create seasons */ async bulkCreateSeasonsRaw(requestParameters, initOverrides) { if (requestParameters['showId'] == null) { throw new runtime.RequiredError('showId', 'Required parameter "showId" was null or undefined when calling bulkCreateSeasons().'); } const queryParameters = {}; const headerParameters = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("JWT-auth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/shows/{showId}/seasons/bulk`.replace(`{${"showId"}}`, encodeURIComponent(String(requestParameters['showId']))), method: 'POST', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => BulkCreateSeasons201ResponseFromJSON(jsonValue)); } /** * Create multiple seasons for a show in one operation * Bulk create seasons */ async bulkCreateSeasons(requestParameters, initOverrides) { const response = await this.bulkCreateSeasonsRaw(requestParameters, initOverrides); return await response.value(); } /** * Creates a new TV show in the system * Create a new show */ async createShowRaw(requestParameters, initOverrides) { if (requestParameters['body'] == null) { throw new runtime.RequiredError('body', 'Required parameter "body" was null or undefined when calling createShow().'); } const queryParameters = {}; const headerParameters = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("JWT-auth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/shows`, method: 'POST', headers: headerParameters, query: queryParameters, body: requestParameters['body'], }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => CreateShow201ResponseFromJSON(jsonValue)); } /** * Creates a new TV show in the system * Create a new show */ async createShow(requestParameters, initOverrides) { const response = await this.createShowRaw(requestParameters, initOverrides); return await response.value(); } /** * Create a new show with seasons, episodes, and cast members in one operation * Create show with full data */ async createShowWithFullDataRaw(requestParameters, initOverrides) { if (requestParameters['body'] == null) { throw new runtime.RequiredError('body', 'Required parameter "body" was null or undefined when calling createShowWithFullData().'); } const queryParameters = {}; const headerParameters = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("JWT-auth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/shows/import`, method: 'POST', headers: headerParameters, query: queryParameters, body: requestParameters['body'], }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => CreateShowWithFullData201ResponseFromJSON(jsonValue)); } /** * Create a new show with seasons, episodes, and cast members in one operation * Create show with full data */ async createShowWithFullData(requestParameters, initOverrides) { const response = await this.createShowWithFullDataRaw(requestParameters, initOverrides); return await response.value(); } /** * Delete a show and all its related data * Delete show */ async deleteShowRaw(requestParameters, initOverrides) { if (requestParameters['id'] == null) { throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling deleteShow().'); } const queryParameters = {}; const headerParameters = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("JWT-auth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/shows/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))), method: 'DELETE', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => DeleteShow200ResponseFromJSON(jsonValue)); } /** * Delete a show and all its related data * Delete show */ async deleteShow(requestParameters, initOverrides) { const response = await this.deleteShowRaw(requestParameters, initOverrides); return await response.value(); } /** * Retrieve all cast members for a specific season * Get all cast members for a season */ async getAllCastMembersRaw(requestParameters, initOverrides) { if (requestParameters['seasonId'] == null) { throw new runtime.RequiredError('seasonId', 'Required parameter "seasonId" was null or undefined when calling getAllCastMembers().'); } const queryParameters = {}; const headerParameters = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("JWT-auth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/shows/{showId}/seasons/{seasonId}/cast`.replace(`{${"seasonId"}}`, encodeURIComponent(String(requestParameters['seasonId']))), method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(GetAllShows200ResponseInnerSeasonsInnerCastInnerFromJSON)); } /** * Retrieve all cast members for a specific season * Get all cast members for a season */ async getAllCastMembers(requestParameters, initOverrides) { const response = await this.getAllCastMembersRaw(requestParameters, initOverrides); return await response.value(); } /** * Retrieve all episodes for a specific season * Get all episodes for a season */ async getAllEpisodesRaw(requestParameters, initOverrides) { if (requestParameters['seasonId'] == null) { throw new runtime.RequiredError('seasonId', 'Required parameter "seasonId" was null or undefined when calling getAllEpisodes().'); } const queryParameters = {}; const headerParameters = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("JWT-auth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/shows/{showId}/seasons/{seasonId}/episodes`.replace(`{${"seasonId"}}`, encodeURIComponent(String(requestParameters['seasonId']))), method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(GetAllShows200ResponseInnerSeasonsInnerEpisodesInnerFromJSON)); } /** * Retrieve all episodes for a specific season * Get all episodes for a season */ async getAllEpisodes(requestParameters, initOverrides) { const response = await this.getAllEpisodesRaw(requestParameters, initOverrides); return await response.value(); } /** * Retrieve all seasons for a specific show * Get all seasons for a show */ async getAllSeasonsRaw(requestParameters, initOverrides) { if (requestParameters['showId'] == null) { throw new runtime.RequiredError('showId', 'Required parameter "showId" was null or undefined when calling getAllSeasons().'); } const queryParameters = {}; const headerParameters = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("JWT-auth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/shows/{showId}/seasons`.replace(`{${"showId"}}`, encodeURIComponent(String(requestParameters['showId']))), method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(GetShowById200ResponseSeasonsInnerFromJSON)); } /** * Retrieve all seasons for a specific show * Get all seasons for a show */ async getAllSeasons(requestParameters, initOverrides) { const response = await this.getAllSeasonsRaw(requestParameters, initOverrides); return await response.value(); } /** * Retrieve a list of all shows * Get all shows */ async getAllShowsRaw(initOverrides) { const queryParameters = {}; const headerParameters = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("JWT-auth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/shows`, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(GetAllShows200ResponseInnerFromJSON)); } /** * Retrieve a list of all shows * Get all shows */ async getAllShows(initOverrides) { const response = await this.getAllShowsRaw(initOverrides); return await response.value(); } /** * Retrieve a specific show by its ID with all related data * Get show by ID */ async getShowByIdRaw(requestParameters, initOverrides) { if (requestParameters['id'] == null) { throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling getShowById().'); } const queryParameters = {}; const headerParameters = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("JWT-auth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/shows/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))), method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => GetShowById200ResponseFromJSON(jsonValue)); } /** * Retrieve a specific show by its ID with all related data * Get show by ID */ async getShowById(requestParameters, initOverrides) { const response = await this.getShowByIdRaw(requestParameters, initOverrides); return await response.value(); } /** * Update an existing show\'s information * Update show */ async updateShowRaw(requestParameters, initOverrides) { if (requestParameters['id'] == null) { throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling updateShow().'); } if (requestParameters['body'] == null) { throw new runtime.RequiredError('body', 'Required parameter "body" was null or undefined when calling updateShow().'); } const queryParameters = {}; const headerParameters = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("JWT-auth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/shows/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))), method: 'PATCH', headers: headerParameters, query: queryParameters, body: requestParameters['body'], }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => DeleteShow200ResponseFromJSON(jsonValue)); } /** * Update an existing show\'s information * Update show */ async updateShow(requestParameters, initOverrides) { const response = await this.updateShowRaw(requestParameters, initOverrides); return await response.value(); } }