Skip to content

Commit ffd3923

Browse files
committed
feat: refactor validateShipmentFunction to accept Shipment as parameter instead of ValidateShipmentRequestData
1 parent fd171e4 commit ffd3923

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

actions/gls-action/src/functions/validateShipmentFunction.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ import {
1212
} from "@code0-tech/hercules";
1313
import { getAuthToken, transformValidateShipmentRequestDataToInternalFormat } from "../helpers.js";
1414
import {
15-
ValidateShipmentRequestData,
1615
ValidateShipmentResponseData,
1716
ValidateShipmentResponseDataSchema,
1817
} from "../data_types/glsValidateShipment.js";
18+
import { Shipment } from "../data_types/glsShipment.js";
1919

2020
@Identifier("validateShipment")
2121
@DisplayIcon("codezero:gls")
22-
@Signature("(data: GLS_VALIDATE_SHIPMENT_REQUEST_DATA): GLS_VALIDATE_SHIPMENT_RESPONSE_DATA")
22+
@Signature("(Shipment: GLS_SHIPMENT): GLS_VALIDATE_SHIPMENT_RESPONSE_DATA")
2323
@Name({ code: "en-US", content: "Validate shipment" })
2424
@DisplayMessage({ code: "en-US", content: "Validate shipment" })
2525
@Documentation({
@@ -31,19 +31,19 @@ import {
3131
content: "Validates a shipment against the GLS API without creating it.\nUse this before `createShipment` functions to catch errors early.",
3232
})
3333
@Parameter({
34-
runtimeName: "data",
35-
name: [{ code: "en-US", content: "Data" }],
36-
description: [{ code: "en-US", content: "The shipment data to validate." }],
34+
runtimeName: "Shipment",
35+
name: [{ code: "en-US", content: "Shipment" }],
36+
description: [{ code: "en-US", content: "The shipment to validate." }],
3737
})
3838
export class ValidateShipmentFunction {
39-
async run(context: FunctionContext, data: ValidateShipmentRequestData): Promise<ValidateShipmentResponseData> {
39+
async run(context: FunctionContext, Shipment: Shipment): Promise<ValidateShipmentResponseData> {
4040
const url = context.matchedConfig.findConfig("ship_it_api_url") as string;
4141
const contactID = (context.matchedConfig.findConfig("contact_id") as string) || "";
4242

4343
try {
4444
const result = await axios.post(
4545
`${url}/rs/shipments/validate`,
46-
transformValidateShipmentRequestDataToInternalFormat(data, context, contactID),
46+
transformValidateShipmentRequestDataToInternalFormat({ Shipment }, context, contactID),
4747
{
4848
headers: {
4949
Authorization: `Bearer ${await getAuthToken(context)}`,

0 commit comments

Comments
 (0)