fedex

package module
v0.0.0-...-d44d268 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 31, 2022 License: BSD-3-Clause Imports: 6 Imported by: 0

README

fedex

Go bindings for the fedex tracking api.

Go Documentation

Example output:

track.Tracking{
    Number:   "XXXXXXXXXXXX",
    Service:  "FedEx Home Delivery",
    Status:   "Delivered",
    Delivery: time.Date(2022, time.August, 31, 11, 10, 27, 0, time.Local),
    Events:   {
        {
            Status:   "Delivered",
            Location: "Astoria",
            Time:     time.Date(2022, time.August, 31, 11, 10, 27, 0, time.Local),
        },
        {
            Status:   "On FedEx vehicle for delivery",
            Location: "WOODSIDE",
            Time:     time.Date(2022, time.August, 31, 4, 34, 0, 0, time.Local),
        },
        {
            Status:   "At local FedEx facility",
            Location: "WOODSIDE",
            Time:     time.Date(2022, time.August, 31, 4, 21, 0, 0, time.Local),
        },
        {
            Status:   "Left FedEx origin facility",
            Location: "LONG ISLAND CITY",
            Time:     time.Date(2022, time.August, 31, 2, 40, 45, 0, time.Local),
        },
        {
            Status:   "Shipment arriving On-Time",
            Location: "LONG ISLAND CITY",
            Time:     time.Date(2022, time.August, 30, 19, 22, 21, 0, time.Local),
        },
        {
            Status:   "Arrived at FedEx location",
            Location: "LONG ISLAND CITY",
            Time:     time.Date(2022, time.August, 30, 19, 7, 0, 0, time.Local),
        },
        {
            Status:   "Picked up",
            Location: "LONG ISLAND CITY",
            Time:     time.Date(2022, time.August, 30, 12, 42, 0, 0, time.Local),
        },
        {
            Status:   "Dropped off at FedEx OnSite-XXXXXXXXXXXXXXX",
            Location: "BROOKLYN",
            Time:     time.Date(2022, time.August, 29, 16, 9, 0, 0, time.Local),
        },
        {
            Status:   "Shipment information sent to FedEx",
            Location: "",
            Time:     time.Date(2022, time.August, 29, 12, 35, 0, 0, time.Local),
        },
    },
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdditionalTrackingInfo

type AdditionalTrackingInfo struct {
	HasAssociatedShipments bool                `json:"hasAssociatedShipments"`
	Nickname               string              `json:"nickname"`
	PackageIdentifiers     []PackageIdentifier `json:"packageIdentifiers"`
	ShipmentNotes          string              `json:"shipmentNotes"`
}

AdditionalTrackingInfo

type Address

type Address struct {
	City                string   `json:"city"`
	Classification      string   `json:"classification"`
	CountryCode         string   `json:"countryCode"`
	CountryName         string   `json:"countryName,omitempty"` // modified, not necessarily always present
	PostalCode          string   `json:"postalCode"`
	Residential         bool     `json:"residential"`
	StateOrProvinceCode string   `json:"stateOrProvinceCode"`
	StreetLines         []string `json:"streetLines"`
	UrbanizationCode    string   `json:"urbanizationCode"`
}

type AncillaryDetail

type AncillaryDetail struct {
	Action            string `json:"action"`
	ActionDescription string `json:"actionDescription"`
	Reason            string `json:"reason"`
	ReasonDescription string `json:"reasonDescription"`
}

type AvailableImage

type AvailableImage struct {
	Size string `json:"size"`
	Type string `json:"type"`
}

AvailableImage

type Client

type Client struct {
	Config Config
	OAuth  OAuthResponse
}

func (*Client) RefreshToken

func (c *Client) RefreshToken() error

func (*Client) Track

func (c *Client) Track(number string) (tracking track.Tracking, err error)

type CompleteTrackResult

type CompleteTrackResult struct {
	TrackResults   []TrackResult `json:"trackResults"`
	TrackingNumber string        `json:"trackingNumber"`
}

type Config

type Config struct {
	ID     string
	Secret string
	URL    string
}

type ConsolidationDetail

type ConsolidationDetail struct {
	ConsolidationID string       `json:"consolidationID"`
	EventType       string       `json:"eventType"`
	PackageCount    int64        `json:"packageCount"`
	ReasonDetail    ReasonDetail `json:"reasonDetail"`
	TimeStamp       string       `json:"timeStamp"`
}

ConsolidationDetail

type Contact

type Contact struct {
	CompanyName string `json:"companyName"`
	PersonName  string `json:"personName"`
	PhoneNumber string `json:"phoneNumber"`
}

type ContactAndAddress

type ContactAndAddress struct {
	Address Address `json:"address"`
	Contact Contact `json:"contact"`
}

type Content

type Content struct {
	Description      string `json:"description"`
	ItemNumber       string `json:"itemNumber"`
	PartNumber       string `json:"partNumber"`
	ReceivedQuantity string `json:"receivedQuantity"`
}

type CustomDeliveryOption

type CustomDeliveryOption struct {
	Description                string                     `json:"description"`
	RequestedAppointmentDetail RequestedAppointmentDetail `json:"requestedAppointmentDetail"`
	Status                     string                     `json:"status"`
	Type                       string                     `json:"type"`
}

CustomDeliveryOption

type DateAndTime

type DateAndTime struct {
	DateTime DateISO `json:"dateTime"`
	Type     string  `json:"type"`
}

DateAndTime

type DateISO

type DateISO struct {
	time.Time
}

func (*DateISO) UnmarshalJSON

func (d *DateISO) UnmarshalJSON(data []byte) error

type DeclaredValue

type DeclaredValue struct {
	Currency string  `json:"currency"`
	Value    float64 `json:"value"`
}

type DelayDetail

type DelayDetail struct {
	Status  string `json:"status"`
	SubType string `json:"subType"`
	Type    string `json:"type"`
}

type DeliveryDetails

type DeliveryDetails struct {
	ActualDeliveryAddress             Address                           `json:"actualDeliveryAddress"`
	DeliveryAttempts                  string                            `json:"deliveryAttempts"`
	DeliveryOptionEligibilityDetails  []DeliveryOptionEligibilityDetail `json:"deliveryOptionEligibilityDetails"`
	DeliveryToday                     bool                              `json:"deliveryToday"`
	DestinationServiceArea            string                            `json:"destinationServiceArea"`
	DestinationServiceAreaDescription string                            `json:"destinationServiceAreaDescription"`
	LocationDescription               string                            `json:"locationDescription"`
	LocationType                      string                            `json:"locationType"`
	OfficeOrderDeliveryMethod         string                            `json:"officeOrderDeliveryMethod"`
	ReceivedByName                    string                            `json:"receivedByName"`
	SignedByName                      string                            `json:"signedByName"`
}

DeliveryDetails

type DeliveryOptionEligibilityDetail

type DeliveryOptionEligibilityDetail struct {
	Eligibility string `json:"eligibility"`
	Option      string `json:"option"`
}

type Dimensions

type Dimensions struct {
	Height int64  `json:"height"`
	Length int64  `json:"length"`
	Units  string `json:"units"`
	Width  int64  `json:"width"`
}

type DistanceToDestination

type DistanceToDestination struct {
	Units string  `json:"units"`
	Value float64 `json:"value"`
}

DistanceToDestination

type Error

type Error struct {
	Code          string      `json:"code"`
	Message       string      `json:"message"`
	ParameterList []Parameter `json:"parameterList"`
}

Error

type HoldAtLocation

type HoldAtLocation struct {
	LocationContactAndAddress ContactAndAddress `json:"locationContactAndAddress"`
	LocationID                string            `json:"locationId"`
	LocationType              string            `json:"locationType"`
}

HoldAtLocation

type InformationNote

type InformationNote struct {
	Code        string `json:"code"`
	Description string `json:"description"`
}

InformationNote

type LatestStatusDetail

type LatestStatusDetail struct {
	AncillaryDetails []AncillaryDetail `json:"ancillaryDetails"`
	Code             string            `json:"code"`
	DelayDetail      DelayDetail       `json:"delayDetail"`
	DerivedCode      string            `json:"derivedCode"`
	Description      string            `json:"description"`
	ScanLocation     Address           `json:"scanLocation"`
	StatusByLocale   string            `json:"statusByLocale"`
}

LatestStatusDetail

type Location

type Location struct {
	ContactAndAddress ContactAndAddress `json:"locationContactAndAddress"`
	ID                string            `json:"locationId"`
	Type              string            `json:"locationType"`
}

Location

type OAuthResponse

type OAuthResponse struct {
	AccessToken string `json:"access_token"`
	TokenType   string `json:"token_type"`
	ExpiresIn   int    `json:"expires_in"`
	Scope       string `json:"scope"`
}

type Output

type Output struct {
	Alerts               string                `json:"alerts"`
	CompleteTrackResults []CompleteTrackResult `json:"completeTrackResults"`
}

type PackageDetails

type PackageDetails struct {
	ContentPieceCount     string              `json:"contentPieceCount"`
	Count                 string              `json:"count"`
	DeclaredValue         DeclaredValue       `json:"declaredValue"`
	PackageContent        []string            `json:"packageContent"`
	PackagingDescription  ReasonDetail        `json:"packagingDescription"`
	PhysicalPackagingType string              `json:"physicalPackagingType"`
	SequenceNumber        string              `json:"sequenceNumber"`
	UndeliveredCount      string              `json:"undeliveredCount"`
	WeightAndDimensions   WeightAndDimensions `json:"weightAndDimensions"`
}

PackageDetails

type PackageIdentifier

type PackageIdentifier struct {
	TrackingNumberUniqueID string `json:"trackingNumberUniqueId"`
	Type                   string `json:"type"`
	Value                  string `json:"value"`
}

type Parameter

type Parameter struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type PieceCount

type PieceCount struct {
	Count       string `json:"count"`
	Description string `json:"description"`
	Type        string `json:"type"`
}

PieceCount

type ReasonDetail

type ReasonDetail struct {
	Description string `json:"description"`
	Type        string `json:"type"`
}

type RequestedAppointmentDetail

type RequestedAppointmentDetail struct {
	Date   string       `json:"date"`
	Window []TimeWindow `json:"window"`
}

type ReturnDetail

type ReturnDetail struct {
	AuthorizationName string         `json:"authorizationName"`
	ReasonDetail      []ReasonDetail `json:"reasonDetail"`
}

ReturnDetail

type ScanEvent

type ScanEvent struct {
	Date                 DateISO     `json:"date"`
	DelayDetail          DelayDetail `json:"delayDetail"`
	DerivedStatus        string      `json:"derivedStatus"`
	DerivedStatusCode    string      `json:"derivedStatusCode"`
	EventDescription     string      `json:"eventDescription"`
	EventType            string      `json:"eventType"`
	ExceptionCode        string      `json:"exceptionCode"`
	ExceptionDescription string      `json:"exceptionDescription"`
	ScanLocation         Address     `json:"scanLocation"`
}

ScanEvent

type ServiceCommitMessage

type ServiceCommitMessage struct {
	Message string `json:"message"`
	Type    string `json:"type"`
}

ServiceCommitMessage

type ServiceDetail

type ServiceDetail struct {
	Description      string `json:"description"`
	ShortDescription string `json:"shortDescription"`
	Type             string `json:"type"`
}

ServiceDetail

type ShipmentDetails

type ShipmentDetails struct {
	BeforePossessionStatus bool            `json:"beforePossessionStatus"`
	ContentPieceCount      string          `json:"contentPieceCount"`
	Contents               []Content       `json:"contents"`
	SplitShipments         []SplitShipment `json:"splitShipments"`
	Weight                 []Weight        `json:"weight"`
}

ShipmentDetails

type SpecialHandling

type SpecialHandling struct {
	Description string `json:"description"`
	PaymentType string `json:"paymentType"`
	Type        string `json:"type"`
}

SpecialHandling

type SplitShipment

type SplitShipment struct {
	PieceCount        string `json:"pieceCount"`
	StatusCode        string `json:"statusCode"`
	StatusDescription string `json:"statusDescription"`
	Timestamp         string `json:"timestamp"`
}

type TimeWindow

type TimeWindow struct {
	Description string `json:"description"`
	Type        string `json:"type"`
	Window      Window `json:"window"`
}

type TrackResponse

type TrackResponse struct {
	CustomerTransactionID string `json:"customerTransactionId"`
	Output                Output `json:"output"`
	TransactionID         string `json:"transactionId"`
}

func (*TrackResponse) Tracking

func (r *TrackResponse) Tracking() (t track.Tracking)

type TrackResult

type TrackResult struct {
	AdditionalTrackingInfo        AdditionalTrackingInfo `json:"additionalTrackingInfo"`
	AvailableImages               []AvailableImage       `json:"availableImages"`
	AvailableNotifications        []string               `json:"availableNotifications"`
	ConsolidationDetail           []ConsolidationDetail  `json:"consolidationDetail"`
	CustomDeliveryOptions         []CustomDeliveryOption `json:"customDeliveryOptions"`
	DateAndTimes                  []DateAndTime          `json:"dateAndTimes"`
	DeliveryDetails               DeliveryDetails        `json:"deliveryDetails"`
	DestinationLocation           Location               `json:"destinationLocation"`
	DistanceToDestination         DistanceToDestination  `json:"distanceToDestination"`
	Error                         Error                  `json:"error"`
	EstimatedDeliveryTimeWindow   TimeWindow             `json:"estimatedDeliveryTimeWindow"`
	GoodsClassificationCode       string                 `json:"goodsClassificationCode"`
	HoldAtLocation                HoldAtLocation         `json:"holdAtLocation"`
	InformationNotes              []InformationNote      `json:"informationNotes"`
	LastUpdatedDestinationAddress Address                `json:"lastUpdatedDestinationAddress"`
	LatestStatusDetail            LatestStatusDetail     `json:"latestStatusDetail"`
	MeterNumber                   string                 `json:"meterNumber"`
	OriginLocation                Location               `json:"originLocation"`
	PackageDetails                PackageDetails         `json:"packageDetails"`
	PieceCounts                   []PieceCount           `json:"pieceCounts"`
	ReasonDetail                  ReasonDetail           `json:"reasonDetail"`
	RecipientInformation          ContactAndAddress      `json:"recipientInformation"`
	ReturnDetail                  ReturnDetail           `json:"returnDetail"`
	ScanEvents                    []ScanEvent            `json:"scanEvents"`
	ServiceCommitMessage          ServiceCommitMessage   `json:"serviceCommitMessage"`
	ServiceDetail                 ServiceDetail          `json:"serviceDetail"`
	ShipmentDetails               ShipmentDetails        `json:"shipmentDetails"`
	ShipperInformation            ContactAndAddress      `json:"shipperInformation"`
	SpecialHandlings              []SpecialHandling      `json:"specialHandlings"`
	StandardTransitTimeWindow     TimeWindow             `json:"standardTransitTimeWindow"`
	TrackingNumberInfo            TrackingNumberInfo     `json:"trackingNumberInfo"`
}

type TrackingInfoRequest

type TrackingInfoRequest struct {
	TrackingNumberInfo TrackingNumberInfoRequest `json:"trackingNumberInfo"`
}

type TrackingNumberInfo

type TrackingNumberInfo struct {
	CarrierCode            string `json:"carrierCode"`
	TrackingNumber         string `json:"trackingNumber"`
	TrackingNumberUniqueID string `json:"trackingNumberUniqueId"`
}

TrackingNumberInfo

type TrackingNumberInfoRequest

type TrackingNumberInfoRequest struct {
	TrackingNumber string `json:"trackingNumber"`
}

type TrackingRequest

type TrackingRequest struct {
	IncludeDetailedScans bool                  `json:"includeDetailedScans"`
	TrackingInfo         []TrackingInfoRequest `json:"trackingInfo"`
}

type Weight

type Weight struct {
	Unit  string `json:"unit"`
	Value string `json:"value"`
}

type WeightAndDimensions

type WeightAndDimensions struct {
	Dimensions []Dimensions `json:"dimensions"`
	Weight     []Weight     `json:"weight"`
}

type Window

type Window struct {
	Begins string `json:"begins"`
	Ends   string `json:"ends"`
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL