Skip to content

Commit 59a3d62

Browse files
committed
feat: make parameters optional in CustomContent schema and function signature
1 parent 83e1af6 commit 59a3d62

2 files changed

Lines changed: 10 additions & 5 deletions

File tree

actions/gls-action/src/data_types/glsCustomContent.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { DisplayMessage, Identifier, Name, Schema } from "@code0-tech/hercules";
22
import { z } from "zod";
33

44
export const CustomContentSchema = z.object({
5-
CustomerLogo: z.string(),
6-
BarcodeContentType: z.enum(["TRACK_ID", "GLS_SHIPMENT_REFERENCE"]),
5+
CustomerLogo: z.string().nullish(),
6+
BarcodeContentType: z.enum(["TRACK_ID", "GLS_SHIPMENT_REFERENCE"]).nullish(),
77
Barcode: z.string().nullish(),
88
BarcodeType: z.enum(["EAN_128", "CODE_39"]).nullish(),
99
HideShipperAddress: z.boolean().nullish(),

actions/gls-action/src/functions/utils/createCustomContentFunction.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
import {CustomContent} from "../../data_types/glsCustomContent.js";
1212

1313
@Identifier("createCustomContent")
14-
@Signature("(barcodeContentType: \"TRACK_ID\"|\"GLS_SHIPMENT_REFERENCE\", customerLogo: string, hideShipperAddress?: boolean, barcodeType?: \"EAN_128\"|\"CODE_39\", barcode?: string): GLS_CUSTOM_CONTENT")
14+
@Signature("(barcodeContentType?: \"TRACK_ID\"|\"GLS_SHIPMENT_REFERENCE\", customerLogo?: string, hideShipperAddress?: boolean, barcodeType?: \"EAN_128\"|\"CODE_39\", barcode?: string): GLS_CUSTOM_CONTENT")
1515
@Name({code: "en-US", content: "Create GLS custom label content"})
1616
@DisplayIcon("codezero:gls")
1717
@DisplayMessage({code: "en-US", content: "Create GLS custom label content"})
@@ -25,6 +25,7 @@ import {CustomContent} from "../../data_types/glsCustomContent.js";
2525
})
2626
@Parameter({
2727
runtimeName: "barcodeContentType",
28+
optional: true,
2829
name: [{code: "en-US", content: "Barcode content type"}],
2930
description: [{
3031
code: "en-US",
@@ -33,29 +34,33 @@ import {CustomContent} from "../../data_types/glsCustomContent.js";
3334
})
3435
@Parameter({
3536
runtimeName: "customerLogo",
37+
optional: true,
3638
name: [{code: "en-US", content: "Customer logo"}],
3739
description: [{code: "en-US", content: "Base64-encoded customer logo to print on the label."}],
3840
})
3941
@Parameter({
4042
runtimeName: "hideShipperAddress",
43+
optional: true,
4144
name: [{code: "en-US", content: "Hide shipper address"}],
4245
description: [{code: "en-US", content: "Whether to hide the shipper address on the label."}],
4346
})
4447
@Parameter({
4548
runtimeName: "barcodeType",
49+
optional: true,
4650
name: [{code: "en-US", content: "Barcode type"}],
4751
description: [{code: "en-US", content: "Type of barcode to use (EAN_128 or CODE_39)."}],
4852
})
4953
@Parameter({
5054
runtimeName: "barcode",
55+
optional: true,
5156
name: [{code: "en-US", content: "Barcode"}],
5257
description: [{code: "en-US", content: "Barcode value to print on the label."}],
5358
})
5459
export class CreateCustomContentFunction {
5560
run(
5661
_context: unknown,
57-
barcodeContentType: CustomContent["BarcodeContentType"],
58-
customerLogo: string,
62+
barcodeContentType?: CustomContent["BarcodeContentType"],
63+
customerLogo?: string,
5964
hideShipperAddress?: boolean,
6065
barcodeType?: CustomContent["BarcodeType"],
6166
barcode?: string

0 commit comments

Comments
 (0)