1- //TODO: Why is the request data here wrapped within a object and isn't a direct parameter
2-
31import {
4- Description , DisplayIcon ,
2+ Description ,
3+ DisplayIcon ,
54 DisplayMessage ,
65 Documentation ,
76 FunctionContext ,
@@ -11,17 +10,14 @@ import {
1110 RuntimeError ,
1211 Signature ,
1312} from "@code0-tech/hercules" ;
14- import { cancelShipment } from "../helpers.js" ;
15- import {
16- CancelShipmentRequestData ,
17- CancelShipmentResponseData ,
18- } from "../data_types/glsCancelShipment.js" ;
13+ import { cancelShipment } from "../helpers.js" ;
14+ import { CancelShipmentResponseData } from "../data_types/glsCancelShipment.js" ;
1915
2016@Identifier ( "cancelShipment" )
2117@DisplayIcon ( "codezero:gls" )
22- @Signature ( "(data: GLS_CANCEL_SHIPMENT_REQUEST_DATA ): GLS_CANCEL_SHIPMENT_RESPONSE_DATA" )
23- @Name ( { code : "en-US" , content : "Cancel shipment" } )
24- @DisplayMessage ( { code : "en-US" , content : "Cancel shipment" } )
18+ @Signature ( "(TrackID: string ): GLS_CANCEL_SHIPMENT_RESPONSE_DATA" )
19+ @Name ( { code : "en-US" , content : "Cancel shipment" } )
20+ @DisplayMessage ( { code : "en-US" , content : "Cancel shipment" } )
2521@Documentation ( {
2622 code : "en-US" ,
2723 content : "Cancels an existing shipment by its Track ID. Only possible if the parcel has not yet been scanned." ,
@@ -31,14 +27,16 @@ import {
3127 content : "Cancels an existing shipment by its Track ID. Only possible if the parcel has not yet been scanned." ,
3228} )
3329@Parameter ( {
34- runtimeName : "data " ,
35- name : [ { code : "en-US" , content : "Data" } ] ,
36- description : [ { code : "en-US" , content : "The cancel shipment request data." } ] ,
30+ runtimeName : "TrackID " ,
31+ name : [ { code : "en-US" , content : "Track ID" } ] ,
32+ description : [ { code : "en-US" , content : "The Track ID of the shipment to cancel." } ] ,
3733} )
3834export class CancelShipmentFunction {
39- async run ( context : FunctionContext , data : CancelShipmentRequestData ) : Promise < CancelShipmentResponseData > {
35+ async run ( context : FunctionContext , TrackID : string ) : Promise < CancelShipmentResponseData > {
4036 try {
41- return await cancelShipment ( data , context ) ;
37+ return await cancelShipment ( {
38+ TrackID
39+ } , context ) ;
4240 } catch ( error ) {
4341 if ( typeof error === "string" ) {
4442 throw new RuntimeError ( "ERROR_CREATING_GLS_SHIPMENT" , error ) ;
0 commit comments