@hirosystems/token-metadata-api-client 1.3.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/api.ts DELETED
@@ -1,1079 +0,0 @@
1
- /// <reference path="./custom.d.ts" />
2
- // tslint:disable
3
- /**
4
- * Token Metadata API
5
- * Welcome to the API reference overview for the [Token Metadata API](https://docs.hiro.so/token-metadata-api). Service that indexes metadata for every SIP-009, SIP-010, and SIP-013 Token in the Stacks blockchain and exposes it via REST API endpoints.
6
- *
7
- * OpenAPI spec version: v0.4.0
8
- *
9
- *
10
- * NOTE: This file is auto generated by the swagger code generator program.
11
- * https://github.com/swagger-api/swagger-codegen.git
12
- * Do not edit the file manually.
13
- */
14
-
15
- import * as url from "url";
16
- import * as isomorphicFetch from "isomorphic-fetch";
17
- import { Configuration } from "./configuration";
18
-
19
- const BASE_PATH = "https://api.hiro.so/".replace(/\/+$/, "");
20
-
21
- /**
22
- *
23
- * @export
24
- */
25
- export const COLLECTION_FORMATS = {
26
- csv: ",",
27
- ssv: " ",
28
- tsv: "\t",
29
- pipes: "|",
30
- };
31
-
32
- /**
33
- *
34
- * @export
35
- * @interface FetchAPI
36
- */
37
- export interface FetchAPI {
38
- (url: string, init?: any): Promise<Response>;
39
- }
40
-
41
- /**
42
- *
43
- * @export
44
- * @interface FetchArgs
45
- */
46
- export interface FetchArgs {
47
- url: string;
48
- options: any;
49
- }
50
-
51
- /**
52
- *
53
- * @export
54
- * @class BaseAPI
55
- */
56
- export class BaseAPI {
57
- protected configuration: Configuration;
58
-
59
- constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected fetch: FetchAPI = isomorphicFetch) {
60
- if (configuration) {
61
- this.configuration = configuration;
62
- this.basePath = configuration.basePath || this.basePath;
63
- }
64
- }
65
- };
66
-
67
- /**
68
- *
69
- * @export
70
- * @class RequiredError
71
- * @extends {Error}
72
- */
73
- export class RequiredError extends Error {
74
- name = "RequiredError"
75
- constructor(public field: string, msg?: string) {
76
- super(msg);
77
- }
78
- }
79
-
80
- /**
81
- *
82
- * @export
83
- * @interface ApiJobCount
84
- */
85
- export interface ApiJobCount {
86
- /**
87
- *
88
- * @type {number}
89
- * @memberof ApiJobCount
90
- */
91
- pending?: number;
92
- /**
93
- *
94
- * @type {number}
95
- * @memberof ApiJobCount
96
- */
97
- queued?: number;
98
- /**
99
- *
100
- * @type {number}
101
- * @memberof ApiJobCount
102
- */
103
- done?: number;
104
- /**
105
- *
106
- * @type {number}
107
- * @memberof ApiJobCount
108
- */
109
- failed?: number;
110
- }
111
- /**
112
- *
113
- * @export
114
- * @interface ApiStatusResponse
115
- */
116
- export interface ApiStatusResponse {
117
- /**
118
- *
119
- * @type {string}
120
- * @memberof ApiStatusResponse
121
- */
122
- server_version: string;
123
- /**
124
- *
125
- * @type {string}
126
- * @memberof ApiStatusResponse
127
- */
128
- status: string;
129
- /**
130
- *
131
- * @type {ApiTokenCount}
132
- * @memberof ApiStatusResponse
133
- */
134
- tokens?: ApiTokenCount;
135
- /**
136
- *
137
- * @type {ApiTokenContractCount}
138
- * @memberof ApiStatusResponse
139
- */
140
- token_contracts?: ApiTokenContractCount;
141
- /**
142
- *
143
- * @type {ApiJobCount}
144
- * @memberof ApiStatusResponse
145
- */
146
- job_queue?: ApiJobCount;
147
- }
148
- /**
149
- *
150
- * @export
151
- * @interface ApiTokenContractCount
152
- */
153
- export interface ApiTokenContractCount {
154
- /**
155
- *
156
- * @type {number}
157
- * @memberof ApiTokenContractCount
158
- */
159
- sip_009?: number;
160
- /**
161
- *
162
- * @type {number}
163
- * @memberof ApiTokenContractCount
164
- */
165
- sip_010?: number;
166
- /**
167
- *
168
- * @type {number}
169
- * @memberof ApiTokenContractCount
170
- */
171
- sip_013?: number;
172
- }
173
- /**
174
- *
175
- * @export
176
- * @interface ApiTokenCount
177
- */
178
- export interface ApiTokenCount {
179
- /**
180
- *
181
- * @type {number}
182
- * @memberof ApiTokenCount
183
- */
184
- ft?: number;
185
- /**
186
- *
187
- * @type {number}
188
- * @memberof ApiTokenCount
189
- */
190
- nft?: number;
191
- /**
192
- *
193
- * @type {number}
194
- * @memberof ApiTokenCount
195
- */
196
- sft?: number;
197
- }
198
- /**
199
- *
200
- * @export
201
- * @interface ErrorResponse
202
- */
203
- export interface ErrorResponse {
204
- }
205
- /**
206
- *
207
- * @export
208
- * @interface FtBasicMetadataResponse
209
- */
210
- export interface FtBasicMetadataResponse {
211
- /**
212
- *
213
- * @type {string}
214
- * @memberof FtBasicMetadataResponse
215
- */
216
- name?: string;
217
- /**
218
- *
219
- * @type {string}
220
- * @memberof FtBasicMetadataResponse
221
- */
222
- symbol?: string;
223
- /**
224
- *
225
- * @type {number}
226
- * @memberof FtBasicMetadataResponse
227
- */
228
- decimals?: number;
229
- /**
230
- *
231
- * @type {string}
232
- * @memberof FtBasicMetadataResponse
233
- */
234
- total_supply?: string;
235
- /**
236
- *
237
- * @type {string}
238
- * @memberof FtBasicMetadataResponse
239
- */
240
- token_uri?: string;
241
- /**
242
- *
243
- * @type {string}
244
- * @memberof FtBasicMetadataResponse
245
- */
246
- description?: string;
247
- /**
248
- *
249
- * @type {string}
250
- * @memberof FtBasicMetadataResponse
251
- */
252
- image_uri?: string;
253
- /**
254
- *
255
- * @type {string}
256
- * @memberof FtBasicMetadataResponse
257
- */
258
- image_thumbnail_uri?: string;
259
- /**
260
- *
261
- * @type {string}
262
- * @memberof FtBasicMetadataResponse
263
- */
264
- image_canonical_uri?: string;
265
- /**
266
- *
267
- * @type {string}
268
- * @memberof FtBasicMetadataResponse
269
- */
270
- tx_id: string;
271
- /**
272
- *
273
- * @type {string}
274
- * @memberof FtBasicMetadataResponse
275
- */
276
- sender_address: string;
277
- /**
278
- *
279
- * @type {string}
280
- * @memberof FtBasicMetadataResponse
281
- */
282
- contract_principal: string;
283
- }
284
- /**
285
- *
286
- * @export
287
- * @interface FtMetadataResponse
288
- */
289
- export interface FtMetadataResponse {
290
- /**
291
- *
292
- * @type {string}
293
- * @memberof FtMetadataResponse
294
- */
295
- name?: string;
296
- /**
297
- *
298
- * @type {string}
299
- * @memberof FtMetadataResponse
300
- */
301
- symbol?: string;
302
- /**
303
- *
304
- * @type {number}
305
- * @memberof FtMetadataResponse
306
- */
307
- decimals?: number;
308
- /**
309
- *
310
- * @type {string}
311
- * @memberof FtMetadataResponse
312
- */
313
- total_supply?: string;
314
- /**
315
- *
316
- * @type {string}
317
- * @memberof FtMetadataResponse
318
- */
319
- token_uri?: string;
320
- /**
321
- *
322
- * @type {string}
323
- * @memberof FtMetadataResponse
324
- */
325
- description?: string;
326
- /**
327
- *
328
- * @type {string}
329
- * @memberof FtMetadataResponse
330
- */
331
- image_uri?: string;
332
- /**
333
- *
334
- * @type {string}
335
- * @memberof FtMetadataResponse
336
- */
337
- image_thumbnail_uri?: string;
338
- /**
339
- *
340
- * @type {string}
341
- * @memberof FtMetadataResponse
342
- */
343
- image_canonical_uri?: string;
344
- /**
345
- *
346
- * @type {string}
347
- * @memberof FtMetadataResponse
348
- */
349
- tx_id: string;
350
- /**
351
- *
352
- * @type {string}
353
- * @memberof FtMetadataResponse
354
- */
355
- sender_address: string;
356
- /**
357
- *
358
- * @type {Metadata}
359
- * @memberof FtMetadataResponse
360
- */
361
- metadata?: Metadata;
362
- }
363
- /**
364
- *
365
- * @export
366
- * @interface Metadata
367
- */
368
- export interface Metadata {
369
- /**
370
- *
371
- * @type {number}
372
- * @memberof Metadata
373
- */
374
- sip: number;
375
- /**
376
- *
377
- * @type {string}
378
- * @memberof Metadata
379
- */
380
- name?: string;
381
- /**
382
- *
383
- * @type {string}
384
- * @memberof Metadata
385
- */
386
- description?: string;
387
- /**
388
- *
389
- * @type {string}
390
- * @memberof Metadata
391
- */
392
- image?: string;
393
- /**
394
- *
395
- * @type {string}
396
- * @memberof Metadata
397
- */
398
- cached_image?: string;
399
- /**
400
- *
401
- * @type {string}
402
- * @memberof Metadata
403
- */
404
- cached_thumbnail_image?: string;
405
- /**
406
- *
407
- * @type {Array<MetadataAttribute>}
408
- * @memberof Metadata
409
- */
410
- attributes?: Array<MetadataAttribute>;
411
- /**
412
- *
413
- * @type {{ [key: string]: any; }}
414
- * @memberof Metadata
415
- */
416
- properties?: { [key: string]: any; };
417
- /**
418
- *
419
- * @type {MetadataLocalization}
420
- * @memberof Metadata
421
- */
422
- localization?: MetadataLocalization;
423
- }
424
- /**
425
- *
426
- * @export
427
- * @interface MetadataAttribute
428
- */
429
- export interface MetadataAttribute {
430
- /**
431
- *
432
- * @type {string}
433
- * @memberof MetadataAttribute
434
- */
435
- trait_type: string;
436
- /**
437
- *
438
- * @type {string}
439
- * @memberof MetadataAttribute
440
- */
441
- display_type?: string;
442
- /**
443
- *
444
- * @type {any}
445
- * @memberof MetadataAttribute
446
- */
447
- value: any;
448
- }
449
- /**
450
- *
451
- * @export
452
- * @interface MetadataLocalization
453
- */
454
- export interface MetadataLocalization {
455
- /**
456
- *
457
- * @type {string}
458
- * @memberof MetadataLocalization
459
- */
460
- uri: string;
461
- /**
462
- *
463
- * @type {string}
464
- * @memberof MetadataLocalization
465
- */
466
- _default: string;
467
- /**
468
- *
469
- * @type {Array<string>}
470
- * @memberof MetadataLocalization
471
- */
472
- locales: Array<string>;
473
- }
474
- /**
475
- *
476
- * @export
477
- * @interface NftMetadataResponse
478
- */
479
- export interface NftMetadataResponse {
480
- /**
481
- *
482
- * @type {string}
483
- * @memberof NftMetadataResponse
484
- */
485
- token_uri?: string;
486
- /**
487
- *
488
- * @type {Metadata}
489
- * @memberof NftMetadataResponse
490
- */
491
- metadata?: Metadata;
492
- }
493
- /**
494
- *
495
- * @export
496
- * @interface NotFoundErrorResponse
497
- */
498
- export interface NotFoundErrorResponse {
499
- }
500
- /**
501
- *
502
- * @export
503
- * @interface Order
504
- */
505
- export enum Order {
506
- asc = 'asc',
507
- desc = 'desc',
508
- }
509
- /**
510
- *
511
- * @export
512
- * @interface OrderBy
513
- */
514
- export enum OrderBy {
515
- name = 'name',
516
- symbol = 'symbol',
517
- }
518
- /**
519
- *
520
- * @export
521
- * @interface PaginatedFtBasicMetadataResponse
522
- */
523
- export interface PaginatedFtBasicMetadataResponse {
524
- /**
525
- *
526
- * @type {number}
527
- * @memberof PaginatedFtBasicMetadataResponse
528
- */
529
- limit: number;
530
- /**
531
- *
532
- * @type {number}
533
- * @memberof PaginatedFtBasicMetadataResponse
534
- */
535
- offset: number;
536
- /**
537
- *
538
- * @type {number}
539
- * @memberof PaginatedFtBasicMetadataResponse
540
- */
541
- total: number;
542
- /**
543
- *
544
- * @type {Array<FtBasicMetadataResponse>}
545
- * @memberof PaginatedFtBasicMetadataResponse
546
- */
547
- results: Array<FtBasicMetadataResponse>;
548
- }
549
- /**
550
- *
551
- * @export
552
- * @interface SftMetadataResponse
553
- */
554
- export interface SftMetadataResponse {
555
- /**
556
- *
557
- * @type {string}
558
- * @memberof SftMetadataResponse
559
- */
560
- token_uri?: string;
561
- /**
562
- *
563
- * @type {number}
564
- * @memberof SftMetadataResponse
565
- */
566
- decimals?: number;
567
- /**
568
- *
569
- * @type {string}
570
- * @memberof SftMetadataResponse
571
- */
572
- total_supply?: string;
573
- /**
574
- *
575
- * @type {Metadata}
576
- * @memberof SftMetadataResponse
577
- */
578
- metadata?: Metadata;
579
- }
580
- /**
581
- * StatusApi - fetch parameter creator
582
- * @export
583
- */
584
- export const StatusApiFetchParamCreator = function (configuration?: Configuration) {
585
- return {
586
- /**
587
- * Displays the status of the API and its current workload
588
- * @summary API Status
589
- * @param {*} [options] Override http request option.
590
- * @throws {RequiredError}
591
- */
592
- getApiStatus(options: any = {}): FetchArgs {
593
- const localVarPath = `/metadata/v1/`;
594
- const localVarUrlObj = url.parse(localVarPath, true);
595
- const localVarRequestOptions = Object.assign({ method: 'GET' }, options);
596
- const localVarHeaderParameter = {} as any;
597
- const localVarQueryParameter = {} as any;
598
-
599
- localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query);
600
- // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
601
- delete localVarUrlObj.search;
602
- localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers);
603
-
604
- return {
605
- url: url.format(localVarUrlObj),
606
- options: localVarRequestOptions,
607
- };
608
- },
609
- }
610
- };
611
-
612
- /**
613
- * StatusApi - functional programming interface
614
- * @export
615
- */
616
- export const StatusApiFp = function(configuration?: Configuration) {
617
- return {
618
- /**
619
- * Displays the status of the API and its current workload
620
- * @summary API Status
621
- * @param {*} [options] Override http request option.
622
- * @throws {RequiredError}
623
- */
624
- getApiStatus(options?: any): (fetch?: FetchAPI, basePath?: string) => Promise<ApiStatusResponse> {
625
- const localVarFetchArgs = StatusApiFetchParamCreator(configuration).getApiStatus(options);
626
- return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => {
627
- return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => {
628
- if (response.status >= 200 && response.status < 300) {
629
- return response.json();
630
- } else {
631
- throw response;
632
- }
633
- });
634
- };
635
- },
636
- }
637
- };
638
-
639
- /**
640
- * StatusApi - factory interface
641
- * @export
642
- */
643
- export const StatusApiFactory = function (configuration?: Configuration, fetch?: FetchAPI, basePath?: string) {
644
- return {
645
- /**
646
- * Displays the status of the API and its current workload
647
- * @summary API Status
648
- * @param {*} [options] Override http request option.
649
- * @throws {RequiredError}
650
- */
651
- getApiStatus(options?: any) {
652
- return StatusApiFp(configuration).getApiStatus(options)(fetch, basePath);
653
- },
654
- };
655
- };
656
-
657
- /**
658
- * StatusApi - object-oriented interface
659
- * @export
660
- * @class StatusApi
661
- * @extends {BaseAPI}
662
- */
663
- export class StatusApi extends BaseAPI {
664
- /**
665
- * Displays the status of the API and its current workload
666
- * @summary API Status
667
- * @param {*} [options] Override http request option.
668
- * @throws {RequiredError}
669
- * @memberof StatusApi
670
- */
671
- public getApiStatus(options?: any) {
672
- return StatusApiFp(this.configuration).getApiStatus(options)(this.fetch, this.basePath);
673
- }
674
-
675
- }
676
- /**
677
- * TokensApi - fetch parameter creator
678
- * @export
679
- */
680
- export const TokensApiFetchParamCreator = function (configuration?: Configuration) {
681
- return {
682
- /**
683
- * Retrieves metadata for a SIP-010 Fungible Token
684
- * @summary Fungible Token Metadata
685
- * @param {string} principal Principal for the contract which owns the SIP-010 token
686
- * @param {string} [locale] Metadata localization to retrieve
687
- * @param {*} [options] Override http request option.
688
- * @throws {RequiredError}
689
- */
690
- getFtMetadata(principal: string, locale?: string, options: any = {}): FetchArgs {
691
- // verify required parameter 'principal' is not null or undefined
692
- if (principal === null || principal === undefined) {
693
- throw new RequiredError('principal','Required parameter principal was null or undefined when calling getFtMetadata.');
694
- }
695
- const localVarPath = `/metadata/v1/ft/{principal}`
696
- .replace(`{${"principal"}}`, encodeURIComponent(String(principal)));
697
- const localVarUrlObj = url.parse(localVarPath, true);
698
- const localVarRequestOptions = Object.assign({ method: 'GET' }, options);
699
- const localVarHeaderParameter = {} as any;
700
- const localVarQueryParameter = {} as any;
701
-
702
- if (locale !== undefined) {
703
- localVarQueryParameter['locale'] = locale;
704
- }
705
-
706
- localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query);
707
- // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
708
- delete localVarUrlObj.search;
709
- localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers);
710
-
711
- return {
712
- url: url.format(localVarUrlObj),
713
- options: localVarRequestOptions,
714
- };
715
- },
716
- /**
717
- * Retrieves a list of Fungible Tokens
718
- * @summary Fungible Tokens
719
- * @param {string} [name]
720
- * @param {string} [symbol]
721
- * @param {string} [address] Stacks Address
722
- * @param {number} [offset] Result offset
723
- * @param {number} [limit] Results per page
724
- * @param {OrderBy} [order_by] Parameter to order results by
725
- * @param {Order} [order] Results order
726
- * @param {*} [options] Override http request option.
727
- * @throws {RequiredError}
728
- */
729
- getFungibleTokens(name?: string, symbol?: string, address?: string, offset?: number, limit?: number, order_by?: OrderBy, order?: Order, options: any = {}): FetchArgs {
730
- const localVarPath = `/metadata/v1/ft`;
731
- const localVarUrlObj = url.parse(localVarPath, true);
732
- const localVarRequestOptions = Object.assign({ method: 'GET' }, options);
733
- const localVarHeaderParameter = {} as any;
734
- const localVarQueryParameter = {} as any;
735
-
736
- if (name !== undefined) {
737
- localVarQueryParameter['name'] = name;
738
- }
739
-
740
- if (symbol !== undefined) {
741
- localVarQueryParameter['symbol'] = symbol;
742
- }
743
-
744
- if (address !== undefined) {
745
- localVarQueryParameter['address'] = address;
746
- }
747
-
748
- if (offset !== undefined) {
749
- localVarQueryParameter['offset'] = offset;
750
- }
751
-
752
- if (limit !== undefined) {
753
- localVarQueryParameter['limit'] = limit;
754
- }
755
-
756
- if (order_by !== undefined) {
757
- localVarQueryParameter['order_by'] = order_by;
758
- }
759
-
760
- if (order !== undefined) {
761
- localVarQueryParameter['order'] = order;
762
- }
763
-
764
- localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query);
765
- // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
766
- delete localVarUrlObj.search;
767
- localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers);
768
-
769
- return {
770
- url: url.format(localVarUrlObj),
771
- options: localVarRequestOptions,
772
- };
773
- },
774
- /**
775
- * Retrieves metadata for a SIP-009 Non-Fungible Token
776
- * @summary Non-Fungible Token Metadata
777
- * @param {string} principal SIP-009 compliant smart contract principal
778
- * @param {number} token_id Token ID to retrieve
779
- * @param {string} [locale] Metadata localization to retrieve
780
- * @param {*} [options] Override http request option.
781
- * @throws {RequiredError}
782
- */
783
- getNftMetadata(principal: string, token_id: number, locale?: string, options: any = {}): FetchArgs {
784
- // verify required parameter 'principal' is not null or undefined
785
- if (principal === null || principal === undefined) {
786
- throw new RequiredError('principal','Required parameter principal was null or undefined when calling getNftMetadata.');
787
- }
788
- // verify required parameter 'token_id' is not null or undefined
789
- if (token_id === null || token_id === undefined) {
790
- throw new RequiredError('token_id','Required parameter token_id was null or undefined when calling getNftMetadata.');
791
- }
792
- const localVarPath = `/metadata/v1/nft/{principal}/{token_id}`
793
- .replace(`{${"principal"}}`, encodeURIComponent(String(principal)))
794
- .replace(`{${"token_id"}}`, encodeURIComponent(String(token_id)));
795
- const localVarUrlObj = url.parse(localVarPath, true);
796
- const localVarRequestOptions = Object.assign({ method: 'GET' }, options);
797
- const localVarHeaderParameter = {} as any;
798
- const localVarQueryParameter = {} as any;
799
-
800
- if (locale !== undefined) {
801
- localVarQueryParameter['locale'] = locale;
802
- }
803
-
804
- localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query);
805
- // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
806
- delete localVarUrlObj.search;
807
- localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers);
808
-
809
- return {
810
- url: url.format(localVarUrlObj),
811
- options: localVarRequestOptions,
812
- };
813
- },
814
- /**
815
- * Retrieves metadata for a SIP-013 Semi-Fungible Token
816
- * @summary Semi-Fungible Token Metadata
817
- * @param {string} principal SIP-013 compliant smart contract principal
818
- * @param {number} token_id Token ID to retrieve
819
- * @param {string} [locale] Metadata localization to retrieve
820
- * @param {*} [options] Override http request option.
821
- * @throws {RequiredError}
822
- */
823
- getSftMetadata(principal: string, token_id: number, locale?: string, options: any = {}): FetchArgs {
824
- // verify required parameter 'principal' is not null or undefined
825
- if (principal === null || principal === undefined) {
826
- throw new RequiredError('principal','Required parameter principal was null or undefined when calling getSftMetadata.');
827
- }
828
- // verify required parameter 'token_id' is not null or undefined
829
- if (token_id === null || token_id === undefined) {
830
- throw new RequiredError('token_id','Required parameter token_id was null or undefined when calling getSftMetadata.');
831
- }
832
- const localVarPath = `/metadata/v1/sft/{principal}/{token_id}`
833
- .replace(`{${"principal"}}`, encodeURIComponent(String(principal)))
834
- .replace(`{${"token_id"}}`, encodeURIComponent(String(token_id)));
835
- const localVarUrlObj = url.parse(localVarPath, true);
836
- const localVarRequestOptions = Object.assign({ method: 'GET' }, options);
837
- const localVarHeaderParameter = {} as any;
838
- const localVarQueryParameter = {} as any;
839
-
840
- if (locale !== undefined) {
841
- localVarQueryParameter['locale'] = locale;
842
- }
843
-
844
- localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query);
845
- // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
846
- delete localVarUrlObj.search;
847
- localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers);
848
-
849
- return {
850
- url: url.format(localVarUrlObj),
851
- options: localVarRequestOptions,
852
- };
853
- },
854
- }
855
- };
856
-
857
- /**
858
- * TokensApi - functional programming interface
859
- * @export
860
- */
861
- export const TokensApiFp = function(configuration?: Configuration) {
862
- return {
863
- /**
864
- * Retrieves metadata for a SIP-010 Fungible Token
865
- * @summary Fungible Token Metadata
866
- * @param {string} principal Principal for the contract which owns the SIP-010 token
867
- * @param {string} [locale] Metadata localization to retrieve
868
- * @param {*} [options] Override http request option.
869
- * @throws {RequiredError}
870
- */
871
- getFtMetadata(principal: string, locale?: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise<FtMetadataResponse> {
872
- const localVarFetchArgs = TokensApiFetchParamCreator(configuration).getFtMetadata(principal, locale, options);
873
- return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => {
874
- return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => {
875
- if (response.status >= 200 && response.status < 300) {
876
- return response.json();
877
- } else {
878
- throw response;
879
- }
880
- });
881
- };
882
- },
883
- /**
884
- * Retrieves a list of Fungible Tokens
885
- * @summary Fungible Tokens
886
- * @param {string} [name]
887
- * @param {string} [symbol]
888
- * @param {string} [address] Stacks Address
889
- * @param {number} [offset] Result offset
890
- * @param {number} [limit] Results per page
891
- * @param {OrderBy} [order_by] Parameter to order results by
892
- * @param {Order} [order] Results order
893
- * @param {*} [options] Override http request option.
894
- * @throws {RequiredError}
895
- */
896
- getFungibleTokens(name?: string, symbol?: string, address?: string, offset?: number, limit?: number, order_by?: OrderBy, order?: Order, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise<PaginatedFtBasicMetadataResponse> {
897
- const localVarFetchArgs = TokensApiFetchParamCreator(configuration).getFungibleTokens(name, symbol, address, offset, limit, order_by, order, options);
898
- return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => {
899
- return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => {
900
- if (response.status >= 200 && response.status < 300) {
901
- return response.json();
902
- } else {
903
- throw response;
904
- }
905
- });
906
- };
907
- },
908
- /**
909
- * Retrieves metadata for a SIP-009 Non-Fungible Token
910
- * @summary Non-Fungible Token Metadata
911
- * @param {string} principal SIP-009 compliant smart contract principal
912
- * @param {number} token_id Token ID to retrieve
913
- * @param {string} [locale] Metadata localization to retrieve
914
- * @param {*} [options] Override http request option.
915
- * @throws {RequiredError}
916
- */
917
- getNftMetadata(principal: string, token_id: number, locale?: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise<NftMetadataResponse> {
918
- const localVarFetchArgs = TokensApiFetchParamCreator(configuration).getNftMetadata(principal, token_id, locale, options);
919
- return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => {
920
- return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => {
921
- if (response.status >= 200 && response.status < 300) {
922
- return response.json();
923
- } else {
924
- throw response;
925
- }
926
- });
927
- };
928
- },
929
- /**
930
- * Retrieves metadata for a SIP-013 Semi-Fungible Token
931
- * @summary Semi-Fungible Token Metadata
932
- * @param {string} principal SIP-013 compliant smart contract principal
933
- * @param {number} token_id Token ID to retrieve
934
- * @param {string} [locale] Metadata localization to retrieve
935
- * @param {*} [options] Override http request option.
936
- * @throws {RequiredError}
937
- */
938
- getSftMetadata(principal: string, token_id: number, locale?: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise<SftMetadataResponse> {
939
- const localVarFetchArgs = TokensApiFetchParamCreator(configuration).getSftMetadata(principal, token_id, locale, options);
940
- return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => {
941
- return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => {
942
- if (response.status >= 200 && response.status < 300) {
943
- return response.json();
944
- } else {
945
- throw response;
946
- }
947
- });
948
- };
949
- },
950
- }
951
- };
952
-
953
- /**
954
- * TokensApi - factory interface
955
- * @export
956
- */
957
- export const TokensApiFactory = function (configuration?: Configuration, fetch?: FetchAPI, basePath?: string) {
958
- return {
959
- /**
960
- * Retrieves metadata for a SIP-010 Fungible Token
961
- * @summary Fungible Token Metadata
962
- * @param {string} principal Principal for the contract which owns the SIP-010 token
963
- * @param {string} [locale] Metadata localization to retrieve
964
- * @param {*} [options] Override http request option.
965
- * @throws {RequiredError}
966
- */
967
- getFtMetadata(principal: string, locale?: string, options?: any) {
968
- return TokensApiFp(configuration).getFtMetadata(principal, locale, options)(fetch, basePath);
969
- },
970
- /**
971
- * Retrieves a list of Fungible Tokens
972
- * @summary Fungible Tokens
973
- * @param {string} [name]
974
- * @param {string} [symbol]
975
- * @param {string} [address] Stacks Address
976
- * @param {number} [offset] Result offset
977
- * @param {number} [limit] Results per page
978
- * @param {OrderBy} [order_by] Parameter to order results by
979
- * @param {Order} [order] Results order
980
- * @param {*} [options] Override http request option.
981
- * @throws {RequiredError}
982
- */
983
- getFungibleTokens(name?: string, symbol?: string, address?: string, offset?: number, limit?: number, order_by?: OrderBy, order?: Order, options?: any) {
984
- return TokensApiFp(configuration).getFungibleTokens(name, symbol, address, offset, limit, order_by, order, options)(fetch, basePath);
985
- },
986
- /**
987
- * Retrieves metadata for a SIP-009 Non-Fungible Token
988
- * @summary Non-Fungible Token Metadata
989
- * @param {string} principal SIP-009 compliant smart contract principal
990
- * @param {number} token_id Token ID to retrieve
991
- * @param {string} [locale] Metadata localization to retrieve
992
- * @param {*} [options] Override http request option.
993
- * @throws {RequiredError}
994
- */
995
- getNftMetadata(principal: string, token_id: number, locale?: string, options?: any) {
996
- return TokensApiFp(configuration).getNftMetadata(principal, token_id, locale, options)(fetch, basePath);
997
- },
998
- /**
999
- * Retrieves metadata for a SIP-013 Semi-Fungible Token
1000
- * @summary Semi-Fungible Token Metadata
1001
- * @param {string} principal SIP-013 compliant smart contract principal
1002
- * @param {number} token_id Token ID to retrieve
1003
- * @param {string} [locale] Metadata localization to retrieve
1004
- * @param {*} [options] Override http request option.
1005
- * @throws {RequiredError}
1006
- */
1007
- getSftMetadata(principal: string, token_id: number, locale?: string, options?: any) {
1008
- return TokensApiFp(configuration).getSftMetadata(principal, token_id, locale, options)(fetch, basePath);
1009
- },
1010
- };
1011
- };
1012
-
1013
- /**
1014
- * TokensApi - object-oriented interface
1015
- * @export
1016
- * @class TokensApi
1017
- * @extends {BaseAPI}
1018
- */
1019
- export class TokensApi extends BaseAPI {
1020
- /**
1021
- * Retrieves metadata for a SIP-010 Fungible Token
1022
- * @summary Fungible Token Metadata
1023
- * @param {string} principal Principal for the contract which owns the SIP-010 token
1024
- * @param {string} [locale] Metadata localization to retrieve
1025
- * @param {*} [options] Override http request option.
1026
- * @throws {RequiredError}
1027
- * @memberof TokensApi
1028
- */
1029
- public getFtMetadata(principal: string, locale?: string, options?: any) {
1030
- return TokensApiFp(this.configuration).getFtMetadata(principal, locale, options)(this.fetch, this.basePath);
1031
- }
1032
-
1033
- /**
1034
- * Retrieves a list of Fungible Tokens
1035
- * @summary Fungible Tokens
1036
- * @param {string} [name]
1037
- * @param {string} [symbol]
1038
- * @param {string} [address] Stacks Address
1039
- * @param {number} [offset] Result offset
1040
- * @param {number} [limit] Results per page
1041
- * @param {OrderBy} [order_by] Parameter to order results by
1042
- * @param {Order} [order] Results order
1043
- * @param {*} [options] Override http request option.
1044
- * @throws {RequiredError}
1045
- * @memberof TokensApi
1046
- */
1047
- public getFungibleTokens(name?: string, symbol?: string, address?: string, offset?: number, limit?: number, order_by?: OrderBy, order?: Order, options?: any) {
1048
- return TokensApiFp(this.configuration).getFungibleTokens(name, symbol, address, offset, limit, order_by, order, options)(this.fetch, this.basePath);
1049
- }
1050
-
1051
- /**
1052
- * Retrieves metadata for a SIP-009 Non-Fungible Token
1053
- * @summary Non-Fungible Token Metadata
1054
- * @param {string} principal SIP-009 compliant smart contract principal
1055
- * @param {number} token_id Token ID to retrieve
1056
- * @param {string} [locale] Metadata localization to retrieve
1057
- * @param {*} [options] Override http request option.
1058
- * @throws {RequiredError}
1059
- * @memberof TokensApi
1060
- */
1061
- public getNftMetadata(principal: string, token_id: number, locale?: string, options?: any) {
1062
- return TokensApiFp(this.configuration).getNftMetadata(principal, token_id, locale, options)(this.fetch, this.basePath);
1063
- }
1064
-
1065
- /**
1066
- * Retrieves metadata for a SIP-013 Semi-Fungible Token
1067
- * @summary Semi-Fungible Token Metadata
1068
- * @param {string} principal SIP-013 compliant smart contract principal
1069
- * @param {number} token_id Token ID to retrieve
1070
- * @param {string} [locale] Metadata localization to retrieve
1071
- * @param {*} [options] Override http request option.
1072
- * @throws {RequiredError}
1073
- * @memberof TokensApi
1074
- */
1075
- public getSftMetadata(principal: string, token_id: number, locale?: string, options?: any) {
1076
- return TokensApiFp(this.configuration).getSftMetadata(principal, token_id, locale, options)(this.fetch, this.basePath);
1077
- }
1078
-
1079
- }