diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d5b83cd..6532950 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,3 +17,10 @@ jobs: - run: npm run build - run: npm run lint - run: npm run test + - name: Validate generated documentation + run: | + npm run generate:docs + if ! git diff --quiet; then + git --no-pager diff + exit 1 + fi \ No newline at end of file diff --git a/README.md b/README.md index d17526d..4cf5dca 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ Full documentation is located in the [`docs/`](docs/) folder: - [GLS Action Overview](docs/Actions/GLS/overview.md) - [GLS Configuration](docs/Actions/GLS/configs.md) - [GLS Functions](docs/Actions/GLS/functions.md) -- [GLS Types](docs/Actions/GLS/types.md) +- [GLS Types](docs/Actions/GLS/types.mdx) - [GLS Events](docs/Actions/GLS/events.md) - [Common Use Cases](docs/Actions/GLS/use-cases.md) - [Troubleshooting & Community Support](docs/Actions/GLS/troubleshooting.md) diff --git a/actions/gls-action/package.json b/actions/gls-action/package.json index 1e8868d..1fcf26d 100644 --- a/actions/gls-action/package.json +++ b/actions/gls-action/package.json @@ -9,6 +9,10 @@ "build": "vite build", "lint": "eslint .", "test": "vitest run", - "start": "node dist/main.js" + "start": "node dist/main.js", + "generate:docs": "npm run build && node dist/generateDocs.js" + }, + "dependencies": { + "ts-morph": "^27.0.2" } } diff --git a/actions/gls-action/scripts/generateDocs.ts b/actions/gls-action/scripts/generateDocs.ts new file mode 100644 index 0000000..27f8ffb --- /dev/null +++ b/actions/gls-action/scripts/generateDocs.ts @@ -0,0 +1,58 @@ +import {runStandardActionDocs, StandardActionDocsConfig} from "../../../src/standardActionDocs" +import {loadAllDefinitions} from "../src/helpers"; + +export function createGlsDocsConfig(): StandardActionDocsConfig { + return { + actionName: "GLS", + typePrefix: "GLS_", + typesOutputPath: "../../docs/Actions/GLS/types.mdx", + functionsOutputPath: "../../docs/Actions/GLS/functions.mdx", + loadAllDefinitions, + typeLinkOverrides: { + GLS_SHIPMENT_UNIT_SERVICE: "GLS_SHIPMENT_UNIT$Service", + }, + typesCopy: { + title: "Datatypes", + description: "All data types registered by the GLS Action.", + heading: "GLS Action Types", + intro: `The GLS Action registers the following data types with the Hercules platform. These types are used as inputs and outputs of the GLS functions and can be referenced in your flows.`, + }, + functionsCopy: { + title: "Functions", + description: "All functions registered by the GLS Action.", + intro: `The GLS Action exposes functions grouped into three categories: + +- **Builder functions** — Construct data objects (no API call) +- **Shipment functions** — Create different types of GLS shipments (calls GLS API) +- **API functions** — Query or modify shipments (calls GLS API)`, + }, + functionGroups: [ + { + heading: "Builder functions", + modules: import.meta.glob("../src/functions/utils/*.ts"), + }, + { + heading: "Shipment functions", + intro: `All shipment functions accept a common set of parameters in addition to their type-specific parameters. They call the GLS ShipIT API (\`POST /rs/shipments\`) and return a \`GLS_CREATE_PARCELS_RESPONSE\`. + +**Common parameters for all shipment functions:** + +| Parameter | Type | Required | Description | +|-------------------|-------------------------------|----------|----------------------------------------------------| +| \`shipment\` | GLS_SHIPMENT_WITHOUT_SERVICES | **Yes** | Shipment data (consignee, shipper, units, product) | +| \`printingOptions\` | GLS_PRINTING_OPTIONS | **Yes** | Label format settings | +| \`returnOptions\` | GLS_RETURN_OPTIONS | No | Whether to return print data and routing info | +| \`customContent\` | GLS_CUSTOM_CONTENT | No | Custom logo and barcode settings | + +---`, + modules: import.meta.glob("../src/functions/services/*.ts"), + }, + { + heading: "API functions", + modules: import.meta.glob("../src/functions/*.ts"), + }, + ], + } +} + +await runStandardActionDocs(createGlsDocsConfig()) diff --git a/actions/gls-action/src/functions/cancelShipment.ts b/actions/gls-action/src/functions/cancelShipment.ts index c08f9e9..a032f4a 100644 --- a/actions/gls-action/src/functions/cancelShipment.ts +++ b/actions/gls-action/src/functions/cancelShipment.ts @@ -7,6 +7,18 @@ export default (sdk: ActionSdk) => { { definition: { runtimeName: "cancelShipment", + documentation: [ + { + code: "en-US", + content: "Cancels an existing shipment by its Track ID. Only possible if the parcel has not yet been scanned." + } + ], + displayMessage: [ + { + code: "en-US", + content: "Cancel shipment" + } + ], name: [ { code: "en-US", @@ -16,7 +28,7 @@ export default (sdk: ActionSdk) => { description: [ { code: "en-US", - content: "Cancels a GLS shipment.", + content: "Cancels an existing shipment by its Track ID. Only possible if the parcel has not yet been scanned.", } ], signature: "(data: GLS_CANCEL_SHIPMENT_REQUEST_DATA): GLS_CANCEL_SHIPMENT_RESPONSE_DATA", diff --git a/actions/gls-action/src/functions/getAllowedServices.ts b/actions/gls-action/src/functions/getAllowedServices.ts index dad11a3..545242a 100644 --- a/actions/gls-action/src/functions/getAllowedServices.ts +++ b/actions/gls-action/src/functions/getAllowedServices.ts @@ -12,6 +12,18 @@ export default (sdk: ActionSdk) => { { definition: { runtimeName: "getAllowedServices", + documentation: [ + { + code: "en-US", + content: "Returns the GLS services available for a given origin/destination country and ZIP code combination." + } + ], + displayMessage: [ + { + code: "en-US", + content: "Get allowed services" + } + ], name: [ { code: "en-US", @@ -21,7 +33,7 @@ export default (sdk: ActionSdk) => { description: [ { code: "en-US", - content: "Returns the allowed GLS services for a given set of parameters.", + content: "Returns the GLS services available for a given origin/destination country and ZIP code combination.", } ], signature: "(data: GLS_ALLOWED_SERVICES_REQUEST_DATA): GLS_ALLOWED_SERVICES_RESPONSE_DATA", diff --git a/actions/gls-action/src/functions/getEndOfDayReport.ts b/actions/gls-action/src/functions/getEndOfDayReport.ts index 150fca0..9fe77b9 100644 --- a/actions/gls-action/src/functions/getEndOfDayReport.ts +++ b/actions/gls-action/src/functions/getEndOfDayReport.ts @@ -8,6 +8,18 @@ export default (sdk: ActionSdk) => { { definition: { runtimeName: "getEndOfDayReport", + documentation: [ + { + code: "en-US", + content: "Retrieves all shipments dispatched on a given date. Useful for reconciliation and end-of-day processing." + } + ], + displayMessage: [ + { + code: "en-US", + content: "Get end of day report" + } + ], name: [ { code: "en-US", @@ -17,7 +29,7 @@ export default (sdk: ActionSdk) => { description: [ { code: "en-US", - content: "Returns the GLS end of day report.", + content: "Retrieves all shipments dispatched on a given date. Useful for reconciliation and end-of-day processing.", } ], signature: "(data: GLS_END_OF_DAY_REQUEST_DATA): GLS_END_OF_DAY_RESPONSE_DATA", diff --git a/actions/gls-action/src/functions/reprintParcel.ts b/actions/gls-action/src/functions/reprintParcel.ts index 2270586..ea9fc86 100644 --- a/actions/gls-action/src/functions/reprintParcel.ts +++ b/actions/gls-action/src/functions/reprintParcel.ts @@ -12,6 +12,18 @@ export default (sdk: ActionSdk) => { { definition: { runtimeName: "reprintParcel", + documentation: [ + { + code: "en-US", + content: "Reprints the label for an existing parcel. Use this if the original label is damaged, lost, or needs to be printed in a different format." + } + ], + displayMessage: [ + { + code: "en-US", + content: "Reprint parcel" + } + ], name: [ { code: "en-US", @@ -21,7 +33,7 @@ export default (sdk: ActionSdk) => { description: [ { code: "en-US", - content: "Reprints the labels for a GLS parcel.", + content: "Reprints the label for an existing parcel. Use this if the original label is damaged, lost, or needs to be printed in a different format.", } ], signature: "(data: GLS_REPRINT_PARCEL_REQUEST_DATA): GLS_REPRINT_PARCEL_RESPONSE_DATA", diff --git a/actions/gls-action/src/functions/services/createAddresseeOnlyShipment.ts b/actions/gls-action/src/functions/services/createAddresseeOnlyShipment.ts index 866a3b3..6b9f5cb 100644 --- a/actions/gls-action/src/functions/services/createAddresseeOnlyShipment.ts +++ b/actions/gls-action/src/functions/services/createAddresseeOnlyShipment.ts @@ -15,6 +15,18 @@ export default (sdk: ActionSdk) => { { definition: { runtimeName: "createAddresseeOnlyShipment", + documentation: [ + { + code: "en-US", + content: "Creates a shipment that can only be delivered to the named addressee (no neighbor delivery)." + } + ], + displayMessage: [ + { + code: "en-US", + content: "Create addressee only shipment" + } + ], name: [ { code: "en-US", @@ -24,7 +36,7 @@ export default (sdk: ActionSdk) => { description: [ { code: "en-US", - content: "Creates a GLS addressee only shipment.", + content: "Creates a shipment that can only be delivered to the named addressee (no neighbor delivery).", } ], signature: `(${DEFAULT_SIGNATURE_FOR_SERVICES}): GLS_CREATE_PARCELS_RESPONSE`, @@ -44,4 +56,5 @@ export default (sdk: ActionSdk) => { } }, ) -} \ No newline at end of file +} + diff --git a/actions/gls-action/src/functions/services/createDeliveryAtWorkShipment.ts b/actions/gls-action/src/functions/services/createDeliveryAtWorkShipment.ts index 2e48ea6..75be85b 100644 --- a/actions/gls-action/src/functions/services/createDeliveryAtWorkShipment.ts +++ b/actions/gls-action/src/functions/services/createDeliveryAtWorkShipment.ts @@ -15,6 +15,18 @@ export default (sdk: ActionSdk) => { { definition: { runtimeName: "createDeliveryAtWorkShipment", + documentation: [ + { + code: "en-US", + content: "Delivers a parcel to a specific location within a workplace (building, floor, room)." + } + ], + displayMessage: [ + { + code: "en-US", + content: "Create delivery at work shipment" + } + ], name: [ { code: "en-US", @@ -24,7 +36,7 @@ export default (sdk: ActionSdk) => { description: [ { code: "en-US", - content: "Creates a GLS delivery at work shipment.", + content: "Delivers a parcel to a specific location within a workplace (building, floor, room).", } ], signature: `(recipientName: string, building: string, floor: number, ${DEFAULT_SIGNATURE_FOR_SERVICES}, alternateRecipientName?: string, room?: number, phonenumber?: string): GLS_CREATE_PARCELS_RESPONSE`, diff --git a/actions/gls-action/src/functions/services/createDeliveryNextWorkingDayShipment.ts b/actions/gls-action/src/functions/services/createDeliveryNextWorkingDayShipment.ts index d3edcc9..845ddaa 100644 --- a/actions/gls-action/src/functions/services/createDeliveryNextWorkingDayShipment.ts +++ b/actions/gls-action/src/functions/services/createDeliveryNextWorkingDayShipment.ts @@ -15,6 +15,18 @@ export default (sdk: ActionSdk) => { { definition: { runtimeName: "createDeliveryNextWorkingDayShipment", + documentation: [ + { + code: "en-US", + content: "Creates an EXPRESS shipment for delivery on the next working day (EOB service)." + } + ], + displayMessage: [ + { + code: "en-US", + content: "Create delivery next working day shipment" + } + ], name: [ { code: "en-US", @@ -24,7 +36,7 @@ export default (sdk: ActionSdk) => { description: [ { code: "en-US", - content: "Creates a GLS delivery next working day shipment.", + content: "Creates an EXPRESS shipment for delivery on the next working day (EOB service).", } ], signature: `(${DEFAULT_SIGNATURE_FOR_SERVICES}): GLS_CREATE_PARCELS_RESPONSE`, diff --git a/actions/gls-action/src/functions/services/createDeliverySaturdayShipment.ts b/actions/gls-action/src/functions/services/createDeliverySaturdayShipment.ts index 59ec597..ba00235 100644 --- a/actions/gls-action/src/functions/services/createDeliverySaturdayShipment.ts +++ b/actions/gls-action/src/functions/services/createDeliverySaturdayShipment.ts @@ -16,6 +16,18 @@ export default (sdk: ActionSdk) => { { definition: { runtimeName: "createDeliverySaturdayShipment", + documentation: [ + { + code: "en-US", + content: "Creates an EXPRESS shipment for Saturday delivery." + } + ], + displayMessage: [ + { + code: "en-US", + content: "Create delivery Saturday shipment" + } + ], name: [ { code: "en-US", @@ -25,7 +37,7 @@ export default (sdk: ActionSdk) => { description: [ { code: "en-US", - content: "Creates a GLS delivery Saturday shipment.", + content: "Creates an EXPRESS shipment for Saturday delivery.", } ], signature: `(${DEFAULT_SIGNATURE_FOR_SERVICES}): GLS_CREATE_PARCELS_RESPONSE`, diff --git a/actions/gls-action/src/functions/services/createDepositShipment.ts b/actions/gls-action/src/functions/services/createDepositShipment.ts index 2964d0d..2307cbf 100644 --- a/actions/gls-action/src/functions/services/createDepositShipment.ts +++ b/actions/gls-action/src/functions/services/createDepositShipment.ts @@ -16,6 +16,18 @@ export default (sdk: ActionSdk) => { { definition: { runtimeName: "createDepositShipment", + documentation: [ + { + code: "en-US", + content: "Delivers a parcel to a designated deposit location (e.g. a garage or shed) without requiring a signature." + } + ], + displayMessage: [ + { + code: "en-US", + content: "Create deposit shipment" + } + ], name: [ { code: "en-US", @@ -25,7 +37,7 @@ export default (sdk: ActionSdk) => { description: [ { code: "en-US", - content: "Creates a GLS deposit shipment.", + content: "Delivers a parcel to a designated deposit location (e.g. a garage or shed) without requiring a signature.", } ], signature: `(placeOfDeposit: string, ${DEFAULT_SIGNATURE_FOR_SERVICES}): GLS_CREATE_PARCELS_RESPONSE`, diff --git a/actions/gls-action/src/functions/services/createExchangeShipment.ts b/actions/gls-action/src/functions/services/createExchangeShipment.ts index 7b99638..e9060e5 100644 --- a/actions/gls-action/src/functions/services/createExchangeShipment.ts +++ b/actions/gls-action/src/functions/services/createExchangeShipment.ts @@ -16,6 +16,18 @@ export default (sdk: ActionSdk) => { { definition: { runtimeName: "createExchangeShipment", + documentation: [ + { + code: "en-US", + content: "Delivers a new parcel while simultaneously picking up an existing one (exchange)." + } + ], + displayMessage: [ + { + code: "en-US", + content: "Create exchange shipment" + } + ], name: [ { code: "en-US", @@ -25,7 +37,7 @@ export default (sdk: ActionSdk) => { description: [ { code: "en-US", - content: "Creates a GLS exchange shipment.", + content: "Delivers a new parcel while simultaneously picking up an existing one (exchange).", } ], signature: `(address: GLS_ADDRESS, ${DEFAULT_SIGNATURE_FOR_SERVICES}, expectedWeight?: number): GLS_CREATE_PARCELS_RESPONSE`, diff --git a/actions/gls-action/src/functions/services/createFlexDeliveryShipment.ts b/actions/gls-action/src/functions/services/createFlexDeliveryShipment.ts index 99f5c29..9be4468 100644 --- a/actions/gls-action/src/functions/services/createFlexDeliveryShipment.ts +++ b/actions/gls-action/src/functions/services/createFlexDeliveryShipment.ts @@ -15,6 +15,18 @@ export default (sdk: ActionSdk) => { { definition: { runtimeName: "createFlexDeliveryShipment", + documentation: [ + { + code: "en-US", + content: "Creates a shipment with flexible delivery - the recipient can redirect or reschedule delivery." + } + ], + displayMessage: [ + { + code: "en-US", + content: "Create flex delivery shipment" + } + ], name: [ { code: "en-US", @@ -24,7 +36,7 @@ export default (sdk: ActionSdk) => { description: [ { code: "en-US", - content: "Creates a GLS flex delivery shipment.", + content: "Creates a shipment with flexible delivery - the recipient can redirect or reschedule delivery.", } ], signature: `(${DEFAULT_SIGNATURE_FOR_SERVICES}): GLS_CREATE_PARCELS_RESPONSE`, diff --git a/actions/gls-action/src/functions/services/createGuaranteed24Shipment.ts b/actions/gls-action/src/functions/services/createGuaranteed24Shipment.ts index 880bad9..f4ce626 100644 --- a/actions/gls-action/src/functions/services/createGuaranteed24Shipment.ts +++ b/actions/gls-action/src/functions/services/createGuaranteed24Shipment.ts @@ -15,6 +15,18 @@ export default (sdk: ActionSdk) => { { definition: { runtimeName: "createGuaranteed24Shipment", + documentation: [ + { + code: "en-US", + content: "Creates a shipment with guaranteed delivery within 24 hours." + } + ], + displayMessage: [ + { + code: "en-US", + content: "Create guaranteed 24 shipment" + } + ], name: [ { code: "en-US", @@ -24,7 +36,7 @@ export default (sdk: ActionSdk) => { description: [ { code: "en-US", - content: "Creates a GLS guaranteed 24 shipment.", + content: "Creates a shipment with guaranteed delivery within 24 hours.", } ], signature: `(${DEFAULT_SIGNATURE_FOR_SERVICES}): GLS_CREATE_PARCELS_RESPONSE`, diff --git a/actions/gls-action/src/functions/services/createIdentPinShipment.ts b/actions/gls-action/src/functions/services/createIdentPinShipment.ts index 7f0a031..881fe57 100644 --- a/actions/gls-action/src/functions/services/createIdentPinShipment.ts +++ b/actions/gls-action/src/functions/services/createIdentPinShipment.ts @@ -16,6 +16,18 @@ export default (sdk: ActionSdk) => { { definition: { runtimeName: "createIdentPinShipment", + documentation: [ + { + code: "en-US", + content: "Delivers a parcel with PIN and optional birthdate verification." + } + ], + displayMessage: [ + { + code: "en-US", + content: "Create ident pin shipment" + } + ], name: [ { code: "en-US", @@ -25,7 +37,7 @@ export default (sdk: ActionSdk) => { description: [ { code: "en-US", - content: "Creates a GLS ident pin shipment.", + content: "Delivers a parcel with PIN and optional birthdate verification.", } ], signature: `(pin: string, ${DEFAULT_SIGNATURE_FOR_SERVICES}, birthDate: string): GLS_CREATE_PARCELS_RESPONSE`, diff --git a/actions/gls-action/src/functions/services/createIdentShipment.ts b/actions/gls-action/src/functions/services/createIdentShipment.ts index a0ea990..f1b99c1 100644 --- a/actions/gls-action/src/functions/services/createIdentShipment.ts +++ b/actions/gls-action/src/functions/services/createIdentShipment.ts @@ -16,6 +16,18 @@ export default (sdk: ActionSdk) => { { definition: { runtimeName: "createIdentShipment", + documentation: [ + { + code: "en-US", + content: "Delivers a parcel with identity verification - the driver checks the recipient's ID document." + } + ], + displayMessage: [ + { + code: "en-US", + content: "Create ident shipment" + } + ], name: [ { code: "en-US", @@ -25,7 +37,7 @@ export default (sdk: ActionSdk) => { description: [ { code: "en-US", - content: "Creates a GLS ident shipment.", + content: "Delivers a parcel with identity verification - the driver checks the recipient's ID document.", } ], signature: `(birthDate: string, firstName: string, lastName: string, nationality: string, ${DEFAULT_SIGNATURE_FOR_SERVICES}): GLS_CREATE_PARCELS_RESPONSE`, diff --git a/actions/gls-action/src/functions/services/createPickAndShipShipment.ts b/actions/gls-action/src/functions/services/createPickAndShipShipment.ts index f1f101d..0836c80 100644 --- a/actions/gls-action/src/functions/services/createPickAndShipShipment.ts +++ b/actions/gls-action/src/functions/services/createPickAndShipShipment.ts @@ -15,6 +15,18 @@ export default (sdk: ActionSdk) => { { definition: { runtimeName: "createPickAndShipShipment", + documentation: [ + { + code: "en-US", + content: "Schedules a pickup from the consignee's address on a given date." + } + ], + displayMessage: [ + { + code: "en-US", + content: "Create pick and ship shipment" + } + ], name: [ { code: "en-US", @@ -24,7 +36,7 @@ export default (sdk: ActionSdk) => { description: [ { code: "en-US", - content: "Creates a GLS pick and ship shipment.", + content: "Schedules a pickup from the consignee's address on a given date.", } ], signature: `(pickupDate: string, ${DEFAULT_SIGNATURE_FOR_SERVICES}): GLS_CREATE_PARCELS_RESPONSE`, diff --git a/actions/gls-action/src/functions/services/createShopDeliveryShipment.ts b/actions/gls-action/src/functions/services/createShopDeliveryShipment.ts index 3595eaf..5e241e6 100644 --- a/actions/gls-action/src/functions/services/createShopDeliveryShipment.ts +++ b/actions/gls-action/src/functions/services/createShopDeliveryShipment.ts @@ -14,6 +14,18 @@ export default (sdk: ActionSdk) => { { definition: { runtimeName: "createShopDeliveryShipment", + documentation: [ + { + code: "en-US", + content: "Delivers a parcel to a GLS Parcel Shop where the recipient can collect it." + } + ], + displayMessage: [ + { + code: "en-US", + content: "Create shop delivery shipment" + } + ], name: [ { code: "en-US", @@ -23,7 +35,7 @@ export default (sdk: ActionSdk) => { description: [ { code: "en-US", - content: "Creates a GLS shop delivery shipment.", + content: "Delivers a parcel to a GLS Parcel Shop where the recipient can collect it.", } ], signature: `(parcelShopId: string, ${DEFAULT_SIGNATURE_FOR_SERVICES}): GLS_CREATE_PARCELS_RESPONSE`, @@ -59,7 +71,3 @@ export default (sdk: ActionSdk) => { }, ) } - - - - diff --git a/actions/gls-action/src/functions/services/createShopReturnShipment.ts b/actions/gls-action/src/functions/services/createShopReturnShipment.ts index df3a823..dd86205 100644 --- a/actions/gls-action/src/functions/services/createShopReturnShipment.ts +++ b/actions/gls-action/src/functions/services/createShopReturnShipment.ts @@ -15,6 +15,18 @@ export default (sdk: ActionSdk) => { { definition: { runtimeName: "createShopReturnShipment", + documentation: [ + { + code: "en-US", + content: "Creates a return shipment from a GLS Parcel Shop (customer drops off parcel at a shop)." + } + ], + displayMessage: [ + { + code: "en-US", + content: "Create shop return shipment" + } + ], name: [ { code: "en-US", @@ -24,23 +36,23 @@ export default (sdk: ActionSdk) => { description: [ { code: "en-US", - content: "Creates a GLS shop return shipment.", + content: "Creates a return shipment from a GLS Parcel Shop (customer drops off parcel at a shop).", } ], signature: `(numberOfLabels: number, ${DEFAULT_SIGNATURE_FOR_SERVICES}, returnQR: "PDF" | "PNG" | "ZPL"): GLS_CREATE_PARCELS_RESPONSE`, parameters: [ { - runtimeName: "parcelShopId", + runtimeName: "numberOfLabels", name: [ { code: "en-US", - content: "Parcel shop Id", + content: "The number of labels", } ], description: [ { code: "en-US", - content: "The ID of the parcel shop where the shipment should be delivered.", + content: "The number of labels to be created for the return shipment.", } ] }, diff --git a/actions/gls-action/src/functions/services/createSignatureShipment.ts b/actions/gls-action/src/functions/services/createSignatureShipment.ts index 2842f38..396bb9a 100644 --- a/actions/gls-action/src/functions/services/createSignatureShipment.ts +++ b/actions/gls-action/src/functions/services/createSignatureShipment.ts @@ -15,6 +15,18 @@ export default (sdk: ActionSdk) => { { definition: { runtimeName: "createSignatureShipment", + documentation: [ + { + code: "en-US", + content: "Creates a shipment that requires a recipient signature upon delivery." + } + ], + displayMessage: [ + { + code: "en-US", + content: "Create signature shipment" + } + ], name: [ { code: "en-US", @@ -24,7 +36,7 @@ export default (sdk: ActionSdk) => { description: [ { code: "en-US", - content: "Creates a GLS signature shipment.", + content: "Creates a shipment that requires a recipient signature upon delivery.", } ], signature: `(${DEFAULT_SIGNATURE_FOR_SERVICES}): GLS_CREATE_PARCELS_RESPONSE`, diff --git a/actions/gls-action/src/functions/services/createTyreShipment.ts b/actions/gls-action/src/functions/services/createTyreShipment.ts index 4e47b37..faf6837 100644 --- a/actions/gls-action/src/functions/services/createTyreShipment.ts +++ b/actions/gls-action/src/functions/services/createTyreShipment.ts @@ -15,6 +15,18 @@ export default (sdk: ActionSdk) => { { definition: { runtimeName: "createTyreShipment", + documentation: [ + { + code: "en-US", + content: "Creates a shipment specifically for tyre/wheel delivery (uses the GLS TyreService)." + } + ], + displayMessage: [ + { + code: "en-US", + content: "Create tyre shipment" + } + ], name: [ { code: "en-US", @@ -24,7 +36,7 @@ export default (sdk: ActionSdk) => { description: [ { code: "en-US", - content: "Creates a GLS tyre shipment.", + content: "Creates a shipment specifically for tyre/wheel delivery (uses the GLS TyreService).", } ], signature: `(${DEFAULT_SIGNATURE_FOR_SERVICES}): GLS_CREATE_PARCELS_RESPONSE`, diff --git a/actions/gls-action/src/functions/updateParcelWeight.ts b/actions/gls-action/src/functions/updateParcelWeight.ts index 3fbbbfa..f1cb59b 100644 --- a/actions/gls-action/src/functions/updateParcelWeight.ts +++ b/actions/gls-action/src/functions/updateParcelWeight.ts @@ -12,6 +12,18 @@ export default (sdk: ActionSdk) => { { definition: { runtimeName: "updateParcelWeight", + documentation: [ + { + code: "en-US", + content: "Updates the weight of an already-created parcel. Useful when the final weight is only known after packaging." + } + ], + displayMessage: [ + { + code: "en-US", + content: "Update parcel weight" + } + ], name: [ { code: "en-US", @@ -21,7 +33,7 @@ export default (sdk: ActionSdk) => { description: [ { code: "en-US", - content: "Updates the weight of a GLS parcel.", + content: "Updates the weight of an already-created parcel. Useful when the final weight is only known after packaging.", } ], signature: "(data: GLS_UPDATE_PARCEL_WEIGHT_REQUEST_DATA): GLS_END_OF_DAY_RESPONSE_DATA", diff --git a/actions/gls-action/src/functions/utils/createAddress.ts b/actions/gls-action/src/functions/utils/createAddress.ts index 77e0461..10d3f7d 100644 --- a/actions/gls-action/src/functions/utils/createAddress.ts +++ b/actions/gls-action/src/functions/utils/createAddress.ts @@ -2,11 +2,23 @@ import {ActionSdk} from "@code0-tech/hercules"; import {AddressSchema} from "../../types/glsAddress"; export default (sdk: ActionSdk) => { - sdk.registerFunctionDefinitions( + return sdk.registerFunctionDefinitions( { definition: { runtimeName: "createAddress", - signature: "Name1: string, CountryCode: string, City: string, Street: string, ZIPCode: string, Name2?: string, Name3?: string, Province?: string, StreetNumber?: string, ContactPerson?: string, FixedLinePhonenumber?: string, MobilePhonenumber?: string, Email?: string): GLS_ADDRESS", + documentation: [ + { + code: "en-US", + content: "Creates a GLS address object (`GLS_ADDRESS`) for use in shipments as consignee, shipper, or return address." + } + ], + displayMessage: [ + { + code: "en-US", + content: "Create address" + } + ], + signature: "(Name1: string, CountryCode: string, City: string, Street: string, ZIPCode: string, Name2?: string, Name3?: string, Province?: string, StreetNumber?: string, ContactPerson?: string, FixedLinePhonenumber?: string, MobilePhonenumber?: string, Email?: string): GLS_ADDRESS", name: [ { code: "en-US", diff --git a/actions/gls-action/src/functions/utils/createConsignee.ts b/actions/gls-action/src/functions/utils/createConsignee.ts index eab02a9..6f5f166 100644 --- a/actions/gls-action/src/functions/utils/createConsignee.ts +++ b/actions/gls-action/src/functions/utils/createConsignee.ts @@ -3,10 +3,22 @@ import {AddressSchema} from "../../types/glsAddress"; import {ConsigneeSchema} from "../../types/glsConsignee"; export default (sdk: ActionSdk) => { - sdk.registerFunctionDefinitions( + return sdk.registerFunctionDefinitions( { definition: { runtimeName: "createConsignee", + documentation: [ + { + code: "en-US", + content: "Creates a GLS consignee (recipient) object for use in shipments." + } + ], + displayMessage: [ + { + code: "en-US", + content: "Create consignee" + } + ], name: [ { code: "en-US", @@ -16,7 +28,7 @@ export default (sdk: ActionSdk) => { description: [ { code: "en-US", - content: "Creates a GLS consignee object which can be used for shipments.", + content: "Creates a GLS consignee (recipient) object for use in shipments.", } ], signature: "(consigneeId: string, costCenter: string, Address: GLS_ADDRESS, Category: \"BUSINESS\"|\"PRIVATE\"): GLS_CONSIGNEE", diff --git a/actions/gls-action/src/functions/utils/createCustomContent.ts b/actions/gls-action/src/functions/utils/createCustomContent.ts index 898e656..23d597b 100644 --- a/actions/gls-action/src/functions/utils/createCustomContent.ts +++ b/actions/gls-action/src/functions/utils/createCustomContent.ts @@ -6,6 +6,18 @@ export default (sdk: ActionSdk) => { { definition: { runtimeName: "createCustomContent", + documentation: [ + { + code: "en-US", + content: "Creates custom content settings for GLS labels, including logos and barcodes." + } + ], + displayMessage: [ + { + code: "en-US", + content: "Create custom content" + } + ], signature: "(barcodeContentType: \"TRACK_ID\"|\"GLS_SHIPMENT_REFERENCE\", customerLogo: string, hideShipperAddress?: boolean, barcodeType?: \"EAN_128\"|\"CODE_39\", barcode?: string): GLS_CUSTOM_CONTENT", name: [ { diff --git a/actions/gls-action/src/functions/utils/createPrintingOptions.ts b/actions/gls-action/src/functions/utils/createPrintingOptions.ts index d41f551..d4a1170 100644 --- a/actions/gls-action/src/functions/utils/createPrintingOptions.ts +++ b/actions/gls-action/src/functions/utils/createPrintingOptions.ts @@ -2,10 +2,22 @@ import {ActionSdk} from "@code0-tech/hercules"; import {PrintingOptions, ReturnLabels} from "../../types/glsPrintingOptions"; export default (sdk: ActionSdk) => { - sdk.registerFunctionDefinitions( + return sdk.registerFunctionDefinitions( { definition: { runtimeName: "createPrintingOptions", + documentation: [ + { + code: "en-US", + content: "Creates GLS printing options that control how labels are generated." + } + ], + displayMessage: [ + { + code: "en-US", + content: "Create printing options" + } + ], signature: "(returnLabels: RETURN_LABELS): GLS_PRINTING_OPTIONS", name: [ { diff --git a/actions/gls-action/src/functions/utils/createShipmentUnit.ts b/actions/gls-action/src/functions/utils/createShipmentUnit.ts index 9d145c7..75c0368 100644 --- a/actions/gls-action/src/functions/utils/createShipmentUnit.ts +++ b/actions/gls-action/src/functions/utils/createShipmentUnit.ts @@ -3,10 +3,22 @@ import { UnitService } from "../../types/glsUnitService"; import {ShipmentUnit} from "../../types/glsShipmentUnit"; export default (sdk: ActionSdk) => { - sdk.registerFunctionDefinitions( + return sdk.registerFunctionDefinitions( { definition: { runtimeName: "createShipmentUnit", + documentation: [ + { + code: "en-US", + content: "Creates a GLS shipment unit (an individual parcel within a shipment)." + } + ], + displayMessage: [ + { + code: "en-US", + content: "Create shipment unit" + } + ], signature: "(weight: number, shipmentUnitReference?: string, partnerParcelNumber?: string, note1?: string, note2?: string, shipmentUnitService: GLS_SHIPMENT_UNIT_SERVICE): GLS_SHIPMENT_UNIT", name: [ { diff --git a/actions/gls-action/src/functions/validateShipment.ts b/actions/gls-action/src/functions/validateShipment.ts index 5088640..153d48c 100644 --- a/actions/gls-action/src/functions/validateShipment.ts +++ b/actions/gls-action/src/functions/validateShipment.ts @@ -12,6 +12,18 @@ export default (sdk: ActionSdk) => { { definition: { runtimeName: "validateShipment", + documentation: [ + { + code: "en-US", + content: "Validates a shipment against the GLS API without creating it. Use this before `createShipment` functions to catch errors early." + } + ], + displayMessage: [ + { + code: "en-US", + content: "Validate shipment" + } + ], name: [ { code: "en-US", @@ -21,7 +33,7 @@ export default (sdk: ActionSdk) => { description: [ { code: "en-US", - content: "Validates a GLS shipment.", + content: "Validates a shipment against the GLS API without creating it. Use this before `createShipment` functions to catch errors early.", } ], signature: "(data: GLS_VALIDATE_SHIPMENT_REQUEST_DATA): GLS_VALIDATE_SHIPMENT_RESPONSE_DATA", diff --git a/actions/gls-action/src/index.ts b/actions/gls-action/src/index.ts index f7bae4b..ad330bf 100644 --- a/actions/gls-action/src/index.ts +++ b/actions/gls-action/src/index.ts @@ -18,6 +18,7 @@ async function main() { console.error(error) } } + main().catch(err => { console.error(err) process.exit(1) diff --git a/actions/gls-action/src/types/glsAddress.ts b/actions/gls-action/src/types/glsAddress.ts index c75eb2c..05f5a86 100644 --- a/actions/gls-action/src/types/glsAddress.ts +++ b/actions/gls-action/src/types/glsAddress.ts @@ -3,19 +3,44 @@ import z from "zod" import {singleZodSchemaToTypescriptDef} from "../helpers"; export const AddressSchema = z.object({ - Name1: z.string().max(40), - Name2: z.string().max(40).optional(), - Name3: z.string().max(40).optional(), - CountryCode: z.string().max(2), - Province: z.string().max(40).optional(), - City: z.string().max(40), - Street: z.string().min(4), - StreetNumber: z.string().max(40).optional(), - ContactPerson: z.string().max(40).min(6).optional(), - FixedLinePhonenumber: z.string().max(35).min(4).optional(), - MobilePhonenumber: z.string().max(35).min(4).optional(), - eMail: z.string().max(80).optional(), - ZIPCode: z.string().max(10), + Name1: z.string().max(40).describe(` + @description Primary name line (person or company). Max 40 characters. + `), + Name2: z.string().max(40).optional().describe(` + @description Optional second name line (e.g., department or additional identifier). Max 40 characters. + `), Name3: z.string().max(40).optional().describe(` + @description Optional third name line for extended address details. Max 40 characters. + `), + CountryCode: z.string().max(2).describe(` + @description Two-letter ISO country code (e.g., DE, US). + `), + Province: z.string().max(40).optional().describe(` + @description State, province, or region. Optional field. Max 40 characters. + `), + City: z.string().max(40).describe(` + @description City or locality name. Max 40 characters. + `), + Street: z.string().min(4).describe(` + @description Street name. Minimum 4 characters required. + `), + StreetNumber: z.string().max(40).optional().describe(` + @description House or building number. Optional field. Max 40 characters. + `), + ContactPerson: z.string().max(40).min(6).optional().describe(` + @description Full name of a contact person. Optional field. Must be between 6 and 40 characters. + `), + FixedLinePhonenumber: z.string().max(35).min(4).optional().describe(` + @description Landline phone number. Optional field. Must be between 4 and 35 characters. + `), + MobilePhonenumber: z.string().max(35).min(4).optional().describe(` + @description Mobile phone number. Optional field. Must be between 4 and 35 characters. + `), + eMail: z.string().max(80).optional().describe(` + @description Email address. Optional field. Max 80 characters. + `), + ZIPCode: z.string().max(10).describe(` + @description Postal or ZIP code. Max 10 characters. + `), }) export type AddressSchema = z.infer diff --git a/actions/gls-action/src/types/glsEndOfDayRequest.ts b/actions/gls-action/src/types/glsEndOfDayRequest.ts index 50f4964..81b62bb 100644 --- a/actions/gls-action/src/types/glsEndOfDayRequest.ts +++ b/actions/gls-action/src/types/glsEndOfDayRequest.ts @@ -1,5 +1,5 @@ import {ActionSdk} from "@code0-tech/hercules"; -import {singleZodSchemaToTypescriptDef} from "../helpers"; +import {singleZodSchemaToTypescriptDef, zodSchemaToTypescriptDefs} from "../helpers"; import z from "zod"; import {AddressSchema} from "./glsAddress"; @@ -50,10 +50,13 @@ export default (sdk: ActionSdk) => { }, { identifier: "GLS_END_OF_DAY_RESPONSE_DATA", - type: singleZodSchemaToTypescriptDef( + type: zodSchemaToTypescriptDefs( "GLS_END_OF_DAY_RESPONSE_DATA", - EndOfDayResponseDataSchema - ), + EndOfDayResponseDataSchema, + { + GLS_ADDRESS: AddressSchema + } + ).get("GLS_END_OF_DAY_RESPONSE_DATA")!, name: [ { code: "en-US", diff --git a/actions/gls-action/src/types/glsPrintingOptions.ts b/actions/gls-action/src/types/glsPrintingOptions.ts index 1abd541..9d59be3 100644 --- a/actions/gls-action/src/types/glsPrintingOptions.ts +++ b/actions/gls-action/src/types/glsPrintingOptions.ts @@ -1,14 +1,16 @@ import {ActionSdk} from "@code0-tech/hercules"; -import {singleZodSchemaToTypescriptDef} from "../helpers"; +import {singleZodSchemaToTypescriptDef, zodSchemaToTypescriptDefs} from "../helpers"; import {z} from "zod"; +export const ReturnLabelsSchema = z.object({ + TemplateSet: z.enum([ + "NONE", "D_200", "PF_4_I", "PF_4_I_200", "PF_4_I_300", "PF_8_D_200", "T_200_BF", "T_300_BF", "ZPL_200", "ZPL_200_TRACKID_EAN_128", "ZPL_200_TRACKID_CODE_39", "ZPL_200_REFNO_EAN_128", "ZPL_200_REFNO_CODE_39", "ZPL_300", "ZPL_300_TRACKID_EAN_128", "ZPL_300_TRACKID_CODE_39", "ZPL_300_REFNO_EAN_128", "ZPL_300_REFNO_CODE_39" + ]), + LabelFormat: z.enum(["PDF", "ZEBRA", "INTERMEC", "DATAMAX", "TOSHIBA", "PNG"]) +}) + export const PrintingOptionsSchema = z.object({ - ReturnLabels: z.object({ - TemplateSet: z.enum([ - "NONE", "D_200", "PF_4_I", "PF_4_I_200", "PF_4_I_300", "PF_8_D_200", "T_200_BF", "T_300_BF", "ZPL_200", "ZPL_200_TRACKID_EAN_128", "ZPL_200_TRACKID_CODE_39", "ZPL_200_REFNO_EAN_128", "ZPL_200_REFNO_CODE_39", "ZPL_300", "ZPL_300_TRACKID_EAN_128", "ZPL_300_TRACKID_CODE_39", "ZPL_300_REFNO_EAN_128", "ZPL_300_REFNO_CODE_39" - ]), - LabelFormat: z.enum(["PDF", "ZEBRA", "INTERMEC", "DATAMAX", "TOSHIBA", "PNG"]) - }).optional(), + ReturnLabels: ReturnLabelsSchema.optional(), useDefault: z.string().max(7).optional(), DefinePrinter: z.object({ LabelPrinter: z.string().max(255).optional(), @@ -16,16 +18,37 @@ export const PrintingOptionsSchema = z.object({ }).optional(), }) export type PrintingOptions = z.infer -export type ReturnLabels = z.infer +export type ReturnLabels = z.infer export default (sdk: ActionSdk) => { return sdk.registerDataTypes( + { + identifier: "RETURN_LABELS", + type: singleZodSchemaToTypescriptDef("RETURN_LABELS", + ReturnLabelsSchema + ), + name: [ + { + code: "en-US", + content: "Return Labels" + } + ], + displayMessage: [ + { + code: "en-US", + content: "Return Labels" + } + ] + }, { identifier: "GLS_PRINTING_OPTIONS", - type: singleZodSchemaToTypescriptDef( + type: zodSchemaToTypescriptDefs( "GLS_PRINTING_OPTIONS", - PrintingOptionsSchema - ), + PrintingOptionsSchema, + { + RETURN_LABELS: ReturnLabelsSchema + } + ).get("GLS_PRINTING_OPTIONS")!, name: [ { code: "en-US", diff --git a/actions/gls-action/src/types/glsShipment.ts b/actions/gls-action/src/types/glsShipment.ts index 1e328f2..e245db9 100644 --- a/actions/gls-action/src/types/glsShipment.ts +++ b/actions/gls-action/src/types/glsShipment.ts @@ -12,12 +12,12 @@ export const ShipmentSchema = z.object({ ShipmentDate: z.date().optional(), IncotermCode: z.int().max(99).optional(), Identifier: z.string().max(40).optional(), - Product: z.enum(["PARCEL", "EXPRESS"]), + Product: z.enum(["PARCEL", "EXPRESS"]).default("PARCEL"), ExpressAltDeliveryAllowed: z.boolean().optional(), Consignee: ConsigneeSchema, Shipper: ShipperSchema.optional(), Carrier: z.enum(["ROYALMAIL"]).optional(), - ShipmentUnit: ShipmentUnitSchema, + ShipmentUnit: z.lazy(() => ShipmentUnitSchema), Service: z.lazy(() => ShipmentServiceSchema), Return: z.object({ Address: AddressSchema @@ -30,7 +30,7 @@ export const InternalShipmentSchma = ShipmentSchema.extend({ Middleware: z.string().max(40), Shipper: InternalShipperSchema, Service: z.lazy(() => InternalShipmentServiceSchema), - ShipmentUnit: InternalShipmentUnitSchema + ShipmentUnit: z.lazy(() => InternalShipmentUnitSchema) }) export default (sdk: ActionSdk) => { diff --git a/actions/gls-action/src/types/glsShipmentService.ts b/actions/gls-action/src/types/glsShipmentService.ts index 5f85514..c65ccf1 100644 --- a/actions/gls-action/src/types/glsShipmentService.ts +++ b/actions/gls-action/src/types/glsShipmentService.ts @@ -1,8 +1,5 @@ import z from "zod"; import {AddressSchema} from "./glsAddress"; -import {zodSchemaToTypescriptDefs} from "../helpers"; -import {ShipmentSchema} from "./glsShipment"; -import {ActionSdk} from "@code0-tech/hercules"; export const ShipmentServiceSchema = z.array(z.object({ @@ -185,33 +182,3 @@ export const InternalShipmentServiceSchema = z.array(z.object({ serviceName: z.string().default("service_Saturday"), }).optional(), })).optional() - -export default (sdk: ActionSdk) => { - return sdk.registerDataTypes( - { - identifier: "GLS_SHIPMENT_SERVICE", - type: zodSchemaToTypescriptDefs( - "XXX", - ShipmentSchema, - { - GLS_SHIPMENT_SERVICE: ShipmentServiceSchema, - } - ).get("GLS_SHIPMENT_SERVICE")!, // Hacky way because shipment service is defined as an array - name: [ - { - code: "en-US", - content: "Shipment Service" - } - ], - displayMessage: [ - { - code: "en-US", - content: "Shipment Service" - } - ], - linkedDataTypes: [ - "GLS_ADDRESS" - ] - }, - ) -} diff --git a/actions/gls-action/src/types/glsUnitService.ts b/actions/gls-action/src/types/glsUnitService.ts index 8976cde..050fe26 100644 --- a/actions/gls-action/src/types/glsUnitService.ts +++ b/actions/gls-action/src/types/glsUnitService.ts @@ -5,7 +5,7 @@ import {ActionSdk} from "@code0-tech/hercules"; export const UnitServiceSchema = z.array(z.object({ Cash: z.object({ - Reason: z.string().max(160), + Reason: z.string().max(160).describe("@description Test"), Amount: z.number().min(1), Currency: z.string().max(3).min(3) }).optional(), diff --git a/actions/gls-action/test/index.test.ts b/actions/gls-action/test/index.test.ts index b1e74c4..f11dcc9 100644 --- a/actions/gls-action/test/index.test.ts +++ b/actions/gls-action/test/index.test.ts @@ -53,6 +53,7 @@ describe("withSdkMock", () => { }); await sdk.registerFlowTypes({ + signature: "", identifier: "Flow1", editable: false, }); @@ -62,7 +63,7 @@ describe("withSdkMock", () => { ]); expect(state.flowTypes).toEqual([ - {identifier: "Flow1", editable: false}, + {identifier: "Flow1", editable: false, signature: ""}, ]); }); @@ -94,6 +95,7 @@ describe("withSdkMock", () => { state.registeredFunctionDefinitions?.forEach(value => { expect(value.definition.name || [], `${value.definition.runtimeName}: Name should be set`).not.toHaveLength(0) expect(value.definition.description || [], `${value.definition.runtimeName}: Description should be set`).not.toHaveLength(0) + expect(value.definition.documentation || [], `${value.definition.runtimeName}: Documentation should be set`).not.toHaveLength(0) value.definition.parameters?.forEach(param => { expect(param.name || [], `${value.definition.runtimeName} parameter ${param.runtimeName}: Name should be set`).not.toHaveLength(0) expect(param.description || [], `${value.definition.runtimeName} parameter ${param.runtimeName}: Description should be set`).not.toHaveLength(0) diff --git a/actions/gls-action/tsconfig.json b/actions/gls-action/tsconfig.json index 8394117..d3ec800 100644 --- a/actions/gls-action/tsconfig.json +++ b/actions/gls-action/tsconfig.json @@ -3,5 +3,5 @@ "compilerOptions": { "outDir": "dist" }, - "include": ["src"] + "include": ["src", "scripts"] } \ No newline at end of file diff --git a/actions/gls-action/vite.config.ts b/actions/gls-action/vite.config.ts index f584efa..7ab94be 100644 --- a/actions/gls-action/vite.config.ts +++ b/actions/gls-action/vite.config.ts @@ -10,6 +10,7 @@ export default defineConfig({ rollupOptions: { input: { main: resolve(__dirname, 'src/index.ts'), + generateDocs: resolve(__dirname, 'scripts/generateDocs.ts') }, external: [ 'fs', diff --git a/docs/Actions/GLS/configs.md b/docs/Actions/GLS/configs.md index 20d3de5..fa374e1 100644 --- a/docs/Actions/GLS/configs.md +++ b/docs/Actions/GLS/configs.md @@ -107,4 +107,4 @@ The value must be a valid `GLS_SHIPPER` object: } ``` -See [Types — GLS_SHIPPER](types.md#GLS_SHIPPER) for the full field reference. +See [Types — GLS_SHIPPER](types.mdx#GLS_SHIPPER) for the full field reference. diff --git a/docs/Actions/GLS/functions.md b/docs/Actions/GLS/functions.md deleted file mode 100644 index 7633a68..0000000 --- a/docs/Actions/GLS/functions.md +++ /dev/null @@ -1,653 +0,0 @@ ---- -title: Functions -description: All functions available in the GLS Action with detailed descriptions, parameters, and data flow diagrams. ---- - -# Functions - -The GLS Action exposes **26 functions** grouped into three categories: - -- **Builder functions** — Construct data objects (no API call) -- **Shipment functions** — Create different types of GLS shipments (calls GLS API) -- **API functions** — Query or modify shipments (calls GLS API) - ---- - -## Builder functions - -### `createAddress` - -Creates a GLS address object (`GLS_ADDRESS`) for use in shipments as consignee, shipper, or return address. - -**Signature:** -``` -createAddress( - Name1: string, - CountryCode: string, - City: string, - Street: string, - ZIPCode: string, - Name2?: string, - Name3?: string, - Province?: string, - StreetNumber?: string, - ContactPerson?: string, - FixedLinePhonenumber?: string, - MobilePhonenumber?: string, - Email?: string -): GLS_ADDRESS -``` - -**Parameters:** - -| Parameter | Type | Required | Description | -|-----------|------|----------|-------------| -| `Name1` | string (max 40) | **Yes** | Primary name (recipient or company name) | -| `CountryCode` | string (max 2) | **Yes** | ISO alpha-2 country code (e.g. `DE`, `FR`, `GB`) | -| `City` | string (max 40) | **Yes** | City name | -| `Street` | string (min 4) | **Yes** | Street name | -| `ZIPCode` | string (max 10) | **Yes** | Postal/ZIP code | -| `Name2` | string (max 40) | No | Additional name line (e.g. department) | -| `Name3` | string (max 40) | No | Additional name line (e.g. c/o) | -| `Province` | string (max 40) | No | State or province | -| `StreetNumber` | string (max 40) | No | House/building number | -| `ContactPerson` | string (min 6, max 40) | No | Contact person at this address | -| `FixedLinePhonenumber` | string (min 4, max 35) | No | Landline phone number | -| `MobilePhonenumber` | string (min 4, max 35) | No | Mobile phone number | -| `eMail` | string (max 80) | No | Email address | - -**Returns:** [`GLS_ADDRESS`](types.md#GLS_ADDRESS) - ---- - -### `createConsignee` - -Creates a GLS consignee (recipient) object for use in shipments. - -**Signature:** -``` -createConsignee( - consigneeId: string, - costCenter: string, - AddressSchema: GLS_ADDRESS, - Category: "BUSINESS" | "PRIVATE" -): GLS_CONSIGNEE -``` - -**Parameters:** - -| Parameter | Type | Required | Description | -|-----------|------|----------|-------------| -| `consigneeId` | string (max 40) | **Yes** | Unique ID for the consignee (your internal customer ID) | -| `costCenter` | string (max 80) | **Yes** | Cost center for billing purposes | -| `AddressSchema` | GLS_ADDRESS | **Yes** | The delivery address for this consignee | -| `Category` | `"BUSINESS"` \| `"PRIVATE"` | **Yes** | Whether the consignee is a business or private recipient | - -**Returns:** [`GLS_CONSIGNEE`](types.md#GLS_CONSIGNEE) - ---- - -### `createShipmentUnit` - -Creates a GLS shipment unit (an individual parcel within a shipment). - -**Signature:** -``` -createShipmentUnit( - weight: number, - shipmentUnitReference?: string, - partnerParcelNumber?: string, - note1?: string, - note2?: string, - shipmentUnitService: GLS_UNIT_SERVICE -): GLS_SHIPMENT_UNIT -``` - -**Parameters:** - -| Parameter | Type | Required | Description | -|-----------|------|----------|-------------| -| `weight` | number (0.10–99) | **Yes** | Weight of the parcel in kilograms | -| `shipmentUnitReference` | string (max 40) | No | Your internal reference for this parcel | -| `partnerParcelNumber` | string (max 50) | No | Partner-assigned parcel number | -| `note1` | string (max 50) | No | Additional note printed on the label (line 1) | -| `note2` | string (max 50) | No | Additional note printed on the label (line 2) | -| `shipmentUnitService` | GLS_UNIT_SERVICE | No | Unit-level services (Cash, AddonLiability, HazardousGoods, etc.) | - -**Returns:** [`GLS_SHIPMENT_UNIT`](types.md#GLS_SHIPMENT_UNIT) - ---- - -### `createPrintingOptions` - -Creates GLS printing options that control how labels are generated. - -**Signature:** -``` -createPrintingOptions(returnLabels: RETURN_LABELS): GLS_PRINTING_OPTIONS -``` - -**Parameters:** - -| Parameter | Type | Required | Description | -|-----------|------|----------|-------------| -| `returnLabels` | RETURN_LABELS | **Yes** | Label format configuration | - -`RETURN_LABELS` fields: - -| Field | Values | Description | -|-------|--------|-------------| -| `TemplateSet` | `NONE`, `D_200`, `PF_4_I`, `ZPL_200`, `ZPL_300`, ... | Label template set | -| `LabelFormat` | `PDF`, `ZEBRA`, `INTERMEC`, `DATAMAX`, `TOSHIBA`, `PNG` | Output format | - -**Returns:** [`GLS_PRINTING_OPTIONS`](types.md#GLS_PRINTING_OPTIONS) - ---- - -### `createCustomContent` - -Creates custom content settings for GLS labels, including logos and barcodes. - -**Signature:** -``` -createCustomContent( - barcodeContentType: "TRACK_ID" | "GLS_SHIPMENT_REFERENCE", - customerLogo: string, - hideShipperAddress?: boolean, - barcodeType?: "EAN_128" | "CODE_39", - barcode?: string -): GLS_CUSTOM_CONTENT -``` - -**Parameters:** - -| Parameter | Type | Required | Description | -|-----------|------|----------|-------------| -| `barcodeContentType` | `"TRACK_ID"` \| `"GLS_SHIPMENT_REFERENCE"` | **Yes** | What the barcode encodes | -| `customerLogo` | string | **Yes** | Base64-encoded customer logo image | -| `hideShipperAddress` | boolean | No | Hide the shipper address on the label | -| `barcodeType` | `"EAN_128"` \| `"CODE_39"` | No | Barcode symbology | -| `barcode` | string | No | Custom barcode value | - -**Returns:** [`GLS_CUSTOM_CONTENT`](types.md#GLS_CUSTOM_CONTENT) - ---- - -## Shipment functions - -All shipment functions accept a common set of parameters in addition to their type-specific parameters. They call the GLS ShipIT API (`POST /rs/shipments`) and return a `GLS_CREATE_PARCELS_RESPONSE`. - -**Common parameters for all shipment functions:** - -| Parameter | Type | Required | Description | -|-------------------|-------------------------------|----------|----------------------------------------------------| -| `shipment` | GLS_SHIPMENT_WITHOUT_SERVICES | **Yes** | Shipment data (consignee, shipper, units, product) | -| `printingOptions` | GLS_PRINTING_OPTIONS | **Yes** | Label format settings | -| `returnOptions` | GLS_RETURN_OPTIONS | No | Whether to return print data and routing info | -| `customContent` | GLS_CUSTOM_CONTENT | No | Custom logo and barcode settings | - ---- - -### `createShopDeliveryShipment` - -Delivers a parcel to a GLS Parcel Shop where the recipient can collect it. - -**Signature:** -``` -createShopDeliveryShipment( - parcelShopId: string, - shipment: GLS_SHIPMENT_WITHOUT_SERVICES, - printingOptions: GLS_PRINTING_OPTIONS, - returnOptions?: GLS_RETURN_OPTIONS, - customContent?: GLS_CUSTOM_CONTENT -): GLS_CREATE_PARCELS_RESPONSE -``` - -| Parameter | Type | Required | Description | -|-----------|------|----------|-------------| -| `parcelShopId` | string | **Yes** | ID of the target GLS Parcel Shop | - -**Data flow:** -``` -createShopDeliveryShipment - │ - ├── Service: [{ ShopDelivery: { ParcelShopID } }] - │ - └── POST /rs/shipments → GLS_CREATE_PARCELS_RESPONSE -``` - ---- - -### `createShopReturnShipment` - -Creates a return shipment from a GLS Parcel Shop (customer drops off parcel at a shop). - -**Signature:** -``` -createShopReturnShipment( - numberOfLabels: number, - shipment: GLS_SHIPMENT_WITHOUT_SERVICES, - printingOptions: GLS_PRINTING_OPTIONS, - returnOptions?: GLS_RETURN_OPTIONS, - customContent?: GLS_CUSTOM_CONTENT, - returnQR?: "PDF" | "PNG" | "ZPL" -): GLS_CREATE_PARCELS_RESPONSE -``` - -| Parameter | Type | Required | Description | -|-----------|------|----------|-------------| -| `numberOfLabels` | number | **Yes** | Number of return labels to generate | -| `returnQR` | `"PDF"` \| `"PNG"` \| `"ZPL"` | No | Format of the QR code for the return | - ---- - -### `createExchangeShipment` - -Delivers a new parcel while simultaneously picking up an existing one (exchange). - -**Signature:** -``` -createExchangeShipment( - address: GLS_ADDRESS, - shipment: GLS_SHIPMENT_WITHOUT_SERVICES, - printingOptions: GLS_PRINTING_OPTIONS, - returnOptions?: GLS_RETURN_OPTIONS, - customContent?: GLS_CUSTOM_CONTENT, - expectedWeight?: number -): GLS_CREATE_PARCELS_RESPONSE -``` - -| Parameter | Type | Required | Description | -|-----------|------|----------|-------------| -| `address` | GLS_ADDRESS | **Yes** | AddressSchema for the exchange pickup | -| `expectedWeight` | number (min 1) | No | Expected weight of the parcel being returned | - ---- - -### `createDeliveryAtWorkShipment` - -Delivers a parcel to a specific location within a workplace (building, floor, room). - -**Signature:** -``` -createDeliveryAtWorkShipment( - recipientName: string, - building: string, - floor: number, - shipment: GLS_SHIPMENT_WITHOUT_SERVICES, - printingOptions: GLS_PRINTING_OPTIONS, - returnOptions?: GLS_RETURN_OPTIONS, - customContent?: GLS_CUSTOM_CONTENT, - alternateRecipientName?: string, - room?: number, - phonenumber?: string -): GLS_CREATE_PARCELS_RESPONSE -``` - -| Parameter | Type | Required | Description | -|-----------|------|----------|-------------| -| `recipientName` | string (max 40) | **Yes** | Name of the recipient at work | -| `building` | string (max 40) | **Yes** | Building name or number | -| `floor` | number | **Yes** | Floor number | -| `alternateRecipientName` | string (max 40) | No | Alternate recipient if primary is unavailable | -| `room` | number | No | Room number | -| `phonenumber` | string (max 35) | No | Contact phone number | - ---- - -### `createDepositShipment` - -Delivers a parcel to a designated deposit location (e.g. a garage or shed) without requiring a signature. - -**Signature:** -``` -createDepositShipment( - placeOfDeposit: string, - shipment: GLS_SHIPMENT_WITHOUT_SERVICES, - printingOptions: GLS_PRINTING_OPTIONS, - returnOptions?: GLS_RETURN_OPTIONS, - customContent?: GLS_CUSTOM_CONTENT -): GLS_CREATE_PARCELS_RESPONSE -``` - -| Parameter | Type | Required | Description | -|-----------|------|----------|-------------| -| `placeOfDeposit` | string (max 121) | **Yes** | Description of where to deposit the parcel | - ---- - -### `createIdentShipment` - -Delivers a parcel with identity verification — the driver checks the recipient's ID document. - -**Signature:** -``` -createIdentShipment( - birthDate: string, - firstName: string, - lastName: string, - nationality: string, - shipment: GLS_SHIPMENT_WITHOUT_SERVICES, - printingOptions: GLS_PRINTING_OPTIONS, - returnOptions?: GLS_RETURN_OPTIONS, - customContent?: GLS_CUSTOM_CONTENT -): GLS_CREATE_PARCELS_RESPONSE -``` - -| Parameter | Type | Required | Description | -|-----------|------|----------|-------------| -| `birthDate` | ISO date string | **Yes** | Recipient's date of birth | -| `firstName` | string (max 40) | **Yes** | Recipient's first name | -| `lastName` | string (max 40) | **Yes** | Recipient's last name | -| `nationality` | string (max 2) | **Yes** | ISO alpha-2 nationality code | - ---- - -### `createIdentPinShipment` - -Delivers a parcel with PIN and optional birthdate verification. - -**Signature:** -``` -createIdentPinShipment( - pin: string, - shipment: GLS_SHIPMENT_WITHOUT_SERVICES, - printingOptions: GLS_PRINTING_OPTIONS, - returnOptions?: GLS_RETURN_OPTIONS, - customContent?: GLS_CUSTOM_CONTENT, - birthDate?: string -): GLS_CREATE_PARCELS_RESPONSE -``` - -| Parameter | Type | Required | Description | -|-----------|------|----------|-------------| -| `pin` | string (max 4) | **Yes** | 4-digit PIN to verify with recipient | -| `birthDate` | ISO date string | No | Recipient's date of birth (additional check) | - ---- - -### `createPickAndShipShipment` - -Schedules a pickup from the consignee's address on a given date. - -**Signature:** -``` -createPickAndShipShipment( - pickupDate: string, - shipment: GLS_SHIPMENT_WITHOUT_SERVICES, - printingOptions: GLS_PRINTING_OPTIONS, - returnOptions?: GLS_RETURN_OPTIONS, - customContent?: GLS_CUSTOM_CONTENT -): GLS_CREATE_PARCELS_RESPONSE -``` - -| Parameter | Type | Required | Description | -|-----------|------|----------|-------------| -| `pickupDate` | ISO date string | **Yes** | Date when GLS will pick up the parcel | - ---- - -### `createFlexDeliveryShipment` - -Creates a shipment with flexible delivery — the recipient can redirect or reschedule delivery. - -**Signature:** -``` -createFlexDeliveryShipment( - shipment: GLS_SHIPMENT_WITHOUT_SERVICES, - printingOptions: GLS_PRINTING_OPTIONS, - returnOptions?: GLS_RETURN_OPTIONS, - customContent?: GLS_CUSTOM_CONTENT -): GLS_CREATE_PARCELS_RESPONSE -``` - -No additional parameters beyond the common ones. - ---- - -### `createSignatureShipment` - -Creates a shipment that requires a recipient signature upon delivery. - -**Signature:** -``` -createSignatureShipment( - shipment: GLS_SHIPMENT_WITHOUT_SERVICES, - printingOptions: GLS_PRINTING_OPTIONS, - returnOptions?: GLS_RETURN_OPTIONS, - customContent?: GLS_CUSTOM_CONTENT -): GLS_CREATE_PARCELS_RESPONSE -``` - -No additional parameters beyond the common ones. - ---- - -### `createGuaranteed24Shipment` - -Creates a shipment with guaranteed delivery within 24 hours. - -**Signature:** -``` -createGuaranteed24Shipment( - shipment: GLS_SHIPMENT_WITHOUT_SERVICES, - printingOptions: GLS_PRINTING_OPTIONS, - returnOptions?: GLS_RETURN_OPTIONS, - customContent?: GLS_CUSTOM_CONTENT -): GLS_CREATE_PARCELS_RESPONSE -``` - -No additional parameters beyond the common ones. - ---- - -### `createAddresseeOnlyShipment` - -Creates a shipment that can only be delivered to the named addressee (no neighbor delivery). - -**Signature:** -``` -createAddresseeOnlyShipment( - shipment: GLS_SHIPMENT_WITHOUT_SERVICES, - printingOptions: GLS_PRINTING_OPTIONS, - returnOptions?: GLS_RETURN_OPTIONS, - customContent?: GLS_CUSTOM_CONTENT -): GLS_CREATE_PARCELS_RESPONSE -``` - -No additional parameters beyond the common ones. - ---- - -### `createTyreShipment` - -Creates a shipment specifically for tyre/wheel delivery (uses the GLS TyreService). - -**Signature:** -``` -createTyreShipment( - shipment: GLS_SHIPMENT_WITHOUT_SERVICES, - printingOptions: GLS_PRINTING_OPTIONS, - returnOptions?: GLS_RETURN_OPTIONS, - customContent?: GLS_CUSTOM_CONTENT -): GLS_CREATE_PARCELS_RESPONSE -``` - -No additional parameters beyond the common ones. - ---- - -### `createDeliveryNextWorkingDayShipment` - -Creates an **EXPRESS** shipment for delivery on the next working day (EOB service). - -> **Requirement:** The shipment's `Product` field must be set to `"EXPRESS"`. Setting it to `"PARCEL"` will throw an `INVALID_PRODUCT` error. - -**Signature:** -``` -createDeliveryNextWorkingDayShipment( - shipment: GLS_SHIPMENT_WITHOUT_SERVICES, - printingOptions: GLS_PRINTING_OPTIONS, - returnOptions?: GLS_RETURN_OPTIONS, - customContent?: GLS_CUSTOM_CONTENT -): GLS_CREATE_PARCELS_RESPONSE -``` - ---- - -### `createDeliverySaturdayShipment` - -Creates an **EXPRESS** shipment for Saturday delivery. - -> **Requirement:** The shipment's `Product` field must be set to `"EXPRESS"`. Setting it to `"PARCEL"` will throw an `INVALID_PRODUCT` error. - -**Signature:** -``` -createDeliverySaturdayShipment( - shipment: GLS_SHIPMENT_WITHOUT_SERVICES, - printingOptions: GLS_PRINTING_OPTIONS, - returnOptions?: GLS_RETURN_OPTIONS, - customContent?: GLS_CUSTOM_CONTENT -): GLS_CREATE_PARCELS_RESPONSE -``` - ---- - -## API functions - -### `validateShipment` - -Validates a shipment against the GLS API without creating it. Use this before `createShipment*` functions to catch errors early. - -**Signature:** -``` -validateShipment(data: GLS_VALIDATE_SHIPMENT_REQUEST_DATA): GLS_VALIDATE_SHIPMENT_RESPONSE_DATA -``` - -**Data flow:** -``` -validateShipment - │ - └── POST /rs/shipments/validate - │ - ▼ - GLS_VALIDATE_SHIPMENT_RESPONSE_DATA - ├── success: boolean - └── validationResult.Issues[] -``` - -See [Types — GLS_VALIDATE_SHIPMENT_REQUEST_DATA](types.md#GLS_VALIDATE_SHIPMENT_REQUEST_DATA) for the input format. - ---- - -### `cancelShipment` - -Cancels an existing shipment by its Track ID. Only possible if the parcel has not yet been scanned. - -**Signature:** -``` -cancelShipment(data: GLS_CANCEL_SHIPMENT_REQUEST_DATA): GLS_CANCEL_SHIPMENT_RESPONSE_DATA -``` - -**Data flow:** -``` -cancelShipment({ TrackID }) - │ - └── POST /rs/shipments/cancel/{TrackID} - │ - ▼ - GLS_CANCEL_SHIPMENT_RESPONSE_DATA - ├── TrackID - └── result: "CANCELLED" | "CANCELLATION_PENDING" | "SCANNED" | "ERROR" -``` - ---- - -### `getAllowedServices` - -Returns the GLS services available for a given origin/destination country and ZIP code combination. - -**Signature:** -``` -getAllowedServices(data: GLS_ALLOWED_SERVICES_REQUEST_DATA): GLS_ALLOWED_SERVICES_RESPONSE_DATA -``` - -**Data flow:** -``` -getAllowedServices({ Source, Destination, ContactID? }) - │ - └── GET /rs/shipments/allowedservices - │ - ▼ - GLS_ALLOWED_SERVICES_RESPONSE_DATA - └── AllowedServices[]: { ServiceName } | { ProductName } -``` - ---- - -### `getEndOfDayReport` - -Retrieves all shipments dispatched on a given date. Useful for reconciliation and end-of-day processing. - -**Signature:** -``` -getEndOfDayReport(data: GLS_END_OF_DAY_REQUEST_DATA): GLS_END_OF_DAY_RESPONSE_DATA -``` - -**Data flow:** -``` -getEndOfDayReport({ date }) - │ - └── GET /rs/shipments/endofday?date={date} - │ - ▼ - GLS_END_OF_DAY_RESPONSE_DATA - └── Shipments[]: { ShippingDate, Product, ConsigneeSchema, ShipperSchema, ShipmentUnit[] } -``` - ---- - -### `updateParcelWeight` - -Updates the weight of an already-created parcel. Useful when the final weight is only known after packaging. - -**Signature:** -``` -updateParcelWeight(data: GLS_UPDATE_PARCEL_WEIGHT_REQUEST_DATA): GLS_UPDATE_PARCEL_WEIGHT_RESPONSE_DATA -``` - -**Data flow:** -``` -updateParcelWeight({ TrackID, Weight }) - │ - └── POST /rs/shipments/updateparcelweight - │ - ▼ - GLS_UPDATE_PARCEL_WEIGHT_RESPONSE_DATA - └── UpdatedWeight: string -``` - ---- - -### `reprintParcel` - -Reprints the label for an existing parcel. Use this if the original label is damaged, lost, or needs to be printed in a different format. - -**Signature:** -``` -reprintParcel(data: GLS_REPRINT_PARCEL_REQUEST_DATA): GLS_REPRINT_PARCEL_RESPONSE_DATA -``` - -**Data flow:** -``` -reprintParcel({ TrackID, CreationDate, PrintingOptions }) - │ - └── POST /rs/shipments/reprintparcel - │ - ▼ - GLS_REPRINT_PARCEL_RESPONSE_DATA - └── CreatedShipment - ├── ParcelData[].TrackID - ├── ParcelData[].Barcodes - └── PrintData[].Data ← new base64-encoded label -``` diff --git a/docs/Actions/GLS/functions.mdx b/docs/Actions/GLS/functions.mdx new file mode 100644 index 0000000..798ed9f --- /dev/null +++ b/docs/Actions/GLS/functions.mdx @@ -0,0 +1,2924 @@ +--- +title: Functions +description: All functions registered by the GLS Action. +--- + +The GLS Action exposes functions grouped into three categories: + +- **Builder functions** — Construct data objects (no API call) +- **Shipment functions** — Create different types of GLS shipments (calls GLS API) +- **API functions** — Query or modify shipments (calls GLS API) + +--- + +## Builder functions + + +### `createShipmentUnit` + +| Parameter | Name | Type | Required | Description | +| --- | --- | --- | --- | --- | +| weight | Weight (kg) | number | Yes | The weight of the shipment unit in kilograms. Must be a positive number and greater than 0.10 and less than 99. | +| shipmentUnitReference | Shipment unit reference | string | No | The reference for the shipment unit. Max length is 40 characters. | +| partnerParcelNumber | Partner parcel number | string | No | The partner parcel number for the shipment unit. Max length is 50 characters. | +| note1 | Note 1 | string | No | Note 1 for the shipment unit. Max length is 50 characters. | +| note2 | Note 2 | string | No | Note 2 for the shipment unit. Max length is 50 characters. | +| shipmentUnitService | Shipment unit service | [GLS_SHIPMENT_UNIT$Service](./types.mdx#gls_shipment_unitservice) | Yes | The service associated with the shipment unit. | + +Return Type: [GLS_SHIPMENT_UNIT](./types.mdx#gls_shipment_unit) + +# + +Creates a GLS shipment unit (an individual parcel within a shipment). + + + +--- + +### `createPrintingOptions` + +| Parameter | Name | Type | Required | Description | +| --- | --- | --- | --- | --- | +| returnLabels | Return labels | RETURN_LABELS | Yes | The return labels to be included in the shipment. | + +Return Type: [GLS_PRINTING_OPTIONS](./types.mdx#gls_printing_options) + +# + +Creates GLS printing options that control how labels are generated. + + + +--- + +### `createCustomContent` + +| Parameter | Name | Type | Required | Description | +| --- | --- | --- | --- | --- | +| barcodeContentType | Barcode content type | "TRACK_ID"\|"GLS_SHIPMENT_REFERENCE" | Yes | Type of content encoded in the barcode (TRACK_ID or GLS_SHIPMENT_REFERENCE). | +| customerLogo | Customer logo | string | Yes | Base64-encoded customer logo to print on the label. | +| hideShipperAddress | Hide shipper address | boolean | No | Whether to hide the shipper address on the label. | +| barcodeType | Barcode type | "EAN_128"\|"CODE_39" | No | Type of barcode to use (EAN_128 or CODE_39). | +| barcode | Barcode | string | No | Barcode value to print on the label. | + +Return Type: [GLS_CUSTOM_CONTENT](./types.mdx#gls_custom_content) + +# + +Creates custom content settings for GLS labels, including logos and barcodes. + + + +--- + +### `createConsignee` + +| Parameter | Name | Type | Required | Description | +| --- | --- | --- | --- | --- | +| consigneeId | Consignee ID | string | Yes | The ID of the consignee. Max length is 40 characters. | +| costCenter | Cost center | string | Yes | The cost center for the consignee. Max length is 80 characters. | +| Address | Address | [GLS_ADDRESS](./types.mdx#gls_address) | Yes | The address of the consignee. | +| Category | Category | "BUSINESS"\|"PRIVATE" | Yes | The category of the consignee. Can be either BUSINESS or PRIVATE. | + +Return Type: [GLS_CONSIGNEE](./types.mdx#gls_consignee) + +# + +Creates a GLS consignee (recipient) object for use in shipments. + + + +--- + +### `createAddress` + +| Parameter | Name | Type | Required | Description | +| --- | --- | --- | --- | --- | +| Name1 | Name 1 | string | Yes | The name of the recipient or company. Max length is 40 characters. | +| CountryCode | Country code | string | Yes | The ISO alpha-2 country code. For example, DE for Germany or FR for France. | +| City | City | string | Yes | The city of the address. Max length is 40 characters. | +| Street | Street | string | Yes | The street name of the address. Min length is 4 characters. | +| ZIPCode | ZIP code | string | Yes | The ZIP code of the address. Max length is 10 characters. | +| Name2 | Name 2 | string | No | Additional name information. Max length is 40 characters. | +| Name3 | Name 3 | string | No | Additional name information. Max length is 40 characters. | +| Province | Province/State | string | No | The province or state of the address. Max length is 40 characters. | +| StreetNumber | Street number | string | No | The street number of the address. Max length is 40 characters. | +| ContactPerson | Contact person | string | No | The contact person for the address. Max length is 40 characters. | +| FixedLinePhonenumber | Fixed line phone number | string | No | The fixed line phone number for the address. Max length is 35 characters. | +| MobilePhonenumber | Mobile phone number | string | No | The mobile phone number for the address. Max length is 35 characters. | +| Email | Email | string | No | The email address for the address. Max length is 80 characters. | + +Return Type: [GLS_ADDRESS](./types.mdx#gls_address) + +# + +Creates a GLS address object (`GLS_ADDRESS`) for use in shipments as consignee, shipper, or return address. + + + +--- + +## Shipment functions + +All shipment functions accept a common set of parameters in addition to their type-specific parameters. They call the GLS ShipIT API (`POST /rs/shipments`) and return a `GLS_CREATE_PARCELS_RESPONSE`. + +**Common parameters for all shipment functions:** + +| Parameter | Type | Required | Description | +|-------------------|-------------------------------|----------|----------------------------------------------------| +| `shipment` | GLS_SHIPMENT_WITHOUT_SERVICES | **Yes** | Shipment data (consignee, shipper, units, product) | +| `printingOptions` | GLS_PRINTING_OPTIONS | **Yes** | Label format settings | +| `returnOptions` | GLS_RETURN_OPTIONS | No | Whether to return print data and routing info | +| `customContent` | GLS_CUSTOM_CONTENT | No | Custom logo and barcode settings | + +--- + + +### `createTyreShipment` + +| Parameter | Name | Type | Required | Description | +| --- | --- | --- | --- | --- | +| shipment | Shipment | [GLS_SHIPMENT](./types.mdx#gls_shipment) | Yes | The shipment for which to create the parcels. Must include all necessary information and services for the shipment. | +| printingOptions | Printing options | [GLS_PRINTING_OPTIONS](./types.mdx#gls_printing_options) | Yes | The printing options for the shipment. Specifies options for the labels to be printed for the shipment. | +| returnOptions | Return options | [GLS_RETURN_OPTIONS](./types.mdx#gls_return_options) | No | The return options for the shipment. Specifies options for return shipments. | +| customContent | Custom content | [GLS_CUSTOM_CONTENT](./types.mdx#gls_custom_content) | No | The custom content for the shipment. Specifies options for custom content to be printed on the labels. | + +Return Type: [GLS_CREATE_PARCELS_RESPONSE](./types.mdx#gls_create_parcels_response) + +# + +Creates a shipment specifically for tyre/wheel delivery (uses the GLS TyreService). + + + +--- + +### `createSignatureShipment` + +| Parameter | Name | Type | Required | Description | +| --- | --- | --- | --- | --- | +| shipment | Shipment | [GLS_SHIPMENT](./types.mdx#gls_shipment) | Yes | The shipment for which to create the parcels. Must include all necessary information and services for the shipment. | +| printingOptions | Printing options | [GLS_PRINTING_OPTIONS](./types.mdx#gls_printing_options) | Yes | The printing options for the shipment. Specifies options for the labels to be printed for the shipment. | +| returnOptions | Return options | [GLS_RETURN_OPTIONS](./types.mdx#gls_return_options) | No | The return options for the shipment. Specifies options for return shipments. | +| customContent | Custom content | [GLS_CUSTOM_CONTENT](./types.mdx#gls_custom_content) | No | The custom content for the shipment. Specifies options for custom content to be printed on the labels. | + +Return Type: [GLS_CREATE_PARCELS_RESPONSE](./types.mdx#gls_create_parcels_response) + +# + +Creates a shipment that requires a recipient signature upon delivery. + + + +--- + +### `createShopReturnShipment` + +| Parameter | Name | Type | Required | Description | +| --- | --- | --- | --- | --- | +| numberOfLabels | The number of labels | number | Yes | The number of labels to be created for the return shipment. | +| shipment | Shipment | [GLS_SHIPMENT](./types.mdx#gls_shipment) | Yes | The shipment for which to create the parcels. Must include all necessary information and services for the shipment. | +| printingOptions | Printing options | [GLS_PRINTING_OPTIONS](./types.mdx#gls_printing_options) | Yes | The printing options for the shipment. Specifies options for the labels to be printed for the shipment. | +| returnOptions | Return options | [GLS_RETURN_OPTIONS](./types.mdx#gls_return_options) | No | The return options for the shipment. Specifies options for return shipments. | +| customContent | Custom content | [GLS_CUSTOM_CONTENT](./types.mdx#gls_custom_content) | No | The custom content for the shipment. Specifies options for custom content to be printed on the labels. | +| returnQR | Return QR | "PDF" \| "PNG" \| "ZPL" | Yes | The return QR of the shipment. | + +Return Type: [GLS_CREATE_PARCELS_RESPONSE](./types.mdx#gls_create_parcels_response) + +# + +Creates a return shipment from a GLS Parcel Shop (customer drops off parcel at a shop). + + + +--- + +### `createShopDeliveryShipment` + +| Parameter | Name | Type | Required | Description | +| --- | --- | --- | --- | --- | +| parcelShopId | Parcel shop Id | string | Yes | The ID of the parcel shop where the shipment should be delivered. | +| shipment | Shipment | [GLS_SHIPMENT](./types.mdx#gls_shipment) | Yes | The shipment for which to create the parcels. Must include all necessary information and services for the shipment. | +| printingOptions | Printing options | [GLS_PRINTING_OPTIONS](./types.mdx#gls_printing_options) | Yes | The printing options for the shipment. Specifies options for the labels to be printed for the shipment. | +| returnOptions | Return options | [GLS_RETURN_OPTIONS](./types.mdx#gls_return_options) | No | The return options for the shipment. Specifies options for return shipments. | +| customContent | Custom content | [GLS_CUSTOM_CONTENT](./types.mdx#gls_custom_content) | No | The custom content for the shipment. Specifies options for custom content to be printed on the labels. | + +Return Type: [GLS_CREATE_PARCELS_RESPONSE](./types.mdx#gls_create_parcels_response) + +# + +Delivers a parcel to a GLS Parcel Shop where the recipient can collect it. + + + +--- + +### `createPickAndShipShipment` + +| Parameter | Name | Type | Required | Description | +| --- | --- | --- | --- | --- | +| pickupDate | Pickup date | string | Yes | The pickup date for the pick and ship shipment. | +| shipment | Shipment | [GLS_SHIPMENT](./types.mdx#gls_shipment) | Yes | The shipment for which to create the parcels. Must include all necessary information and services for the shipment. | +| printingOptions | Printing options | [GLS_PRINTING_OPTIONS](./types.mdx#gls_printing_options) | Yes | The printing options for the shipment. Specifies options for the labels to be printed for the shipment. | +| returnOptions | Return options | [GLS_RETURN_OPTIONS](./types.mdx#gls_return_options) | No | The return options for the shipment. Specifies options for return shipments. | +| customContent | Custom content | [GLS_CUSTOM_CONTENT](./types.mdx#gls_custom_content) | No | The custom content for the shipment. Specifies options for custom content to be printed on the labels. | + +Return Type: [GLS_CREATE_PARCELS_RESPONSE](./types.mdx#gls_create_parcels_response) + +# + +Schedules a pickup from the consignee's address on a given date. + + + +--- + +### `createIdentShipment` + +| Parameter | Name | Type | Required | Description | +| --- | --- | --- | --- | --- | +| birthDate | Birth date | string | Yes | The birth date for the ident shipment identification. | +| firstName | First name | string | Yes | The first name for the ident shipment identification. | +| lastName | Last name | string | Yes | The last name for the ident shipment identification. | +| nationality | Nationality | string | Yes | The nationality for the ident shipment identification. | +| shipment | Shipment | [GLS_SHIPMENT](./types.mdx#gls_shipment) | Yes | The shipment for which to create the parcels. Must include all necessary information and services for the shipment. | +| printingOptions | Printing options | [GLS_PRINTING_OPTIONS](./types.mdx#gls_printing_options) | Yes | The printing options for the shipment. Specifies options for the labels to be printed for the shipment. | +| returnOptions | Return options | [GLS_RETURN_OPTIONS](./types.mdx#gls_return_options) | No | The return options for the shipment. Specifies options for return shipments. | +| customContent | Custom content | [GLS_CUSTOM_CONTENT](./types.mdx#gls_custom_content) | No | The custom content for the shipment. Specifies options for custom content to be printed on the labels. | + +Return Type: [GLS_CREATE_PARCELS_RESPONSE](./types.mdx#gls_create_parcels_response) + +# + +Delivers a parcel with identity verification - the driver checks the recipient's ID document. + + + +--- + +### `createIdentPinShipment` + +| Parameter | Name | Type | Required | Description | +| --- | --- | --- | --- | --- | +| pin | Pin | string | Yes | The pin for the ident pin shipment identification. | +| shipment | Shipment | [GLS_SHIPMENT](./types.mdx#gls_shipment) | Yes | The shipment for which to create the parcels. Must include all necessary information and services for the shipment. | +| printingOptions | Printing options | [GLS_PRINTING_OPTIONS](./types.mdx#gls_printing_options) | Yes | The printing options for the shipment. Specifies options for the labels to be printed for the shipment. | +| returnOptions | Return options | [GLS_RETURN_OPTIONS](./types.mdx#gls_return_options) | No | The return options for the shipment. Specifies options for return shipments. | +| customContent | Custom content | [GLS_CUSTOM_CONTENT](./types.mdx#gls_custom_content) | No | The custom content for the shipment. Specifies options for custom content to be printed on the labels. | +| birthDate | Birth date | string | Yes | The birth date for the ident pin shipment identification. | + +Return Type: [GLS_CREATE_PARCELS_RESPONSE](./types.mdx#gls_create_parcels_response) + +# + +Delivers a parcel with PIN and optional birthdate verification. + + + +--- + +### `createGuaranteed24Shipment` + +| Parameter | Name | Type | Required | Description | +| --- | --- | --- | --- | --- | +| shipment | Shipment | [GLS_SHIPMENT](./types.mdx#gls_shipment) | Yes | The shipment for which to create the parcels. Must include all necessary information and services for the shipment. | +| printingOptions | Printing options | [GLS_PRINTING_OPTIONS](./types.mdx#gls_printing_options) | Yes | The printing options for the shipment. Specifies options for the labels to be printed for the shipment. | +| returnOptions | Return options | [GLS_RETURN_OPTIONS](./types.mdx#gls_return_options) | No | The return options for the shipment. Specifies options for return shipments. | +| customContent | Custom content | [GLS_CUSTOM_CONTENT](./types.mdx#gls_custom_content) | No | The custom content for the shipment. Specifies options for custom content to be printed on the labels. | + +Return Type: [GLS_CREATE_PARCELS_RESPONSE](./types.mdx#gls_create_parcels_response) + +# + +Creates a shipment with guaranteed delivery within 24 hours. + + + +--- + +### `createFlexDeliveryShipment` + +| Parameter | Name | Type | Required | Description | +| --- | --- | --- | --- | --- | +| shipment | Shipment | [GLS_SHIPMENT](./types.mdx#gls_shipment) | Yes | The shipment for which to create the parcels. Must include all necessary information and services for the shipment. | +| printingOptions | Printing options | [GLS_PRINTING_OPTIONS](./types.mdx#gls_printing_options) | Yes | The printing options for the shipment. Specifies options for the labels to be printed for the shipment. | +| returnOptions | Return options | [GLS_RETURN_OPTIONS](./types.mdx#gls_return_options) | No | The return options for the shipment. Specifies options for return shipments. | +| customContent | Custom content | [GLS_CUSTOM_CONTENT](./types.mdx#gls_custom_content) | No | The custom content for the shipment. Specifies options for custom content to be printed on the labels. | + +Return Type: [GLS_CREATE_PARCELS_RESPONSE](./types.mdx#gls_create_parcels_response) + +# + +Creates a shipment with flexible delivery - the recipient can redirect or reschedule delivery. + + + +--- + +### `createExchangeShipment` + +| Parameter | Name | Type | Required | Description | +| --- | --- | --- | --- | --- | +| address | Address | [GLS_ADDRESS](./types.mdx#gls_address) | Yes | The address of the exchange shipment. | +| shipment | Shipment | [GLS_SHIPMENT](./types.mdx#gls_shipment) | Yes | The shipment for which to create the parcels. Must include all necessary information and services for the shipment. | +| printingOptions | Printing options | [GLS_PRINTING_OPTIONS](./types.mdx#gls_printing_options) | Yes | The printing options for the shipment. Specifies options for the labels to be printed for the shipment. | +| returnOptions | Return options | [GLS_RETURN_OPTIONS](./types.mdx#gls_return_options) | No | The return options for the shipment. Specifies options for return shipments. | +| customContent | Custom content | [GLS_CUSTOM_CONTENT](./types.mdx#gls_custom_content) | No | The custom content for the shipment. Specifies options for custom content to be printed on the labels. | +| expectedWeight | Expected weight | number | No | The expected weight for the exchange shipment. | + +Return Type: [GLS_CREATE_PARCELS_RESPONSE](./types.mdx#gls_create_parcels_response) + +# + +Delivers a new parcel while simultaneously picking up an existing one (exchange). + + + +--- + +### `createDepositShipment` + +| Parameter | Name | Type | Required | Description | +| --- | --- | --- | --- | --- | +| placeOfDeposit | Place of deposit | string | Yes | The place of deposit for the delivery. | +| shipment | Shipment | [GLS_SHIPMENT](./types.mdx#gls_shipment) | Yes | The shipment for which to create the parcels. Must include all necessary information and services for the shipment. | +| printingOptions | Printing options | [GLS_PRINTING_OPTIONS](./types.mdx#gls_printing_options) | Yes | The printing options for the shipment. Specifies options for the labels to be printed for the shipment. | +| returnOptions | Return options | [GLS_RETURN_OPTIONS](./types.mdx#gls_return_options) | No | The return options for the shipment. Specifies options for return shipments. | +| customContent | Custom content | [GLS_CUSTOM_CONTENT](./types.mdx#gls_custom_content) | No | The custom content for the shipment. Specifies options for custom content to be printed on the labels. | + +Return Type: [GLS_CREATE_PARCELS_RESPONSE](./types.mdx#gls_create_parcels_response) + +# + +Delivers a parcel to a designated deposit location (e.g. a garage or shed) without requiring a signature. + + + +--- + +### `createDeliverySaturdayShipment` + +| Parameter | Name | Type | Required | Description | +| --- | --- | --- | --- | --- | +| shipment | Shipment | [GLS_SHIPMENT](./types.mdx#gls_shipment) | Yes | The shipment for which to create the parcels. Must include all necessary information and services for the shipment. | +| printingOptions | Printing options | [GLS_PRINTING_OPTIONS](./types.mdx#gls_printing_options) | Yes | The printing options for the shipment. Specifies options for the labels to be printed for the shipment. | +| returnOptions | Return options | [GLS_RETURN_OPTIONS](./types.mdx#gls_return_options) | No | The return options for the shipment. Specifies options for return shipments. | +| customContent | Custom content | [GLS_CUSTOM_CONTENT](./types.mdx#gls_custom_content) | No | The custom content for the shipment. Specifies options for custom content to be printed on the labels. | + +Return Type: [GLS_CREATE_PARCELS_RESPONSE](./types.mdx#gls_create_parcels_response) + +# + +Creates an EXPRESS shipment for Saturday delivery. + + + +--- + +### `createDeliveryNextWorkingDayShipment` + +| Parameter | Name | Type | Required | Description | +| --- | --- | --- | --- | --- | +| shipment | Shipment | [GLS_SHIPMENT](./types.mdx#gls_shipment) | Yes | The shipment for which to create the parcels. Must include all necessary information and services for the shipment. | +| printingOptions | Printing options | [GLS_PRINTING_OPTIONS](./types.mdx#gls_printing_options) | Yes | The printing options for the shipment. Specifies options for the labels to be printed for the shipment. | +| returnOptions | Return options | [GLS_RETURN_OPTIONS](./types.mdx#gls_return_options) | No | The return options for the shipment. Specifies options for return shipments. | +| customContent | Custom content | [GLS_CUSTOM_CONTENT](./types.mdx#gls_custom_content) | No | The custom content for the shipment. Specifies options for custom content to be printed on the labels. | + +Return Type: [GLS_CREATE_PARCELS_RESPONSE](./types.mdx#gls_create_parcels_response) + +# + +Creates an EXPRESS shipment for delivery on the next working day (EOB service). + + + +--- + +### `createDeliveryAtWorkShipment` + +| Parameter | Name | Type | Required | Description | +| --- | --- | --- | --- | --- | +| recipientName | Recipient name | string | Yes | The recipient name for the delivery at work shipment. | +| building | Building | string | Yes | The building of the delivery at work shipment. | +| floor | Floor | number | Yes | The floor of the delivery at work shipment. | +| shipment | Shipment | [GLS_SHIPMENT](./types.mdx#gls_shipment) | Yes | The shipment for which to create the parcels. Must include all necessary information and services for the shipment. | +| printingOptions | Printing options | [GLS_PRINTING_OPTIONS](./types.mdx#gls_printing_options) | Yes | The printing options for the shipment. Specifies options for the labels to be printed for the shipment. | +| returnOptions | Return options | [GLS_RETURN_OPTIONS](./types.mdx#gls_return_options) | No | The return options for the shipment. Specifies options for return shipments. | +| customContent | Custom content | [GLS_CUSTOM_CONTENT](./types.mdx#gls_custom_content) | No | The custom content for the shipment. Specifies options for custom content to be printed on the labels. | +| alternateRecipientName | Alternate recipient name | string | No | The alternate recipient name for the delivery at work shipment. | +| room | Room | number | No | The room of the delivery at work shipment. | +| phonenumber | Phone number | string | No | The phone number for the delivery at work shipment. | + +Return Type: [GLS_CREATE_PARCELS_RESPONSE](./types.mdx#gls_create_parcels_response) + +# + +Delivers a parcel to a specific location within a workplace (building, floor, room). + + + +--- + +### `createAddresseeOnlyShipment` + +| Parameter | Name | Type | Required | Description | +| --- | --- | --- | --- | --- | +| shipment | Shipment | [GLS_SHIPMENT](./types.mdx#gls_shipment) | Yes | The shipment for which to create the parcels. Must include all necessary information and services for the shipment. | +| printingOptions | Printing options | [GLS_PRINTING_OPTIONS](./types.mdx#gls_printing_options) | Yes | The printing options for the shipment. Specifies options for the labels to be printed for the shipment. | +| returnOptions | Return options | [GLS_RETURN_OPTIONS](./types.mdx#gls_return_options) | No | The return options for the shipment. Specifies options for return shipments. | +| customContent | Custom content | [GLS_CUSTOM_CONTENT](./types.mdx#gls_custom_content) | No | The custom content for the shipment. Specifies options for custom content to be printed on the labels. | + +Return Type: [GLS_CREATE_PARCELS_RESPONSE](./types.mdx#gls_create_parcels_response) + +# + +Creates a shipment that can only be delivered to the named addressee (no neighbor delivery). + + + +--- + +## API functions + + +### `validateShipment` + +| Parameter | Name | Type | Required | Description | +| --- | --- | --- | --- | --- | +| data | Data | [GLS_VALIDATE_SHIPMENT_REQUEST_DATA](./types.mdx#gls_validate_shipment_request_data) | Yes | The shipment data to validate. | + +Return Type: [GLS_VALIDATE_SHIPMENT_RESPONSE_DATA](./types.mdx#gls_validate_shipment_response_data) + +# + +Validates a shipment against the GLS API without creating it. Use this before `createShipment` functions to catch errors early. + + + +--- + +### `updateParcelWeight` + +| Parameter | Name | Type | Required | Description | +| --- | --- | --- | --- | --- | +| data | Data | [GLS_UPDATE_PARCEL_WEIGHT_REQUEST_DATA](./types.mdx#gls_update_parcel_weight_request_data) | Yes | The update parcel weight request data. | + +Return Type: [GLS_END_OF_DAY_RESPONSE_DATA](./types.mdx#gls_end_of_day_response_data) + +# + +Updates the weight of an already-created parcel. Useful when the final weight is only known after packaging. + + + +--- + +### `reprintParcel` + +| Parameter | Name | Type | Required | Description | +| --- | --- | --- | --- | --- | +| data | Data | [GLS_REPRINT_PARCEL_REQUEST_DATA](./types.mdx#gls_reprint_parcel_request_data) | Yes | The reprint parcel request data. | + +Return Type: [GLS_REPRINT_PARCEL_RESPONSE_DATA](./types.mdx#gls_reprint_parcel_response_data) + +# + +Reprints the label for an existing parcel. Use this if the original label is damaged, lost, or needs to be printed in a different format. + + + +--- + +### `getEndOfDayReport` + +| Parameter | Name | Type | Required | Description | +| --- | --- | --- | --- | --- | +| data | Data | [GLS_END_OF_DAY_REQUEST_DATA](./types.mdx#gls_end_of_day_request_data) | Yes | The end of day report request data. | + +Return Type: [GLS_END_OF_DAY_RESPONSE_DATA](./types.mdx#gls_end_of_day_response_data) + +# + +Retrieves all shipments dispatched on a given date. Useful for reconciliation and end-of-day processing. + + + +--- + +### `getAllowedServices` + +| Parameter | Name | Type | Required | Description | +| --- | --- | --- | --- | --- | +| data | Data | [GLS_ALLOWED_SERVICES_REQUEST_DATA](./types.mdx#gls_allowed_services_request_data) | Yes | The allowed services request data. | + +Return Type: [GLS_ALLOWED_SERVICES_RESPONSE_DATA](./types.mdx#gls_allowed_services_response_data) + +# + +Returns the GLS services available for a given origin/destination country and ZIP code combination. + + + +--- + +### `cancelShipment` + +| Parameter | Name | Type | Required | Description | +| --- | --- | --- | --- | --- | +| data | Data | [GLS_CANCEL_SHIPMENT_REQUEST_DATA](./types.mdx#gls_cancel_shipment_request_data) | Yes | The cancel shipment request data. | + +Return Type: [GLS_CANCEL_SHIPMENT_RESPONSE_DATA](./types.mdx#gls_cancel_shipment_response_data) + +# + +Cancels an existing shipment by its Track ID. Only possible if the parcel has not yet been scanned. + + + +--- diff --git a/docs/Actions/GLS/overview.md b/docs/Actions/GLS/overview.md index 3913cc9..6b05243 100644 --- a/docs/Actions/GLS/overview.md +++ b/docs/Actions/GLS/overview.md @@ -90,8 +90,8 @@ GLS_CREATE_PARCELS_RESPONSE ← tracking IDs, barcode data, print data, routing - [Quick Start](quick-start.md) — Create your first shipment in a few steps - [Configuration](configs.md) — Full list of configuration options and how to get credentials -- [Functions](functions.md) — All available functions with parameter details -- [Types](types.md) — All data types used in the GLS Action +- [Functions](functions.mdx) — All available functions with parameter details +- [Types](types.mdx) — All data types used in the GLS Action - [Events](events.md) — Events emitted by the GLS Action - [Common Use Cases](use-cases.md) — Example flows for real-world scenarios - [Troubleshooting](troubleshooting.md) — FAQ and community support diff --git a/docs/Actions/GLS/quick-start.md b/docs/Actions/GLS/quick-start.md index 60e2c8f..80fab6f 100644 --- a/docs/Actions/GLS/quick-start.md +++ b/docs/Actions/GLS/quick-start.md @@ -128,7 +128,7 @@ The `GLS_CREATE_PARCELS_RESPONSE` contains everything you need: ## Common next steps -- [Validate before creating](functions.md#validateShipment) — Call `validateShipment` first to catch errors before committing -- [Cancel a shipment](functions.md#cancelShipment) — Use `cancelShipment` with the `TrackID` if something changes -- [Reprint a label](functions.md#reprintParcel) — Use `reprintParcel` if a label is lost or damaged +- [Validate before creating](functions.mdx#validateShipment) — Call `validateShipment` first to catch errors before committing +- [Cancel a shipment](functions.mdx#cancelShipment) — Use `cancelShipment` with the `TrackID` if something changes +- [Reprint a label](functions.mdx#reprintParcel) — Use `reprintParcel` if a label is lost or damaged - [Common Use Cases](use-cases.md) — End-to-end examples for real-world scenarios diff --git a/docs/Actions/GLS/troubleshooting.md b/docs/Actions/GLS/troubleshooting.md index 947344f..ec8d12c 100644 --- a/docs/Actions/GLS/troubleshooting.md +++ b/docs/Actions/GLS/troubleshooting.md @@ -30,7 +30,7 @@ A: The action supports all major GLS shipment types and services, including: - Tyre service, addressee-only delivery - Saturday and next-working-day delivery (EXPRESS only) -See [Functions](functions.md) for the complete list. +See [Functions](functions.mdx) for the complete list. --- diff --git a/docs/Actions/GLS/types.md b/docs/Actions/GLS/types.md deleted file mode 100644 index fd3af33..0000000 --- a/docs/Actions/GLS/types.md +++ /dev/null @@ -1,434 +0,0 @@ ---- -title: Datatypes -description: All data types registered by the GLS Action — field references and descriptions. ---- - -# GLS Action Types - -The GLS Action registers the following data types with the Hercules platform. These types are used as inputs and outputs -of the GLS functions and can be referenced in your flows. - ---- - -## `GLS_ADDRESS` - -Represents a physical address used for consignee, shipper, and return addresses. - -**Used by:** `GLS_CONSIGNEE`, `GLS_SHIPPER`, `GLS_SHIPMENT_SERVICE` (Exchange, DeliveryAtWork, etc.) - -| Field | Type | Required | Constraints | Description | -|------------------------|--------|----------|---------------|--------------------------------------------| -| `Name1` | string | **Yes** | max 40 | Primary name (person or company) | -| `Name2` | string | No | max 40 | Additional name line (e.g. department) | -| `Name3` | string | No | max 40 | Additional name line (e.g. c/o) | -| `CountryCode` | string | **Yes** | max 2 | ISO alpha-2 country code (e.g. `DE`, `FR`) | -| `Province` | string | No | max 40 | State or province | -| `City` | string | **Yes** | max 40 | City name | -| `Street` | string | **Yes** | min 4 | Street name | -| `StreetNumber` | string | No | max 40 | House/building number | -| `ContactPerson` | string | No | min 6, max 40 | Contact person name | -| `FixedLinePhonenumber` | string | No | min 4, max 35 | Landline phone number | -| `MobilePhonenumber` | string | No | min 4, max 35 | Mobile phone number | -| `eMail` | string | No | max 80 | Email address | -| `ZIPCode` | string | **Yes** | max 10 | Postal/ZIP code | - ---- - -## `GLS_CONSIGNEE` - -Represents the recipient of a shipment. - -**Used by:** `GLS_SHIPMENT` - -**Linked types:** `GLS_ADDRESS` - -| Field | Type | Required | Constraints | Description | -|---------------|-----------------------------|----------|-------------|-------------------------------------| -| `ConsigneeID` | string | No | max 40 | Your internal customer/consignee ID | -| `CostCenter` | string | No | max 80 | Cost center for billing | -| `Category` | `"BUSINESS"` \| `"PRIVATE"` | No | — | Type of recipient | -| `AddressSchema` | GLS_ADDRESS | **Yes** | — | Physical delivery address | - ---- - -## `GLS_SHIPPER` - -Represents the sender of a shipment. - -**Used by:** `GLS_SHIPMENT`, action configuration - -**Linked types:** `GLS_ADDRESS` - -| Field | Type | Required | Description | -|-----------------------------|-------------|----------|-------------------------------------------| -| `AddressSchema` | GLS_ADDRESS | No | Primary shipper address | -| `AlternativeShipperAddress` | GLS_ADDRESS | No | Alternative address to print on the label | - -> **Note:** When used in the configuration (`shipper`), the action automatically includes the `ContactID` from the -`contact_id` configuration value. - ---- - -## `GLS_UNIT_SERVICE` - -An optional array of value-added services applied to an individual shipment unit (parcel). - -**Used by:** `GLS_SHIPMENT_UNIT` - -Each element is an object with one or more of the following optional fields: - -| Service field | Description | -|---------------------|----------------------------------------------------------------------------------| -| `Cash` | Cash on delivery — `Reason` (max 160), `Amount` (min 1), `Currency` (3 chars) | -| `AddonLiability` | Additional liability insurance — `Amount`, `Currency`, `ParcelContent` (max 255) | -| `HazardousGoods` | Hazardous goods declaration — array of `{ Weight, GLSHazNo (max 8) }` | -| `ExWorks` | Ex-works shipping terms | -| `LimitedQuantities` | Limited quantities of dangerous goods — optional `Weight` | - ---- - -## `GLS_SHIPMENT_UNIT` - -Represents a single parcel within a shipment. A shipment may contain multiple units. - -**Used by:** `GLS_SHIPMENT`, `GLS_SHIPMENT_WITHOUT_SERVICES` - -**Linked types:** `GLS_UNIT_SERVICE` - -| Field | Type | Required | Constraints | Description | -|-------------------------|------------------|----------|-------------|---------------------------------| -| `Weight` | number | **Yes** | 0.10–99 kg | Weight of the parcel | -| `ShipmentUnitReference` | string | No | max 40 | Your internal parcel reference | -| `PartnerParcelNumber` | string | No | max 50 | Partner-assigned number | -| `Note1` | string | No | max 50 | Label note line 1 | -| `Note2` | string | No | max 50 | Label note line 2 | -| `Service` | GLS_UNIT_SERVICE | No | — | Unit-level value-added services | - ---- - -## `GLS_SHIPMENT_SERVICE` - -An optional array of shipment-level services. Shipment creation functions automatically populate this based on which -function you call. - -**Used by:** `GLS_SHIPMENT` - -Each element is an object with one of the following service fields: - -| Service | Parameters | Description | -|------------------------|------------------------------------------------------------------------------------------|------------------------------------| -| `ShopDelivery` | `ParcelShopID` (max 50) | Delivery to a GLS Parcel Shop | -| `ShopReturn` | `NumberOfLabels`, `ReturnQR?` | Return from a Parcel Shop | -| `Exchange` | `AddressSchema` (GLS_ADDRESS), `ExpectedWeight?` | Exchange delivery and pickup | -| `DeliveryAtWork` | `RecipientName`, `Building`, `Floor`, `Room?`, `Phonenumber?`, `AlternateRecipientName?` | Workplace delivery | -| `Deposit` | `PlaceOfDeposit` (max 121) | Deposit without signature | -| `IdentPin` | `PIN` (max 4), `Birthdate?` | PIN-based identity check | -| `Ident` | `Birthdate`, `Firstname`, `Lastname`, `Nationality` (max 2) | Full identity check | -| `PickAndShip` | `PickupDate` | GLS picks up from consignee | -| `FlexDeliveryService` | — | Recipient can redirect delivery | -| `SignatureService` | — | Signature required on delivery | -| `Guaranteed24Service` | — | 24-hour guaranteed delivery | -| `AddresseeOnlyService` | — | Delivery to named addressee only | -| `TyreService` | — | Tyre/wheel delivery service | -| `EOB` | — | End of Business (next working day) | -| `SaturdayService` | — | Saturday delivery | -| `Saturday1000Service` | — | Saturday by 10:00 | -| `Saturday1200Service` | — | Saturday by 12:00 | - ---- - -## `GLS_SHIPMENT` - -The complete shipment object including all services. - -**Used by:** `GLS_VALIDATE_SHIPMENT_REQUEST_DATA` - -**Linked types:** `GLS_CONSIGNEE`, `GLS_SHIPPER`, `GLS_SHIPMENT_UNIT`, `GLS_SHIPMENT_SERVICE`, `GLS_ADDRESS` - -| Field | Type | Required | Description | -|-----------------------------|---------------------------|----------|--------------------------------------------------| -| `Product` | `"PARCEL"` \| `"EXPRESS"` | **Yes** | Shipment product type | -| `ConsigneeSchema` | GLS_CONSIGNEE | **Yes** | Recipient details | -| `ShipperSchema` | GLS_SHIPPER | **Yes** | Sender details | -| `ShipmentUnit` | GLS_SHIPMENT_UNIT[] | **Yes** | Array of parcels (min 1) | -| `Service` | GLS_SHIPMENT_SERVICE | No | Shipment-level services | -| `ShipmentReference` | string (max 40) | No | Your internal shipment reference | -| `ShipmentDate` | date | No | Shipment date (defaults to today) | -| `IncotermCode` | integer (max 99) | No | International commerce terms code | -| `Identifier` | string (max 40) | No | Additional identifier | -| `ExpressAltDeliveryAllowed` | boolean | No | Allow alternative delivery for express shipments | -| `Carrier` | `"ROYALMAIL"` | No | Override carrier (UK only) | -| `Return.AddressSchema` | GLS_ADDRESS | No | AddressSchema for return shipments | - ---- - -## `GLS_SHIPMENT_WITHOUT_SERVICES` - -The shipment object without the `Service` field. Used as input to all shipment creation functions — the service is added -automatically based on which function you call. - -**Linked types:** `GLS_SHIPMENT` - -Same fields as `GLS_SHIPMENT` except `Service` is omitted. - ---- - -## `GLS_PRINTING_OPTIONS` - -Configures how shipping labels are generated. - -| Field | Type | Required | Description | -|---------------------------------|--------|----------|----------------------------------------------------------------------------------------------------------| -| `ReturnLabels.TemplateSet` | enum | **Yes** | Label template to use | -| `ReturnLabels.LabelFormat` | enum | **Yes** | Output file format | -| `useDefault` | string | No | If set to `"Default"`, uses the default printing options configured in GLS instead of the specified ones | -| `DefinePrinter.LabelPrinter` | string | No | Specify the printer name, only backend printers are valid | -| `DefinePrinter.DocumentPrinter` | string | no | Specify the document printer name, only backend printers are valid | - -**Template sets:** `NONE`, `D_200`, `PF_4_I`, `PF_4_I_200`, `PF_4_I_300`, `PF_8_D_200`, `T_200_BF`, `T_300_BF`, -`ZPL_200`, `ZPL_200_TRACKID_EAN_128`, `ZPL_200_TRACKID_CODE_39`, `ZPL_200_REFNO_EAN_128`, `ZPL_200_REFNO_CODE_39`, -`ZPL_300`, `ZPL_300_TRACKID_EAN_128`, `ZPL_300_TRACKID_CODE_39`, `ZPL_300_REFNO_EAN_128`, `ZPL_300_REFNO_CODE_39` - -**Label formats:** `PDF`, `ZEBRA`, `INTERMEC`, `DATAMAX`, `TOSHIBA`, `PNG` - ---- - -## `GLS_RETURN_OPTIONS` - -Controls whether the GLS API includes print data and routing info in the response. - -| Field | Type | Default | Description | -|---------------------|---------|---------|------------------------------------------| -| `ReturnPrintData` | boolean | `true` | Include base64-encoded label in response | -| `ReturnRoutingInfo` | boolean | `true` | Include routing information in response | - -> Set both to `false` if you only need the `TrackID` and don't need the label data immediately. - ---- - -## `GLS_CUSTOM_CONTENT` - -Customizes what appears on the printed shipping label. - -| Field | Type | Required | Description | -|----------------------|--------------------------------------------|----------|--------------------------------------| -| `CustomerLogo` | string | **Yes** | Base64-encoded logo image | -| `BarcodeContentType` | `"TRACK_ID"` \| `"GLS_SHIPMENT_REFERENCE"` | **Yes** | What to encode in the custom barcode | -| `Barcode` | string | No | Custom barcode value | -| `BarcodeType` | `"EAN_128"` \| `"CODE_39"` | No | Barcode symbology | -| `HideShipperAddress` | boolean | No | Hide shipper address on label | - ---- - -## `GLS_CREATE_PARCELS_RESPONSE` - -The response returned by all shipment creation functions. - -| Field | Type | Description | -|--------------------------------------------------------------|------------------|------------------------------------------| -| `CreatedShipment.ShipmentReference` | string[] | Your shipment references | -| `CreatedShipment.ParcelData[].TrackID` | string (8 chars) | GLS tracking ID — use to track or cancel | -| `CreatedShipment.ParcelData[].ParcelNumber` | string | GLS parcel number | -| `CreatedShipment.ParcelData[].Barcodes.Primary2D` | string | 2D barcode data | -| `CreatedShipment.ParcelData[].Barcodes.Secondary2D` | string | Secondary 2D barcode | -| `CreatedShipment.ParcelData[].Barcodes.Primary1D` | string | 1D barcode data | -| `CreatedShipment.ParcelData[].Barcodes.Primary1DPrint` | boolean | Whether to print 1D barcode | -| `CreatedShipment.ParcelData[].RoutingInfo.Tour` | string | Delivery tour identifier | -| `CreatedShipment.ParcelData[].RoutingInfo.FinalLocationCode` | string | Final delivery depot | -| `CreatedShipment.ParcelData[].RoutingInfo.HubLocation` | string | Hub location code | -| `CreatedShipment.ParcelData[].RoutingInfo.LastRoutingDate` | date | Last valid routing date | -| `CreatedShipment.PrintData[].Data` | string | Base64-encoded label | -| `CreatedShipment.PrintData[].LabelFormat` | enum | Format of the label | -| `CreatedShipment.CustomerID` | string | GLS customer identifier | -| `CreatedShipment.PickupLocation` | string | Depot where parcel will be picked up | -| `CreatedShipment.GDPR` | string[] | GDPR-related references | - ---- - -## `GLS_CANCEL_SHIPMENT_REQUEST_DATA` - -Input for the `cancelShipment` function. - -| Field | Type | Required | Description | -|-----------|--------|----------|-------------------------------------------| -| `TrackID` | string | **Yes** | GLS tracking ID of the shipment to cancel | - ---- - -## `GLS_CANCEL_SHIPMENT_RESPONSE_DATA` - -Response from the `cancelShipment` function. - -| Field | Type | Description | -|-----------|-----------------------------------------------------------------------|------------------------------------| -| `TrackID` | string | The tracking ID that was cancelled | -| `result` | `"CANCELLED"` \| `"CANCELLATION_PENDING"` \| `"SCANNED"` \| `"ERROR"` | Result of the cancellation | - ---- - -## `GLS_ALLOWED_SERVICES_REQUEST_DATA` - -Input for the `getAllowedServices` function. - -| Field | Type | Required | Description | -|---------------------------|-----------------|----------|-----------------------------------| -| `Source.CountryCode` | string (max 2) | **Yes** | Origin country code | -| `Source.ZIPCode` | string (max 10) | **Yes** | Origin ZIP/postal code | -| `Destination.CountryCode` | string (max 2) | **Yes** | Destination country code | -| `Destination.ZIPCode` | string (max 10) | **Yes** | Destination ZIP/postal code | -| `ContactID` | string | No | GLS contact ID (overrides config) | - ---- - -## `GLS_ALLOWED_SERVICES_RESPONSE_DATA` - -Response from the `getAllowedServices` function. - -| Field | Type | Description | -|---------------------------------|--------|------------------------------------------------------| -| `AllowedServices[]` | array | List of services or products available for the route | -| `AllowedServices[].ServiceName` | string | Name of an available service | -| `AllowedServices[].ProductName` | string | Name of an available product | - -Each element contains either `ServiceName` or `ProductName`, not both. - ---- - -## `GLS_END_OF_DAY_REQUEST_DATA` - -Input for the `getEndOfDayReport` function. - -| Field | Type | Required | Description | -|--------|-----------------|----------|-----------------------------------------------------------------| -| `date` | ISO date string | **Yes** | The date for which to retrieve the report (e.g. `"2025-01-15"`) | - ---- - -## `GLS_END_OF_DAY_RESPONSE_DATA` - -Response from the `getEndOfDayReport` function. - -| Field | Type | Description | -|-------------------------------------------------|---------------------------|----------------------------------| -| `Shipments[].ShippingDate` | ISO date | Date the shipment was dispatched | -| `Shipments[].Product` | `"PARCEL"` \| `"EXPRESS"` | Product type | -| `Shipments[].ConsigneeSchema.AddressSchema` | GLS_ADDRESS | Recipient address | -| `Shipments[].ShipperSchema.ContactID` | string | GLS contact ID of shipper | -| `Shipments[].ShipperSchema.AlternativeShipperAddress` | GLS_ADDRESS | Alternative shipper address | -| `Shipments[].ShipmentUnit[].TrackID` | string | Tracking ID | -| `Shipments[].ShipmentUnit[].Weight` | string | Parcel weight | -| `Shipments[].ShipmentUnit[].ParcelNumber` | string | GLS parcel number | - ---- - -## `GLS_UPDATE_PARCEL_WEIGHT_REQUEST_DATA` - -Input for the `updateParcelWeight` function. Provide at least one identifier (`TrackID`, `ParcelNumber`, -`ShipmentReference`, `ShipmentUnitReference`, or `PartnerParcelNumber`). - -| Field | Type | Required | Constraints | Description | -|-------------------------|--------|----------|------------------|----------------------------| -| `TrackID` | string | No | max 8 | GLS tracking ID | -| `ParcelNumber` | number | No | max 999999999999 | GLS parcel number | -| `ShipmentReference` | string | No | max 40 | Your shipment reference | -| `ShipmentUnitReference` | string | No | max 40 | Your parcel unit reference | -| `PartnerParcelNumber` | string | No | max 50 | Partner parcel number | -| `Weight` | number | **Yes** | min 0.10 | New weight in kilograms | - ---- - -## `GLS_UPDATE_PARCEL_WEIGHT_RESPONSE_DATA` - -Response from the `updateParcelWeight` function. - -| Field | Type | Description | -|-----------------|--------|--------------------------------| -| `UpdatedWeight` | string | Confirmed updated weight value | - ---- - -## `GLS_REPRINT_PARCEL_REQUEST_DATA` - -Input for the `reprintParcel` function. Provide at least one identifier. - -| Field | Type | Required | Constraints | Description | -|--------------------------------------------|-----------------|----------|----------------------------------|---------------------------------| -| `TrackID` | string | No | max 8 | GLS tracking ID | -| `ParcelNumber` | number | No | max 999999999999 | GLS parcel number | -| `ShipmentReference` | string | No | max 40 | Your shipment reference | -| `ShipmentUnitReference` | string | No | max 40 | Your parcel unit reference | -| `PartnerParcelNumber` | string | No | max 50 | Partner parcel number | -| `CreationDate` | ISO date string | **Yes** | — | Original shipment creation date | -| `PrintingOptions.ReturnLabels.TemplateSet` | enum | **Yes** | `NONE`, `ZPL_200`, `ZPL_300` | Label template | -| `PrintingOptions.ReturnLabels.LabelFormat` | enum | **Yes** | `PDF`, `ZEBRA`, `PNG`, `PNG_200` | Output format | - ---- - -## `GLS_REPRINT_PARCEL_RESPONSE_DATA` - -Response from the `reprintParcel` function. Same structure as `GLS_CREATE_PARCELS_RESPONSE` without the -`ShipmentReference` and `GDPR` fields. - -| Field | Type | Description | -|------------------------------------------------------|----------|----------------------------------| -| `CreatedShipment.ParcelData[].TrackID` | string | Tracking ID | -| `CreatedShipment.ParcelData[].ShipmentUnitReference` | string[] | Unit references | -| `CreatedShipment.ParcelData[].ParcelNumber` | string | Parcel number | -| `CreatedShipment.ParcelData[].Barcodes` | object | Barcode data | -| `CreatedShipment.ParcelData[].RoutingInfo` | object | Routing details | -| `CreatedShipment.PrintData[].Data` | string | Base64-encoded label | -| `CreatedShipment.PrintData[].LabelFormat` | enum | `PDF`, `ZEBRA`, `PNG`, `PNG_200` | -| `CreatedShipment.CustomerID` | string | GLS customer identifier | -| `CreatedShipment.PickupLocation` | string | Depot pickup location | -| `CreatedShipment.GDPR` | string[] | GDPR references | - ---- - -## `GLS_VALIDATE_SHIPMENT_REQUEST_DATA` - -Input for the `validateShipment` function. - -| Field | Type | Required | Description | -|------------|--------------|----------|-----------------------------------| -| `Shipment` | GLS_SHIPMENT | **Yes** | The complete shipment to validate | - ---- - -## `GLS_VALIDATE_SHIPMENT_RESPONSE_DATA` - -Response from the `validateShipment` function. - -| Field | Type | Description | -|----------------------------------------|----------|--------------------------------------------------| -| `success` | boolean | Whether the shipment passed all validation rules | -| `validationResult.Issues[]` | array | List of validation issues (empty if valid) | -| `validationResult.Issues[].Rule` | string | Name of the failed validation rule | -| `validationResult.Issues[].Location` | string | Path in the data where the issue was found | -| `validationResult.Issues[].Parameters` | string[] | Additional details about the issue | - ---- - -## Type dependency diagram - -``` -GLS_SHIPMENT_WITHOUT_SERVICES - ├── ConsigneeSchema: GLS_CONSIGNEE - │ └── AddressSchema: GLS_ADDRESS - ├── ShipperSchema: GLS_SHIPPER - │ ├── AddressSchema: GLS_ADDRESS - │ └── AlternativeShipperAddress: GLS_ADDRESS - └── ShipmentUnit[]: GLS_SHIPMENT_UNIT - └── Service: GLS_UNIT_SERVICE - -GLS_PRINTING_OPTIONS - └── ReturnLabels: { TemplateSet, LabelFormat } - -GLS_CUSTOM_CONTENT - └── { CustomerLogo, BarcodeContentType, Barcode, BarcodeType, HideShipperAddress } - -GLS_RETURN_OPTIONS - └── { ReturnPrintData, ReturnRoutingInfo } - -─── Shipment function ────────────────────────────────────────────── -[GLS_SHIPMENT_WITHOUT_SERVICES + GLS_PRINTING_OPTIONS + ...] → GLS_CREATE_PARCELS_RESPONSE -``` diff --git a/docs/Actions/GLS/types.mdx b/docs/Actions/GLS/types.mdx new file mode 100644 index 0000000..6d259e7 --- /dev/null +++ b/docs/Actions/GLS/types.mdx @@ -0,0 +1,1619 @@ +--- +title: Datatypes +description: All data types registered by the GLS Action. +--- +import {TypeTable} from "fumadocs-ui/components/type-table"; + +# GLS Action Types + +The GLS Action registers the following data types with the Hercules platform. These types are used as inputs and outputs of the GLS functions and can be referenced in your flows. + +--- + +# GLS_VALIDATE_SHIPMENT_REQUEST_DATA +No documentation provided for this type. + + + +# GLS_VALIDATE_SHIPMENT_RESPONSE_DATA +No documentation provided for this type. + + + +# GLS_VALIDATE_SHIPMENT_RESPONSE_DATA$validationResult +No documentation provided for this type. + + + +# GLS_VALIDATE_SHIPMENT_RESPONSE_DATA$validationResult$Issues +No documentation provided for this type. + + + +# GLS_UPDATE_PARCEL_WEIGHT_REQUEST_DATA +No documentation provided for this type. + + + +# GLS_UPDATE_PARCEL_WEIGHT_RESPONSE_DATA +No documentation provided for this type. + + + +# GLS_UNIT_SERVICE +No documentation provided for this type. + + + +# GLS_UNIT_SERVICE$LimitedQuantities +No documentation provided for this type. + + + +# GLS_UNIT_SERVICE$ExWorks +No documentation provided for this type. + + + +# GLS_UNIT_SERVICE$HazardousGoods +No documentation provided for this type. + + + +# GLS_UNIT_SERVICE$HazardousGoods$HarzardousGood +No documentation provided for this type. + + + +# GLS_UNIT_SERVICE$AddonLiability +No documentation provided for this type. + + + +# GLS_UNIT_SERVICE$Cash +No documentation provided for this type. + + + +# GLS_SHIPPER +No documentation provided for this type. + + + +# GLS_SHIPMENT_UNIT +No documentation provided for this type. + + + +# GLS_SHIPMENT_UNIT$Service +No documentation provided for this type. + + + +# GLS_SHIPMENT_UNIT$Service$LimitedQuantities +No documentation provided for this type. + + + +# GLS_SHIPMENT_UNIT$Service$ExWorks +No documentation provided for this type. + + + +# GLS_SHIPMENT_UNIT$Service$HazardousGoods +No documentation provided for this type. + + + +# GLS_SHIPMENT_UNIT$Service$HazardousGoods$HarzardousGood +No documentation provided for this type. + + + +# GLS_SHIPMENT_UNIT$Service$AddonLiability +No documentation provided for this type. + + + +# GLS_SHIPMENT_UNIT$Service$Cash +No documentation provided for this type. + + + +# GLS_SHIPMENT +No documentation provided for this type. + + + +# GLS_SHIPMENT$Return +No documentation provided for this type. + + + +# GLS_SHIPMENT_WITHOUT_SERVICES +No documentation provided for this type. + + + +# GLS_SHIPMENT_WITHOUT_SERVICES$Return +No documentation provided for this type. + + + +# GLS_RETURN_OPTIONS +No documentation provided for this type. + + + +# GLS_REPRINT_PARCEL_REQUEST_DATA +No documentation provided for this type. + + + +# GLS_REPRINT_PARCEL_REQUEST_DATA$PrintingOptions +No documentation provided for this type. + + + +# GLS_REPRINT_PARCEL_REQUEST_DATA$PrintingOptions$ReturnLabels +No documentation provided for this type. + + + +# GLS_REPRINT_PARCEL_RESPONSE_DATA +No documentation provided for this type. + + + +# GLS_REPRINT_PARCEL_RESPONSE_DATA$CreatedShipment +No documentation provided for this type. + + + +# GLS_REPRINT_PARCEL_RESPONSE_DATA$CreatedShipment$PrintData +No documentation provided for this type. + + + +# GLS_REPRINT_PARCEL_RESPONSE_DATA$CreatedShipment$ParcelData +No documentation provided for this type. + + + +# GLS_REPRINT_PARCEL_RESPONSE_DATA$CreatedShipment$ParcelData$RoutingInfo +No documentation provided for this type. + + + +# GLS_REPRINT_PARCEL_RESPONSE_DATA$CreatedShipment$ParcelData$Barcodes +No documentation provided for this type. + + + +# RETURN_LABELS +No documentation provided for this type. + + + +# GLS_PRINTING_OPTIONS +No documentation provided for this type. + + + +# GLS_PRINTING_OPTIONS$DefinePrinter +No documentation provided for this type. + + + +# GLS_END_OF_DAY_REQUEST_DATA +No documentation provided for this type. + + + +# GLS_END_OF_DAY_RESPONSE_DATA +No documentation provided for this type. + + + +# GLS_END_OF_DAY_RESPONSE_DATA$Shipments +No documentation provided for this type. + + + +# GLS_END_OF_DAY_RESPONSE_DATA$Shipments$ShipmentUnit +No documentation provided for this type. + + + +# GLS_END_OF_DAY_RESPONSE_DATA$Shipments$Shipper +No documentation provided for this type. + + + +# GLS_END_OF_DAY_RESPONSE_DATA$Shipments$Consignee +No documentation provided for this type. + + + +# GLS_CUSTOM_CONTENT +No documentation provided for this type. + + + +# GLS_CREATE_PARCELS_RESPONSE +No documentation provided for this type. + + + +# GLS_CREATE_PARCELS_RESPONSE$CreatedShipment +No documentation provided for this type. + + + +# GLS_CREATE_PARCELS_RESPONSE$CreatedShipment$PrintData +No documentation provided for this type. + + + +# GLS_CREATE_PARCELS_RESPONSE$CreatedShipment$ParcelData +No documentation provided for this type. + + + +# GLS_CREATE_PARCELS_RESPONSE$CreatedShipment$ParcelData$RoutingInfo +No documentation provided for this type. + + + +# GLS_CREATE_PARCELS_RESPONSE$CreatedShipment$ParcelData$Barcodes +No documentation provided for this type. + + + +# GLS_CONSIGNEE +No documentation provided for this type. + + + +# GLS_CANCEL_SHIPMENT_REQUEST_DATA +No documentation provided for this type. + + + +# GLS_CANCEL_SHIPMENT_RESPONSE_DATA +No documentation provided for this type. + + + +# GLS_ALLOWED_SERVICES_REQUEST_DATA +No documentation provided for this type. + + + +# GLS_ALLOWED_SERVICES_REQUEST_DATA$Destination +No documentation provided for this type. + + + +# GLS_ALLOWED_SERVICES_REQUEST_DATA$Source +No documentation provided for this type. + + + +# GLS_ALLOWED_SERVICES_RESPONSE_DATA +No documentation provided for this type. + + + +# GLS_ALLOWED_SERVICES_RESPONSE_DATA$AllowedServices +No documentation provided for this type. + + + +# GLS_ADDRESS +No documentation provided for this type. + + + \ No newline at end of file diff --git a/docs/index.mdx b/docs/index.mdx index 272254b..6ddc0a0 100644 --- a/docs/index.mdx +++ b/docs/index.mdx @@ -36,8 +36,8 @@ Before using any action from Centaurus, make sure you have: - [Installation Guide](installation.md) — How to deploy an action on your self-hosted instance - [GLS Action Overview](Actions/GLS/overview.md) — Get started with the GLS shipping integration - [GLS Configuration](Actions/GLS/configs.md) — API keys and configuration options -- [GLS Functions](Actions/GLS/functions.md) — All available functions and their parameters -- [GLS Types](Actions/GLS/types.md) — Data types used across the GLS action +- [GLS Functions](Actions/GLS/functions.mdx) — All available functions and their parameters +- [GLS Types](Actions/GLS/types.mdx) — Data types used across the GLS action - [GLS Events](Actions/GLS/events.md) — Events emitted by the GLS action - [Common Use Cases](Actions/GLS/use-cases.md) — Example workflows using the GLS action - [Troubleshooting](Actions/GLS/troubleshooting.md) — FAQ and community support \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index f45fe06..273360b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ "actions/*" ], "dependencies": { - "@code0-tech/hercules": "file:code0-tech-hercules-0.0.0.tgz", + "@code0-tech/hercules": "^0.0.2", "axios": "^1.13.6", "vite": "^7.3.1", "zod": "^4.3.6", @@ -29,7 +29,10 @@ }, "actions/gls-action": { "name": "@code0-tech/gls-action", - "version": "0.0.0" + "version": "0.0.0", + "dependencies": { + "ts-morph": "^27.0.2" + } }, "actions/notion-action": { "name": "@code0-tech/notion-action", @@ -41,12 +44,12 @@ "link": true }, "node_modules/@code0-tech/hercules": { - "version": "0.0.0", - "resolved": "file:code0-tech-hercules-0.0.0.tgz", - "integrity": "sha512-MwoauVdEnfA7IvODjPt2aPbQe8m0xmFAq+smn/sIId/yeJ1ldmoJjhtDFeXpYgS6fLZQ09lgpXrTYmZAiyRPsQ==", + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/@code0-tech/hercules/-/hercules-0.0.2.tgz", + "integrity": "sha512-oG0N8zRNX8WJmYORhbNnAj75HXi6pzL+xclO3vOxHQiOBjb4hjqnRYIBtCTuR9xAJSXeOEqPu5rgK2hHKTsdzA==", "license": "ISC", "dependencies": { - "@code0-tech/tucana": "file:code0-tech-tucana-0.0.0.tgz", + "@code0-tech/tucana": "^0.0.65", "@grpc/grpc-js": "^1.14.3", "@protobuf-ts/grpc-backend": "^2.11.1", "@protobuf-ts/grpc-transport": "^2.11.1", @@ -54,10 +57,10 @@ "@protobuf-ts/runtime-rpc": "^2.11.1" } }, - "node_modules/@code0-tech/hercules/node_modules/@code0-tech/tucana": { - "version": "0.0.0", - "resolved": "file:code0-tech-tucana-0.0.0.tgz", - "integrity": "sha512-ZXpWELHdEYyeJaGue9Lq2t0sqnR4F77fxwsAaim0Q7gkilsCCzIFYPy4t3cRhfhKtw3iSknDOGrtFqvAaH6D5w==", + "node_modules/@code0-tech/tucana": { + "version": "0.0.65", + "resolved": "https://registry.npmjs.org/@code0-tech/tucana/-/tucana-0.0.65.tgz", + "integrity": "sha512-XTNAZ+iqTEf1yLU0uqNc2+ICg6tRF0w41C6da9DePoV4qDa2aRmZwA4jJyr/1i+hohZVKRrhkY7Qaf/blsyx0g==", "license": "Apache-2.0" }, "node_modules/@esbuild/aix-ppc64": { @@ -1141,6 +1144,17 @@ "dev": true, "license": "MIT" }, + "node_modules/@ts-morph/common": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@ts-morph/common/-/common-0.28.1.tgz", + "integrity": "sha512-W74iWf7ILp1ZKNYXY5qbddNaml7e9Sedv5lvU1V8lftlitkc9Pq1A+jlH23ltDgWYeZFFEqGCD1Ies9hqu3O+g==", + "license": "MIT", + "dependencies": { + "minimatch": "^10.0.1", + "path-browserify": "^1.0.1", + "tinyglobby": "^0.2.14" + } + }, "node_modules/@turbo/darwin-64": { "version": "2.8.21", "resolved": "https://registry.npmjs.org/@turbo/darwin-64/-/darwin-64-2.8.21.tgz", @@ -1694,21 +1708,20 @@ "license": "MIT" }, "node_modules/axios": { - "version": "1.13.6", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.13.6.tgz", - "integrity": "sha512-ChTCHMouEe2kn713WHbQGcuYrr6fXTBiu460OTwWrWob16g1bXn4vtz07Ope7ewMozJAnEquLk5lWQWtBig9DQ==", + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.15.0.tgz", + "integrity": "sha512-wWyJDlAatxk30ZJer+GeCWS209sA42X+N5jU2jy6oHTp7ufw8uzUTVFBX9+wTfAlhiJXGS0Bq7X6efruWjuK9Q==", "license": "MIT", "dependencies": { "follow-redirects": "^1.15.11", "form-data": "^4.0.5", - "proxy-from-env": "^1.1.0" + "proxy-from-env": "^2.1.0" } }, "node_modules/balanced-match": { "version": "4.0.4", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz", "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==", - "dev": true, "license": "MIT", "engines": { "node": "18 || 20 || >=22" @@ -1718,7 +1731,6 @@ "version": "5.0.5", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.5.tgz", "integrity": "sha512-VZznLgtwhn+Mact9tfiwx64fA9erHH/MCXEUfB/0bX/6Fz6ny5EGTXYltMocqg4xFAQZtnO3DHWWXi8RiuN7cQ==", - "dev": true, "license": "MIT", "dependencies": { "balanced-match": "^4.0.2" @@ -1764,6 +1776,12 @@ "node": ">=12" } }, + "node_modules/code-block-writer": { + "version": "13.0.3", + "resolved": "https://registry.npmjs.org/code-block-writer/-/code-block-writer-13.0.3.tgz", + "integrity": "sha512-Oofo0pq3IKnsFtuHqSF7TqBfr71aeyZDVJ0HpmqB7FBM2qEigL0iPONSCZSO9pE9dZTAxANe5XHG9Uy0YMv8cg==", + "license": "MIT" + }, "node_modules/color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", @@ -2597,7 +2615,6 @@ "version": "10.2.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.4.tgz", "integrity": "sha512-oRjTw/97aTBN0RHbYCdtF1MQfvusSIBQM0IZEgzl6426+8jSC0nF1a/GmnVLpfB9yyr6g6FTqWqiZVbxrtaCIg==", - "dev": true, "license": "BlueOak-1.0.0", "dependencies": { "brace-expansion": "^5.0.2" @@ -2702,6 +2719,12 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/path-browserify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-1.0.1.tgz", + "integrity": "sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==", + "license": "MIT" + }, "node_modules/path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -2810,10 +2833,13 @@ } }, "node_modules/proxy-from-env": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", - "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", - "license": "MIT" + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-2.1.0.tgz", + "integrity": "sha512-cJ+oHTW1VAEa8cJslgmUZrc+sjRKgAKl3Zyse6+PV38hZe/V6Z14TbCuXcan9F9ghlz4QrFr2c92TNF82UkYHA==", + "license": "MIT", + "engines": { + "node": ">=10" + } }, "node_modules/punycode": { "version": "2.3.1", @@ -3026,6 +3052,16 @@ "typescript": ">=4.8.4" } }, + "node_modules/ts-morph": { + "version": "27.0.2", + "resolved": "https://registry.npmjs.org/ts-morph/-/ts-morph-27.0.2.tgz", + "integrity": "sha512-fhUhgeljcrdZ+9DZND1De1029PrE+cMkIP7ooqkLRTrRLTqcki2AstsyJm0vRNbTbVCNJ0idGlbBrfqc7/nA8w==", + "license": "MIT", + "dependencies": { + "@ts-morph/common": "~0.28.1", + "code-block-writer": "^13.0.3" + } + }, "node_modules/turbo": { "version": "2.8.21", "resolved": "https://registry.npmjs.org/turbo/-/turbo-2.8.21.tgz", @@ -3111,9 +3147,9 @@ } }, "node_modules/vite": { - "version": "7.3.1", - "resolved": "https://registry.npmjs.org/vite/-/vite-7.3.1.tgz", - "integrity": "sha512-w+N7Hifpc3gRjZ63vYBXA56dvvRlNWRczTdmCBBa+CotUzAPf5b7YMdMR/8CQoeYE5LX3W4wj6RYTgonm1b9DA==", + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/vite/-/vite-7.3.2.tgz", + "integrity": "sha512-Bby3NOsna2jsjfLVOHKes8sGwgl4TT0E6vvpYgnAYDIF/tie7MRaFthmKuHx1NSXjiTueXH3do80FMQgvEktRg==", "license": "MIT", "dependencies": { "esbuild": "^0.27.0", diff --git a/package.json b/package.json index 03cbe81..4eb0488 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "packageManager": "npm@11.12.1", "scripts": { "build": "npm run build --workspaces --if-present", + "generate:docs": "npm run generate:docs --workspaces --if-present", "start": "turbo run start", "test": "vitest run", "test:watch": "vitest", @@ -25,7 +26,7 @@ "vitest": "^4.0.0" }, "dependencies": { - "@code0-tech/hercules": "file:code0-tech-hercules-0.0.0.tgz", + "@code0-tech/hercules": "^0.0.2", "axios": "^1.13.6", "vite": "^7.3.1", "zod": "^4.3.6", diff --git a/src/standardActionDocs.ts b/src/standardActionDocs.ts new file mode 100644 index 0000000..5d3b9ab --- /dev/null +++ b/src/standardActionDocs.ts @@ -0,0 +1,399 @@ +import {writeFileSync} from "fs" +import { + ActionSdk, + HerculesActionConfigurationDefinition, + HerculesDataType, + HerculesFlowType, + HerculesRegisterFunctionParameter, +} from "@code0-tech/hercules" +import {Project, SymbolFlags, Type} from "ts-morph" + +interface Translation { + code?: string + content?: string +} + +interface FunctionDefinitionCard { + descriptions?: Array + displayMessages?: Array + identifier?: string + names?: Array + parameterDefinitions?: { + nodes: { + identifier: string + descriptions: Array + names: Array + }[] + } +} + +interface RegistryState { + dataTypes: HerculesDataType[] + actionConfigurationDefinitions: HerculesActionConfigurationDefinition[] + runtimeFunctions: HerculesRegisterFunctionParameter[] + flowTypes: HerculesFlowType[] +} + +interface FunctionGroup { + heading: string + modules: Record Promise> + intro?: string +} + +interface TypesCopy { + title: string + description: string + heading: string + intro: string +} + +interface FunctionsCopy { + title: string + description: string + intro: string +} + +export interface StandardActionDocsConfig { + actionName: string + typePrefix: string + typesOutputPath: string + functionsOutputPath: string + typesCopy: TypesCopy + functionsCopy: FunctionsCopy + functionGroups: FunctionGroup[] + typeLinkOverrides?: Record + loadAllDefinitions: (sdk: ActionSdk) => Promise +} + +function createRegistry(): RegistryState { + return { + dataTypes: [], + actionConfigurationDefinitions: [], + runtimeFunctions: [], + flowTypes: [], + } +} + +function createMockSdk(registry: RegistryState): ActionSdk { + return { + onError: () => {}, + connect: () => Promise.resolve([]), + dispatchEvent: () => Promise.resolve(), + getProjectActionConfigurations: () => [], + config: { + authToken: "", + aquilaUrl: "", + version: "", + actionId: "", + }, + fullyConnected: () => false, + registerDataTypes: (...dataTypes) => { + registry.dataTypes = [...dataTypes, ...registry.dataTypes] + return Promise.resolve() + }, + registerConfigDefinitions: (...actionConfigurations) => { + registry.actionConfigurationDefinitions = [ + ...actionConfigurations, + ...registry.actionConfigurationDefinitions, + ] + return Promise.resolve() + }, + registerFunctionDefinitions: (...functionDefinitions) => { + registry.runtimeFunctions = [...functionDefinitions, ...registry.runtimeFunctions] + return Promise.resolve() + }, + registerFlowTypes: (...flowTypes) => { + registry.flowTypes = [...registry.flowTypes, ...flowTypes] + return Promise.resolve() + }, + } +} + +function breakDownType(typeName: string, code: string): Record { + const map: Record = {} + const project = new Project({useInMemoryFileSystem: true}) + const sourceFile = project.createSourceFile("example.ts", code) + + const typeAlias = sourceFile.getTypeAliasOrThrow(typeName) + let rootType = typeAlias.getType() + + if (rootType.isArray()) { + rootType = rootType.getArrayElementTypeOrThrow() + } + + function buildType(type: Type, currentName: string): string { + const lines: string[] = [] + + type.getProperties().forEach(symbol => { + const name = symbol.getName() + const decl = symbol.getDeclarations()[0] + if (!decl) { + return + } + + let propType = symbol.getTypeAtLocation(decl) + let isArray = false + if (propType.isArray()) { + propType = propType.getArrayElementTypeOrThrow() + isArray = true + } + + let typeText: string + if (propType.getText().startsWith("{")) { + const nestedName = `${currentName}$${name}` + const nestedType = buildType(propType, nestedName) + map[nestedName] = `export type ${nestedName} = ${nestedType};` + typeText = isArray ? `${nestedName}[]` : nestedName + } else { + typeText = propType.getText(decl) + } + + const jsDocs = (decl as any).getJsDocs?.() + ?.map((doc: any) => doc.getText()) + .join("\n") + const docPrefix = jsDocs ? `${jsDocs}\n` : "" + lines.push(`${docPrefix}${name}${symbol.hasFlags(SymbolFlags.Optional) ? "?" : ""}: ${typeText};`) + }) + + return `{\n${lines.map(line => ` ${line}`).join("\n")}\n}` + } + + const finalType = buildType(rootType, typeName) + map[typeName] = `export type ${typeName} = ${finalType};` + return map +} + +function normalizeAnchor(typeName: string): string { + return typeName.toLowerCase().replace(/-/g, "_").replace(/\$/g, "").replace("[]", "") +} + +function getTypeLink(typeName: string | null, config: StandardActionDocsConfig): string | null { + if (!typeName) { + return null + } + + const override = config.typeLinkOverrides?.[typeName] + const resolved = override || typeName + + if (!resolved.startsWith(config.typePrefix)) { + return resolved + } + + return `[${resolved}](./types.mdx#${normalizeAnchor(resolved)})` +} + +function generateDatatypes(config: StandardActionDocsConfig, registry: RegistryState): string { + let generatedDoc = `--- +title: ${config.typesCopy.title} +description: ${config.typesCopy.description} +--- +import {TypeTable} from "fumadocs-ui/components/type-table"; + +# ${config.typesCopy.heading} + +${config.typesCopy.intro} + +--- +` + + registry.dataTypes.forEach(value => { + value.type = `export type ${value.identifier} = ${value.type}`.replace(/ \| undefined/g, "") + + const parts = breakDownType(value.identifier, value.type) + const entries = Object.entries(parts).reverse() + + entries.forEach(([key, rawType]) => { + let typeString = "\n" + let globalDocumentation = "" + + const project = new Project({useInMemoryFileSystem: true}) + const sourceFile = project.createSourceFile("example.ts", rawType) + const typeAlias = sourceFile.getTypeAliasOrThrow(key) + + let parsedType = typeAlias.getType() + if (parsedType.isArray()) { + parsedType = parsedType.getArrayElementTypeOrThrow() + } + + parsedType.getProperties().forEach(property => { + const propertyType = property.getTypeAtLocation(typeAlias) + const propertyTypeText = propertyType.getText() + + const docs: Record = { + description: "No description set", + deprecated: false, + default: undefined, + link: undefined, + } + + property.getJsDocTags().forEach(tag => { + tag.getText().forEach(part => { + if (tag.getName() === "global") { + globalDocumentation = `${globalDocumentation}\n${part.text.trim()}` + return + } + docs[tag.getName()] = part.text.trim() + }) + }) + + if (propertyTypeText.startsWith(config.typePrefix)) { + docs.link = normalizeAnchor(propertyTypeText) + } + + typeString += `${property.getName()}: { + description: '${docs.description}', + deprecated: ${docs.deprecated}, + required: ${!property.isOptional()}, ${docs.link ? `\ntypeDescriptionLink: '#${docs.link}',` : ""} + type: '${propertyTypeText}', ${docs.default ? `\ndefault: ${docs.default}` : ""} + }, + ` + }) + + generatedDoc += ` +# ${key}${globalDocumentation || "\nNo documentation provided for this type."} + + + ` + }) + }) + + return generatedDoc +} + +function getParamInfo(signature: string, paramName: string): { optional: boolean; type: string | null } { + const paramsMatch = signature.match(/\((.*)\)/s) + if (!paramsMatch) { + return {optional: false, type: null} + } + + const params = paramsMatch[1].split(",") + for (const param of params) { + const trimmed = param.trim() + const match = trimmed.match(new RegExp(`${paramName}\\s*(\\?)?\\s*:\\s*(.+)`)) + if (match) { + return { + optional: match[1] === "?", + type: match[2].trim(), + } + } + } + + return {optional: false, type: null} +} + +function generateMarkdownTable(headers: string[], rows: string[][]): string { + const headerRow = `| ${headers.join(" | ")} |` + const separator = `| ${headers.map(() => "---").join(" | ")} |` + const bodyRows = rows.map(row => `| ${row.join(" | ")} |`) + return [headerRow, separator, ...bodyRows].join("\n") +} + +async function loadFunctions( + modules: Record Promise>, + sdk: ActionSdk, + registry: RegistryState, +): Promise { + for (const path in modules) { + const mod: any = await modules[path]() + if (typeof mod.default !== "function") { + continue + } + + try { + await mod.default(sdk) + } catch (error) { + console.log(`Error registering functions from ${path}:`, error) + } + } + + registry.runtimeFunctions = [...registry.runtimeFunctions] +} + +async function generateFunctions(config: StandardActionDocsConfig, sdk: ActionSdk, registry: RegistryState): Promise { + let generatedDoc = `--- +title: ${config.functionsCopy.title} +description: ${config.functionsCopy.description} +--- + +${config.functionsCopy.intro} + +--- +` + + for (const group of config.functionGroups) { + registry.runtimeFunctions = [] + await loadFunctions(group.modules, sdk, registry) + + generatedDoc += ` +## ${group.heading} +${group.intro ? `\n${group.intro}\n` : ""} +` + + registry.runtimeFunctions.forEach(value => { + const definition = value.definition + const card: FunctionDefinitionCard = { + descriptions: definition.description, + names: definition.name, + identifier: definition.runtimeName, + parameterDefinitions: { + nodes: definition.parameters.map(parameter => ({ + names: parameter.name, + identifier: parameter.runtimeName, + descriptions: parameter.description, + })), + }, + displayMessages: definition.displayMessage, + } + + const headers = ["Parameter", "Name", "Type", "Required", "Description"] + const rows: string[][] = definition.parameters.map(parameter => { + const paramInfo = getParamInfo(definition.signature, parameter.runtimeName) + const linkedType = getTypeLink(paramInfo.type, config) + + return [ + parameter.runtimeName, + parameter.name[0].content, + linkedType?.replace(/\|/g, "\\|") || "Unknown", + paramInfo.optional ? "No" : "Yes", + parameter.description[0].content, + ] + }) + + const returnType = definition.signature.split("):")[1]?.trim() + generatedDoc += ` +### \`${definition.runtimeName}\` + +${generateMarkdownTable(headers, rows)} + +Return Type: ${getTypeLink(returnType || null, config) || "Unknown"} + +# + +${definition.documentation?.at(0)?.content || ""} + + + +--- +` + }) + } + + return generatedDoc +} + +export async function runStandardActionDocs(config: StandardActionDocsConfig): Promise { + const registry = createRegistry() + const sdk = createMockSdk(registry) + + await config.loadAllDefinitions(sdk) + + const typesContent = generateDatatypes(config, registry) + const functionsContent = await generateFunctions(config, sdk, registry) + + writeFileSync(config.typesOutputPath, typesContent, "utf8") + writeFileSync(config.functionsOutputPath, functionsContent, "utf8") +} + diff --git a/tsconfig.base.json b/tsconfig.base.json index fbfad07..e8bddc1 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -3,12 +3,12 @@ "esModuleInterop": true, "module": "es2022", "moduleResolution": "bundler", - "target": "es2020", - "lib": ["es2020", "dom"], + "target": "es2021", + "lib": ["es2022", "es2021", "dom"], "strict": false, "skipLibCheck": true, - "types": ["vite/client"] + "types": ["vite/client"], }, - "include": ["src/**/*"], + "include": ["src/**/*", "scripts"], "exclude": ["node_modules", "dist", "***/test/**", "**/*.test.ts"] } \ No newline at end of file