export type SubscriptionPricing = {currencyCode?: (string | null) | undefined, purchasePrice?: number | undefined, recommendedRetailPrice?: number | undefined}; export type ObjectReference = {id?: number | undefined, name?: (string | null) | undefined}; export type CustomerTenantReference = {id?: number | undefined}; export type ProductReference = {id?: number | undefined, partNumber?: (string | null) | undefined, publisherProductId?: (string | null) | undefined, itemLegalName?: (string | null) | undefined, itemName?: (string | null) | undefined}; export type SubscriptionStatus = 0 | 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128 | 256 | 446 | 511; export type ProvisionType = 0 | 1 | 2 | 3 | 4 | 5; export type SubscriptionTags = {subscriptionId?: number | undefined, costCenter?: (string | null) | undefined, department?: (string | null) | undefined, project?: (string | null) | undefined, custom?: (string | null) | undefined, owner?: (string | null) | undefined, createdDate?: string | undefined, modifiedDate?: string | undefined}; export type SubscriptionAddOn = {id?: number | undefined, publisherSubscriptionId?: (string | null) | undefined, publisherCustomerId?: (string | null) | undefined, name?: (string | null) | undefined, status?: SubscriptionStatus | undefined, quantity?: number | undefined, organization?: ObjectReference | undefined, orderId?: (string | null) | undefined, creationDate?: string | undefined, product?: ProductReference | undefined, publisher?: ObjectReference | undefined, markup?: number | undefined, subscriptionTags?: SubscriptionTags | undefined, termDuration?: (string | null) | undefined, autoRenewEnabled?: (boolean | null) | undefined, cancellationAllowedUntilDate?: (string | null) | undefined}; export type BillingCycleEnum = 0 | 1 | 2 | 3 | 4 | 5 | 7 | 8 | 9; export type SubscriptionPriceType = 1 | 2 | 3; export type Product = {productId?: (string | null) | undefined, skuId?: (string | null) | undefined, availabilityId?: (string | null) | undefined, billingCycle?: (string | null) | undefined, termDuration?: (string | null) | undefined}; export type ScheduledNextTermInstructions = {product?: Product | undefined, quantity?: number | undefined, customTermEndDate?: (string | null) | undefined}; export type SubscriptionRenewalType = 0 | 1 | 2; export type SubscriptionDetailed = {effectiveStartDate?: string | undefined, commitmentEndDate?: string | undefined, suspensionReasons?: (string | null) | undefined, originalAgreementId?: (number | null) | undefined, pricing?: SubscriptionPricing | undefined, attestationAccepted?: (boolean | null) | undefined, purchasePrice?: number | undefined, purchasePriceCurrency?: (string | null) | undefined, invoiceProfile?: ObjectReference | undefined, id?: number | undefined, publisherSubscriptionId?: (string | null) | undefined, entitlementId?: (string | null) | undefined, publisher?: ObjectReference | undefined, organization?: ObjectReference | undefined, customerTenant?: CustomerTenantReference | undefined, product?: ProductReference | undefined, quantity?: number | undefined, name?: (string | null) | undefined, status?: SubscriptionStatus | undefined, provisionType?: ProvisionType | undefined, availableAddonsCount?: number | undefined, subscriptions?: (Array | null) | undefined, orderId?: (string | null) | undefined, creationDate?: string | undefined, billingCycle?: BillingCycleEnum | undefined, markup?: number | undefined, isTrial?: boolean | undefined, startDate?: (string | null) | undefined, endDate?: (string | null) | undefined, priceType?: SubscriptionPriceType | undefined, salesPrice?: number | undefined, registeredForReservedInstance?: boolean | undefined, subscriptionTags?: SubscriptionTags | undefined, acceptAutoSuspension?: (boolean | null) | undefined, autoSuspensionDate?: (string | null) | undefined, partNumber?: (string | null) | undefined, termDuration?: (string | null) | undefined, termLifeCycleState?: (string | null) | undefined, autoRenewEnabled?: (boolean | null) | undefined, cancellationAllowedUntilDate?: (string | null) | undefined, scheduledNextTermInstructions?: ScheduledNextTermInstructions | undefined, maxEndCustomerQuantity?: (number | null) | undefined, renewalType?: SubscriptionRenewalType | undefined, renewalEffectiveDate?: (string | null) | undefined}; export type CreateApiApiV1SubscriptionsArgs = {body: SubscriptionDetailed}; export type CreateApiApiV1SubscriptionsOptions = {baseUrl: string, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * POST /api/v1/Subscriptions */ export const createApiApiV1Subscriptions = async (args: CreateApiApiV1SubscriptionsArgs, options: CreateApiApiV1SubscriptionsOptions) => { 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/Subscriptions${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 };