123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410 |
- /* tslint:disable */
- /* eslint-disable */
- /**
- * Distributor node public API
- * Distributor node public API
- *
- * The version of the OpenAPI document: 0.1.0
- * Contact: info@joystream.org
- *
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
- * https://openapi-generator.tech
- * Do not edit the class manually.
- */
- import { Configuration } from './configuration'
- import globalAxios, { AxiosPromise, AxiosInstance } 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'
- // @ts-ignore
- import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from './base'
- /**
- * @type BucketsResponse
- * @export
- */
- export type BucketsResponse = BucketsResponseOneOf | BucketsResponseOneOf1
- /**
- *
- * @export
- * @interface BucketsResponseOneOf
- */
- export interface BucketsResponseOneOf {
- /**
- *
- * @type {Array<string>}
- * @memberof BucketsResponseOneOf
- */
- bucketIds: Array<string>
- }
- /**
- *
- * @export
- * @interface BucketsResponseOneOf1
- */
- export interface BucketsResponseOneOf1 {
- /**
- *
- * @type {number}
- * @memberof BucketsResponseOneOf1
- */
- allByWorkerId: number
- }
- /**
- *
- * @export
- * @interface ErrorResponse
- */
- export interface ErrorResponse {
- /**
- *
- * @type {string}
- * @memberof ErrorResponse
- */
- type?: string
- /**
- *
- * @type {string}
- * @memberof ErrorResponse
- */
- message: string
- }
- /**
- *
- * @export
- * @interface StatusResponse
- */
- export interface StatusResponse {
- /**
- *
- * @type {string}
- * @memberof StatusResponse
- */
- id: string
- /**
- *
- * @type {number}
- * @memberof StatusResponse
- */
- objectsInCache: number
- /**
- *
- * @type {number}
- * @memberof StatusResponse
- */
- storageLimit: number
- /**
- *
- * @type {number}
- * @memberof StatusResponse
- */
- storageUsed: number
- /**
- *
- * @type {number}
- * @memberof StatusResponse
- */
- uptime: number
- /**
- *
- * @type {number}
- * @memberof StatusResponse
- */
- downloadsInProgress: number
- }
- /**
- * DefaultApi - axios parameter creator
- * @export
- */
- export const DefaultApiAxiosParamCreator = function (configuration?: Configuration) {
- return {
- /**
- * Returns a media file.
- * @param {string} objectId Data Object ID
- * @param {*} [options] Override http request option.
- * @throws {RequiredError}
- */
- publicAsset: async (objectId: string, options: any = {}): Promise<RequestArgs> => {
- // verify required parameter 'objectId' is not null or undefined
- assertParamExists('publicAsset', 'objectId', objectId)
- const localVarPath = `/assets/{objectId}`.replace(`{${'objectId'}}`, encodeURIComponent(String(objectId)))
- // 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
- setSearchParams(localVarUrlObj, localVarQueryParameter, options.query)
- let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}
- localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers }
- return {
- url: toPathString(localVarUrlObj),
- options: localVarRequestOptions,
- }
- },
- /**
- * Returns asset response headers (cache status, content type and/or length, accepted ranges etc.)
- * @param {string} objectId Data Object ID
- * @param {*} [options] Override http request option.
- * @throws {RequiredError}
- */
- publicAssetHead: async (objectId: string, options: any = {}): Promise<RequestArgs> => {
- // verify required parameter 'objectId' is not null or undefined
- assertParamExists('publicAssetHead', 'objectId', objectId)
- const localVarPath = `/assets/{objectId}`.replace(`{${'objectId'}}`, encodeURIComponent(String(objectId)))
- // 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: 'HEAD', ...baseOptions, ...options }
- const localVarHeaderParameter = {} as any
- const localVarQueryParameter = {} as any
- setSearchParams(localVarUrlObj, localVarQueryParameter, options.query)
- let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}
- localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers }
- return {
- url: toPathString(localVarUrlObj),
- options: localVarRequestOptions,
- }
- },
- /**
- * Returns list of distributed buckets
- * @param {*} [options] Override http request option.
- * @throws {RequiredError}
- */
- publicBuckets: async (options: any = {}): Promise<RequestArgs> => {
- const localVarPath = `/buckets`
- // 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
- setSearchParams(localVarUrlObj, localVarQueryParameter, options.query)
- let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}
- localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers }
- return {
- url: toPathString(localVarUrlObj),
- options: localVarRequestOptions,
- }
- },
- /**
- * Returns json object describing current node status.
- * @param {*} [options] Override http request option.
- * @throws {RequiredError}
- */
- publicStatus: async (options: any = {}): Promise<RequestArgs> => {
- const localVarPath = `/status`
- // 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
- setSearchParams(localVarUrlObj, localVarQueryParameter, options.query)
- let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}
- localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers }
- return {
- url: toPathString(localVarUrlObj),
- options: localVarRequestOptions,
- }
- },
- }
- }
- /**
- * DefaultApi - functional programming interface
- * @export
- */
- export const DefaultApiFp = function (configuration?: Configuration) {
- const localVarAxiosParamCreator = DefaultApiAxiosParamCreator(configuration)
- return {
- /**
- * Returns a media file.
- * @param {string} objectId Data Object ID
- * @param {*} [options] Override http request option.
- * @throws {RequiredError}
- */
- async publicAsset(
- objectId: string,
- options?: any
- ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<any>> {
- const localVarAxiosArgs = await localVarAxiosParamCreator.publicAsset(objectId, options)
- return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)
- },
- /**
- * Returns asset response headers (cache status, content type and/or length, accepted ranges etc.)
- * @param {string} objectId Data Object ID
- * @param {*} [options] Override http request option.
- * @throws {RequiredError}
- */
- async publicAssetHead(
- objectId: string,
- options?: any
- ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
- const localVarAxiosArgs = await localVarAxiosParamCreator.publicAssetHead(objectId, options)
- return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)
- },
- /**
- * Returns list of distributed buckets
- * @param {*} [options] Override http request option.
- * @throws {RequiredError}
- */
- async publicBuckets(
- options?: any
- ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<BucketsResponse>> {
- const localVarAxiosArgs = await localVarAxiosParamCreator.publicBuckets(options)
- return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)
- },
- /**
- * Returns json object describing current node status.
- * @param {*} [options] Override http request option.
- * @throws {RequiredError}
- */
- async publicStatus(
- options?: any
- ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<StatusResponse>> {
- const localVarAxiosArgs = await localVarAxiosParamCreator.publicStatus(options)
- return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)
- },
- }
- }
- /**
- * DefaultApi - factory interface
- * @export
- */
- export const DefaultApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
- const localVarFp = DefaultApiFp(configuration)
- return {
- /**
- * Returns a media file.
- * @param {string} objectId Data Object ID
- * @param {*} [options] Override http request option.
- * @throws {RequiredError}
- */
- publicAsset(objectId: string, options?: any): AxiosPromise<any> {
- return localVarFp.publicAsset(objectId, options).then((request) => request(axios, basePath))
- },
- /**
- * Returns asset response headers (cache status, content type and/or length, accepted ranges etc.)
- * @param {string} objectId Data Object ID
- * @param {*} [options] Override http request option.
- * @throws {RequiredError}
- */
- publicAssetHead(objectId: string, options?: any): AxiosPromise<void> {
- return localVarFp.publicAssetHead(objectId, options).then((request) => request(axios, basePath))
- },
- /**
- * Returns list of distributed buckets
- * @param {*} [options] Override http request option.
- * @throws {RequiredError}
- */
- publicBuckets(options?: any): AxiosPromise<BucketsResponse> {
- return localVarFp.publicBuckets(options).then((request) => request(axios, basePath))
- },
- /**
- * Returns json object describing current node status.
- * @param {*} [options] Override http request option.
- * @throws {RequiredError}
- */
- publicStatus(options?: any): AxiosPromise<StatusResponse> {
- return localVarFp.publicStatus(options).then((request) => request(axios, basePath))
- },
- }
- }
- /**
- * DefaultApi - object-oriented interface
- * @export
- * @class DefaultApi
- * @extends {BaseAPI}
- */
- export class DefaultApi extends BaseAPI {
- /**
- * Returns a media file.
- * @param {string} objectId Data Object ID
- * @param {*} [options] Override http request option.
- * @throws {RequiredError}
- * @memberof DefaultApi
- */
- public publicAsset(objectId: string, options?: any) {
- return DefaultApiFp(this.configuration)
- .publicAsset(objectId, options)
- .then((request) => request(this.axios, this.basePath))
- }
- /**
- * Returns asset response headers (cache status, content type and/or length, accepted ranges etc.)
- * @param {string} objectId Data Object ID
- * @param {*} [options] Override http request option.
- * @throws {RequiredError}
- * @memberof DefaultApi
- */
- public publicAssetHead(objectId: string, options?: any) {
- return DefaultApiFp(this.configuration)
- .publicAssetHead(objectId, options)
- .then((request) => request(this.axios, this.basePath))
- }
- /**
- * Returns list of distributed buckets
- * @param {*} [options] Override http request option.
- * @throws {RequiredError}
- * @memberof DefaultApi
- */
- public publicBuckets(options?: any) {
- return DefaultApiFp(this.configuration)
- .publicBuckets(options)
- .then((request) => request(this.axios, this.basePath))
- }
- /**
- * Returns json object describing current node status.
- * @param {*} [options] Override http request option.
- * @throws {RequiredError}
- * @memberof DefaultApi
- */
- public publicStatus(options?: any) {
- return DefaultApiFp(this.configuration)
- .publicStatus(options)
- .then((request) => request(this.axios, this.basePath))
- }
- }
|