fix: pagination and proof params in openapi spec

fixing #222
This commit is contained in:
Alexander Graebe
2020-09-14 14:19:37 -07:00
parent dc890c643d
commit 4363ffe7ef
5 changed files with 163 additions and 7 deletions

View File

@@ -34,6 +34,8 @@ import {
export interface GetAccountAssetsRequest {
principal: string;
limit?: number;
offset?: number;
}
export interface GetAccountBalanceRequest {
@@ -51,6 +53,8 @@ export interface GetAccountStxBalanceRequest {
export interface GetAccountTransactionsRequest {
principal: string;
limit?: number;
offset?: number;
}
/**
@@ -68,6 +72,14 @@ export class AccountsApi extends runtime.BaseAPI {
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({
@@ -194,6 +206,14 @@ export class AccountsApi extends runtime.BaseAPI {
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({

View File

@@ -50,6 +50,8 @@ export interface GetContractDataMapEntryRequest {
export interface GetContractEventsByIdRequest {
contractId: string;
limit?: number;
offset?: number;
}
export interface GetContractInterfaceRequest {
@@ -208,6 +210,14 @@ export class SmartContractsApi extends runtime.BaseAPI {
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({

View File

@@ -23,10 +23,21 @@ import {
TransactionResultsToJSON,
} from '../models';
export interface GetMempoolTransactionListRequest {
limit?: number;
offset?: number;
}
export interface GetTransactionByIdRequest {
txId: string;
}
export interface GetTransactionListRequest {
limit?: number;
offset?: number;
type?: GetTransactionListTypeEnum;
}
export interface PostCoreNodeTransactionsRequest {
body?: string;
}
@@ -40,9 +51,17 @@ export class TransactionsApi extends runtime.BaseAPI {
* Get all recently-broadcast mempool transactions
* Get mempool transactions
*/
async getMempoolTransactionListRaw(): Promise<runtime.ApiResponse<MempoolTransactionListResponse>> {
async getMempoolTransactionListRaw(requestParameters: GetMempoolTransactionListRequest): Promise<runtime.ApiResponse<MempoolTransactionListResponse>> {
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({
@@ -59,8 +78,8 @@ export class TransactionsApi extends runtime.BaseAPI {
* Get all recently-broadcast mempool transactions
* Get mempool transactions
*/
async getMempoolTransactionList(): Promise<MempoolTransactionListResponse> {
const response = await this.getMempoolTransactionListRaw();
async getMempoolTransactionList(requestParameters: GetMempoolTransactionListRequest): Promise<MempoolTransactionListResponse> {
const response = await this.getMempoolTransactionListRaw(requestParameters);
return await response.value();
}
@@ -100,9 +119,21 @@ export class TransactionsApi extends runtime.BaseAPI {
* Get all recently mined transactions If using TypeScript, import typings for this response from our types package: `import type { TransactionResults } from \'@blockstack/stacks-blockchain-api-types\';`
* Get recent transactions
*/
async getTransactionListRaw(): Promise<runtime.ApiResponse<TransactionResults>> {
async getTransactionListRaw(requestParameters: GetTransactionListRequest): Promise<runtime.ApiResponse<TransactionResults>> {
const queryParameters: runtime.HTTPQuery = {};
if (requestParameters.limit !== undefined) {
queryParameters['limit'] = requestParameters.limit;
}
if (requestParameters.offset !== undefined) {
queryParameters['offset'] = requestParameters.offset;
}
if (requestParameters.type !== undefined) {
queryParameters['type'] = requestParameters.type;
}
const headerParameters: runtime.HTTPHeaders = {};
const response = await this.request({
@@ -119,8 +150,8 @@ export class TransactionsApi extends runtime.BaseAPI {
* Get all recently mined transactions If using TypeScript, import typings for this response from our types package: `import type { TransactionResults } from \'@blockstack/stacks-blockchain-api-types\';`
* Get recent transactions
*/
async getTransactionList(): Promise<TransactionResults> {
const response = await this.getTransactionListRaw();
async getTransactionList(requestParameters: GetTransactionListRequest): Promise<TransactionResults> {
const response = await this.getTransactionListRaw(requestParameters);
return await response.value();
}
@@ -155,3 +186,15 @@ export class TransactionsApi extends runtime.BaseAPI {
}
}
/**
* @export
* @enum {string}
*/
export enum GetTransactionListTypeEnum {
coinbase = 'coinbase',
token_transfer = 'token_transfer',
smart_contract = 'smart_contract',
contract_call = 'contract_call',
poison_microblock = 'poison_microblock'
}

14
docs/index.d.ts vendored
View File

@@ -497,6 +497,20 @@ export interface Block {
txs: string[];
}
/**
* Describes representation of a Type-0 Stacks 2.0 transaction. https://github.com/blockstack/stacks-blockchain/blob/master/sip/sip-005-blocks-and-transactions.md#type-0-transferring-an-asset
*/
export interface ReadOnlyFunctionArgs {
/**
* The simulated tx-sender
*/
sender: string;
/**
* An array of hex serialized Clarity values
*/
arguments: string[];
}
/**
* Describes representation of a Type-0 Stacks 2.0 transaction. https://github.com/blockstack/stacks-blockchain/blob/master/sip/sip-005-blocks-and-transactions.md#type-0-transferring-an-asset
*/

View File

@@ -101,6 +101,26 @@ paths:
If using TypeScript, import typings for this response from our types package:
`import type { TransactionResults } from '@blockstack/stacks-blockchain-api-types';`
parameters:
- name: limit
in: query
description: max number of transactions to fetch
required: false
schema:
type: integer
- name: offset
in: query
description: index of first transaction to fetch
required: false
schema:
type: integer
- name: type
in: query
description: Filter by transaction type
required: false
schema:
type: string
enum: [coinbase, token_transfer, smart_contract, contract_call, poison_microblock]
responses:
200:
description: List of transactions
@@ -118,6 +138,19 @@ paths:
- Transactions
operationId: get_mempool_transaction_list
description: Get all recently-broadcast mempool transactions
parameters:
- name: limit
in: query
description: max number of mempool transactions to fetch
required: false
schema:
type: integer
- name: offset
in: query
description: index of first mempool transaction to fetch
required: false
schema:
type: integer
responses:
200:
description: List of mempool transactions
@@ -269,6 +302,18 @@ paths:
- Smart Contracts
operationId: get_contract_events_by_id
parameters:
- name: limit
in: query
description: max number of contract events to fetch
required: false
schema:
type: integer
- name: offset
in: query
description: index of first contract event to fetch
required: false
schema:
type: integer
- name: contract_id
in: path
description: Contract identifier formatted as `<principal_address>.<contract_name>`
@@ -356,7 +401,7 @@ paths:
type: string
- name: proof
in: query
description: Returns object without the proof field
description: Returns object without the proof field when set to 0
schema:
type: integer
x-codegen-request-body-name: key
@@ -510,6 +555,18 @@ paths:
- Accounts
operationId: get_account_transactions
parameters:
- name: limit
in: query
description: max number of account transactions to fetch
required: false
schema:
type: integer
- name: offset
in: query
description: index of first account transaction to fetch
required: false
schema:
type: integer
- name: principal
in: path
description: Stacks address or a Contract identifier (e.g. `SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0.get-info`)
@@ -533,6 +590,18 @@ paths:
- Accounts
operationId: get_account_assets
parameters:
- name: limit
in: query
description: max number of account assets to fetch
required: false
schema:
type: integer
- name: offset
in: query
description: index of first account assets to fetch
required: false
schema:
type: integer
- name: principal
in: path
description: Stacks address or a Contract identifier (e.g. `SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0.get-info`)