starkbank
Version:
SDK to facilitate Node integrations with Stark Bank
235 lines (220 loc) • 12.1 kB
TypeScript
declare module 'starkbank' {
export class Split {
/**
*
* Split object
*
* @description When you initialize a Split, the entity will not be automatically
* created in the Stark Bank API. The 'create' function sends the objects
* to the Stark Bank API and returns the list of created objects.
*
* Parameters (required):
* @param amount [int]: value to send to receivers. ex: 1000 (= R$ 10.00)
* @param receiverId [string]: split receiver unique id. ex: '5656565656565656'
*
* Attributes (return-only):
* @param id [string]: unique id returned when split is created. ex: '5656565656565656'
* @param source [string]: source receivable which generated this split object. ex: '5656565656565656'
* @param externalId [string]: unique id, generated by the system, to avoid duplicated splits. ex: 'invoice/1234/receiver/5678'
* @param tags [list of strings, default None]: list of strings for tagging
* @param scheduled [string, default now]: payment scheduled date or datetime. ex: '2020-03-10 10:30:00.000000+00:00'
* @param status [string]: current payment status. ex: 'success', 'failed', 'canceled', 'failed' or 'processing'
* @param created [string]: creation datetime for the payment. ex: '2020-03-10 10:30:00.000000+00:00'
* @param updated [string]: update datetime for the payment. ex: '2020-03-10 10:30:00.000000+00:00'
*
*/
amount: number
receiverId: string
readonly id: string
readonly source: string
readonly externalId: string
readonly tags: string[]
readonly scheduled: string
readonly status: string
readonly created: string
readonly updated: string
constructor(params: {
amount: number, receiverId: string, id?: string, source?: string, externalId?: string, tags?: string[], scheduled?: string,
status?: string, created?: string, updated?: string
})
}
export namespace split {
/**
*
* Retrieve a specific Split
*
* @description Receive a single Split object previously created in the Stark Bank API by passing its id
*
* Parameters (required):
* @param id [string]: object unique id. ex: '5656565656565656'
*
* Parameters (optional):
* @param user [Project object]: Project object. Not necessary if starkbank.user was set before function call
*
* Return:
* @returns Split object with updated attributes
*
*/
export function get(id: string, params?: { user?: Project | Organization | null }): Promise<Split>
/**
*
* Retrieve Splits
*
* @description Receive a generator of Split objects previously created in the Stark Bank API
*
* Parameters (optional):
* @param limit [integer, default null]: maximum number of objects to be retrieved. Unlimited if null. ex: 35
* @param after [string, default null] date filter for objects created only after specified date. ex: '2020-03-10'
* @param before [string, default null] date filter for objects created only before specified date. ex: '2020-03-10'
* @param tags [list of strings, default null]: tags to filter retrieved objects. ex: ['tony', 'stark']
* @param ids [list of strings, default null]: list of ids to filter retrieved objects. ex: ['5656565656565656', '4545454545454545']
* @param receiverIds [list of strings, default None]: list of receiver ids to filter retrieved objects. ex: ['5656565656565656', '4545454545454545']
* @param status [string, default null]: filter for status of retrieved objects. ex: 'success', 'failed', 'canceled', 'failed' or 'processing'
* @param user [Organization/Project object, default null]: Organization or Project object. Not necessary if starkbank.user was set before function call
*
* Return:
* @returns generator of Split objects with updated attributes
*
*/
export function query(params?: {
limit?: number,
after?: string,
before?: string,
tags?: string[],
ids?: string[],
receiverIds?: string[],
status?: string,
user?: Project | Organization | null
}): Promise<Split[]>;
/**
*
* Retrieve Splits
*
* @description Receive a list of up to 100 Split objects previously created in the Stark Bank API and the cursor to the next page.
* Use this function instead of query if you want to manually page your requests.
*
* Parameters (optional):
* @param cursor [string, default null]: cursor returned on the previous page function call
* @param limit [integer, default null]: maximum number of objects to be retrieved. Unlimited if null. ex: 35
* @param after [string, default null] date filter for objects created only after specified date. ex: '2020-03-10'
* @param before [string, default null] date filter for objects created only before specified date. ex: '2020-03-10'
* @param tags [list of strings, default null]: tags to filter retrieved objects. ex: ['tony', 'stark']
* @param ids [list of strings, default null]: list of ids to filter retrieved objects. ex: ['5656565656565656', '4545454545454545']
* @param receiverIds [list of strings, default None]: list of receiver ids to filter retrieved objects. ex: ['5656565656565656', '4545454545454545']
* @param status [string, default null]: filter for status of retrieved objects. ex: 'success', 'failed', 'canceled', 'failed' or 'processing'
* @param user [Organization/Project object, default null]: Organization or Project object. Not necessary if starkbank.user was set before function call
*
* Return:
* @returns list of Split objects with updated attributes and cursor to retrieve the next page of objects
*
*/
export function page(params?: {
cursor?: string | null,
limit?: number,
after?: string,
before?: string,
tags?: string[],
ids?: string[],
receiverIds?: string[],
status?: string,
user?: Project | Organization | null
}): Promise<[Split[], string | null]>;
export class Log {
/**
*
* Split Log object
*
* @description Every time a Split entity is updated, a corresponding Split Log
* is generated for the entity. This log is never generated by the user,
* but it can be retrieved to check additional information on the Split.
*
* Attributes:
* @param id [string]: unique id returned when the log is created. ex: '5656565656565656'
* @param split [Split]: Split entity to which the log refers to.
* @param errors [list of strings]: list of errors linked to this Split event.
* @param type [string]: type of the Split event which triggered the log creation. ex: 'created' or 'updated'
* @param created [string]: creation datetime for the log. ex: '2020-03-10 10:30:00.000'
*
*/
readonly id: string
readonly split: Split
readonly errors: string[]
readonly type: string
readonly created: string
constructor(id: string, split: Split, errors: string[], type: string, created: string)
}
export namespace log {
/**
*
* Retrieve a specific Split Log
*
* @description Receive a single Split Log object previously created by the Stark Bank API by passing its id
*
* Parameters (required):
* @param id [string]: object unique id. ex: '5656565656565656'
*
* Parameters (optional):
* @param user [Organization/Project object]: Organization or Project object. Not necessary if starkbank.user was set before function call
*
* Return:
* @returns Split Log object with updated attributes
*
*/
export function get(id: string, params?: { user?: Project | Organization | null }): Promise<Split.Log>
/**
*
* Retrieve Split Logs
*
* @description Receive a generator of Split Log objects previously created in the Stark Bank API
*
* Parameters (optional):
* @param limit [integer, default null]: maximum number of objects to be retrieved. Unlimited if null. ex: 35
* @param after [string, default null] date filter for objects created only after specified date. ex: '2020-03-10'
* @param before [string, default null] date filter for objects created only before specified date. ex: '2020-03-10'
* @param types [list of strings, default null]: filter for log event types. ex: 'canceled', 'created', 'failed', 'processing', 'success' or 'updated'
* @param splitIds [list of strings, default null]: list of Split ids to filter logs. ex: ['5656565656565656', '4545454545454545']
* @param user [Organization/Project object, default null]: Organization or Project object. Not necessary if starkbank.user was set before function call
*
* Return:
* @returns list of Split Log objects with updated attributes
*
*/
export function query(params?: {
limit?: number | null,
after?: string | null,
before?: string | null,
types?: string[] | null,
splitIds?: string[] | null,
user?: Project | Organization | null
}): Promise<Split.Log[]>;
/**
*
* Retrieve paged Split Logs
*
* @description Receive a generator of Split Log objects previously created in the Stark Bank API
*
* Parameters (optional):
* @param cursor [string, default null]: cursor returned on the previous page function call
* @param limit [integer, default null]: maximum number of objects to be retrieved. Unlimited if null. ex: 35
* @param after [string, default null] date filter for objects created only after specified date. ex: '2020-03-10'
* @param before [string, default null] date filter for objects created only before specified date. ex: '2020-03-10'
* @param types [list of strings, default null]: filter for log event types. ex: 'canceled', 'created', 'failed', 'processing', 'success' or 'updated'
* @param splitIds [list of strings, default null]: list of Split ids to filter logs. ex: ['5656565656565656', '4545454545454545']
* @param user [Organization/Project object, default null]: Organization or Project object. Not necessary if starkbank.user was set before function call
*
* Return:
* @returns list of Split Log objects with updated attributes and cursor to retrieve the next page of Split Log objects
*
*/
export function page(params?: {
cursor?: string | null,
limit?: number | null,
after?: string | null,
before?: string | null,
types?: string[] | null,
splitIds?: string[] | null,
user?: Project | Organization | null
}): Promise<[Split.Log[], string | null]>;
}
}
}