import { Methods } from "./methods.js"; import { OfferCode } from "./types/gumroad.js"; //#region src/offer-codes.d.ts /** Bindings for {@link OfferCode} */ interface OfferCodeProps { /** * Updates the offer code * * @param options Options * * @returns On success, a {@link OfferCode} */ update(options: { offer_code: string; } | { max_purchase_count: number; } | { offer_code: string; max_purchase_count: number; }, requestOptions?: { signal?: AbortSignal; }): Promise; /** * Deletes the offer code * * @returns On success, `true` */ delete(requestOptions?: { signal?: AbortSignal; }): Promise; } /** A class having API methods related to Offer Codes */ declare class OfferCodesMethods extends Methods { protected _bindOfferCode(offer_code: OfferCode, product_id: string): OfferCode & OfferCodeProps; /** * Retrieve all of the existing offer codes for a product. * * Either `amount_cents` or `percent_off` will be returned depending if the offer code is a fixed amount off or a percentage off. * * A universal offer code is one that applies to all products. * * @param product_id The id of the product * * @returns On success, a {@link OfferCode} * * @see https://app.gumroad.com/api#get-/products/:product_id/offer_codes */ list(product_id: string, { signal }?: { signal?: AbortSignal; }): Promise<(OfferCode & OfferCodeProps)[]>; /** * Retrieve the details of a specific offer code of a product * * @param product_id The id of the product * @param offer_code_id The id of the offer code * * @returns On success, a {@link OfferCode} * * @see https://app.gumroad.com/api#get-/products/:product_id/offer_codes/:id */ get(product_id: string, offer_code_id: string, { signal }?: { signal?: AbortSignal; }): Promise; /** * Create a new offer code for a product. * Default offer code is in cents. * A universal offer code is one that applies to all products. * * @param product_id The id of the product * @param name The name of the offer code * @param amount_off The amount depending on offer type * @param options (Optional) Options * * @returns On success, a {@link OfferCode} * * @see https://app.gumroad.com/api#post-/products/:product_id/offer_codes */ create(product_id: string, name: string, amount_off: number, options?: { /** * @default "cents" */ offer_type?: 'cents' | 'percent'; max_purchase_count?: number; universal?: boolean; }, { signal }?: { signal?: AbortSignal; }): Promise; /** * Edit an existing product's offer code. * * @param product_id The id of the product * @param offer_code_id The id of the offer code * @param options Options * * @returns On success, a {@link OfferCode} * * @see https://app.gumroad.com/api#put-/products/:product_id/offer_codes/:id */ update(product_id: string, offer_code_id: string, options: { offer_code: string; } | { max_purchase_count: number; } | { offer_code: string; max_purchase_count: number; }, { signal }?: { signal?: AbortSignal; }): Promise; /** * Permanently delete a product's offer code. * * @param product_id The id of the product * @param offer_code_id The id of the offer code * * @returns On success, `true` * * @see https://app.gumroad.com/api#delete-/products/:product_id/offer_codes/:id */ delete(product_id: string, offer_code_id: string, { signal }?: { signal?: AbortSignal; }): Promise; } //#endregion export { OfferCodeProps, OfferCodesMethods }; //# sourceMappingURL=offer-codes.d.ts.map