/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { basketOrdersAddOrders } from "../funcs/basketOrdersAddOrders.js"; import { basketOrdersCreateBasket } from "../funcs/basketOrdersCreateBasket.js"; import { basketOrdersGetBasket } from "../funcs/basketOrdersGetBasket.js"; import { basketOrdersListBasketOrders } from "../funcs/basketOrdersListBasketOrders.js"; import { basketOrdersListCompressedOrders } from "../funcs/basketOrdersListCompressedOrders.js"; import { basketOrdersRemoveOrders } from "../funcs/basketOrdersRemoveOrders.js"; import { basketOrdersSetExtraReportingData } from "../funcs/basketOrdersSetExtraReportingData.js"; import { basketOrdersSubmitBasket } from "../funcs/basketOrdersSubmitBasket.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import * as components from "../models/components/index.js"; import * as operations from "../models/operations/index.js"; import { unwrapAsync } from "../types/fp.js"; import { PageIterator, unwrapResultIterator } from "../types/operations.js"; export class BasketOrders extends ClientSDK { /** * Create Basket * * @remarks * Creates an empty basket * * Upon successful submission, if the request is a duplicate, returns the existing basket in its current state in the system. If the request is not a duplicate, returns the summary of the newly created basket. */ async createBasket( basketCreate: components.BasketCreate, correspondentId: string, options?: RequestOptions, ): Promise { return unwrapAsync(basketOrdersCreateBasket( this, basketCreate, correspondentId, options, )); } /** * Add Orders * * @remarks * Adds a list of basket orders to a basket * * Upon successful submission, returns the basket with a new total count of orders within the basket */ async addOrders( addOrdersRequestCreate: components.AddOrdersRequestCreate, correspondentId: string, basketId: string, options?: RequestOptions, ): Promise { return unwrapAsync(basketOrdersAddOrders( this, addOrdersRequestCreate, correspondentId, basketId, options, )); } /** * Get Basket * * @remarks * Gets a basket by basket ID. * * Upon successful submission, returns the details of the queried basket */ async getBasket( correspondentId: string, basketId: string, options?: RequestOptions, ): Promise { return unwrapAsync(basketOrdersGetBasket( this, correspondentId, basketId, options, )); } /** * Submit Basket * * @remarks * Submits a basket for execution in the market * * Upon successful submission, if the request is a duplicate, returns the existing basket in its current state in the system. If the request is not a duplicate, returns the summary of the newly submitted basket in a SUBMITTED state */ async submitBasket( submitBasketRequestCreate: components.SubmitBasketRequestCreate, correspondentId: string, basketId: string, options?: RequestOptions, ): Promise { return unwrapAsync(basketOrdersSubmitBasket( this, submitBasketRequestCreate, correspondentId, basketId, options, )); } /** * List Basket Orders * * @remarks * Gets a list of basket orders within a basket. * * Upon successful submission, returns a list of basket orders for the basket. If the list of basket orders becomes too large, a token is returned to retrieve the next page of basket orders. */ async listBasketOrders( request: operations.BasketOrdersServiceListBasketOrdersRequest, options?: RequestOptions, ): Promise< PageIterator< operations.BasketOrdersServiceListBasketOrdersResponse, { cursor: string } > > { return unwrapResultIterator(basketOrdersListBasketOrders( this, request, options, )); } /** * List Compressed Orders * * @remarks * Gets a list of compressed orders within a basket. * * Upon successful submission, returns a list of compressed orders for the basket. If the basket has not been submitted yet, this list will be empty. If the list of compressed orders becomes too large, a token is returned to retrieve the next page of compressed orders. */ async listCompressedOrders( correspondentId: string, basketId: string, pageSize?: number | undefined, pageToken?: string | undefined, options?: RequestOptions, ): Promise< PageIterator< operations.BasketOrdersServiceListCompressedOrdersResponse, { cursor: string } > > { return unwrapResultIterator(basketOrdersListCompressedOrders( this, correspondentId, basketId, pageSize, pageToken, options, )); } /** * Remove Basket Orders * * @remarks * Removes a list of basket orders by client order ID. * * Upon successful submission, returns the details of the removed basket orders. */ async removeOrders( removeOrdersRequestCreate: components.RemoveOrdersRequestCreate, correspondentId: string, basketId: string, options?: RequestOptions, ): Promise { return unwrapAsync(basketOrdersRemoveOrders( this, removeOrdersRequestCreate, correspondentId, basketId, options, )); } /** * Set Extra Reporting Data * * @remarks * Sets extra reporting data to an existing basket order. Any SetExtraReportingDataRequest must include the name of the order and the cancel_confirmed_time */ async setExtraReportingData( setExtraReportingDataRequestCreate: components.SetExtraReportingDataRequestCreate, correspondentId: string, basketId: string, options?: RequestOptions, ): Promise { return unwrapAsync(basketOrdersSetExtraReportingData( this, setExtraReportingDataRequestCreate, correspondentId, basketId, options, )); } }