/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { buyersCreate } from "../funcs/buyersCreate.js"; import { buyersDelete } from "../funcs/buyersDelete.js"; import { buyersGet } from "../funcs/buyersGet.js"; import { buyersList } from "../funcs/buyersList.js"; import { buyersUpdate } from "../funcs/buyersUpdate.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"; import { Gr4vyGiftCards } from "./gr4vygiftcards.js"; import { Gr4vyPaymentMethods } from "./gr4vypaymentmethods.js"; import { ShippingDetails } from "./shippingdetails.js"; export class Buyers extends ClientSDK { private _paymentMethods?: Gr4vyPaymentMethods; get paymentMethods(): Gr4vyPaymentMethods { return (this._paymentMethods ??= new Gr4vyPaymentMethods(this._options)); } private _giftCards?: Gr4vyGiftCards; get giftCards(): Gr4vyGiftCards { return (this._giftCards ??= new Gr4vyGiftCards(this._options)); } private _shippingDetails?: ShippingDetails; get shippingDetails(): ShippingDetails { return (this._shippingDetails ??= new ShippingDetails(this._options)); } /** * List all buyers * * @remarks * List all buyers or search for a specific buyer. */ async list( request?: operations.ListBuyersRequest | undefined, options?: RequestOptions, ): Promise> { return unwrapResultIterator(buyersList( this, request, options, )); } /** * Add a buyer * * @remarks * Create a new buyer record. */ async create( buyerCreate: components.BuyerCreate, merchantAccountId?: string | null | undefined, options?: RequestOptions, ): Promise { return unwrapAsync(buyersCreate( this, buyerCreate, merchantAccountId, options, )); } /** * Get a buyer * * @remarks * Fetches a buyer by its ID. */ async get( buyerId: string, merchantAccountId?: string | null | undefined, options?: RequestOptions, ): Promise { return unwrapAsync(buyersGet( this, buyerId, merchantAccountId, options, )); } /** * Update a buyer * * @remarks * Updates a buyer record. */ async update( buyerUpdate: components.BuyerUpdate, buyerId: string, merchantAccountId?: string | null | undefined, options?: RequestOptions, ): Promise { return unwrapAsync(buyersUpdate( this, buyerUpdate, buyerId, merchantAccountId, options, )); } /** * Delete a buyer * * @remarks * Permanently removes a buyer record. */ async delete( buyerId: string, merchantAccountId?: string | null | undefined, options?: RequestOptions, ): Promise { return unwrapAsync(buyersDelete( this, buyerId, merchantAccountId, options, )); } }