UNPKG

@shipengine/connect-carrier-api

Version:

This is the typescript/javascript definitions for carrier api

30 lines (28 loc) 1.84 kB
import { Method, Handler, mapExtensions } from '@shipengine/connect-runtime'; import { ApiEndpoints } from './constants'; import { CarrierAppDefinition } from './carrier-app-definition'; export const createEndpointMapping = ( definition: CarrierAppDefinition, ): [Method, string, Handler | undefined][] => [ //TODO: Remove `Method.POST` from this and all other maps since they are ALL post //TODO: Remove JOI validation from all endpoints and replace them with OpenAPI validation [Method.POST, ApiEndpoints.CancelNotification, definition.CancelNotification], [Method.POST, ApiEndpoints.CancelPickup, definition.CancelPickup], [Method.POST, ApiEndpoints.CreateLabel, definition.CreateLabel], [Method.POST, ApiEndpoints.CreateManifest, definition.CreateManifest], [Method.POST, ApiEndpoints.GetManifest, definition.GetManifest], [Method.POST, ApiEndpoints.CreateNotification, definition.CreateNotification], [Method.POST, ApiEndpoints.GetRates, definition.GetRates], [Method.POST, ApiEndpoints.NormalizeTrackingData, definition.NormalizeTrackingData], [Method.POST, ApiEndpoints.Register, definition.Register], [Method.POST, ApiEndpoints.SchedulePickup, definition.SchedulePickup], [Method.POST, ApiEndpoints.Track, definition.Track], [Method.POST, ApiEndpoints.ValidateInboundData, definition.ValidateInboundData], [Method.POST, ApiEndpoints.VoidLabels, definition.VoidLabels], [Method.POST, ApiEndpoints.GetRelayPoints, definition.GetRelayPoints], [Method.POST, ApiEndpoints.GetServicePoints, definition.GetServicePoints], [Method.POST, ApiEndpoints.GetServicePoint, definition.GetServicePoint], [Method.POST, ApiEndpoints.ImportTrackingEvents, definition.ImportTrackingEvents], [Method.POST, ApiEndpoints.UpdateSettings, definition.UpdateSettings], ...mapExtensions(definition.Extensions), ];