bananas-commerce
Version:
A client for bananas-commerce with support for TypeScript
42 lines (41 loc) • 1.99 kB
TypeScript
import { components } from "../types/openapi.js";
import { CamelCasedObjectKeys } from "../util/casedObjectKeys.js";
import { paths } from "../types/openapi.js";
import { VariableResult } from "../util/formatVariableResult.js";
import { Extension } from "../extension.js";
import { CountryCode, CountryCodeArgs } from "../types/types.js";
export declare class Webshipper extends Extension<"webshipper", paths, {
countryCode: CountryCode;
}> {
readonly name = "webshipper";
shippingOptions(args: WebshipperShippingOptions.Args): Promise<WebshipperShippingOptions.Result>;
}
/** @see {@link Webshipper.shippingOptions} */
export declare namespace WebshipperShippingOptions {
type RawBody = CamelCasedObjectKeys<components["schemas"]["WebshipperCheckoutRequest"]>;
/** @see {@link Webshipper.shippingOptions} */
type Args = Omit<RawBody, "deliveryAddress"> & {
deliveryAddress: Omit<RawBody["deliveryAddress"], "countryCode">;
} & CountryCodeArgs;
/** @see {@link Webshipper.shippingOptions} */
type Result = VariableResult<{
success: ShipmentOptions;
"no-shipping-needed": NoShippingNeeded;
"invalid-args": NoShippingNeeded;
"not-found": NotFound;
unprocessable: Unprocessable;
"internal-error": InternalError;
}>;
/** `200` */
type ShipmentOptions = CamelCasedObjectKeys<components["schemas"]["WebshipperOptionsList"]>;
/** `204` */
type NoShippingNeeded = void;
/** `400` */
type Unprocessable = CamelCasedObjectKeys<components["schemas"]["ErrorDetail_LocationErrors_"]>;
/** `404` */
type NotFound = CamelCasedObjectKeys<components["schemas"]["ErrorDetail_str_"]>;
/** `503` */
type InternalError = CamelCasedObjectKeys<components["schemas"]["ErrorDetail_str_"]>;
/** A pick up location */
type PickupLocation = NonNullable<CamelCasedObjectKeys<components["schemas"]["WebshipperOptionsList"]>["results"][number]["pickupLocations"]>[number];
}