Socket
Book a DemoInstallSign in
Socket

@myorb/dhl-express

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@myorb/dhl-express

DHL Express api client

1.0.0
latest
Source
npmnpm
Version published
Weekly downloads
6
-45.45%
Maintainers
1
Weekly downloads
 
Created
Source

DHL Express - MyDHL API js client

  • v2.4.0
  • Division: DHL Express

This is TypeScript/JavaScript client that utilizes axios.

Exampel usage:

import type {
  SupermodelIoLogisticsExpressAddressCreateShipmentRequest,
  SupermodelIoLogisticsExpressContact,
  SupermodelIoLogisticsExpressCreateShipmentRequest,
  SupermodelIoLogisticsExpressCreateShipmentResponse,
} from '@myorb/dhl-express';
import {
  ShipmentApi,
  SupermodelIoLogisticsExpressCreateShipmentRequestContentIncotermEnum,
  SupermodelIoLogisticsExpressCreateShipmentRequestContentUnitOfMeasurementEnum,
} from '@myorb/dhl-express';

export class DHLService {
  static async createShipping(req: SomeInput): Promise<SupermodelIoLogisticsExpressCreateShipmentResponse> {
    const config = {
      basePath?: string;
      username?: string;
      password?: string;
      apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
      accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
    };
    const dhlApi = new ShipmentApi(config);
    const body: SupermodelIoLogisticsExpressCreateShipmentRequest = {
      plannedShippingDateAndTime: '',
      pickup: {
        isRequested: true,
      },
      productCode: '',
      accounts: [],
      customerDetails: {
        shipperDetails: {
          postalAddress: {
            postalCode: '8888',
            cityName: 'Berlin',
            countryCode: 'DE',
            provinceCode: '',
            addressLine1: 'Alexander Platz 1',
            addressLine2: '',
            addressLine3: '',
            provinceName: '',
            countryName: 'Germany',
          },
          contactInformation: {
            phone: '0123456789',
            companyName: 'MyOrb',
            fullName: 'MyOrb',
          },
        },
        receiverDetails: {
          postalAddress: {
            postalCode: '8888',
            cityName: 'Munchen',
            countryCode: 'DE',
            provinceCode: '',
            addressLine1: 'Marienplatz 1',
            addressLine2: '',
            addressLine3: '',
            provinceName: '',
            countryName: 'Germany',
          },
          contactInformation: {
            phone: '0123456789',
            companyName: 'MyOrb',
            fullName: 'MyOrb',
          },
        },
      },
      content: {
        isCustomsDeclarable: false,
        description: 'DOCUMENTS',
        packages: [
          {
            weight: 0.3,
            dimensions: {
              length: 32,
              width: 23.8,
              height: 1,
            },
          },
        ],
        incoterm: SupermodelIoLogisticsExpressCreateShipmentRequestContentIncotermEnum.DAP,
        unitOfMeasurement: SupermodelIoLogisticsExpressCreateShipmentRequestContentUnitOfMeasurementEnum.Metric,
      },
    };
    const shipment = await dhlApi.expApiShipments(body);
    return shipment.data;
  }
}

Configuration

NameTypeDefaultDescription
basePathstrhttps://express.api.dhl.com/mydhlapi/The base URL that is going to be used for DHL API connections.
usernamestrNoneThe DHL API username to be used for authentication
passwordstrNoneThe DHL API password to be used for authentication
apiKeystrNoneCan be used for authentication
accessTokenstrNoneCan be used for authentication

License

DHL API for Javascript is currently licensed under the Apache License, Version 2.0.

Keywords

typescript

FAQs

Package last updated on 23 Jun 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.