UNPKG

@myparcel/constants

Version:

Collection of constant values for use with the MyParcel API

269 lines (256 loc) 10.3 kB
declare enum CarrierId { PostNl = 1, Bpost = 2, CheapCargo = 3, Dpd = 4, Instabox = 5, Dhl = 6, Bol = 7, BolCom = 7, Ups = 8, DhlForYou = 9, DhlParcelConnect = 10, DhlEuroPlus = 11, UpsStandard = 12, UpsExpressSaver = 13, Gls = 14, Brt = 15, Trunkrs = 16, InPost = 17 } declare enum CarrierName { PostNl = "postnl", Bpost = "bpost", CheapCargo = "cheapcargo", Dpd = "dpd", Instabox = "instabox", Dhl = "dhl", Bol = "bol.com", BolCom = "bol.com", Ups = "ups", DhlForYou = "dhlforyou", DhlParcelConnect = "dhlparcelconnect", DhlEuroPlus = "dhleuroplus", UpsStandard = "upsstandard", UpsExpressSaver = "upsexpresssaver", Gls = "gls", Brt = "brt", Trunkrs = "trunkrs", InPost = "inpost" } type CarrierNameOrId = CarrierName | CarrierId; type CarrierNameType = `${CarrierName}`; type CarrierNameOrIdType = CarrierNameType | CarrierId; declare const CARRIER_NAMES_TO_IDS: { readonly postnl: CarrierId.PostNl; readonly bpost: CarrierId.Bpost; readonly cheapcargo: CarrierId.CheapCargo; readonly dpd: CarrierId.Dpd; readonly instabox: CarrierId.Instabox; readonly dhl: CarrierId.Dhl; readonly "bol.com": CarrierId.Bol; readonly ups: CarrierId.Ups; readonly dhlforyou: CarrierId.DhlForYou; readonly dhlparcelconnect: CarrierId.DhlParcelConnect; readonly dhleuroplus: CarrierId.DhlEuroPlus; readonly upsstandard: CarrierId.UpsStandard; readonly upsexpresssaver: CarrierId.UpsExpressSaver; readonly gls: CarrierId.Gls; readonly brt: CarrierId.Brt; readonly trunkrs: CarrierId.Trunkrs; readonly inpost: CarrierId.InPost; }; declare const CARRIER_IDS_TO_NAMES: { readonly 1: CarrierName.PostNl; readonly 2: CarrierName.Bpost; readonly 3: CarrierName.CheapCargo; readonly 4: CarrierName.Dpd; readonly 5: CarrierName.Instabox; readonly 6: CarrierName.Dhl; readonly 7: CarrierName.Bol; readonly 8: CarrierName.Ups; readonly 9: CarrierName.DhlForYou; readonly 10: CarrierName.DhlParcelConnect; readonly 11: CarrierName.DhlEuroPlus; readonly 12: CarrierName.UpsStandard; readonly 13: CarrierName.UpsExpressSaver; readonly 14: CarrierName.Gls; readonly 15: CarrierName.Brt; readonly 16: CarrierName.Trunkrs; readonly 17: CarrierName.InPost; }; /** * @see https://myparcelnl.github.io/api/#package_contents */ declare enum CustomsDeclarationContents { CommercialGoods = 1, CommercialSamples = 2, Documents = 3, Gifts = 4, ReturnShipment = 5 } /** @see https://myparcelnl.github.io/api/#6_A_2 */ declare enum DeliveryTypeId { Morning = 1, Standard = 2, Evening = 3, Pickup = 4, Express = 7 } /** @see https://myparcelnl.github.io/api/#6_A_2 */ declare enum DeliveryTypeName { Morning = "morning", Standard = "standard", Evening = "evening", Pickup = "pickup", Express = "express" } type DeliveryTypeNameOrId = DeliveryTypeName | DeliveryTypeId; type DeliveryTypeNameType = `${DeliveryTypeName}`; type DeliveryTypeNameOrIdType = DeliveryTypeNameType | DeliveryTypeId; declare const DELIVERY_TYPE_NAMES_TO_IDS: { readonly morning: DeliveryTypeId.Morning; readonly standard: DeliveryTypeId.Standard; readonly evening: DeliveryTypeId.Evening; readonly pickup: DeliveryTypeId.Pickup; readonly express: DeliveryTypeId.Express; }; declare const DELIVERY_TYPE_IDS_TO_NAMES: { readonly 1: DeliveryTypeName.Morning; readonly 2: DeliveryTypeName.Standard; readonly 3: DeliveryTypeName.Evening; readonly 4: DeliveryTypeName.Pickup; readonly 7: DeliveryTypeName.Express; }; /** @see https://myparcelnl.github.io/api/#6_A_1 */ declare enum PackageTypeId { Package = 1, Mailbox = 2, Letter = 3, DigitalStamp = 4, Pallet = 5, PackageSmall = 6 } /** @see https://myparcelnl.github.io/api/#6_A_1 */ declare enum PackageTypeName { Package = "package", Mailbox = "mailbox", Letter = "letter", DigitalStamp = "digital_stamp", Pallet = "pallet", PackageSmall = "package_small" } type PackageTypeNameOrId = PackageTypeName | PackageTypeId; type PackageTypeNameType = `${PackageTypeName}`; type PackageTypeNameOrIdType = PackageTypeNameType | PackageTypeId; declare const PACKAGE_TYPE_NAMES_TO_IDS: { readonly package: PackageTypeId.Package; readonly mailbox: PackageTypeId.Mailbox; readonly letter: PackageTypeId.Letter; readonly digital_stamp: PackageTypeId.DigitalStamp; readonly pallet: PackageTypeId.Pallet; readonly package_small: PackageTypeId.PackageSmall; }; declare const PACKAGE_TYPE_IDS_TO_NAMES: { readonly 1: PackageTypeName.Package; readonly 2: PackageTypeName.Mailbox; readonly 3: PackageTypeName.Letter; readonly 4: PackageTypeName.DigitalStamp; readonly 5: PackageTypeName.Pallet; readonly 6: PackageTypeName.PackageSmall; }; declare enum PlatformId { MyParcel = 1, Flespakket = 2, SendMyParcel = 3 } declare enum PlatformName { MyParcel = "myparcel", Flespakket = "flespakket", SendMyParcel = "belgie" } declare enum PlatformDomain { MyParcel = "myparcel.nl", Flespakket = "flespakket.nl", SendMyParcel = "sendmyparcel.be" } type PlatformNameOrId = PlatformName | PlatformId; type PlatformNameType = `${PlatformName}`; type PlatformNameOrIdType = PlatformNameType | PlatformId; declare const PLATFORM_NAMES_TO_IDS: { myparcel: PlatformId; belgie: PlatformId; flespakket: PlatformId; }; declare const PLATFORM_IDS_TO_NAMES: { 1: PlatformName; 3: PlatformName; 2: PlatformName; }; declare const PLATFORM_IDS_TO_DOMAINS: { 1: PlatformDomain; 3: PlatformDomain; 2: PlatformDomain; }; declare const PLATFORM_NAMES_TO_DOMAINS: { myparcel: PlatformDomain; belgie: PlatformDomain; flespakket: PlatformDomain; }; /** * @see https://myparcelnl.github.io/api/#6_A_3 */ declare enum ShipmentOptionName { AgeCheck = "age_check", Collect = "collect", CooledDelivery = "cooled_delivery", Insurance = "insurance", LargeFormat = "large_format", OnlyRecipient = "only_recipient", PrinterlessReturn = "printerless_return", Return = "return", SameDayDelivery = "same_day_delivery", Signature = "signature" } type ShipmentOptionNameType = `${ShipmentOptionName}`; /** @see https://myparcelnl.github.io/api/#shipment_status */ declare enum ShipmentStatus { PendingConcept = 1, PendingRegistered = 2, EnRouteHandedToCarrier = 3, EnRouteSorting = 4, EnRouteDistribution = 5, EnRouteCustoms = 6, DeliveredAtRecipient = 7, DeliveredReadyForPickup = 8, DeliveredPackagePickedUp = 9, DeliveredReturnShipmentReadyForPickup = 10, DeliveredReturnShipmentPackagePickedUp = 11, PrintedLetter = 12, InactiveCredited = 13, PrintedDigitalStamp = 14, InactiveConcept = 30, InactiveRegistered = 31, InactiveEnRouteHandedToCarrier = 32, InactiveEnRouteSorting = 33, InactiveEnRouteDistribution = 34, InactiveEnRouteCustoms = 35, InactiveDeliveredAtRecipient = 36, InactiveDeliveredReadyForPickup = 37, InactiveDeliveredPackagePickedUp = 38 } declare const SHIPMENT_STATUS_PENDING: readonly [ShipmentStatus.PendingConcept, ShipmentStatus.PendingRegistered]; declare const SHIPMENT_STATUS_EN_ROUTE: readonly [ShipmentStatus.EnRouteHandedToCarrier, ShipmentStatus.EnRouteSorting, ShipmentStatus.EnRouteDistribution, ShipmentStatus.EnRouteCustoms]; declare const SHIPMENT_STATUS_DELIVERED: readonly [ShipmentStatus.DeliveredAtRecipient, ShipmentStatus.DeliveredReadyForPickup, ShipmentStatus.DeliveredPackagePickedUp, ShipmentStatus.DeliveredReturnShipmentReadyForPickup, ShipmentStatus.DeliveredReturnShipmentPackagePickedUp]; declare const SHIPMENT_STATUS_PRINTED: readonly [ShipmentStatus.PrintedLetter, ShipmentStatus.PrintedDigitalStamp]; declare const SHIPMENT_STATUS_INACTIVE: readonly [ShipmentStatus.InactiveCredited, ShipmentStatus.InactiveConcept, ShipmentStatus.InactiveRegistered, ShipmentStatus.InactiveEnRouteHandedToCarrier, ShipmentStatus.InactiveEnRouteSorting, ShipmentStatus.InactiveEnRouteDistribution, ShipmentStatus.InactiveEnRouteCustoms, ShipmentStatus.InactiveDeliveredAtRecipient, ShipmentStatus.InactiveDeliveredReadyForPickup, ShipmentStatus.InactiveDeliveredPackagePickedUp]; declare const toCarrierName: (carrier: CarrierNameOrIdType) => CarrierName; declare const toCarrierId: (carrier: CarrierNameOrIdType) => CarrierId; declare const convertEnumValue: <T>(enumObject: Record<string, unknown>, value: string | number) => T; declare const toDeliveryTypeName: (carrier: DeliveryTypeNameOrIdType) => DeliveryTypeName; declare const toDeliveryTypeId: (carrier: DeliveryTypeNameOrIdType) => DeliveryTypeId; declare const toPackageTypeName: (carrier: PackageTypeNameOrIdType) => PackageTypeName; declare const toPackageTypeId: (carrier: PackageTypeNameOrIdType) => PackageTypeId; declare const toPlatformName: (carrier: PlatformNameOrIdType) => PlatformName; declare const toPlatformId: (carrier: PlatformNameOrIdType) => PlatformId; export { CARRIER_IDS_TO_NAMES, CARRIER_NAMES_TO_IDS, CarrierId, CarrierName, type CarrierNameOrId, type CarrierNameOrIdType, type CarrierNameType, CustomsDeclarationContents, DELIVERY_TYPE_IDS_TO_NAMES, DELIVERY_TYPE_NAMES_TO_IDS, DeliveryTypeId, DeliveryTypeName, type DeliveryTypeNameOrId, type DeliveryTypeNameOrIdType, type DeliveryTypeNameType, PACKAGE_TYPE_IDS_TO_NAMES, PACKAGE_TYPE_NAMES_TO_IDS, PLATFORM_IDS_TO_DOMAINS, PLATFORM_IDS_TO_NAMES, PLATFORM_NAMES_TO_DOMAINS, PLATFORM_NAMES_TO_IDS, PackageTypeId, PackageTypeName, type PackageTypeNameOrId, type PackageTypeNameOrIdType, type PackageTypeNameType, PlatformDomain, PlatformId, PlatformName, type PlatformNameOrId, type PlatformNameOrIdType, type PlatformNameType, SHIPMENT_STATUS_DELIVERED, SHIPMENT_STATUS_EN_ROUTE, SHIPMENT_STATUS_INACTIVE, SHIPMENT_STATUS_PENDING, SHIPMENT_STATUS_PRINTED, ShipmentOptionName, type ShipmentOptionNameType, ShipmentStatus, convertEnumValue, toCarrierId, toCarrierName, toDeliveryTypeId, toDeliveryTypeName, toPackageTypeId, toPackageTypeName, toPlatformId, toPlatformName };