beckn-typescript
Version:
Beckn Protocol Client & Server Tools for Typescript
502 lines (501 loc) • 23.6 kB
TypeScript
export default paths;
export type paths = {
"/get_cancellation_reasons": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
get?: never;
put?: never;
/** @description BAP fetches the list of cancellation reasons from BPP */
post: {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
requestBody?: {
content: {
"application/json": components["schemas"]["GetCancellationReasons"];
};
};
responses: {
default: components["responses"]["Response"];
};
};
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/cancellation_reasons": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
get?: never;
put?: never;
/** @description BPP sends cancellation reasons to BAP */
post: {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
requestBody?: {
content: {
"application/json": components["schemas"]["CancellationReasons"];
};
};
responses: {
default: components["responses"]["Response"];
};
};
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/get_return_reasons": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
get?: never;
put?: never;
/** @description BAP requests BPP to provide the list of return reasons */
post: {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
requestBody?: {
content: {
"application/json": components["schemas"]["GetReturnReasons"];
};
};
responses: {
default: components["responses"]["Response"];
};
};
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/return_reasons": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
get?: never;
put?: never;
/** @description BPP provides the list of return reasons to the BAP */
post: {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
requestBody?: {
content: {
"application/json": components["schemas"]["ReturnReasons"];
};
};
responses: {
default: components["responses"]["Response"];
};
};
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/get_rating_categories": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
get?: never;
put?: never;
/** @description BAP requests BPP to provide the list of entities that can be rated on its system */
post: {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
requestBody?: {
content: {
"application/json": components["schemas"]["GetRatingCategories"];
};
};
responses: {
default: components["responses"]["Response"];
};
};
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/rating_categories": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
get?: never;
put?: never;
/** @description BPP provides the list of entities that can be rated in its system to the BAP */
post: {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
requestBody?: {
content: {
"application/json": components["schemas"]["RatingCategories"];
};
};
responses: {
default: components["responses"]["Response"];
};
};
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
};
export type webhooks = Record<string, never>;
export type components = {
schemas: {
/** @description Standard code representing the domain. The standard is usually published as part of the network policy. Furthermore, the network facilitator should also provide a mechanism to provide the supported domains of a network. */
code: unknown;
/** @description This object contains a url to a media file. */
MediaFile: {
/** @description indicates the nature and format of the document, file, or assortment of bytes. MIME types are defined and standardized in IETF's RFC 6838 */
mimetype?: string;
/**
* Format: uri
* @description The URL of the file
*/
url?: string;
/** @description The digital signature of the file signed by the sender */
signature?: string;
/** @description The signing algorithm used by the sender */
dsa?: string;
};
/** @description Describes an image */
Image: {
/**
* Format: uri
* @description URL to the image. This can be a data url or an remote url
*/
url?: string;
/**
* @description The size of the image. The network policy can define the default dimensions of each type
* @enum {string}
*/
size_type?: "xs" | "sm" | "md" | "lg" | "xl" | "custom";
/** @description Width of the image in pixels */
width?: string;
/** @description Height of the image in pixels */
height?: string;
};
/** @description Physical description of something. */
Descriptor: {
name?: string;
code?: string;
short_desc?: string;
long_desc?: string;
additional_desc?: {
url?: string;
/** @enum {string} */
content_type?: "text/plain" | "text/html" | "application/json";
};
media?: components["schemas"]["MediaFile"][];
images?: components["schemas"]["Image"][];
};
/** @description Describes a GPS coordinate */
Gps: string;
/** @description Describes a postal address. */
Address: string;
/** @description Describes a city */
City: {
/** @description Name of the city */
name?: string;
/** @description City code */
code?: string;
};
/** @description A bounded geopolitical region of governance inside a country. */
State: {
/** @description Name of the state */
name?: string;
/** @description State code as per country or international standards */
code?: string;
};
/** @description Describes a country */
Country: {
/** @description Name of the country */
name?: string;
/** @description Country code as per ISO 3166-1 and ISO 3166-2 format */
code?: string;
};
/** @description Describes a numerical value in decimal form */
DecimalValue: string;
/** @description Describes a scalar */
Scalar: {
/** @enum {string} */
type?: "CONSTANT" | "VARIABLE";
value?: components["schemas"]["DecimalValue"];
estimated_value?: components["schemas"]["DecimalValue"];
computed_value?: components["schemas"]["DecimalValue"];
range?: {
min?: components["schemas"]["DecimalValue"];
max?: components["schemas"]["DecimalValue"];
};
unit?: string;
};
/** @description Describes a circular region of a specified radius centered at a specified GPS coordinate. */
Circle: {
gps?: components["schemas"]["Gps"];
radius?: components["schemas"]["Scalar"];
};
/** @description Rating value given to the object. This can be a single value or can also contain an inequality operator like gt, gte, lt, lte. This can also contain an inequality expression containing logical operators like && and ||. */
value: string;
/** @description The physical location of something */
Location: {
id?: string;
descriptor?: components["schemas"]["Descriptor"];
/**
* Format: uri
* @description The url to the map of the location. This can be a globally recognized map url or the one specified by the network policy.
*/
map_url?: string;
/** @description The GPS co-ordinates of this location. */
gps?: components["schemas"]["Gps"];
/** @description The address of this location. */
address?: components["schemas"]["Address"];
/** @description The city this location is, or is located within */
city?: components["schemas"]["City"];
/** @description The state this location is, or is located within */
district?: string;
/** @description The state this location is, or is located within */
state?: components["schemas"]["State"];
/** @description The country this location is, or is located within */
country?: components["schemas"]["Country"];
area_code?: string;
circle?: components["schemas"]["Circle"];
/** @description The boundary polygon of this location */
polygon?: string;
/** @description The three dimensional region describing this location */
"3dspace"?: string;
/** @description The rating of this location */
rating?: components["schemas"]["value"];
};
/** @description A globally unique identifier of the platform, Typically it is the fully qualified domain name (FQDN) of the platform. */
subscriber_id: string;
/**
* Format: uri
* @description The callback URL of the Subscriber. This should necessarily contain the same domain name as set in `subscriber_id``.
*/
url: string;
/** @description Every API call in beckn protocol has a context. It provides a high-level overview to the receiver about the nature of the intended transaction. Typically, it is the BAP that sets the transaction context based on the consumer's location and action on their UI. But sometimes, during unsolicited callbacks, the BPP also sets the transaction context but it is usually the same as the context of a previous full-cycle, request-callback interaction between the BAP and the BPP. The context object contains four types of fields. <ol><li>Demographic information about the transaction using fields like `domain`, `country`, and `region`.</li><li>Addressing details like the sending and receiving platform's ID and API URL.</li><li>Interoperability information like the protocol version that implemented by the sender and,</li><li>Transaction details like the method being called at the receiver's endpoint, the transaction_id that represents an end-to-end user session at the BAP, a message ID to pair requests with callbacks, a timestamp to capture sending times, a ttl to specifiy the validity of the request, and a key to encrypt information if necessary.</li></ol> This object must be passed in every interaction between a BAP and a BPP. In HTTP/S implementations, it is not necessary to send the context during the synchronous response. However, in asynchronous protocols, the context must be sent during all interactions, */
Context: {
/** @description Domain code that is relevant to this transaction context */
domain?: components["schemas"]["code"];
/** @description The location where the transaction is intended to be fulfilled. */
location?: components["schemas"]["Location"];
/** @description The Beckn protocol method being called by the sender and executed at the receiver. */
action?: string;
/** @description Version of transaction protocol being used by the sender. */
version?: string;
/** @description Subscriber ID of the BAP */
bap_id?: components["schemas"]["subscriber_id"];
/** @description Subscriber URL of the BAP for accepting callbacks from BPPs. */
bap_uri?: components["schemas"]["url"];
/** @description Subscriber ID of the BPP */
bpp_id?: components["schemas"]["subscriber_id"];
/** @description Subscriber URL of the BPP for accepting calls from BAPs. */
bpp_uri?: components["schemas"]["url"];
/**
* Format: uuid
* @description This is a unique value which persists across all API calls from `search` through `confirm`. This is done to indicate an active user session across multiple requests. The BPPs can use this value to push personalized recommendations, and dynamic offerings related to an ongoing transaction despite being unaware of the user active on the BAP.
*/
transaction_id?: string;
/**
* Format: uuid
* @description This is a unique value which persists during a request / callback cycle. Since beckn protocol APIs are asynchronous, BAPs need a common value to match an incoming callback from a BPP to an earlier call. This value can also be used to ignore duplicate messages coming from the BPP. It is recommended to generate a fresh message_id for every new interaction. When sending unsolicited callbacks, BPPs must generate a new message_id.
*/
message_id?: string;
/**
* Format: date-time
* @description Time of request generation in RFC3339 format
*/
timestamp?: string;
/** @description The encryption public key of the sender */
key?: string;
/** @description The duration in ISO8601 format after timestamp for which this message holds valid */
ttl?: string;
};
GetCancellationReasons: {
context: components["schemas"]["Context"] & {
/** @enum {unknown} */
action: "get_cancellation_reasons";
};
};
/** @description Describes a tag. This is used to contain extended metadata. This object can be added as a property to any schema to describe extended attributes. For BAPs, tags can be sent during search to optimize and filter search results. BPPs can use tags to index their catalog to allow better search functionality. Tags are sent by the BPP as part of the catalog response in the `on_search` callback. Tags are also meant for display purposes. Upon receiving a tag, BAPs are meant to render them as name-value pairs. This is particularly useful when rendering tabular information about a product or service. */
Tag: {
/** @description Description of the Tag, can be used to store detailed information. */
descriptor?: components["schemas"]["Descriptor"];
/** @description The value of the tag. This set by the BPP and rendered as-is by the BAP. */
value?: string;
/** @description This value indicates if the tag is intended for display purposes. If set to `true`, then this tag must be displayed. If it is set to `false`, it should not be displayed. This value can override the group display value. */
display?: boolean;
};
/** @description A collection of tag objects with group level attributes. For detailed documentation on the Tags and Tag Groups schema go to https://github.com/beckn/protocol-specifications/discussions/316 */
TagGroup: {
/**
* @description Indicates the display properties of the tag group. If display is set to false, then the group will not be displayed. If it is set to true, it should be displayed. However, group-level display properties can be overriden by individual tag-level display property. As this schema is purely for catalog display purposes, it is not recommended to send this value during search.
* @default true
*/
display: boolean;
/** @description Description of the TagGroup, can be used to store detailed information. */
descriptor?: components["schemas"]["Descriptor"];
/** @description An array of Tag objects listed under this group. This property can be set by BAPs during search to narrow the `search` and achieve more relevant results. When received during `on_search`, BAPs must render this list under the heading described by the `name` property of this schema. */
list?: components["schemas"]["Tag"][];
};
/** @description Describes the acknowledgement sent in response to an API call. If the implementation uses HTTP/S, then Ack must be returned in the same session. Every API call to a BPP must be responded to with an Ack whether the BPP intends to respond with a callback or not. This has one property called `status` that indicates the status of the Acknowledgement. */
Ack: {
/**
* @description The status of the acknowledgement. If the request passes the validation criteria of the BPP, then this is set to ACK. If a BPP responds with status = `ACK` to a request, it is required to respond with a callback. If the request fails the validation criteria, then this is set to NACK. Additionally, if a BPP does not intend to respond with a callback even after the request meets the validation criteria, it should set this value to `NACK`.
* @enum {string}
*/
status?: "ACK" | "NACK";
/** @description A list of tags containing any additional information sent along with the Acknowledgement. */
tags?: components["schemas"]["TagGroup"][];
};
/** @description Describes an error object that is returned by a BAP, BPP or BG as a response or callback to an action by another network participant. This object is sent when any request received by a network participant is unacceptable. This object can be sent either during Ack or with the callback. */
Error: {
/** @description Standard error code. For full list of error codes, refer to docs/protocol-drafts/BECKN-005-ERROR-CODES-DRAFT-01.md of this repo" */
code?: string;
/** @description Path to json schema generating the error. Used only during json schema validation errors */
paths?: string;
/** @description Human readable message describing the error. Used mainly for logging. Not recommended to be shown to the user. */
message?: string;
};
/** @description Describes a selectable option */
Option: {
id?: string;
descriptor?: components["schemas"]["Descriptor"];
};
CancellationReasons: {
context: components["schemas"]["Context"] & {
/** @enum {unknown} */
action: "cancellation_reasons";
};
message: {
cancellation_reasons: components["schemas"]["Option"][];
};
};
GetReturnReasons: {
context: components["schemas"]["Context"] & {
/** @enum {unknown} */
action: "get_return_reasons";
};
};
ReturnReasons: {
context: components["schemas"]["Context"] & {
/** @enum {unknown} */
action: "return_reasons";
};
message: {
return_reasons: components["schemas"]["Option"][];
};
};
GetRatingCategories: {
context: components["schemas"]["Context"] & {
/** @enum {unknown} */
action: "get_rating_categories";
};
};
/**
* @description Category of the entity being rated
* @enum {string}
*/
rating_category: "Item" | "Order" | "Fulfillment" | "Provider" | "Agent" | "Support";
RatingCategories: {
context: components["schemas"]["Context"] & {
/** @enum {unknown} */
action: "rating_categories";
};
message: {
rating_categories?: components["schemas"]["rating_category"][];
};
};
/** @description Describes the rating of an entity */
Rating: {
/**
* @description Category of the entity being rated
* @enum {string}
*/
rating_category?: "Item" | "Order" | "Fulfillment" | "Provider" | "Agent" | "Support";
/** @description Id of the object being rated */
id?: string;
/** @description Rating value given to the object. This can be a single value or can also contain an inequality operator like gt, gte, lt, lte. This can also contain an inequality expression containing logical operators like && and ||. */
value?: string;
};
};
responses: {
/** @description Acknowledgement of message received after successful validation of schema and signature */
Response: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
message: {
ack: components["schemas"]["Ack"] & {
/** @enum {unknown} */
status?: "ACK" | "NACK";
};
};
error?: components["schemas"]["Error"];
};
};
};
};
parameters: never;
requestBodies: never;
headers: never;
pathItems: never;
};
export type $defs = Record<string, never>;
export type operations = Record<string, never>;