export type PurchaseRequestOrderError = {orderGroupId?: (string | null) | undefined, code?: number | undefined, description?: (string | null) | undefined}; export type BillingCycleType = 0 | 1 | 2 | 3 | 4 | 5 | 6; export type AssetType = 1 | 2 | 3; export type AssetScope = 1 | 2 | 3; export type ResellerSalesPricePriceType = 1 | 2 | 3 | 4; export type AssetTags = {assetId?: number | undefined, costCenter?: (string | null) | undefined, department?: (string | null) | undefined, project?: (string | null) | undefined, custom?: (string | null) | undefined, owner?: (string | null) | undefined}; export type PurchaseRequestOrderLineError = {reasonCode?: (string | null) | undefined, description?: (string | null) | undefined, properties?: ({[key: string]: string} | null) | undefined}; export type PurchaseRequestOrderLine = {productId?: (string | null) | undefined, subscriptionId?: (number | null) | undefined, armRegionName?: (string | null) | undefined, skuId?: (string | null) | undefined, productVariantId?: (number | null) | undefined, quantity?: number | undefined, billingCycle?: BillingCycleType | undefined, provisioningContext?: ({[key: string]: string} | null) | undefined, type?: AssetType | undefined, requiresInventoryCheck?: boolean | undefined, catalogItemId?: (string | null) | undefined, termDuration?: (string | null) | undefined, scope?: AssetScope | undefined, resellerPriceType?: ResellerSalesPricePriceType | undefined, resellerPriceTypeValue?: (number | null) | undefined, isTrial?: boolean | undefined, name?: (string | null) | undefined, attestationAccepted?: (boolean | null) | undefined, tags?: AssetTags | undefined, errors?: (Array | null) | undefined, customTermEndDate?: (string | null) | undefined}; export type PurchaseRequestOrder = {externalOrderId?: (string | null) | undefined, countryCode?: (string | null) | undefined, resellerCustomerId?: number | undefined, adminAccount?: (string | null) | undefined, notificationEmail?: (string | null) | undefined, invoiceProfileId?: (number | null) | undefined, scheduledPurchaseDate?: (string | null) | undefined, errors?: (Array | null) | undefined, orderLines?: (Array | null) | undefined}; export type CreateApiApiV1PurchaseRequestCheckoutArgs = {body: PurchaseRequestOrder}; export type CreateApiApiV1PurchaseRequestCheckoutOptions = {baseUrl: string, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * POST /api/v1/PurchaseRequest/checkout */ export const createApiApiV1PurchaseRequestCheckout = async (args: CreateApiApiV1PurchaseRequestCheckoutArgs, options: CreateApiApiV1PurchaseRequestCheckoutOptions) => { const {baseUrl, fetch: fetchFn = fetch, Bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (Bearer !== undefined) headers.set("Authorization", Bearer) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/PurchaseRequest/checkout${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };