@pelygo/janus 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +617 -16
- package/dist/index.js +460 -158
- package/package.json +6 -2
package/dist/index.d.ts
CHANGED
|
@@ -208,24 +208,50 @@ export declare interface ClientSettingsPublicResponse {
|
|
|
208
208
|
export declare interface ClientsResource {
|
|
209
209
|
/** Get all clients accessible to the current user */
|
|
210
210
|
getAll(): Promise<Client[]>;
|
|
211
|
+
/** Get all clients with active integrations */
|
|
212
|
+
getWithActiveIntegrations(): Promise<Client[]>;
|
|
213
|
+
/** Preview a notification template */
|
|
214
|
+
previewNotification(type: string, clientId: number): Promise<string>;
|
|
211
215
|
/** Get a client by ID */
|
|
212
216
|
getById(id: number): Promise<Client>;
|
|
213
|
-
/**
|
|
217
|
+
/** Get a client by ID with minimal data */
|
|
218
|
+
getByIdMinimal(id: number): Promise<Client>;
|
|
219
|
+
/** Create a new client */
|
|
220
|
+
create(data: CreateClientRequest): Promise<Client>;
|
|
221
|
+
/** Full update a client (PUT) */
|
|
222
|
+
replace(id: number, data: Client): Promise<Client>;
|
|
223
|
+
/** Partial update a client (PATCH) */
|
|
214
224
|
update(id: number, data: UpdateClientRequest): Promise<Client>;
|
|
225
|
+
/** Get return reasons for a client */
|
|
226
|
+
getReturnReasons(clientId: number): Promise<unknown[]>;
|
|
227
|
+
/** Add a return reason to a client */
|
|
228
|
+
addReturnReason(clientId: number, returnReasonId: number): Promise<unknown>;
|
|
229
|
+
/** Update return reasons for a client */
|
|
230
|
+
updateReturnReasons(clientId: number, data: unknown): Promise<unknown>;
|
|
231
|
+
/** Remove a return reason from a client */
|
|
232
|
+
removeReturnReason(clientId: number, returnReasonId: number): Promise<void>;
|
|
215
233
|
/** Get courier services for a client */
|
|
216
234
|
getCourierServices(clientId: number): Promise<ClientCourierService[]>;
|
|
217
235
|
/** Get a specific courier service for a client */
|
|
218
236
|
getCourierServiceById(clientId: number, serviceId: number): Promise<ClientCourierService>;
|
|
237
|
+
/** Add a courier service for a client */
|
|
238
|
+
addCourierService(clientId: number, data: Partial<ClientCourierService>): Promise<ClientCourierService>;
|
|
219
239
|
/** Update a courier service for a client */
|
|
220
240
|
updateCourierService(clientId: number, service: Partial<ClientCourierService>): Promise<ClientCourierService>;
|
|
241
|
+
/** Delete a courier service from a client */
|
|
242
|
+
deleteCourierService(clientId: number, serviceId: number): Promise<boolean>;
|
|
243
|
+
/** Create an integration for a client */
|
|
244
|
+
createIntegration(clientId: number, data: CreateClientIntegrationRequest): Promise<unknown>;
|
|
221
245
|
/** Get order by reference for a client */
|
|
222
246
|
getOrderByRef(clientId: number, orderRef: string): Promise<unknown>;
|
|
223
|
-
/**
|
|
224
|
-
|
|
225
|
-
/** Remove a return reason from a client */
|
|
226
|
-
removeReturnReason(clientId: number, returnReasonId: number): Promise<void>;
|
|
247
|
+
/** Get files for a client */
|
|
248
|
+
getFiles(clientId: number): Promise<unknown>;
|
|
227
249
|
/** Upload a file for a client */
|
|
228
250
|
uploadFile(clientId: number, filename: string, data: UploadFileRequest): Promise<UploadFileResponse>;
|
|
251
|
+
/** Delete a file for a client */
|
|
252
|
+
deleteFile(clientId: number, filename: string): Promise<boolean>;
|
|
253
|
+
/** Get settings for a client */
|
|
254
|
+
getSettings(clientId: number): Promise<unknown>;
|
|
229
255
|
}
|
|
230
256
|
|
|
231
257
|
/**
|
|
@@ -242,6 +268,18 @@ export declare interface Courier extends BaseEntity {
|
|
|
242
268
|
active?: boolean;
|
|
243
269
|
}
|
|
244
270
|
|
|
271
|
+
/** Courier entity from the API */
|
|
272
|
+
export declare interface CourierEntity {
|
|
273
|
+
id: number;
|
|
274
|
+
name: string;
|
|
275
|
+
logo_url?: string;
|
|
276
|
+
location_url?: string;
|
|
277
|
+
status?: boolean;
|
|
278
|
+
courier_services?: CourierServiceEntity[];
|
|
279
|
+
created_ts?: string;
|
|
280
|
+
updated_ts?: string;
|
|
281
|
+
}
|
|
282
|
+
|
|
245
283
|
/**
|
|
246
284
|
* Courier Service Entity
|
|
247
285
|
*
|
|
@@ -264,6 +302,138 @@ export declare interface CourierService extends BaseEntity {
|
|
|
264
302
|
price?: number;
|
|
265
303
|
}
|
|
266
304
|
|
|
305
|
+
/** Courier service entity from the API */
|
|
306
|
+
export declare interface CourierServiceEntity {
|
|
307
|
+
id: number;
|
|
308
|
+
name: string;
|
|
309
|
+
courier_integration_name?: string;
|
|
310
|
+
courier_service_code?: string;
|
|
311
|
+
weight_min?: number;
|
|
312
|
+
weight_max?: number;
|
|
313
|
+
status?: boolean;
|
|
314
|
+
courier?: CourierEntity;
|
|
315
|
+
created_ts?: string;
|
|
316
|
+
updated_ts?: string;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* Couriers resource interface
|
|
321
|
+
*/
|
|
322
|
+
export declare interface CouriersResource {
|
|
323
|
+
/** Get all couriers */
|
|
324
|
+
getAll(): Promise<CourierEntity[]>;
|
|
325
|
+
/** Get a courier by ID */
|
|
326
|
+
getById(id: number): Promise<CourierEntity>;
|
|
327
|
+
/** Create a new courier */
|
|
328
|
+
create(data: CreateCourierRequest): Promise<CourierEntity>;
|
|
329
|
+
/** Update a courier */
|
|
330
|
+
update(id: number, data: Partial<CreateCourierRequest>): Promise<CourierEntity>;
|
|
331
|
+
/** Get all services for a courier */
|
|
332
|
+
getServices(courierId: number): Promise<CourierServiceEntity[]>;
|
|
333
|
+
/** Get a specific service for a courier */
|
|
334
|
+
getServiceById(courierId: number, serviceId: number): Promise<CourierServiceEntity>;
|
|
335
|
+
/** Create a new service for a courier */
|
|
336
|
+
createService(courierId: number, data: CreateCourierServiceRequest): Promise<CourierServiceEntity>;
|
|
337
|
+
/** Update a courier service */
|
|
338
|
+
updateService(courierId: number, serviceId: number, data: Partial<CreateCourierServiceRequest>): Promise<CourierServiceEntity>;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* Data for client integration creation
|
|
343
|
+
*/
|
|
344
|
+
export declare interface CreateClientIntegrationRequest {
|
|
345
|
+
/** Client ID */
|
|
346
|
+
client_id: number;
|
|
347
|
+
/** Integration name */
|
|
348
|
+
integration_name: string;
|
|
349
|
+
/** Store ID */
|
|
350
|
+
store_id?: string;
|
|
351
|
+
/** Whether integration is active */
|
|
352
|
+
active?: boolean;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* Data for creating a client
|
|
357
|
+
*/
|
|
358
|
+
export declare interface CreateClientRequest {
|
|
359
|
+
/** Client name */
|
|
360
|
+
name: string;
|
|
361
|
+
/** Short name */
|
|
362
|
+
short_name?: string;
|
|
363
|
+
/** Email */
|
|
364
|
+
email?: string;
|
|
365
|
+
/** Phone */
|
|
366
|
+
phone?: string;
|
|
367
|
+
/** Operational status */
|
|
368
|
+
operational_status?: string;
|
|
369
|
+
/** Settings object */
|
|
370
|
+
settings?: Record<string, unknown>;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* Data for creating/updating a courier
|
|
375
|
+
*/
|
|
376
|
+
export declare interface CreateCourierRequest {
|
|
377
|
+
/** Courier name */
|
|
378
|
+
name: string;
|
|
379
|
+
/** Logo URL */
|
|
380
|
+
logo_url?: string;
|
|
381
|
+
/** Location URL */
|
|
382
|
+
location_url?: string;
|
|
383
|
+
/** Whether courier is active */
|
|
384
|
+
status?: boolean;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* Data for creating/updating a courier service
|
|
389
|
+
*/
|
|
390
|
+
export declare interface CreateCourierServiceRequest {
|
|
391
|
+
/** Service name */
|
|
392
|
+
name: string;
|
|
393
|
+
/** Courier integration name */
|
|
394
|
+
courier_integration_name?: string;
|
|
395
|
+
/** Service code */
|
|
396
|
+
courier_service_code?: string;
|
|
397
|
+
/** Minimum weight */
|
|
398
|
+
weight_min?: number;
|
|
399
|
+
/** Maximum weight */
|
|
400
|
+
weight_max?: number;
|
|
401
|
+
/** Whether service is active */
|
|
402
|
+
status?: boolean;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
/**
|
|
406
|
+
* Data for creating/updating an integration
|
|
407
|
+
*/
|
|
408
|
+
export declare interface CreateIntegrationRequest {
|
|
409
|
+
/** Integration name */
|
|
410
|
+
name: string;
|
|
411
|
+
/** Display name */
|
|
412
|
+
display_name?: string;
|
|
413
|
+
/** Store ID */
|
|
414
|
+
store_id?: string;
|
|
415
|
+
/** Whether integration is active */
|
|
416
|
+
active?: boolean;
|
|
417
|
+
/** Client object with ID */
|
|
418
|
+
client?: {
|
|
419
|
+
id: number;
|
|
420
|
+
};
|
|
421
|
+
/** Country accept list */
|
|
422
|
+
country_accept?: string;
|
|
423
|
+
/** Country reject list */
|
|
424
|
+
country_reject?: string;
|
|
425
|
+
/** Order status sync */
|
|
426
|
+
order_status_sync?: boolean;
|
|
427
|
+
/** Product status sync */
|
|
428
|
+
product_status_sync?: boolean;
|
|
429
|
+
/** Returns active */
|
|
430
|
+
returns_active?: boolean;
|
|
431
|
+
/** Default warehouse ID */
|
|
432
|
+
default_warehouse_id?: string;
|
|
433
|
+
/** Sources */
|
|
434
|
+
sources?: string;
|
|
435
|
+
}
|
|
436
|
+
|
|
267
437
|
/**
|
|
268
438
|
* Create a JANUS API client.
|
|
269
439
|
*
|
|
@@ -307,6 +477,14 @@ export declare interface CourierService extends BaseEntity {
|
|
|
307
477
|
*/
|
|
308
478
|
export declare function createJanusApi(options?: JanusApiOptions): JanusApi;
|
|
309
479
|
|
|
480
|
+
/**
|
|
481
|
+
* Data for creating/updating a return category
|
|
482
|
+
*/
|
|
483
|
+
export declare interface CreateReturnCategoryRequest {
|
|
484
|
+
/** Category name */
|
|
485
|
+
category_name: string;
|
|
486
|
+
}
|
|
487
|
+
|
|
310
488
|
/**
|
|
311
489
|
* Data for a return item in create request
|
|
312
490
|
*/
|
|
@@ -325,6 +503,18 @@ export declare interface CreateReturnItemRequest {
|
|
|
325
503
|
price_paid?: number;
|
|
326
504
|
}
|
|
327
505
|
|
|
506
|
+
/**
|
|
507
|
+
* Data for creating/updating a return reason
|
|
508
|
+
*/
|
|
509
|
+
export declare interface CreateReturnReasonRequest {
|
|
510
|
+
/** Reason name */
|
|
511
|
+
name: string;
|
|
512
|
+
/** Category ID */
|
|
513
|
+
category_id?: number;
|
|
514
|
+
/** Whether reason is active */
|
|
515
|
+
active?: boolean;
|
|
516
|
+
}
|
|
517
|
+
|
|
328
518
|
/**
|
|
329
519
|
* Request Types for API Operations
|
|
330
520
|
* @module types/requests
|
|
@@ -367,6 +557,46 @@ export declare interface CreateReturnRequest {
|
|
|
367
557
|
items?: CreateReturnItemRequest[];
|
|
368
558
|
}
|
|
369
559
|
|
|
560
|
+
/**
|
|
561
|
+
* Data for creating/updating a return source
|
|
562
|
+
*/
|
|
563
|
+
export declare interface CreateReturnSourceRequest {
|
|
564
|
+
/** Source alias */
|
|
565
|
+
alias: string;
|
|
566
|
+
/** Whether source is active */
|
|
567
|
+
status?: boolean;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
/**
|
|
571
|
+
* Data for creating/updating a return status
|
|
572
|
+
*/
|
|
573
|
+
export declare interface CreateReturnStatusRequest {
|
|
574
|
+
/** Status name */
|
|
575
|
+
name: string;
|
|
576
|
+
/** Display color */
|
|
577
|
+
color?: string;
|
|
578
|
+
/** Sort order */
|
|
579
|
+
sort_order?: number;
|
|
580
|
+
/** Whether this is a final status */
|
|
581
|
+
is_final?: boolean;
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
/**
|
|
585
|
+
* Data for creating a user
|
|
586
|
+
*/
|
|
587
|
+
export declare interface CreateUserRequest {
|
|
588
|
+
/** Username */
|
|
589
|
+
username: string;
|
|
590
|
+
/** Password */
|
|
591
|
+
password: string;
|
|
592
|
+
/** First name */
|
|
593
|
+
firstname?: string;
|
|
594
|
+
/** Last name */
|
|
595
|
+
lastname?: string;
|
|
596
|
+
/** Partition ID */
|
|
597
|
+
partition_id?: number;
|
|
598
|
+
}
|
|
599
|
+
|
|
370
600
|
/**
|
|
371
601
|
* Customer login response
|
|
372
602
|
*/
|
|
@@ -383,6 +613,32 @@ export declare interface CustomerLoginResponse {
|
|
|
383
613
|
error?: string;
|
|
384
614
|
}
|
|
385
615
|
|
|
616
|
+
/**
|
|
617
|
+
* Customer resource interface (no auth required)
|
|
618
|
+
*/
|
|
619
|
+
export declare interface CustomerResource {
|
|
620
|
+
/** Login and track an order by ref, postcode, and client ID */
|
|
621
|
+
tracking(orderRef: string, postcode: string, clientId: number): Promise<unknown>;
|
|
622
|
+
/** Track an order by reference */
|
|
623
|
+
track(ref: string): Promise<unknown>;
|
|
624
|
+
/** Customer login */
|
|
625
|
+
login(data: CustomerTrackingLoginRequest): Promise<CustomerLoginResponse>;
|
|
626
|
+
/** View email notification by reference */
|
|
627
|
+
viewEmail(ref: string): Promise<string>;
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
/**
|
|
631
|
+
* Customer tracking login request
|
|
632
|
+
*/
|
|
633
|
+
export declare interface CustomerTrackingLoginRequest {
|
|
634
|
+
/** Order reference */
|
|
635
|
+
order_ref: string;
|
|
636
|
+
/** Postcode */
|
|
637
|
+
postcode: string;
|
|
638
|
+
/** Client ID */
|
|
639
|
+
client_id: number;
|
|
640
|
+
}
|
|
641
|
+
|
|
386
642
|
/**
|
|
387
643
|
* Date range filter
|
|
388
644
|
*/
|
|
@@ -455,6 +711,70 @@ export declare interface HelpersResource {
|
|
|
455
711
|
customerLogin(clientId: number, orderRef: string, postcode: string): Promise<CustomerLoginResponse>;
|
|
456
712
|
}
|
|
457
713
|
|
|
714
|
+
/**
|
|
715
|
+
* HTTP query for legacy products
|
|
716
|
+
*/
|
|
717
|
+
export declare interface HttpQueryRequest {
|
|
718
|
+
/** Query conditions */
|
|
719
|
+
query: Array<{
|
|
720
|
+
query_name: string;
|
|
721
|
+
query_type: string | number;
|
|
722
|
+
query_value: string | number;
|
|
723
|
+
}>;
|
|
724
|
+
/** Result limit */
|
|
725
|
+
limit?: number;
|
|
726
|
+
/** Result offset */
|
|
727
|
+
offset?: number;
|
|
728
|
+
/** Include child records */
|
|
729
|
+
include_children?: boolean;
|
|
730
|
+
/** Short results */
|
|
731
|
+
short_results?: boolean;
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
/** Integration entity from the API (uses generated IntegrationStandard) */
|
|
735
|
+
export declare interface IntegrationEntity {
|
|
736
|
+
id: number;
|
|
737
|
+
name: string;
|
|
738
|
+
display_name?: string;
|
|
739
|
+
store_id?: string;
|
|
740
|
+
active?: boolean;
|
|
741
|
+
client?: {
|
|
742
|
+
id: number;
|
|
743
|
+
name?: string;
|
|
744
|
+
};
|
|
745
|
+
country_accept?: string;
|
|
746
|
+
country_reject?: string;
|
|
747
|
+
order_status_sync?: boolean;
|
|
748
|
+
product_status_sync?: boolean;
|
|
749
|
+
returns_active?: boolean;
|
|
750
|
+
default_warehouse_id?: string;
|
|
751
|
+
sources?: string;
|
|
752
|
+
last_run?: number;
|
|
753
|
+
created_ts?: string;
|
|
754
|
+
updated_ts?: string;
|
|
755
|
+
[key: string]: unknown;
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
/**
|
|
759
|
+
* Integrations resource interface
|
|
760
|
+
*/
|
|
761
|
+
export declare interface IntegrationsResource {
|
|
762
|
+
/** Get all integrations */
|
|
763
|
+
getAll(): Promise<IntegrationEntity[]>;
|
|
764
|
+
/** Get integrations by client ID */
|
|
765
|
+
getByClientId(clientId: number): Promise<IntegrationEntity[]>;
|
|
766
|
+
/** Get a specific integration by customer ID and name */
|
|
767
|
+
getByCustomerAndName(customerId: number, integrationName: string): Promise<IntegrationEntity>;
|
|
768
|
+
/** Get all active integrations */
|
|
769
|
+
getActive(): Promise<IntegrationEntity[]>;
|
|
770
|
+
/** Get active integration names only */
|
|
771
|
+
getNamesOnly(): Promise<string[]>;
|
|
772
|
+
/** Create a new integration */
|
|
773
|
+
create(data: CreateIntegrationRequest): Promise<IntegrationEntity>;
|
|
774
|
+
/** Update an integration */
|
|
775
|
+
update(id: number, data: Partial<CreateIntegrationRequest>): Promise<IntegrationEntity>;
|
|
776
|
+
}
|
|
777
|
+
|
|
458
778
|
/**
|
|
459
779
|
* Check if an error is a JanusApiError
|
|
460
780
|
*/
|
|
@@ -479,6 +799,22 @@ export declare interface JanusApi {
|
|
|
479
799
|
reports: ReportsResource;
|
|
480
800
|
/** Helpers resource - public endpoints (no auth required) */
|
|
481
801
|
helpers: HelpersResource;
|
|
802
|
+
/** Couriers resource - manage couriers and services */
|
|
803
|
+
couriers: CouriersResource;
|
|
804
|
+
/** Orders resource - query orders and stats */
|
|
805
|
+
orders: OrdersResource;
|
|
806
|
+
/** Integrations resource - manage integrations */
|
|
807
|
+
integrations: IntegrationsResource;
|
|
808
|
+
/** Users resource - manage users */
|
|
809
|
+
users: UsersResource;
|
|
810
|
+
/** Logs resource - activity and order issue logs */
|
|
811
|
+
logs: LogsResource;
|
|
812
|
+
/** Tasks resource - task history */
|
|
813
|
+
tasks: TasksResource;
|
|
814
|
+
/** Customer resource - public customer tracking (no auth) */
|
|
815
|
+
customer: CustomerResource;
|
|
816
|
+
/** Legacy resource - legacy couriers, post services, products */
|
|
817
|
+
legacy: LegacyResource;
|
|
482
818
|
/** Underlying AuthApi instance for raw requests */
|
|
483
819
|
auth: AuthApi;
|
|
484
820
|
}
|
|
@@ -516,6 +852,32 @@ export declare interface JanusApiOptions {
|
|
|
516
852
|
onLoginError?: (error: Error) => void;
|
|
517
853
|
}
|
|
518
854
|
|
|
855
|
+
/**
|
|
856
|
+
* Legacy resource interface
|
|
857
|
+
*/
|
|
858
|
+
export declare interface LegacyResource {
|
|
859
|
+
/** Get all legacy couriers */
|
|
860
|
+
getCouriers(): Promise<unknown[]>;
|
|
861
|
+
/** Get all legacy post services */
|
|
862
|
+
getPostServices(): Promise<unknown[]>;
|
|
863
|
+
/** Get legacy post services by carrier code */
|
|
864
|
+
getPostServicesByCarrier(carrierCode: string): Promise<unknown[]>;
|
|
865
|
+
/** Query legacy products */
|
|
866
|
+
queryProducts(query: HttpQueryRequest): Promise<unknown>;
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
/**
|
|
870
|
+
* Logs resource interface
|
|
871
|
+
*/
|
|
872
|
+
export declare interface LogsResource {
|
|
873
|
+
/** Create activity log entries */
|
|
874
|
+
createActivity(entries: Record<string, unknown>[]): Promise<unknown>;
|
|
875
|
+
/** Create an order issue log */
|
|
876
|
+
createOrderIssue(data: Record<string, unknown>): Promise<unknown>;
|
|
877
|
+
/** Update an order issue log */
|
|
878
|
+
updateOrderIssue(data: Record<string, unknown>): Promise<unknown>;
|
|
879
|
+
}
|
|
880
|
+
|
|
519
881
|
/**
|
|
520
882
|
* Error thrown when resource is not found (404)
|
|
521
883
|
*/
|
|
@@ -537,6 +899,115 @@ declare interface NotificationSettingsResponse {
|
|
|
537
899
|
settings?: Record<string, unknown>;
|
|
538
900
|
}
|
|
539
901
|
|
|
902
|
+
/**
|
|
903
|
+
* Filters for order returns
|
|
904
|
+
*/
|
|
905
|
+
export declare interface OrderReturnsFilters extends BaseFilters {
|
|
906
|
+
/** Filter by client ID */
|
|
907
|
+
clientId?: number;
|
|
908
|
+
/** Page number */
|
|
909
|
+
pageNumber?: number;
|
|
910
|
+
/** Column to sort by */
|
|
911
|
+
order_column?: string;
|
|
912
|
+
/** Sort direction */
|
|
913
|
+
order_direction?: 'ASC' | 'DESC';
|
|
914
|
+
/** Filter by creation date from */
|
|
915
|
+
created_at?: string;
|
|
916
|
+
/** Filter by creation date to */
|
|
917
|
+
created_to?: string;
|
|
918
|
+
/** Columns to include in response */
|
|
919
|
+
include_columns?: string;
|
|
920
|
+
/** Search query */
|
|
921
|
+
query?: string;
|
|
922
|
+
/** Filter by channel */
|
|
923
|
+
channel?: string;
|
|
924
|
+
/** Filter by destination */
|
|
925
|
+
destination?: string;
|
|
926
|
+
/** Filter by courier */
|
|
927
|
+
courier?: string;
|
|
928
|
+
/** Filter by service */
|
|
929
|
+
service?: string;
|
|
930
|
+
/** Filter by status */
|
|
931
|
+
status?: string;
|
|
932
|
+
/** Group by field */
|
|
933
|
+
group_by?: string;
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
/**
|
|
937
|
+
* Filters for querying orders
|
|
938
|
+
*/
|
|
939
|
+
export declare interface OrdersQueryFilters extends BaseFilters {
|
|
940
|
+
/** Filter by client ID */
|
|
941
|
+
clientId?: number;
|
|
942
|
+
/** Page number */
|
|
943
|
+
pageNumber?: number;
|
|
944
|
+
/** Column to sort by */
|
|
945
|
+
order_column?: string;
|
|
946
|
+
/** Sort direction */
|
|
947
|
+
order_direction?: 'ASC' | 'DESC';
|
|
948
|
+
/** Filter by creation date from */
|
|
949
|
+
created_at?: string;
|
|
950
|
+
/** Filter by creation date to */
|
|
951
|
+
created_to?: string;
|
|
952
|
+
/** Filter by channel */
|
|
953
|
+
channel?: string;
|
|
954
|
+
/** Filter by destination */
|
|
955
|
+
destination?: string;
|
|
956
|
+
/** Filter by courier */
|
|
957
|
+
courier?: string;
|
|
958
|
+
/** Filter by service */
|
|
959
|
+
service?: string;
|
|
960
|
+
/** Columns to include in response */
|
|
961
|
+
include_columns?: string;
|
|
962
|
+
/** Search query */
|
|
963
|
+
query?: string;
|
|
964
|
+
/** Include all stages */
|
|
965
|
+
include_all_stages?: boolean;
|
|
966
|
+
/** Filter by status */
|
|
967
|
+
status?: string;
|
|
968
|
+
/** Filter */
|
|
969
|
+
filter?: string;
|
|
970
|
+
/** Sub-filter */
|
|
971
|
+
subfilter?: string;
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
/**
|
|
975
|
+
* Orders resource interface
|
|
976
|
+
*/
|
|
977
|
+
export declare interface OrdersResource {
|
|
978
|
+
/** Get orders with filters */
|
|
979
|
+
getAll(filters?: OrdersQueryFilters): Promise<unknown[]>;
|
|
980
|
+
/** Get order statistics */
|
|
981
|
+
getStats(filters?: OrdersStatsFilters): Promise<OrdersStatsResponse>;
|
|
982
|
+
/** Get return orders */
|
|
983
|
+
getReturns(filters?: OrderReturnsFilters): Promise<unknown[]>;
|
|
984
|
+
/** Get order by dispatch reference */
|
|
985
|
+
getByRef(dispatchRef: string, clientId?: number): Promise<unknown>;
|
|
986
|
+
/** Get filter options for returns */
|
|
987
|
+
getReturnFilterOptions(clientId: number): Promise<FilterOptionsResponse>;
|
|
988
|
+
}
|
|
989
|
+
|
|
990
|
+
/**
|
|
991
|
+
* Filters for order statistics
|
|
992
|
+
*/
|
|
993
|
+
export declare interface OrdersStatsFilters {
|
|
994
|
+
/** Filter by client ID */
|
|
995
|
+
clientId?: number;
|
|
996
|
+
/** Filter by creation date from */
|
|
997
|
+
created_at?: string;
|
|
998
|
+
/** Filter by creation date to */
|
|
999
|
+
created_to?: string;
|
|
1000
|
+
/** Dashboard mode */
|
|
1001
|
+
dashboard?: boolean;
|
|
1002
|
+
}
|
|
1003
|
+
|
|
1004
|
+
/**
|
|
1005
|
+
* Orders statistics response
|
|
1006
|
+
*/
|
|
1007
|
+
export declare interface OrdersStatsResponse {
|
|
1008
|
+
[key: string]: unknown;
|
|
1009
|
+
}
|
|
1010
|
+
|
|
540
1011
|
/**
|
|
541
1012
|
* Response Types for API Operations
|
|
542
1013
|
* @module types/responses
|
|
@@ -655,6 +1126,15 @@ export declare interface ReturnCategory extends BaseEntity {
|
|
|
655
1126
|
active?: boolean;
|
|
656
1127
|
}
|
|
657
1128
|
|
|
1129
|
+
/** Return category entity */
|
|
1130
|
+
export declare interface ReturnCategoryEntity {
|
|
1131
|
+
id: number;
|
|
1132
|
+
category_name: string;
|
|
1133
|
+
clients?: unknown[];
|
|
1134
|
+
created_ts?: string;
|
|
1135
|
+
updated_ts?: string;
|
|
1136
|
+
}
|
|
1137
|
+
|
|
658
1138
|
/**
|
|
659
1139
|
* Return Comment Entity
|
|
660
1140
|
*
|
|
@@ -722,6 +1202,15 @@ export declare interface ReturnReason extends BaseEntity {
|
|
|
722
1202
|
active?: boolean;
|
|
723
1203
|
}
|
|
724
1204
|
|
|
1205
|
+
/** Return source entity */
|
|
1206
|
+
export declare interface ReturnSourceEntity {
|
|
1207
|
+
id: number;
|
|
1208
|
+
alias?: string;
|
|
1209
|
+
status: boolean;
|
|
1210
|
+
created_ts?: string;
|
|
1211
|
+
updated_ts?: string;
|
|
1212
|
+
}
|
|
1213
|
+
|
|
725
1214
|
/**
|
|
726
1215
|
* Filters for returns overview report
|
|
727
1216
|
*/
|
|
@@ -794,40 +1283,90 @@ export declare interface ReturnsReasonsFilters extends BaseFilters {
|
|
|
794
1283
|
export declare interface ReturnsResource {
|
|
795
1284
|
/** Query returns with filters */
|
|
796
1285
|
query(filters?: ReturnsQueryFilters): Promise<Return[]>;
|
|
1286
|
+
/** Query returns with HTTP query body */
|
|
1287
|
+
queryPost(query: HttpQueryRequest): Promise<Return[]>;
|
|
797
1288
|
/** Get a return by ID */
|
|
798
1289
|
getById(id: number, options?: {
|
|
799
1290
|
include_associations?: string;
|
|
800
1291
|
}): Promise<Return>;
|
|
801
1292
|
/** Create a new return (via helpers endpoint for portal access) */
|
|
802
1293
|
create(data: CreateReturnRequest): Promise<Return>;
|
|
803
|
-
/**
|
|
1294
|
+
/** Create a new return (authenticated, direct endpoint) */
|
|
1295
|
+
createDirect(data: Partial<Return>): Promise<Return>;
|
|
1296
|
+
/** Full update a return (PUT) */
|
|
1297
|
+
replace(returnId: number, data: Partial<Return>): Promise<Return>;
|
|
1298
|
+
/** Partial update a return (PATCH) */
|
|
804
1299
|
update(returnId: number, data: Partial<Return>): Promise<Return>;
|
|
805
1300
|
/** Delete a return */
|
|
806
1301
|
delete(returnId: number): Promise<void>;
|
|
807
|
-
/**
|
|
808
|
-
|
|
809
|
-
/**
|
|
810
|
-
|
|
811
|
-
/** Remove a specific status from a return */
|
|
812
|
-
removeStatus(returnId: number, statusId: number): Promise<void>;
|
|
1302
|
+
/** Set approval status for a return */
|
|
1303
|
+
setApproval(returnId: number, approved: boolean): Promise<unknown>;
|
|
1304
|
+
/** View return email by reference */
|
|
1305
|
+
getEmail(ref: string): Promise<string>;
|
|
813
1306
|
/** Get return items for a return */
|
|
814
1307
|
getItems(returnId: number): Promise<ReturnItem[]>;
|
|
1308
|
+
/** Get a specific return item */
|
|
1309
|
+
getItemById(returnId: number, itemId: number): Promise<ReturnItem>;
|
|
815
1310
|
/** Add an item to a return */
|
|
816
1311
|
addItem(returnId: number, item: CreateReturnItemRequest): Promise<ReturnItem>;
|
|
817
1312
|
/** Update a return item */
|
|
818
1313
|
updateItem(returnId: number, itemId: number, data: Partial<ReturnItem>): Promise<ReturnItem>;
|
|
1314
|
+
/** Bulk update return items */
|
|
1315
|
+
updateItems(returnId: number, items: Partial<ReturnItem>[]): Promise<ReturnItem[]>;
|
|
1316
|
+
/** Get all statuses for a return */
|
|
1317
|
+
getStatuses(returnId: number): Promise<ReturnStatus[]>;
|
|
1318
|
+
/** Add a status to a return */
|
|
1319
|
+
addStatus(returnId: number, statusId: number): Promise<unknown>;
|
|
1320
|
+
/** Remove a specific status from a return */
|
|
1321
|
+
removeStatus(returnId: number, statusId: number): Promise<void>;
|
|
819
1322
|
/** Get comments for a return */
|
|
820
1323
|
getComments(returnId: number): Promise<ReturnComment[]>;
|
|
1324
|
+
/** Get a specific comment */
|
|
1325
|
+
getCommentById(returnId: number, commentId: number): Promise<ReturnComment>;
|
|
821
1326
|
/** Add a comment to a return */
|
|
822
1327
|
addComment(returnId: number, comment: string): Promise<ReturnComment>;
|
|
823
1328
|
/** Remove a comment from a return */
|
|
824
1329
|
removeComment(returnId: number, commentId: number): Promise<void>;
|
|
825
|
-
/**
|
|
826
|
-
setApproval(returnId: number, approved: boolean): Promise<unknown>;
|
|
827
|
-
/** Get all return reasons (reference data) */
|
|
1330
|
+
/** Get all return reasons */
|
|
828
1331
|
getReasons(): Promise<ReturnReason[]>;
|
|
829
|
-
/** Get
|
|
1332
|
+
/** Get a return reason by ID */
|
|
1333
|
+
getReasonById(id: number): Promise<ReturnReason>;
|
|
1334
|
+
/** Create a return reason */
|
|
1335
|
+
createReason(data: CreateReturnReasonRequest): Promise<ReturnReason>;
|
|
1336
|
+
/** Update a return reason */
|
|
1337
|
+
updateReason(id: number, data: Partial<CreateReturnReasonRequest>): Promise<ReturnReason>;
|
|
1338
|
+
/** Get all return statuses */
|
|
830
1339
|
getAllStatuses(): Promise<ReturnStatus[]>;
|
|
1340
|
+
/** Get a return status by ID */
|
|
1341
|
+
getStatusById(id: number): Promise<ReturnStatus>;
|
|
1342
|
+
/** Create a return status */
|
|
1343
|
+
createStatus(data: CreateReturnStatusRequest): Promise<ReturnStatus>;
|
|
1344
|
+
/** Update a return status */
|
|
1345
|
+
updateStatus(id: number, data: Partial<CreateReturnStatusRequest>): Promise<ReturnStatus>;
|
|
1346
|
+
/** Delete a return status */
|
|
1347
|
+
deleteStatus(id: number): Promise<void>;
|
|
1348
|
+
/** Get all return categories */
|
|
1349
|
+
getCategories(): Promise<ReturnCategoryEntity[]>;
|
|
1350
|
+
/** Get a return category by ID */
|
|
1351
|
+
getCategoryById(id: number): Promise<ReturnCategoryEntity>;
|
|
1352
|
+
/** Create a return category */
|
|
1353
|
+
createCategory(data: CreateReturnCategoryRequest): Promise<ReturnCategoryEntity>;
|
|
1354
|
+
/** Update a return category */
|
|
1355
|
+
updateCategory(id: number, data: Partial<CreateReturnCategoryRequest>): Promise<ReturnCategoryEntity>;
|
|
1356
|
+
/** Get all return sources */
|
|
1357
|
+
getSources(): Promise<ReturnSourceEntity[]>;
|
|
1358
|
+
/** Get a return source by ID */
|
|
1359
|
+
getSourceById(id: number): Promise<ReturnSourceEntity>;
|
|
1360
|
+
/** Create a return source */
|
|
1361
|
+
createSource(data: CreateReturnSourceRequest): Promise<ReturnSourceEntity>;
|
|
1362
|
+
/** Update a return source */
|
|
1363
|
+
updateSource(id: number, data: Partial<CreateReturnSourceRequest>): Promise<ReturnSourceEntity>;
|
|
1364
|
+
/** Delete a return source */
|
|
1365
|
+
deleteSource(id: number): Promise<void>;
|
|
1366
|
+
/** Get all return comments (global) */
|
|
1367
|
+
getAllComments(): Promise<ReturnComment[]>;
|
|
1368
|
+
/** Get a return comment by ID (global) */
|
|
1369
|
+
getGlobalCommentById(id: number): Promise<ReturnComment>;
|
|
831
1370
|
/** Get filter options for returns */
|
|
832
1371
|
getFilterOptions(clientId: number): Promise<FilterOptionsResponse>;
|
|
833
1372
|
}
|
|
@@ -944,6 +1483,44 @@ export declare interface SetReturnApprovalRequest {
|
|
|
944
1483
|
approve: boolean;
|
|
945
1484
|
}
|
|
946
1485
|
|
|
1486
|
+
/** Task history entity from the API */
|
|
1487
|
+
export declare interface TaskHistoryEntity {
|
|
1488
|
+
id: number;
|
|
1489
|
+
task?: string;
|
|
1490
|
+
uuid?: string;
|
|
1491
|
+
clientName?: string;
|
|
1492
|
+
userName?: string;
|
|
1493
|
+
clientId?: number;
|
|
1494
|
+
integrationName?: string;
|
|
1495
|
+
progress?: number;
|
|
1496
|
+
endpoint?: string;
|
|
1497
|
+
method?: string;
|
|
1498
|
+
payload?: Record<string, unknown>;
|
|
1499
|
+
result?: Record<string, unknown>;
|
|
1500
|
+
created_ts?: string;
|
|
1501
|
+
updated_ts?: string;
|
|
1502
|
+
}
|
|
1503
|
+
|
|
1504
|
+
/**
|
|
1505
|
+
* Filters for task histories
|
|
1506
|
+
*/
|
|
1507
|
+
export declare interface TaskHistoryFilters {
|
|
1508
|
+
/** Filter by date from */
|
|
1509
|
+
date_from?: string;
|
|
1510
|
+
/** Filter by date to */
|
|
1511
|
+
date_to?: string;
|
|
1512
|
+
}
|
|
1513
|
+
|
|
1514
|
+
/**
|
|
1515
|
+
* Tasks resource interface
|
|
1516
|
+
*/
|
|
1517
|
+
export declare interface TasksResource {
|
|
1518
|
+
/** Get task history by UUID */
|
|
1519
|
+
getByUuid(uuid: string): Promise<TaskHistoryEntity>;
|
|
1520
|
+
/** Get task histories with optional date filters */
|
|
1521
|
+
getAll(filters?: TaskHistoryFilters): Promise<TaskHistoryEntity[]>;
|
|
1522
|
+
}
|
|
1523
|
+
|
|
947
1524
|
/**
|
|
948
1525
|
* Error thrown when authentication fails (401)
|
|
949
1526
|
*/
|
|
@@ -975,6 +1552,20 @@ export declare interface UpdateClientRequest {
|
|
|
975
1552
|
active?: boolean;
|
|
976
1553
|
}
|
|
977
1554
|
|
|
1555
|
+
/**
|
|
1556
|
+
* Data for updating a user
|
|
1557
|
+
*/
|
|
1558
|
+
export declare interface UpdateUserRequest {
|
|
1559
|
+
/** User ID */
|
|
1560
|
+
id: number;
|
|
1561
|
+
/** First name */
|
|
1562
|
+
firstname?: string;
|
|
1563
|
+
/** Last name */
|
|
1564
|
+
lastname?: string;
|
|
1565
|
+
/** Password */
|
|
1566
|
+
password?: string;
|
|
1567
|
+
}
|
|
1568
|
+
|
|
978
1569
|
/**
|
|
979
1570
|
* Data for uploading a file
|
|
980
1571
|
*/
|
|
@@ -1025,6 +1616,16 @@ export declare interface UserClientAccess {
|
|
|
1025
1616
|
name: string;
|
|
1026
1617
|
}
|
|
1027
1618
|
|
|
1619
|
+
/**
|
|
1620
|
+
* Users resource interface
|
|
1621
|
+
*/
|
|
1622
|
+
export declare interface UsersResource {
|
|
1623
|
+
/** Create a new user */
|
|
1624
|
+
create(data: CreateUserRequest): Promise<User>;
|
|
1625
|
+
/** Update a user */
|
|
1626
|
+
update(data: UpdateUserRequest): Promise<User>;
|
|
1627
|
+
}
|
|
1628
|
+
|
|
1028
1629
|
/**
|
|
1029
1630
|
* Error thrown for validation errors (400)
|
|
1030
1631
|
*/
|