Skip to content

Commit

Permalink
chore: generate client with new BTC info endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
zone117x committed Nov 17, 2020
1 parent 7a9b18e commit a63be91
Show file tree
Hide file tree
Showing 5 changed files with 347 additions and 0 deletions.
159 changes: 159 additions & 0 deletions client/src/generated/apis/BurnchainApi.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
/* tslint:disable */
/* eslint-disable */
/**
* Stacks 2.0 Blockchain API
* This is the documentation for the Stacks 2.0 Blockchain API. It is comprised of two parts; the Stacks Blockchain API and the Stacks Core API. [![Run in Postman](https://run.pstmn.io/button.svg)](https://app.getpostman.com/run-collection/614feab5c108d292bffa#?env%5BStacks%20Blockchain%20API%5D=W3sia2V5Ijoic3R4X2FkZHJlc3MiLCJ2YWx1ZSI6IlNUMlRKUkhESE1ZQlE0MTdIRkIwQkRYNDMwVFFBNVBYUlg2NDk1RzFWIiwiZW5hYmxlZCI6dHJ1ZX0seyJrZXkiOiJibG9ja19pZCIsInZhbHVlIjoiMHgiLCJlbmFibGVkIjp0cnVlfSx7ImtleSI6Im9mZnNldCIsInZhbHVlIjoiMCIsImVuYWJsZWQiOnRydWV9LHsia2V5IjoibGltaXRfdHgiLCJ2YWx1ZSI6IjIwMCIsImVuYWJsZWQiOnRydWV9LHsia2V5IjoibGltaXRfYmxvY2siLCJ2YWx1ZSI6IjMwIiwiZW5hYmxlZCI6dHJ1ZX0seyJrZXkiOiJ0eF9pZCIsInZhbHVlIjoiMHg1NDA5MGMxNmE3MDJiNzUzYjQzMTE0ZTg4NGJjMTlhODBhNzk2MzhmZDQ0OWE0MGY4MDY4Y2RmMDAzY2RlNmUwIiwiZW5hYmxlZCI6dHJ1ZX0seyJrZXkiOiJjb250cmFjdF9pZCIsInZhbHVlIjoiU1RKVFhFSlBKUFBWRE5BOUIwNTJOU1JSQkdRQ0ZOS1ZTMTc4VkdIMS5oZWxsb193b3JsZFxuIiwiZW5hYmxlZCI6dHJ1ZX0seyJrZXkiOiJidGNfYWRkcmVzcyIsInZhbHVlIjoiYWJjIiwiZW5hYmxlZCI6dHJ1ZX0seyJrZXkiOiJjb250cmFjdF9hZGRyZXNzIiwidmFsdWUiOiJTVEpUWEVKUEpQUFZETkE5QjA1Mk5TUlJCR1FDRk5LVlMxNzhWR0gxIiwiZW5hYmxlZCI6dHJ1ZX0seyJrZXkiOiJjb250cmFjdF9uYW1lIiwidmFsdWUiOiJoZWxsb193b3JsZCIsImVuYWJsZWQiOnRydWV9LHsia2V5IjoiY29udHJhY3RfbWFwIiwidmFsdWUiOiJzdG9yZSIsImVuYWJsZWQiOnRydWV9LHsia2V5IjoiY29udHJhY3RfbWV0aG9kIiwidmFsdWUiOiJnZXQtdmFsdWUiLCJlbmFibGVkIjp0cnVlfV0=)
*
* The version of the OpenAPI document: 1.0.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 {
BurnchainRewardListResponse,
BurnchainRewardListResponseFromJSON,
BurnchainRewardListResponseToJSON,
} from '../models';

export interface GetBurnchainRewardListRequest {
limit?: number;
offset?: number;
}

export interface GetBurnchainRewardListByAddressRequest {
address: string;
limit?: number;
offset?: number;
}

/**
* BurnchainApi - interface
*
* @export
* @interface BurnchainApiInterface
*/
export interface BurnchainApiInterface {
/**
* Get a list of recent burnchain (e.g. Bitcoin) reward recipients with the associated amounts and block info
* @summary Get recent burnchain reward recipients
* @param {number} [limit] max number of rewards to fetch
* @param {number} [offset] index of first rewards to fetch
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof BurnchainApiInterface
*/
getBurnchainRewardListRaw(requestParameters: GetBurnchainRewardListRequest): Promise<runtime.ApiResponse<BurnchainRewardListResponse>>;

/**
* Get a list of recent burnchain (e.g. Bitcoin) reward recipients with the associated amounts and block info
* Get recent burnchain reward recipients
*/
getBurnchainRewardList(requestParameters: GetBurnchainRewardListRequest): Promise<BurnchainRewardListResponse>;

/**
* Get a list of recent burnchain (e.g. Bitcoin) rewards for the given recipient with the associated amounts and block info
* @summary Get recent burnchain reward for the given recipient
* @param {string} address Reward recipient address. Should either be in the native burnchain\&#39;s format (e.g. B58 for Bitcoin), or if a STX principal address is provided it will be encoded as into the equivalent burnchain format
* @param {number} [limit] max number of rewards to fetch
* @param {number} [offset] index of first rewards to fetch
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof BurnchainApiInterface
*/
getBurnchainRewardListByAddressRaw(requestParameters: GetBurnchainRewardListByAddressRequest): Promise<runtime.ApiResponse<BurnchainRewardListResponse>>;

/**
* Get a list of recent burnchain (e.g. Bitcoin) rewards for the given recipient with the associated amounts and block info
* Get recent burnchain reward for the given recipient
*/
getBurnchainRewardListByAddress(requestParameters: GetBurnchainRewardListByAddressRequest): Promise<BurnchainRewardListResponse>;

}

/**
*
*/
export class BurnchainApi extends runtime.BaseAPI implements BurnchainApiInterface {

/**
* Get a list of recent burnchain (e.g. Bitcoin) reward recipients with the associated amounts and block info
* Get recent burnchain reward recipients
*/
async getBurnchainRewardListRaw(requestParameters: GetBurnchainRewardListRequest): Promise<runtime.ApiResponse<BurnchainRewardListResponse>> {
const queryParameters: runtime.HTTPQuery = {};

if (requestParameters.limit !== undefined) {
queryParameters['limit'] = requestParameters.limit;
}

if (requestParameters.offset !== undefined) {
queryParameters['offset'] = requestParameters.offset;
}

const headerParameters: runtime.HTTPHeaders = {};

const response = await this.request({
path: `/extended/v1/burnchain/rewards`,
method: 'GET',
headers: headerParameters,
query: queryParameters,
});

return new runtime.JSONApiResponse(response, (jsonValue) => BurnchainRewardListResponseFromJSON(jsonValue));
}

/**
* Get a list of recent burnchain (e.g. Bitcoin) reward recipients with the associated amounts and block info
* Get recent burnchain reward recipients
*/
async getBurnchainRewardList(requestParameters: GetBurnchainRewardListRequest): Promise<BurnchainRewardListResponse> {
const response = await this.getBurnchainRewardListRaw(requestParameters);
return await response.value();
}

/**
* Get a list of recent burnchain (e.g. Bitcoin) rewards for the given recipient with the associated amounts and block info
* Get recent burnchain reward for the given recipient
*/
async getBurnchainRewardListByAddressRaw(requestParameters: GetBurnchainRewardListByAddressRequest): Promise<runtime.ApiResponse<BurnchainRewardListResponse>> {
if (requestParameters.address === null || requestParameters.address === undefined) {
throw new runtime.RequiredError('address','Required parameter requestParameters.address was null or undefined when calling getBurnchainRewardListByAddress.');
}

const queryParameters: runtime.HTTPQuery = {};

if (requestParameters.limit !== undefined) {
queryParameters['limit'] = requestParameters.limit;
}

if (requestParameters.offset !== undefined) {
queryParameters['offset'] = requestParameters.offset;
}

const headerParameters: runtime.HTTPHeaders = {};

const response = await this.request({
path: `/extended/v1/burnchain/rewards/{address}`.replace(`{${"address"}}`, encodeURIComponent(String(requestParameters.address))),
method: 'GET',
headers: headerParameters,
query: queryParameters,
});

return new runtime.JSONApiResponse(response, (jsonValue) => BurnchainRewardListResponseFromJSON(jsonValue));
}

/**
* Get a list of recent burnchain (e.g. Bitcoin) rewards for the given recipient with the associated amounts and block info
* Get recent burnchain reward for the given recipient
*/
async getBurnchainRewardListByAddress(requestParameters: GetBurnchainRewardListByAddressRequest): Promise<BurnchainRewardListResponse> {
const response = await this.getBurnchainRewardListByAddressRaw(requestParameters);
return await response.value();
}

}
1 change: 1 addition & 0 deletions client/src/generated/apis/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export * from './AccountsApi';
export * from './BlocksApi';
export * from './BurnchainApi';
export * from './FaucetsApi';
export * from './FeesApi';
export * from './InfoApi';
Expand Down
105 changes: 105 additions & 0 deletions client/src/generated/models/BurnchainReward.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
/* tslint:disable */
/* eslint-disable */
/**
* Stacks 2.0 Blockchain API
* This is the documentation for the Stacks 2.0 Blockchain API. It is comprised of two parts; the Stacks Blockchain API and the Stacks Core API. [![Run in Postman](https://run.pstmn.io/button.svg)](https://app.getpostman.com/run-collection/614feab5c108d292bffa#?env%5BStacks%20Blockchain%20API%5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sdWUiLCJlbmFibGVkIjp0cnVlfV0=)
*
* The version of the OpenAPI document: 1.0.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 { exists, mapValues } from '../runtime';
/**
* Reward payment made on the burnchain
* @export
* @interface BurnchainReward
*/
export interface BurnchainReward {
/**
* Set to `true` if block corresponds to the canonical burchchain tip
* @type {boolean}
* @memberof BurnchainReward
*/
canonical: boolean;
/**
* The hash representing the burnchain block
* @type {string}
* @memberof BurnchainReward
*/
burn_block_hash: string;
/**
* Height of the burnchain block
* @type {number}
* @memberof BurnchainReward
*/
burn_block_height: number;
/**
* The total amount of burnchain tokens burned for this burnchain block, in the smallest unit (e.g. satoshis for Bitcoin)
* @type {string}
* @memberof BurnchainReward
*/
burn_amount: string;
/**
* The recipient address that received the burnchain rewards, in the format native to the burnchain (e.g. B58 encoded for Bitcoin)
* @type {string}
* @memberof BurnchainReward
*/
reward_recipient: string;
/**
* The amount of burnchain tokens rewarded to the recipient, in the smallest unit (e.g. satoshis for Bitcoin)
* @type {string}
* @memberof BurnchainReward
*/
reward_amount: string;
/**
* The index position of the reward entry, useful for ordering when there's more than one recipient per burnchain block
* @type {number}
* @memberof BurnchainReward
*/
reward_index: number;
}

export function BurnchainRewardFromJSON(json: any): BurnchainReward {
return BurnchainRewardFromJSONTyped(json, false);
}

export function BurnchainRewardFromJSONTyped(json: any, ignoreDiscriminator: boolean): BurnchainReward {
if ((json === undefined) || (json === null)) {
return json;
}
return {

'canonical': json['canonical'],
'burn_block_hash': json['burn_block_hash'],
'burn_block_height': json['burn_block_height'],
'burn_amount': json['burn_amount'],
'reward_recipient': json['reward_recipient'],
'reward_amount': json['reward_amount'],
'reward_index': json['reward_index'],
};
}

export function BurnchainRewardToJSON(value?: BurnchainReward | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {

'canonical': value.canonical,
'burn_block_hash': value.burn_block_hash,
'burn_block_height': value.burn_block_height,
'burn_amount': value.burn_amount,
'reward_recipient': value.reward_recipient,
'reward_amount': value.reward_amount,
'reward_index': value.reward_index,
};
}


80 changes: 80 additions & 0 deletions client/src/generated/models/BurnchainRewardListResponse.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/* tslint:disable */
/* eslint-disable */
/**
* Stacks 2.0 Blockchain API
* This is the documentation for the Stacks 2.0 Blockchain API. It is comprised of two parts; the Stacks Blockchain API and the Stacks Core API. [![Run in Postman](https://run.pstmn.io/button.svg)](https://app.getpostman.com/run-collection/614feab5c108d292bffa#?env%5BStacks%20Blockchain%20API%5D=W3sia2V5Ijoic3R4X2FkZHJlc3MiLCJ2YWx1ZSI6IlNUMlRKUkhESE1ZQlE0MTdIRkIwQkRYNDMwVFFBNVBYUlg2NDk1RzFWIiwiZW5hYmxlZCI6dHJ1ZX0seyJrZXkiOiJibG9ja19pZCIsInZhbHVlIjoiMHgiLCJlbmFibGVkIjp0cnVlfSx7ImtleSI6Im9mZnNldCIsInZhbHVlIjoiMCIsImVuYWJsZWQiOnRydWV9LHsia2V5IjoibGltaXRfdHgiLCJ2YWx1ZSI6IjIwMCIsImVuYWJsZWQiOnRydWV9LHsia2V5IjoibGltaXRfYmxvY2siLCJ2YWx1ZSI6IjMwIiwiZW5hYmxlZCI6dHJ1ZX0seyJrZXkiOiJ0eF9pZCIsInZhbHVlIjoiMHg1NDA5MGMxNmE3MDJiNzUzYjQzMTE0ZTg4NGJjMTlhODBhNzk2MzhmZDQ0OWE0MGY4MDY4Y2RmMDAzY2RlNmUwIiwiZW5hYmxlZCI6dHJ1ZX0seyJrZXkiOiJjb250cmFjdF9pZCIsInZhbHVlIjoiU1RKVFhFSlBKUFBWRE5BOUIwNTJOU1JSQkdRQ0ZOS1ZTMTc4VkdIMS5oZWxsb193b3JsZFxuIiwiZW5hYmxlZCI6dHJ1ZX0seyJrZXkiOiJidGNfYWRkcmVzcyIsInZhbHVlIjoiYWJjIiwiZW5hYmxlZCI6dHJ1ZX0seyJrZXkiOiJjb250cmFjdF9hZGRyZXNzIiwidmFsdWUiOiJTVEpUWEVKUEpQUFZETkE5QjA1Mk5TUlJCR1FDRk5LVlMxNzhWR0gxIiwiZW5hYmxlZCI6dHJ1ZX0seyJrZXkiOiJjb250cmFjdF9uYW1lIiwidmFsdWUiOiJoZWxsb193b3JsZCIsImVuYWJsZWQiOnRydWV9LHsia2V5IjoiY29udHJhY3RfbWFwIiwidmFsdWUiOiJzdG9yZSIsImVuYWJsZWQiOnRydWV9LHsia2V5IjoiY29udHJhY3RfbWV0aG9kIiwidmFsdWUiOiJnZXQtdmFsdWUiLCJlbmFibGVkIjp0cnVlfV0=)
*
* The version of the OpenAPI document: 1.0.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 { exists, mapValues } from '../runtime';
import {
BurnchainReward,
BurnchainRewardFromJSON,
BurnchainRewardFromJSONTyped,
BurnchainRewardToJSON,
} from './';

/**
* GET request that returns blocks
* @export
* @interface BurnchainRewardListResponse
*/
export interface BurnchainRewardListResponse {
/**
* The number of burnchain rewards to return
* @type {number}
* @memberof BurnchainRewardListResponse
*/
limit: number;
/**
* The number to burnchain rewards to skip (starting at `0`)
* @type {number}
* @memberof BurnchainRewardListResponse
*/
offset: number;
/**
*
* @type {Array<BurnchainReward>}
* @memberof BurnchainRewardListResponse
*/
results: Array<BurnchainReward>;
}

export function BurnchainRewardListResponseFromJSON(json: any): BurnchainRewardListResponse {
return BurnchainRewardListResponseFromJSONTyped(json, false);
}

export function BurnchainRewardListResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): BurnchainRewardListResponse {
if ((json === undefined) || (json === null)) {
return json;
}
return {

'limit': json['limit'],
'offset': json['offset'],
'results': ((json['results'] as Array<any>).map(BurnchainRewardFromJSON)),
};
}

export function BurnchainRewardListResponseToJSON(value?: BurnchainRewardListResponse | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {

'limit': value.limit,
'offset': value.offset,
'results': ((value.results as Array<any>).map(BurnchainRewardToJSON)),
};
}


2 changes: 2 additions & 0 deletions client/src/generated/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ export * from './AddressStxBalanceResponse';
export * from './AddressTransactionsListResponse';
export * from './Block';
export * from './BlockListResponse';
export * from './BurnchainReward';
export * from './BurnchainRewardListResponse';
export * from './ContractInterfaceResponse';
export * from './ContractSourceResponse';
export * from './CoreNodeInfoResponse';
Expand Down

0 comments on commit a63be91

Please sign in to comment.