Documentation ¶
Index ¶
- func StuartResponseHandler(resp *http.Response) error
- type AccessCodeType
- type AccessCodesModel
- type AddressType
- type CancelReasonType
- type CancelRequestModel
- type CancellationResponseModel
- type ClientInterface
- type ClientWrapper
- func (c ClientWrapper) CancelDelivery(ctx context.Context, deliveryId string, cancelReq *CancelRequestModel) (int, error)
- func (c ClientWrapper) CancelJob(ctx context.Context, jobId string, cancelReq *CancelRequestModel) (int, error)
- func (c ClientWrapper) CreateJob(ctx context.Context, model JobRequestModel) ([]byte, error)
- func (c ClientWrapper) GetDriverPhoneNumber(ctx context.Context, deliveryId string) (string, error)
- func (c ClientWrapper) GetJob(ctx context.Context, jobId string) (*JobResponseModel, error)
- func (c ClientWrapper) GetJobOriginEta(ctx context.Context, model JobRequestModel) (int, error)
- func (c ClientWrapper) GetJobPricing(ctx context.Context, model JobRequestModel) (*PricingProposalModel, error)
- func (c ClientWrapper) GetJobs(ctx context.Context, options GetJobsOptions) ([]JobResponseModel, error)
- func (c ClientWrapper) GetParcelShops(ctx context.Context, address string, date string) (*ParcelShopsResponse, error)
- func (c ClientWrapper) GetSchedulingSlots(ctx context.Context, zone string, requestType RequestType, date string) (*SchedulingSlotsResponseModel, error)
- func (c ClientWrapper) GetZoneCoverage(ctx context.Context, zone string, addressType RequestType) (*geojson.FeatureCollection, error)
- func (c ClientWrapper) UpdateJob(ctx context.Context, jobId string, model JobRequestModel) (*JobResponseModel, error)
- func (c ClientWrapper) ValidateAddress(ctx context.Context, address string, addressType RequestType, phone string) (bool, error)
- func (c ClientWrapper) ValidateJobParameters(ctx context.Context, model JobRequestModel) (bool, error)
- type ContactDetails
- type DeliveriesResponseModel
- type DriverModel
- type DropoffRequestModel
- type EnvEndpointType
- type EtaModel
- type GetJobsOptions
- type JobModel
- type JobRequestModel
- type JobResponseModel
- type OrderValuesType
- type PackageType
- type ParcelContactType
- type ParcelShopType
- type ParcelShopsResponse
- type PickupDropoffResponseModel
- type PickupRequestModel
- type PricingModel
- type PricingProposalModel
- type ProofModel
- type RequestType
- type ScheduleType
- type SchedulingSlotsResponseModel
- type StatusType
- type StuartPackageDimensions
- type TimeSlotModel
- type TransportType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StuartResponseHandler ¶
Types ¶
type AccessCodeType ¶
type AccessCodeType string
const ( ScanQRText AccessCodeType = "scan_qr_text" ScanBarcode128 AccessCodeType = "scan_barcode_128" QRText AccessCodeType = "qr_text" Barcode128 AccessCodeType = "barcode_128" )
type AccessCodesModel ¶
type AccessCodesModel struct { Code string `json:"code"` Type AccessCodeType `json:"type"` Title string `json:"title"` Instructions string `json:"instructions"` }
type AddressType ¶
type CancelReasonType ¶
type CancelReasonType string
const ( CancelAddressError CancelReasonType = "address_error" CancelCourierIssue CancelReasonType = "courier_issue" CancelCustomerCancellationRequested CancelReasonType = "customer_cancellation_requested" CancelDuplicateJob CancelReasonType = "duplicate_job" CancelIncorrectPackage CancelReasonType = "incrorrect_package" CancelNoSupply CancelReasonType = "no_supply" CancelOther CancelReasonType = "other" CancelPackageDamaged CancelReasonType = "package_damaged" CancelPackageNotReady CancelReasonType = "package_not_ready" CancelPUClosed CancelReasonType = "pu_closed" CancelTechnicalIssue CancelReasonType = "technical_issue" CancelWrongTransportType CancelReasonType = "wrong_transport_type" )
type CancelRequestModel ¶
type CancelRequestModel struct { PublicReasonKey CancelReasonType `json:"public_reason_key"` Comment string `json:"comment"` }
type ClientInterface ¶
type ClientInterface interface { GetDriverPhoneNumber(ctx context.Context, deliveryId string) (string, error) CancelDelivery(ctx context.Context, deliveryId string, cancelReq *CancelRequestModel) (int, error) ValidateAddress(ctx context.Context, address string, addressType RequestType, phone string) (bool, error) GetZoneCoverage(ctx context.Context, zone string, addressType RequestType) (*geojson.FeatureCollection, error) GetParcelShops(ctx context.Context, address string, date string) (*ParcelShopsResponse, error) CreateJob(ctx context.Context, model JobRequestModel) ([]byte, error) GetJobPricing(ctx context.Context, model JobRequestModel) (*PricingProposalModel, error) ValidateJobParameters(ctx context.Context, model JobRequestModel) (bool, error) GetJobOriginEta(ctx context.Context, model JobRequestModel) (int, error) GetJobs(ctx context.Context, options GetJobsOptions) ([]JobResponseModel, error) GetJob(ctx context.Context, jobId string) (*JobResponseModel, error) GetSchedulingSlots(ctx context.Context, zone string, requestType RequestType, date string) (*SchedulingSlotsResponseModel, error) UpdateJob(ctx context.Context, jobId string, model JobRequestModel) (*JobResponseModel, error) CancelJob(ctx context.Context, jobId string, cancelReq *CancelRequestModel) (int, error) }
func NewClient ¶
func NewClient(ctx context.Context, envType EnvEndpointType, apiClientId string, apiClientSecret string) (client ClientInterface)
type ClientWrapper ¶
func (ClientWrapper) CancelDelivery ¶
func (c ClientWrapper) CancelDelivery(ctx context.Context, deliveryId string, cancelReq *CancelRequestModel) (int, error)
func (ClientWrapper) CancelJob ¶
func (c ClientWrapper) CancelJob(ctx context.Context, jobId string, cancelReq *CancelRequestModel) (int, error)
func (ClientWrapper) CreateJob ¶
func (c ClientWrapper) CreateJob(ctx context.Context, model JobRequestModel) ([]byte, error)
func (ClientWrapper) GetDriverPhoneNumber ¶
func (ClientWrapper) GetJob ¶
func (c ClientWrapper) GetJob(ctx context.Context, jobId string) (*JobResponseModel, error)
func (ClientWrapper) GetJobOriginEta ¶
func (c ClientWrapper) GetJobOriginEta(ctx context.Context, model JobRequestModel) (int, error)
func (ClientWrapper) GetJobPricing ¶
func (c ClientWrapper) GetJobPricing(ctx context.Context, model JobRequestModel) (*PricingProposalModel, error)
func (ClientWrapper) GetJobs ¶
func (c ClientWrapper) GetJobs(ctx context.Context, options GetJobsOptions) ([]JobResponseModel, error)
func (ClientWrapper) GetParcelShops ¶
func (c ClientWrapper) GetParcelShops(ctx context.Context, address string, date string) (*ParcelShopsResponse, error)
func (ClientWrapper) GetSchedulingSlots ¶
func (c ClientWrapper) GetSchedulingSlots(ctx context.Context, zone string, requestType RequestType, date string) (*SchedulingSlotsResponseModel, error)
func (ClientWrapper) GetZoneCoverage ¶
func (c ClientWrapper) GetZoneCoverage(ctx context.Context, zone string, addressType RequestType) (*geojson.FeatureCollection, error)
func (ClientWrapper) UpdateJob ¶
func (c ClientWrapper) UpdateJob(ctx context.Context, jobId string, model JobRequestModel) (*JobResponseModel, error)
func (ClientWrapper) ValidateAddress ¶
func (c ClientWrapper) ValidateAddress(ctx context.Context, address string, addressType RequestType, phone string) (bool, error)
func (ClientWrapper) ValidateJobParameters ¶
func (c ClientWrapper) ValidateJobParameters(ctx context.Context, model JobRequestModel) (bool, error)
type ContactDetails ¶
type DeliveriesResponseModel ¶
type DeliveriesResponseModel struct { Id int `json:"id"` Status string `json:"status"` PickedAt string `json:"picked_at"` DeliveredAt string `json:"delivered_at"` TrackingUrl string `json:"tracking_url"` ClientReference string `json:"client_reference"` PackageDescription string `json:"package_description"` PackageType string `json:"package_type"` Pickup PickupDropoffResponseModel `json:"pickup"` Dropoff PickupDropoffResponseModel `json:"dropoff"` Cancellation CancellationResponseModel `json:"cancellation"` Eta EtaModel `json:"eta"` Proof ProofModel `json:"proof"` ProofOfDeliveryUrl string `json:"proof_of_delivery_url"` }
type DriverModel ¶
type DropoffRequestModel ¶
type DropoffRequestModel struct { PackageType PackageType `json:"package_type"` PackageDescription string `json:"package_description"` ClientReference string `json:"client_reference"` Address string `json:"address"` Comment string `json:"comment,omitempty"` Contact ContactDetails `json:"contact"` AccessCodes []AccessCodesModel `json:"access_codes"` EndCustomerTimeWindowStart *time.Time `json:"end_customer_time_window_start,omitempty"` EndCustomerTimeWindowEnd *time.Time `json:"end_customer_time_window_end,omitempty"` }
type EnvEndpointType ¶
type EnvEndpointType string
const ( SandboxEnv EnvEndpointType = "https://api.sandbox.stuart.com" ProdEnv EnvEndpointType = "https://api.stuart.com" TokenURLSuffix = "/oauth/token" )
func (EnvEndpointType) GetBaseURL ¶
func (endpoint EnvEndpointType) GetBaseURL() string
func (EnvEndpointType) GetOAuthURL ¶
func (endpoint EnvEndpointType) GetOAuthURL() string
func (EnvEndpointType) GetURL ¶
func (endpoint EnvEndpointType) GetURL(suffix string) string
type GetJobsOptions ¶
type GetJobsOptions struct { Status StatusType Page int PerPage int ClientReference string Active bool Order OrderValuesType }
type JobModel ¶
type JobModel struct { PickupAt *time.Time `json:"pickup_at"` AssignmentCode string `json:"assignment_code"` ClientReference string `json:"client_reference"` Pickups []PickupRequestModel `json:"pickups"` Dropoffs []DropoffRequestModel `json:"dropoffs"` TransportType TransportType `json:"transport_type"` }
type JobRequestModel ¶
type JobRequestModel struct {
Job JobModel `json:"job"`
}
type JobResponseModel ¶
type JobResponseModel struct { Id int `json:"id"` CreatedAt time.Time `json:"created_at"` Status string `json:"status"` PackageType string `json:"package_type"` TransportType string `json:"transport_type"` AssignmentCode string `json:"assignment_code"` DropoffAt string `json:"dropoff_at"` PickupAt string `json:"pickup_at"` EndedAt string `json:"ended_at"` Comment string `json:"comment"` Distance float64 `json:"distance"` Duration int `json:"duration"` Deliveries []DeliveriesResponseModel `json:"deliveries"` Driver DriverModel `json:"driver"` Pricing PricingModel `json:"pricing"` Cancellation CancellationResponseModel `json:"cancelation"` Eta EtaModel `json:"eta"` Rating string `json:"rating"` }
type OrderValuesType ¶
type OrderValuesType string
const ( ORDER_START_INVITING_AT_DESC OrderValuesType = "start_inviting_at:desc" ORDER_PICKUP_AT_DESC OrderValuesType = "pickup_at:desc" ORDER_PICKUP_AT_ASC OrderValuesType = "pickup_at:asc" )
type PackageType ¶
type PackageType string
const ( XSmall PackageType = "xsmall" Small PackageType = "small" Medium PackageType = "medium" Large PackageType = "large" Xlarge PackageType = "xlarge" )
func CalculateParcelSize ¶
func CalculateParcelSize(heightCM float32, lengthCm float32, widthCm float32, weightKg float32) PackageType
type ParcelContactType ¶
type ParcelShopType ¶
type ParcelShopType struct { Address string `json:"address"` Contact ParcelContactType `json:"contact"` }
type ParcelShopsResponse ¶
type ParcelShopsResponse struct { Date string `json:"date"` Schedule []ScheduleType `json:"schedule"` }
type PickupDropoffResponseModel ¶
type PickupDropoffResponseModel struct { Id int `json:"id"` Latitude float64 `json:"latitude"` Longitude float64 `json:"longitude"` Comment string `json:"comment"` Address AddressType `json:"address"` Contact ContactDetails `json:"contact"` }
type PickupRequestModel ¶
type PickupRequestModel struct { Address string `json:"address"` Comment string `json:"comment"` Contact ContactDetails `json:"contact"` AccessCodes []AccessCodesModel `json:"access_codes"` }
type PricingModel ¶
type PricingProposalModel ¶
type ProofModel ¶
type ProofModel struct {
SignatureUrl string `json:"signature_url"`
}
type RequestType ¶
type RequestType string
const ( PickupType RequestType = "picking" DropoffType RequestType = "delivering" )
type ScheduleType ¶
type ScheduleType struct { ParcelShop ParcelShopType `json:"parcel_shop"` From time.Time `json:"from"` To time.Time `json:"to"` }
type SchedulingSlotsResponseModel ¶
type SchedulingSlotsResponseModel struct { Date time.Time `json:"date"` Type string `json:"type"` Slots []TimeSlotModel `json:"slots"` }
type StatusType ¶
type StatusType string
const ( STATUS_NEW StatusType = "new" STATUS_SCHEDULED StatusType = "scheduled" STATUS_SEARCHING StatusType = "searching" STATUS_IN_PROGRESS StatusType = "in_progress" STATUS_FINISHED StatusType = "finished" STATUS_CANCELLED StatusType = "cancelled" STATUS_EXPIRED StatusType = "expired" )
type StuartPackageDimensions ¶
type StuartPackageDimensions struct {
// contains filtered or unexported fields
}
type TimeSlotModel ¶
type TransportType ¶
type TransportType string
const ( TransportTypeBike TransportType = "bike" TransportTypeCar TransportType = "car" //motorbike TransportTypeMoto TransportType = "motorbike" )
Source Files ¶
Click to show internal directories.
Click to hide internal directories.