api.ts 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410
  1. /* tslint:disable */
  2. /* eslint-disable */
  3. /**
  4. * Distributor node public API
  5. * Distributor node public API
  6. *
  7. * The version of the OpenAPI document: 0.1.0
  8. * Contact: info@joystream.org
  9. *
  10. * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
  11. * https://openapi-generator.tech
  12. * Do not edit the class manually.
  13. */
  14. import { Configuration } from './configuration'
  15. import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'
  16. // Some imports not used depending on template conditions
  17. // @ts-ignore
  18. import {
  19. DUMMY_BASE_URL,
  20. assertParamExists,
  21. setApiKeyToObject,
  22. setBasicAuthToObject,
  23. setBearerAuthToObject,
  24. setOAuthToObject,
  25. setSearchParams,
  26. serializeDataIfNeeded,
  27. toPathString,
  28. createRequestFunction,
  29. } from './common'
  30. // @ts-ignore
  31. import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from './base'
  32. /**
  33. * @type BucketsResponse
  34. * @export
  35. */
  36. export type BucketsResponse = BucketsResponseOneOf | BucketsResponseOneOf1
  37. /**
  38. *
  39. * @export
  40. * @interface BucketsResponseOneOf
  41. */
  42. export interface BucketsResponseOneOf {
  43. /**
  44. *
  45. * @type {Array<string>}
  46. * @memberof BucketsResponseOneOf
  47. */
  48. bucketIds: Array<string>
  49. }
  50. /**
  51. *
  52. * @export
  53. * @interface BucketsResponseOneOf1
  54. */
  55. export interface BucketsResponseOneOf1 {
  56. /**
  57. *
  58. * @type {number}
  59. * @memberof BucketsResponseOneOf1
  60. */
  61. allByWorkerId: number
  62. }
  63. /**
  64. *
  65. * @export
  66. * @interface ErrorResponse
  67. */
  68. export interface ErrorResponse {
  69. /**
  70. *
  71. * @type {string}
  72. * @memberof ErrorResponse
  73. */
  74. type?: string
  75. /**
  76. *
  77. * @type {string}
  78. * @memberof ErrorResponse
  79. */
  80. message: string
  81. }
  82. /**
  83. *
  84. * @export
  85. * @interface StatusResponse
  86. */
  87. export interface StatusResponse {
  88. /**
  89. *
  90. * @type {string}
  91. * @memberof StatusResponse
  92. */
  93. id: string
  94. /**
  95. *
  96. * @type {number}
  97. * @memberof StatusResponse
  98. */
  99. objectsInCache: number
  100. /**
  101. *
  102. * @type {number}
  103. * @memberof StatusResponse
  104. */
  105. storageLimit: number
  106. /**
  107. *
  108. * @type {number}
  109. * @memberof StatusResponse
  110. */
  111. storageUsed: number
  112. /**
  113. *
  114. * @type {number}
  115. * @memberof StatusResponse
  116. */
  117. uptime: number
  118. /**
  119. *
  120. * @type {number}
  121. * @memberof StatusResponse
  122. */
  123. downloadsInProgress: number
  124. }
  125. /**
  126. * DefaultApi - axios parameter creator
  127. * @export
  128. */
  129. export const DefaultApiAxiosParamCreator = function (configuration?: Configuration) {
  130. return {
  131. /**
  132. * Returns a media file.
  133. * @param {string} objectId Data Object ID
  134. * @param {*} [options] Override http request option.
  135. * @throws {RequiredError}
  136. */
  137. publicAsset: async (objectId: string, options: any = {}): Promise<RequestArgs> => {
  138. // verify required parameter 'objectId' is not null or undefined
  139. assertParamExists('publicAsset', 'objectId', objectId)
  140. const localVarPath = `/assets/{objectId}`.replace(`{${'objectId'}}`, encodeURIComponent(String(objectId)))
  141. // use dummy base URL string because the URL constructor only accepts absolute URLs.
  142. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL)
  143. let baseOptions
  144. if (configuration) {
  145. baseOptions = configuration.baseOptions
  146. }
  147. const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }
  148. const localVarHeaderParameter = {} as any
  149. const localVarQueryParameter = {} as any
  150. setSearchParams(localVarUrlObj, localVarQueryParameter, options.query)
  151. let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}
  152. localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers }
  153. return {
  154. url: toPathString(localVarUrlObj),
  155. options: localVarRequestOptions,
  156. }
  157. },
  158. /**
  159. * Returns asset response headers (cache status, content type and/or length, accepted ranges etc.)
  160. * @param {string} objectId Data Object ID
  161. * @param {*} [options] Override http request option.
  162. * @throws {RequiredError}
  163. */
  164. publicAssetHead: async (objectId: string, options: any = {}): Promise<RequestArgs> => {
  165. // verify required parameter 'objectId' is not null or undefined
  166. assertParamExists('publicAssetHead', 'objectId', objectId)
  167. const localVarPath = `/assets/{objectId}`.replace(`{${'objectId'}}`, encodeURIComponent(String(objectId)))
  168. // use dummy base URL string because the URL constructor only accepts absolute URLs.
  169. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL)
  170. let baseOptions
  171. if (configuration) {
  172. baseOptions = configuration.baseOptions
  173. }
  174. const localVarRequestOptions = { method: 'HEAD', ...baseOptions, ...options }
  175. const localVarHeaderParameter = {} as any
  176. const localVarQueryParameter = {} as any
  177. setSearchParams(localVarUrlObj, localVarQueryParameter, options.query)
  178. let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}
  179. localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers }
  180. return {
  181. url: toPathString(localVarUrlObj),
  182. options: localVarRequestOptions,
  183. }
  184. },
  185. /**
  186. * Returns list of distributed buckets
  187. * @param {*} [options] Override http request option.
  188. * @throws {RequiredError}
  189. */
  190. publicBuckets: async (options: any = {}): Promise<RequestArgs> => {
  191. const localVarPath = `/buckets`
  192. // use dummy base URL string because the URL constructor only accepts absolute URLs.
  193. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL)
  194. let baseOptions
  195. if (configuration) {
  196. baseOptions = configuration.baseOptions
  197. }
  198. const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }
  199. const localVarHeaderParameter = {} as any
  200. const localVarQueryParameter = {} as any
  201. setSearchParams(localVarUrlObj, localVarQueryParameter, options.query)
  202. let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}
  203. localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers }
  204. return {
  205. url: toPathString(localVarUrlObj),
  206. options: localVarRequestOptions,
  207. }
  208. },
  209. /**
  210. * Returns json object describing current node status.
  211. * @param {*} [options] Override http request option.
  212. * @throws {RequiredError}
  213. */
  214. publicStatus: async (options: any = {}): Promise<RequestArgs> => {
  215. const localVarPath = `/status`
  216. // use dummy base URL string because the URL constructor only accepts absolute URLs.
  217. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL)
  218. let baseOptions
  219. if (configuration) {
  220. baseOptions = configuration.baseOptions
  221. }
  222. const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }
  223. const localVarHeaderParameter = {} as any
  224. const localVarQueryParameter = {} as any
  225. setSearchParams(localVarUrlObj, localVarQueryParameter, options.query)
  226. let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}
  227. localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers }
  228. return {
  229. url: toPathString(localVarUrlObj),
  230. options: localVarRequestOptions,
  231. }
  232. },
  233. }
  234. }
  235. /**
  236. * DefaultApi - functional programming interface
  237. * @export
  238. */
  239. export const DefaultApiFp = function (configuration?: Configuration) {
  240. const localVarAxiosParamCreator = DefaultApiAxiosParamCreator(configuration)
  241. return {
  242. /**
  243. * Returns a media file.
  244. * @param {string} objectId Data Object ID
  245. * @param {*} [options] Override http request option.
  246. * @throws {RequiredError}
  247. */
  248. async publicAsset(
  249. objectId: string,
  250. options?: any
  251. ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<any>> {
  252. const localVarAxiosArgs = await localVarAxiosParamCreator.publicAsset(objectId, options)
  253. return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)
  254. },
  255. /**
  256. * Returns asset response headers (cache status, content type and/or length, accepted ranges etc.)
  257. * @param {string} objectId Data Object ID
  258. * @param {*} [options] Override http request option.
  259. * @throws {RequiredError}
  260. */
  261. async publicAssetHead(
  262. objectId: string,
  263. options?: any
  264. ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
  265. const localVarAxiosArgs = await localVarAxiosParamCreator.publicAssetHead(objectId, options)
  266. return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)
  267. },
  268. /**
  269. * Returns list of distributed buckets
  270. * @param {*} [options] Override http request option.
  271. * @throws {RequiredError}
  272. */
  273. async publicBuckets(
  274. options?: any
  275. ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<BucketsResponse>> {
  276. const localVarAxiosArgs = await localVarAxiosParamCreator.publicBuckets(options)
  277. return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)
  278. },
  279. /**
  280. * Returns json object describing current node status.
  281. * @param {*} [options] Override http request option.
  282. * @throws {RequiredError}
  283. */
  284. async publicStatus(
  285. options?: any
  286. ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<StatusResponse>> {
  287. const localVarAxiosArgs = await localVarAxiosParamCreator.publicStatus(options)
  288. return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)
  289. },
  290. }
  291. }
  292. /**
  293. * DefaultApi - factory interface
  294. * @export
  295. */
  296. export const DefaultApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
  297. const localVarFp = DefaultApiFp(configuration)
  298. return {
  299. /**
  300. * Returns a media file.
  301. * @param {string} objectId Data Object ID
  302. * @param {*} [options] Override http request option.
  303. * @throws {RequiredError}
  304. */
  305. publicAsset(objectId: string, options?: any): AxiosPromise<any> {
  306. return localVarFp.publicAsset(objectId, options).then((request) => request(axios, basePath))
  307. },
  308. /**
  309. * Returns asset response headers (cache status, content type and/or length, accepted ranges etc.)
  310. * @param {string} objectId Data Object ID
  311. * @param {*} [options] Override http request option.
  312. * @throws {RequiredError}
  313. */
  314. publicAssetHead(objectId: string, options?: any): AxiosPromise<void> {
  315. return localVarFp.publicAssetHead(objectId, options).then((request) => request(axios, basePath))
  316. },
  317. /**
  318. * Returns list of distributed buckets
  319. * @param {*} [options] Override http request option.
  320. * @throws {RequiredError}
  321. */
  322. publicBuckets(options?: any): AxiosPromise<BucketsResponse> {
  323. return localVarFp.publicBuckets(options).then((request) => request(axios, basePath))
  324. },
  325. /**
  326. * Returns json object describing current node status.
  327. * @param {*} [options] Override http request option.
  328. * @throws {RequiredError}
  329. */
  330. publicStatus(options?: any): AxiosPromise<StatusResponse> {
  331. return localVarFp.publicStatus(options).then((request) => request(axios, basePath))
  332. },
  333. }
  334. }
  335. /**
  336. * DefaultApi - object-oriented interface
  337. * @export
  338. * @class DefaultApi
  339. * @extends {BaseAPI}
  340. */
  341. export class DefaultApi extends BaseAPI {
  342. /**
  343. * Returns a media file.
  344. * @param {string} objectId Data Object ID
  345. * @param {*} [options] Override http request option.
  346. * @throws {RequiredError}
  347. * @memberof DefaultApi
  348. */
  349. public publicAsset(objectId: string, options?: any) {
  350. return DefaultApiFp(this.configuration)
  351. .publicAsset(objectId, options)
  352. .then((request) => request(this.axios, this.basePath))
  353. }
  354. /**
  355. * Returns asset response headers (cache status, content type and/or length, accepted ranges etc.)
  356. * @param {string} objectId Data Object ID
  357. * @param {*} [options] Override http request option.
  358. * @throws {RequiredError}
  359. * @memberof DefaultApi
  360. */
  361. public publicAssetHead(objectId: string, options?: any) {
  362. return DefaultApiFp(this.configuration)
  363. .publicAssetHead(objectId, options)
  364. .then((request) => request(this.axios, this.basePath))
  365. }
  366. /**
  367. * Returns list of distributed buckets
  368. * @param {*} [options] Override http request option.
  369. * @throws {RequiredError}
  370. * @memberof DefaultApi
  371. */
  372. public publicBuckets(options?: any) {
  373. return DefaultApiFp(this.configuration)
  374. .publicBuckets(options)
  375. .then((request) => request(this.axios, this.basePath))
  376. }
  377. /**
  378. * Returns json object describing current node status.
  379. * @param {*} [options] Override http request option.
  380. * @throws {RequiredError}
  381. * @memberof DefaultApi
  382. */
  383. public publicStatus(options?: any) {
  384. return DefaultApiFp(this.configuration)
  385. .publicStatus(options)
  386. .then((request) => request(this.axios, this.basePath))
  387. }
  388. }