onfleet

package module
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: MIT Imports: 3 Imported by: 1

README

gonfleet

The official Onfleet Go client library.

Installation

go get github.com/onfleet/gonfleet

Documentation

Below are a few examples.

For comprehensive documentation / examples, visit Onfleet API reference

Initialize Client
import (
    "log"
    "os"
    "github.com/onfleet/gonfleet/client"
)

apiKey := os.Getenv("onfleet_api_key")

client, err := client.New(apiKey, nil)
if err != nil {
    log.Fatal(err)
}

// do something with client ...
Tasks
import (
    "fmt"
    "github.com/onfleet/gonfleet"
    "github.com/onfleet/gonfleet/client"
)

params := onfleet.TaskParams{
    Destination: onfleet.DestinationCreateParams{
        Address: onfleet.DestinationAddress{
            Number:     "8221",
            Street:     "Sunset Blvd",
            City:       "Los Angeles",
            State:      "CA",
            PostalCode: "90046",
            Country:    "US",
        },
    },
    Recipients: []onfleet.RecipientCreateParams{
        {
            Name:  "Kurt Cobain",
            Phone: "+13105550107",
        },
    },
    PickupTask: true,
}

task, err := client.Tasks.Create(params)
if err != nil {
    fmt.Println(err)
    return
}

// do something with task ...
Workers
import (
    "fmt"
    "github.com/onfleet/gonfleet"
    "github.com/onfleet/gonfleet/client"
)

params := onfleet.WorkerCreateParams{
    Addresses: &onfleet.WorkerCreateParamsAddressRouting{
        Routing: "destination_id",
    },
    Capacity: 10,
    Teams:    []string{"team_id_a", "team_id_b"},
    Name:     "Janis Joplin",
    Phone:    "+13105550101",
    Vehicle: &onfleet.WorkerCreateParamsVehicle{
        Type: onfleet.WorkerVehicleTypeBicycle,
    },
}

worker, err := client.Workers.Create(params)
if err != nil {
    fmt.Println(err)
    return
}

// do something with worker ...

Documentation

Index

Constants

View Source
const (
	CustomFieldVisibilityOptionAdmin  = "admin"
	CustomFieldVisibilityOptionAPI    = "api"
	CustomFieldVisibilityOptionWorker = "worker"

	CustomFieldValidDataTypeSingleLineText = "single_line_text_field"
	CustomFieldValidDataTypeMultiLineText  = "multi_line_text_field"
	CustomFieldValidDataTypeBoolean        = "boolean"
	CustomFieldValidDataTypeInteger        = "integer"
	CustomFieldValidDataTypeDecimal        = "decimal"
	CustomFieldValidDataTypeDate           = "date"
	CustomFieldValidDataTypeURL            = "Url"
)

Variables

This section is empty.

Functions

func ParseError

func ParseError(r io.Reader) error

Types

type Admin

type Admin struct {
	Email            string     `json:"email"`
	ID               string     `json:"id"`
	IsAccountOwner   bool       `json:"isAccountOwner"`
	IsActive         bool       `json:"isActive"`
	IsReadOnly       bool       `json:"isReadOnly"`
	Metadata         []Metadata `json:"metadata"`
	Name             string     `json:"name"`
	Organization     string     `json:"organization"`
	Phone            string     `json:"phone"`
	Teams            []string   `json:"teams"`
	TimeCreated      int64      `json:"timeCreated"`
	TimeLastModified int64      `json:"timeLastModified"`
	Type             string     `json:"type"`
}

type AdminCreateParams

type AdminCreateParams struct {
	Email      string     `json:"email"`
	IsReadOnly bool       `json:"isReadOnly"`
	Metadata   []Metadata `json:"metadata,omitempty"`
	Name       string     `json:"name"`
	Phone      string     `json:"phone,omitempty"`
	Type       string     `json:"type,omitempty"`
}

type AdminUpdateParams

type AdminUpdateParams struct {
	Email    string     `json:"email,omitempty"`
	Metadata []Metadata `json:"metadata,omitempty"`
	Name     string     `json:"name,omitempty"`
	Phone    string     `json:"phone,omitempty"`
}

type Container

type Container struct {
	ActiveTask       *string       `json:"activeTask"`
	ID               string        `json:"id"`
	Organization     string        `json:"organization"`
	TimeCreated      int64         `json:"timeCreated"`
	TimeLastModified int64         `json:"timeLastModified"`
	Type             ContainerType `json:"type"`
	Tasks            []string      `json:"tasks"`
	Worker           string        `json:"worker,omitempty"`
	Team             string        `json:"team,omitempty"`
}

type ContainerQueryKey

type ContainerQueryKey string
const (
	ContainerQueryKeyOrganizations ContainerQueryKey = "organizations"
	ContainerQueryKeyTeams         ContainerQueryKey = "teams"
	ContainerQueryKeyWorkers       ContainerQueryKey = "workers"
)

type ContainerTaskInsertParams

type ContainerTaskInsertParams struct {
	Tasks                []any `json:"tasks"`
	ConsiderDependencies bool  `json:"considerDependencies"`
}

type ContainerType

type ContainerType string
const (
	ContainerTypeOrganization ContainerType = "ORGANIZATION"
	ContainerTypeTeam         ContainerType = "TEAM"
	ContainerTypeWorker       ContainerType = "WORKER"
)

type CustomField added in v0.5.2

type CustomField struct {
	Description string                        `json:"description"`
	AsArray     bool                          `json:"asArray"`
	Visibility  []CustomFieldVisibilityOption `json:"visibility"`
	Editability []CustomFieldVisibilityOption `json:"editability"`
	Key         string                        `json:"key"`
	Name        string                        `json:"name"`
	Type        CustomFieldValidDataType      `json:"type"`
	Contexts    []CustomFieldContext          `json:"context"`
	Value       any                           `json:"value"`
}

type CustomFieldContext added in v0.5.2

type CustomFieldContext struct {
	IsRequired bool   `json:"isRequired"`
	Conditions []any  `json:"conditions"`
	Name       string `json:"name"`
}

type CustomFieldParams added in v0.5.2

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

type CustomFieldValidDataType added in v0.5.2

type CustomFieldValidDataType string

type CustomFieldVisibilityOption added in v0.5.2

type CustomFieldVisibilityOption string

type DeliveryManifest added in v0.5.1

type DeliveryManifest struct {
	DepartureTime int64              `json:"departureTime"`
	Driver        Driver             `json:"driver"`
	HubAddress    string             `json:"hubAddress"`
	ManifestDate  int64              `json:"manifestDate"`
	Tasks         []Task             `json:"tasks"`
	TotalDistance string             `json:"totalDistance"`
	TurnByTurn    []TurnByTurn       `json:"turnByTurn"`
	Vehicle       WorkerVehicleParam `json:"vehicle"`
}

type Destination

type Destination struct {
	Address          DestinationAddress  `json:"address"`
	GooglePlaceId    string              `json:"googlePlaceId"`
	ID               string              `json:"id"`
	Location         DestinationLocation `json:"location"`
	Metadata         []Metadata          `json:"metadata"`
	Notes            string              `json:"notes"`
	TimeCreated      int64               `json:"timeCreated"`
	TimeLastModified int64               `json:"timeLastModified"`
	Warnings         []any               `json:"warnings"`
}

type DestinationAddress

type DestinationAddress struct {
	Apartment  string `json:"apartment"`
	City       string `json:"city"`
	Country    string `json:"country"`
	Name       string `json:"name,omitempty"`
	Number     string `json:"number"`
	PostalCode string `json:"postalCode"`
	State      string `json:"state"`
	Street     string `json:"street"`
	Unparsed   string `json:"unparsed,omitempty"`
}

type DestinationCreateParams

type DestinationCreateParams struct {
	Address  DestinationAddress       `json:"address"`
	Location DestinationLocation      `json:"location,omitempty"`
	Metadata []Metadata               `json:"metadata,omitempty"`
	Notes    string                   `json:"notes,omitempty"`
	Options  *DestinationOptionsParam `json:"options,omitempty"`
}

type DestinationLocation

type DestinationLocation []float64

type DestinationOptionsParam

type DestinationOptionsParam struct {
	Language string `json:"language,omitempty"`
}

type Driver added in v0.5.1

type Driver struct {
	Name  string `json:"name"`
	Phone string `json:"phone"`
}

type Hub

type Hub struct {
	Address  DestinationAddress  `json:"address"`
	ID       string              `json:"id"`
	Location DestinationLocation `json:"location"`
	Name     string              `json:"name"`
	Teams    []string            `json:"teams"`
}

type HubCreateParams

type HubCreateParams struct {
	Address DestinationAddress `json:"address"`
	Name    string             `json:"name"`
	Teams   []string           `json:"teams,omitempty"`
}

type HubUpdateParams

type HubUpdateParams struct {
	Address DestinationAddress `json:"address"`
	Name    string             `json:"name"`
	Teams   []string           `json:"teams,omitempty"`
}

type ManifestGenerateParams added in v0.5.1

type ManifestGenerateParams struct {
	HubId    string `json:"hubId"`
	WorkerId string `json:"workerId"`
}

type Metadata

type Metadata struct {
	Name       string                     `json:"name"`
	Subtype    string                     `json:"subtype,omitempty"`
	Type       string                     `json:"type"`
	Value      any                        `json:"value"`
	Visibility []MetadataVisibilityOption `json:"visibility,omitempty"`
}

Onfleet Metadata. Reference https://docs.onfleet.com/reference/metadata

type MetadataVisibilityOption

type MetadataVisibilityOption string
const (
	MetadataVisibilityOptionApi       MetadataVisibilityOption = "api"
	MetadataVisibilityOptionDashboard MetadataVisibilityOption = "dashboard"
	MetadataVisibilityOptionWorker    MetadataVisibilityOption = "worker"
)

type Organization

type Organization struct {
	Country            string   `json:"country"`
	Delegatees         []string `json:"delegatees"`
	DriverSupportEmail string   `json:"driverSupportEmail"`
	Email              string   `json:"email"`
	ID                 string   `json:"id"`
	Image              string   `json:"image,omitempty"`
	Name               string   `json:"name"`
	TimeCreated        int64    `json:"timeCreated"`
	TimeLastModified   int64    `json:"timeLastModified"`
	Timezone           string   `json:"timezone"`
}

type OrganizationDelegate

type OrganizationDelegate struct {
	Country            string `json:"country"`
	DriverSupportEmail string `json:"driverSupportEmail"`
	Email              string `json:"email"`
	ID                 string `json:"id"`
	IsFulfillment      bool   `json:"isFulfillment"`
	Name               string `json:"name"`
	Timezone           string `json:"timezone"`
}

type PositionEnum added in v0.5.4

type PositionEnum string
const (
	PositionEnumHub            PositionEnum = "HUB"
	PositionEnumWorkerLocation PositionEnum = "WORKER_LOCATION"
	PositionEnumWorkerAddress  PositionEnum = "WORKER_ADDRESS"
)

type Recipient

type Recipient struct {
	ID                   string     `json:"id"`
	TimeCreated          int64      `json:"timeCreated"`
	TimeLastModified     int64      `json:"timeLastModified"`
	Metadata             []Metadata `json:"metadata"`
	Name                 string     `json:"name"`
	Notes                string     `json:"notes"`
	Organization         string     `json:"organization"`
	Phone                string     `json:"phone"`
	SkipSmsNotifications bool       `json:"skipSMSNotifications"`
}

type RecipientCreateParams

type RecipientCreateParams struct {
	Metadata                  []Metadata `json:"metadata,omitempty"`
	Name                      string     `json:"name,omitempty"`
	Notes                     string     `json:"notes,omitempty"`
	Phone                     string     `json:"phone,omitempty"`
	SkipPhoneNumberValidation bool       `json:"skipPhoneNumberValidation,omitempty"`
	SkipSmsNotifications      bool       `json:"skipSMSNotifications,omitempty"`
	UseLongCodeForText        bool       `json:"useLongCodeForText,omitempty"`
}

type RecipientQueryKey

type RecipientQueryKey string
const (
	RecipientQueryKeyName  RecipientQueryKey = "name"
	RecipientQueryKeyPhone RecipientQueryKey = "phone"
)

type RecipientUpdateParams

type RecipientUpdateParams struct {
	Metadata             []Metadata `json:"metadata,omitempty"`
	Name                 string     `json:"name,omitempty"`
	Notes                string     `json:"notes,omitempty"`
	SkipSmsNotifications bool       `json:"skipSMSNotifications,omitempty"`
}

type RequestError

type RequestError struct {
	// Code is error type e.g. "InvalidArgument"
	Code string `json:"code,omitempty"`
	// Message contains futher details about the error.
	Message RequestErrorMessage `json:"message"`
}

func (RequestError) Error

func (err RequestError) Error() string

type RequestErrorMessage

type RequestErrorMessage struct {
	Cause any `json:"cause,omitempty"`
	// Error is an internal error code.
	// It is different than the request status code.
	Error int `json:"error,omitempty"`
	// Message is the error messages / description
	Message string `json:"message,omitempty"`
	// RemoteAddress is remote ip
	RemoteAddress string `json:"remoteAddress,omitempty"`
	// Request is uuid associated with the request
	Request string `json:"request,omitempty"`
	// StatusCode only present on errors returned for batch task creation
	StatusCode int `json:"statusCode,omitempty"`
}

type RoutePlan added in v0.5.4

type RoutePlan struct {
	Id               string   `json:"id"`
	Name             string   `json:"name"`
	State            string   `json:"state"`
	Color            string   `json:"color"`
	Tasks            []string `json:"tasks"`
	Organization     string   `json:"organization"`
	Team             *string  `json:"team"`
	Worker           string   `json:"worker"`
	VehicleType      string   `json:"vehicleType"`
	StartTime        int64    `json:"startTime"`
	EndTime          *int64   `json:"endTime"`
	ActualStartTime  *int64   `json:"actualStartTime"`
	ActualEndTime    *int64   `json:"actualEndTime"`
	StartingHubId    *string  `json:"startingHubId"`
	EndingHubId      *string  `json:"endingHubId"`
	ShortId          string   `json:"shortId"`
	TimeCreated      int64    `json:"timeCreated"`
	TimeLastModified int64    `json:"timeLastModified"`
}

type RoutePlanAddTasksParams added in v0.5.4

type RoutePlanAddTasksParams struct {
	Tasks []string `json:"tasks"`
}

type RoutePlanListQueryParams added in v0.5.4

type RoutePlanListQueryParams struct {
	WorkerId        string `json:"workerId,omitempty"`
	StartTimeTo     int64  `json:"startTimeTo,omitempty"`
	StartTimeFrom   int64  `json:"startTimeFrom,omitempty"`
	CreatedTimeTo   int64  `json:"createdTimeTo,omitempty"`
	CreatedTimeFrom int64  `json:"createdTimeFrom,omitempty"`
	HasTasks        bool   `json:"hasTasks,omitempty"`
	Limit           int64  `json:"limit,omitempty"`
}

type RoutePlanParams added in v0.5.4

type RoutePlanParams struct {
	Name          string       `json:"name"`
	StartTime     int64        `json:"startTime"`
	TaskIds       []string     `json:"tasks,omitempty"`
	Color         string       `json:"color,omitempty"`
	VehicleType   string       `json:"vehicleType,omitempty"`
	Worker        string       `json:"worker,omitempty"`
	Team          string       `json:"team,omitempty"`
	StartAt       PositionEnum `json:"start,omitempty"`
	EndAt         PositionEnum `json:"end,omitempty"`
	StartingHubId string       `json:"startingHubId,omitempty"`
	EndingHubId   string       `json:"endingHubId,omitempty"`
	EndTime       int64        `json:"endTime,omitempty"`
	Timezone      string       `json:"timezone,omitempty"`
}

type RoutePlansPaginated added in v0.5.4

type RoutePlansPaginated struct {
	LastId     string      `json:"lastId,omitempty"`
	RoutePlans []RoutePlan `json:"routePlans"`
}

type Task

type Task struct {
	AdditionalQuantities     TaskAdditionalQuantities `json:"additionalQuantities"`
	Appearance               TaskAppearance           `json:"appearance"`
	Barcodes                 *TaskBarcodeContainer    `json:"barcodes,omitempty"`
	CompleteAfter            *int64                   `json:"completeAfter"`
	CompleteBefore           *int64                   `json:"completeBefore"`
	CompletionDetails        TaskCompletionDetails    `json:"completionDetails"`
	Container                *TaskContainer           `json:"container"`
	Creator                  string                   `json:"creator"`
	CustomFields             []CustomField            `json:"customFields"`
	DelayTime                *float64                 `json:"delayTime"`
	Dependencies             []string                 `json:"dependencies"`
	Destination              Destination              `json:"destination"`
	EstimatedArrivalTime     *int64                   `json:"estimatedArrivalTime"`
	EstimatedCompletionTime  *int64                   `json:"estimatedCompletionTime"`
	ETA                      *int64                   `json:"eta"`
	Executor                 string                   `json:"executor"`
	Feedback                 []any                    `json:"feedback"`
	ID                       string                   `json:"id"`
	Identity                 TaskIdentity             `json:"identity"`
	Merchant                 string                   `json:"merchant"`
	Metadata                 []Metadata               `json:"metadata"`
	Notes                    string                   `json:"notes"`
	Organization             string                   `json:"organization"`
	Overrides                TaskOverrides            `json:"overrides"`
	PickupTask               bool                     `json:"pickupTask"`
	Quantity                 float64                  `json:"quantity"`
	Recipients               []Recipient              `json:"recipients"`
	ScanOnlyRequiredBarcodes bool                     `json:"scanOnlyRequiredBarcodes"`
	ServiceTime              float64                  `json:"serviceTime"`
	ShortId                  string                   `json:"shortId"`
	// SourceTaskId only set on cloned tasks
	SourceTaskId     string    `json:"sourceTaskId,omitempty"`
	State            TaskState `json:"state"`
	TimeCreated      int64     `json:"timeCreated"`
	TimeLastModified int64     `json:"timeLastModified"`
	TrackingUrl      string    `json:"trackingURL"`
	TrackingViewed   bool      `json:"trackingViewed"`
	Worker           *string   `json:"worker"`
	RoutePlan        *string   `json:"routePlan"`
}

type TaskAdditionalQuantities

type TaskAdditionalQuantities struct {
	QuantityA float64 `json:"quantityA"`
	QuantityB float64 `json:"quantityB"`
	QuantityC float64 `json:"quantityC"`
}

type TaskAppearance

type TaskAppearance struct {
	TriangleColor *int `json:"triangleColor"`
}

type TaskAppearanceParam

type TaskAppearanceParam struct {
	TriangleColor int `json:"triangleColor"`
}

type TaskAutoAssignMode

type TaskAutoAssignMode string
const (
	TaskAutoAssignModeDistance TaskAutoAssignMode = "distance"
	TaskAutoAssignModeLoad     TaskAutoAssignMode = "load"
)

type TaskAutoAssignMultiOptionsParam

type TaskAutoAssignMultiOptionsParam struct {
	ConsiderDependencies         bool               `json:"considerDependencies,omitempty"`
	ExcludedWorkerIds            []string           `json:"excludedWorkerIds,omitempty"`
	MaxAssignedTaskCount         int                `json:"maxAssignedTaskCount,omitempty"`
	Mode                         TaskAutoAssignMode `json:"mode"`
	RestrictAutoAssignmentToTeam bool               `json:"restrictAutoAssignmentToTeam"`
	Teams                        []string           `json:"teams,omitempty"`
}

type TaskAutoAssignMultiParams

type TaskAutoAssignMultiParams struct {
	Tasks   []string                        `json:"tasks"`
	Options TaskAutoAssignMultiOptionsParam `json:"options"`
}

type TaskAutoAssignMultiResponse

type TaskAutoAssignMultiResponse struct {
	AssignedTasksCount int      `json:"assignedTasksCount"`
	AssignedTasks      []string `json:"assignedTasks"`
}

type TaskAutoAssignParam

type TaskAutoAssignParam struct {
	ConsiderDependencies bool               `json:"considerDependencies,omitempty"`
	ExcludedWorkerIds    []string           `json:"excludedWorkerIds,omitempty"`
	MaxAssignedTaskCount int                `json:"maxAssignedTaskCount,omitempty"`
	Mode                 TaskAutoAssignMode `json:"mode"`
	Team                 string             `json:"team,omitempty"`
}

type TaskBarcode

type TaskBarcode struct {
	BlockCompletion bool   `json:"blockCompletion"`
	Data            string `json:"data,omitempty"`
}

type TaskBarcodeContainer

type TaskBarcodeContainer struct {
	Captured []TaskCapturedBarcode `json:"captured"`
	Required []TaskBarcode         `json:"required"`
}

type TaskBatchCreateError

type TaskBatchCreateError struct {
	Error RequestErrorMessage `json:"error"`
	Task  TaskParams          `json:"task"`
}

type TaskBatchCreateErrorAsync added in v0.5.0

type TaskBatchCreateErrorAsync struct {
	StatusCode int        `json:"statusCode"`
	ErrorCode  int        `json:"errorCode"`
	Message    string     `json:"message"`
	Cause      string     `json:"cause"`
	TaskData   TaskParams `json:"taskData"`
}

type TaskBatchCreateParams

type TaskBatchCreateParams struct {
	Tasks []TaskParams `json:"tasks"`
}

type TaskBatchCreateResponse

type TaskBatchCreateResponse struct {
	Tasks  []Task                 `json:"tasks"`
	Errors []TaskBatchCreateError `json:"errors"`
}

type TaskBatchCreateResponseAsync added in v0.5.0

type TaskBatchCreateResponseAsync struct {
	JobID  string `json:"jobId"`
	Status string `json:"status"`
}

type TaskBatchStatusResponseAsync added in v0.5.0

type TaskBatchStatusResponseAsync struct {
	Status               string                      `json:"status"`
	Submitted            string                      `json:"submitted"`
	TasksReceived        int                         `json:"tasksReceived"`
	TasksCreated         int                         `json:"tasksCreated"`
	TasksErrored         int                         `json:"tasksErrored"`
	NewTasks             []Task                      `json:"newTasks"`
	NewTasksWithWarnings []Task                      `json:"newTasksWithWarnings"`
	FailedTasks          []TaskParams                `json:"failedTasks"`
	Errors               []TaskBatchCreateErrorAsync `json:"errors"`
}

type TaskCapturedBarcode

type TaskCapturedBarcode struct {
	Data         string              `json:"data"`
	ID           string              `json:"id"`
	Location     DestinationLocation `json:"location"`
	Symbology    string              `json:"symbology"`
	Time         int64               `json:"time"`
	WasRequested bool                `json:"wasRequested"`
}

type TaskCloneOverridesParam

type TaskCloneOverridesParam struct {
	CompleteAfter  int64 `json:"completeAfter,omitempty"`
	CompleteBefore int64 `json:"completeBefore,omitempty"`
	// Destination can string destination id or destination object onfleet.DestinationCreateParams
	Destination any        `json:"destination,omitempty"`
	Metadata    []Metadata `json:"metadata,omitempty"`
	Notes       string     `json:"notes,omitempty"`
	PickupTask  bool       `json:"pickupTask"`
	// Recipients can be slice of string recipient ids or recipient objects []onfleet.RecipientCreateParams
	Recipients  any     `json:"recipients,omitempty"`
	ServiceTime float64 `json:"serviceTime,omitempty"`
}

type TaskCloneParams

type TaskCloneParams struct {
	IncludeBarcodes     bool                     `json:"includeBarcodes"`
	IncludeDependencies bool                     `json:"includeDependencies"`
	IncludeMetadata     bool                     `json:"includeMetadata"`
	Overrides           *TaskCloneOverridesParam `json:"overrides,omitempty"`
}

type TaskCompletionDetails

type TaskCompletionDetails struct {
	Actions                []any                 `json:"actions"`
	Distance               float64               `json:"distance"`
	Events                 []TaskCompletionEvent `json:"events"`
	FailureNotes           string                `json:"failureNotes"`
	FailureReason          string                `json:"failureReason"`
	FirstLocation          DestinationLocation   `json:"firstLocation"`
	LastLocation           DestinationLocation   `json:"lastLocation"`
	Notes                  string                `json:"notes"`
	PhotoUploadId          *string               `json:"photoUploadId"`
	PhotoUploadIds         *[]string             `json:"photoUploadIds"`
	SignatureUploadId      *string               `json:"signatureUploadId"`
	Success                bool                  `json:"success"`
	Time                   *int64                `json:"time"`
	UnavailableAttachments []any                 `json:"unavailableAttachments"`
}

type TaskCompletionEvent

type TaskCompletionEvent struct {
	Location DestinationLocation `json:"location"`
	Name     string              `json:"name"`
	Time     int64               `json:"time"`
}

type TaskCompletionRequirementsParam

type TaskCompletionRequirementsParam struct {
	MinimumAge int  `json:"minimumAge,omitempty"`
	Notes      bool `json:"notes,omitempty"`
	Photo      bool `json:"photo,omitempty"`
	Signature  bool `json:"signature,omitempty"`
}

type TaskContainer

type TaskContainer struct {
	Organization string        `json:"organization,omitempty"`
	Team         string        `json:"team,omitempty"`
	Type         ContainerType `json:"type"`
	Worker       string        `json:"worker,omitempty"`
}

type TaskForceCompletionDetailsParam

type TaskForceCompletionDetailsParam struct {
	Success bool   `json:"success"`
	Notes   string `json:"notes,omitempty"`
}

type TaskForceCompletionParams

type TaskForceCompletionParams struct {
	CompletionDetails TaskForceCompletionDetailsParam `json:"completionDetails"`
}

type TaskIdentity

type TaskIdentity struct {
	Checksum        *any `json:"checksum"`
	FailedScanCount int  `json:"failedScanCount"`
}

type TaskListQueryParams added in v0.3.0

type TaskListQueryParams struct {
	// From is required
	From int64 `json:"from,omitempty,string"`
	To   int64 `json:"to,omitempty,string"`
	// Used for pagination
	LastId               string   `json:"lastId,omitempty"`
	Worker               string   `json:"worker,omitempty"`
	CompleteBeforeBefore int64    `json:"completeBeforeBefore,omitempty,string"`
	CompleteAfterAfter   int64    `json:"completeAfterAfter,omitempty,string"`
	Dependencies         []string `json:"dependencies,omitempty"`
}

type TaskOverrides

type TaskOverrides struct {
	RecipientName                 *string `json:"recipientName"`
	RecipientNotes                *string `json:"recipientNotes"`
	RecipientSkipSmsNotifications *bool   `json:"recipientSkipSMSNotifications"`
	UseMerchantForProxy           *string `json:"useMerchantForProxy"`
}

type TaskParams

type TaskParams struct {
	Appearance     *TaskAppearanceParam `json:"appearance,omitempty"`
	AutoAssign     *TaskAutoAssignParam `json:"autoAssign,omitempty"`
	Barcodes       []TaskBarcode        `json:"barcodes,omitempty"`
	CompleteAfter  int64                `json:"completeAfter,omitempty"`
	CompleteBefore int64                `json:"completeBefore,omitempty"`
	Container      *TaskContainer       `json:"container,omitempty"`
	CustomFields   []CustomFieldParams  `json:"customFields,omitempty"`
	Dependencies   []string             `json:"dependencies,omitempty"`
	// Destination can string destination id or destination object onfleet.DestinationCreateParams
	Destination    any        `json:"destination,omitempty"`
	Executor       string     `json:"executor,omitempty"`
	Merchant       string     `json:"merchant,omitempty"`
	Metadata       []Metadata `json:"metadata,omitempty"`
	Notes          string     `json:"notes,omitempty"`
	PickupTask     bool       `json:"pickupTask"`
	Quantity       float64    `json:"quantity,omitempty"`
	RecipientName  string     `json:"recipientName,omitempty"`
	RecipientNotes string     `json:"recipientNotes,omitempty"`
	// Recipients can be slice of string recipient ids or recipient objects []onfleet.RecipientCreateParams
	Recipients                    any                              `json:"recipients,omitempty"`
	RecipientSkipSmsNotifications bool                             `json:"recipientSkipSMSNotifications,omitempty"`
	Requirements                  *TaskCompletionRequirementsParam `json:"requirements,omitempty"`
	ScanOnlyRequiredBarcodes      bool                             `json:"scanOnlyRequiredBarcodes,omitempty"`
	ServiceTime                   float64                          `json:"serviceTime,omitempty"`
	UseMerchantForProxy           bool                             `json:"useMerchantForProxy,omitempty"`
}

type TaskState

type TaskState int
const (
	TaskStateUnassigned TaskState = 0
	TaskStateAssigned   TaskState = 1
	TaskStateActive     TaskState = 2
	TaskStateCompleted  TaskState = 3
)

type TasksPaginated added in v0.3.0

type TasksPaginated struct {
	LastId string `json:"lastId,omitempty"`
	Tasks  []Task `json:"tasks"`
}

type Team

type Team struct {
	EnableSelfAssignment bool     `json:"enableSelfAssignment"`
	Hub                  *string  `json:"hub"`
	ID                   string   `json:"id"`
	Managers             []string `json:"managers"`
	Name                 string   `json:"name"`
	Tasks                []string `json:"tasks"`
	TimeCreated          int64    `json:"timeCreated"`
	TimeLastModified     int64    `json:"timeLastModified"`
	Workers              []string `json:"workers"`
}

type TeamAutoDispatch

type TeamAutoDispatch struct {
	DispatchId string `json:"dispatchId"`
}

type TeamAutoDispatchParams

type TeamAutoDispatchParams struct {
	MaxAllowedDelay    int     `json:"maxAllowedDelay,omitempty"`
	MaxTasksPerRoute   int     `json:"maxTasksPerRoute,omitempty"`
	RouteEnd           string  `json:"routeEnd,omitempty"`
	ScheduleTimeWindow []int64 `json:"scheduleTimeWindow,omitempty"`
	ServiceTime        int     `json:"serviceTime,omitempty"`
	TaskTimeWindow     []int64 `json:"taskTimeWindow,omitempty"`
}

type TeamCreateParams

type TeamCreateParams struct {
	EnableSelfAssignment bool     `json:"enableSelfAssignment"`
	Hub                  string   `json:"hub,omitempty"`
	Managers             []string `json:"managers"`
	Name                 string   `json:"name"`
	Workers              []string `json:"workers"`
}

type TeamTasks

type TeamTasks struct {
	LastId string `json:"lastId,omitempty"`
	Tasks  []Task `json:"tasks"`
}

type TeamTasksListQueryParams

type TeamTasksListQueryParams struct {
	From int64 `json:"from,omitempty,string"`
	// IsPickupTask is a boolean represented as a string.
	//
	// E.g. "true" or "false".
	//
	// Set to empty string "" if both dropoff and pickup tasks should be returned.
	IsPickupTask string `json:"isPickupTask,omitempty"`
	LastId       string `json:"lastId,omitempty"`
	To           int64  `json:"to,omitempty,string"`
}

type TeamUpdateParams

type TeamUpdateParams struct {
	EnableSelfAssignment bool     `json:"enableSelfAssignment"`
	Hub                  string   `json:"hub,omitempty"`
	Managers             []string `json:"managers"`
	Name                 string   `json:"name"`
	Workers              []string `json:"workers"`
}

type TeamWorkerEta

type TeamWorkerEta struct {
	Steps    []TeamWorkerEtaStep `json:"steps"`
	Vehicle  WorkerVehicleType   `json:"vehicle"`
	WorkerId string              `json:"workerId"`
}

type TeamWorkerEtaQueryParams

type TeamWorkerEtaQueryParams struct {
	DropoffLocation         string            `json:"dropoffLocation,omitempty"`
	PickupLocation          string            `json:"pickupLocation,omitempty"`
	PickupTime              int64             `json:"pickupTime,omitempty,string"`
	RestrictedVehiclesTypes WorkerVehicleType `json:"restrictedVehiclesTypes,omitempty"`
	ServiceTime             float64           `json:"serviceTime,omitempty,string"`
}

type TeamWorkerEtaStep

type TeamWorkerEtaStep struct {
	CompletionTime int64               `json:"completionTime"`
	Distance       float64             `json:"distance"`
	Location       DestinationLocation `json:"location"`
	ServiceTime    float64             `json:"serviceTime"`
	TravelTime     float64             `json:"travelTime"`
}

type TooManyRequestsError added in v0.5.3

type TooManyRequestsError struct {
}

func (TooManyRequestsError) Error added in v0.5.3

func (err TooManyRequestsError) Error() string

type TurnByTurn added in v0.5.1

type TurnByTurn struct {
	DrivingDistance string   `json:"driving_distance"`
	EndAddress      string   `json:"end_address"`
	ETA             int64    `json:"eta"`
	StartAddress    string   `json:"start_address"`
	Steps           []string `json:"steps"`
}

type Webhook

type Webhook struct {
	Count     int64   `json:"count"`
	ID        string  `json:"id"`
	IsEnabled bool    `json:"isEnabled"`
	Name      string  `json:"name"`
	Threshold float64 `json:"threshold,omitempty"`
	Trigger   int     `json:"trigger"`
	Url       string  `json:"url"`
}

type WebhookCreateParams

type WebhookCreateParams struct {
	Name      string  `json:"name"`
	Threshold float64 `json:"threshold,omitempty"`
	Trigger   int     `json:"trigger"`
	Url       string  `json:"url"`
}

type Worker

type Worker struct {
	AccountStatus                   WorkerAccountStatus        `json:"accountStatus"`
	ActiveTask                      *string                    `json:"activeTask"`
	AdditionalCapacities            WorkerAdditionalCapacities `json:"additionalCapacities"`
	Addresses                       *WorkerAddresses           `json:"addresses,omitempty"`
	Analytics                       *WorkerAnalytics           `json:"analytics,omitempty"`
	Capacity                        float64                    `json:"capacity"`
	DelayTime                       *float64                   `json:"delayTime"`
	DisplayName                     *string                    `json:"displayName"`
	HasRecentlyUsedSpoofedLocations bool                       `json:"hasRecentlyUsedSpoofedLocations"`
	ID                              string                     `json:"id"`
	ImageUrl                        *string                    `json:"imageUrl"`
	Location                        DestinationLocation        `json:"location"`
	Metadata                        []Metadata                 `json:"metadata"`
	Name                            string                     `json:"name"`
	OnDuty                          bool                       `json:"onDuty"`
	Organization                    string                     `json:"organization"`
	Phone                           string                     `json:"phone"`
	Tasks                           []string                   `json:"tasks"`
	Teams                           []string                   `json:"teams"`
	TimeCreated                     int64                      `json:"timeCreated"`
	TimeLastModified                int64                      `json:"timeLastModified"`
	TimeLastSeen                    int64                      `json:"timeLastSeen"`
	UserData                        WorkerUserData             `json:"userData"`
	Timezone                        *string                    `json:"timezone"`
	Vehicle                         *WorkerVehicle             `json:"vehicle"`
}

type WorkerAccountStatus

type WorkerAccountStatus string
const (
	WorkerAccountStatusAccepted WorkerAccountStatus = "ACCEPTED"
	WorkerAccountStatusInvited  WorkerAccountStatus = "INVITED"
)

type WorkerAdditionalCapacities

type WorkerAdditionalCapacities struct {
	CapacityA float64 `json:"capacityA"`
	CapacityB float64 `json:"capacityB"`
	CapacityC float64 `json:"capacityC"`
}

type WorkerAddressRoutingParam

type WorkerAddressRoutingParam struct {
	Routing string `json:"routing"`
}

type WorkerAddresses

type WorkerAddresses struct {
	Routing *WorkerAddressesRouting `json:"routing"`
}

type WorkerAddressesRouting

type WorkerAddressesRouting struct {
	Address           DestinationAddress  `json:"address"`
	CreatedByLocation bool                `json:"createdByLocation"`
	GooglePlaceId     string              `json:"googlePlaceId"`
	ID                string              `json:"id"`
	Location          DestinationLocation `json:"location"`
	Notes             string              `json:"notes"`
	Organization      string              `json:"organization"`
	TimeCreated       int64               `json:"timeCreated"`
	TimeLastModified  int64               `json:"timeLastModified"`
	WasGeocoded       bool                `json:"wasGeocoded"`
}

type WorkerAnalytics

type WorkerAnalytics struct {
	Distances  WorkerAnalyticsDistances  `json:"distances"`
	Events     []WorkerAnalyticsEvent    `json:"events"`
	TaskCounts WorkerAnalyticsTaskCounts `json:"taskCounts"`
	Times      WorkerAnalyticsTimes      `json:"times"`
}

type WorkerAnalyticsDistances

type WorkerAnalyticsDistances struct {
	Enroute float64 `json:"enroute"`
	Idle    float64 `json:"idle"`
}

type WorkerAnalyticsEvent

type WorkerAnalyticsEvent struct {
	Action string `json:"action"`
	Time   int64  `json:"time"`
}

type WorkerAnalyticsTaskCounts

type WorkerAnalyticsTaskCounts struct {
	Failed    int `json:"failed"`
	Succeeded int `json:"succeeded"`
}

type WorkerAnalyticsTimes

type WorkerAnalyticsTimes struct {
	Enroute float64 `json:"enroute"`
	Idle    float64 `json:"idle"`
}

type WorkerCreateParams

type WorkerCreateParams struct {
	Addresses   *WorkerAddressRoutingParam `json:"addresses,omitempty"`
	Capacity    float64                    `json:"capacity,omitempty"`
	DisplayName string                     `json:"displayName,omitempty"`
	Metadata    []Metadata                 `json:"metadata,omitempty"`
	Name        string                     `json:"name"`
	Phone       string                     `json:"phone"`
	Teams       []string                   `json:"teams"`
	Vehicle     *WorkerVehicleParam        `json:"vehicle,omitempty"`
}

type WorkerGetQueryParams

type WorkerGetQueryParams struct {
	Analytics bool   `json:"analytics,omitempty"`
	Filter    string `json:"filter,omitempty"`
	From      int64  `json:"from,omitempty,string"`
	To        int64  `json:"to,omitempty,string"`
}

type WorkerListQueryParams

type WorkerListQueryParams struct {
	Filter string `json:"filter,omitempty"`
	Phones string `json:"phones,omitempty"`
	States string `json:"states,omitempty"`
	Teams  string `json:"teams,omitempty"`
}

type WorkerSchedule

type WorkerSchedule struct {
	Date     string    `json:"date"`
	Shifts   [][]int64 `json:"shifts"`
	Timezone string    `json:"timezone"`
}

type WorkerScheduleEntries

type WorkerScheduleEntries struct {
	Entries []WorkerSchedule `json:"entries"`
}

type WorkerTasks

type WorkerTasks struct {
	LastId string `json:"lastId,omitempty"`
	Tasks  []Task `json:"tasks"`
}

type WorkerTasksListQueryParams

type WorkerTasksListQueryParams struct {
	From int64 `json:"from,omitempty,string"`
	// IsPickupTask is a boolean represented as a string.
	//
	// E.g. "true" or "false".
	//
	// Set to empty string "" if both dropoff and pickup tasks should be returned.
	IsPickupTask string `json:"isPickupTask,omitempty"`
	LastId       string `json:"lastId,omitempty"`
	To           int64  `json:"to,omitempty,string"`
}

type WorkerUpdateParams

type WorkerUpdateParams struct {
	Addresses   *WorkerAddressRoutingParam `json:"addresses,omitempty"`
	Capacity    float64                    `json:"capacity,omitempty"`
	DisplayName string                     `json:"displayName,omitempty"`
	Metadata    []Metadata                 `json:"metadata,omitempty"`
	Name        string                     `json:"name,omitempty"`
	Teams       []string                   `json:"teams,omitempty"`
	Vehicle     *WorkerVehicleParam        `json:"vehicle,omitempty"`
}

type WorkerUserData

type WorkerUserData struct {
	AppVersion        string  `json:"appVersion,omitempty"`
	BatteryLevel      float32 `json:"batteryLevel,omitempty"`
	DeviceDescription string  `json:"deviceDescription,omitempty"`
	Platform          string  `json:"platform,omitempty"`
}

type WorkerVehicle

type WorkerVehicle struct {
	Color            *string           `json:"color"`
	Description      *string           `json:"description"`
	ID               string            `json:"id"`
	LicensePlate     *string           `json:"licensePlate"`
	TimeLastModified int64             `json:"timeLastModified"`
	Type             WorkerVehicleType `json:"type"`
}

type WorkerVehicleParam

type WorkerVehicleParam struct {
	Color        string            `json:"color,omitempty"`
	Description  string            `json:"description,omitempty"`
	LicensePlate string            `json:"licensePlate,omitempty"`
	Type         WorkerVehicleType `json:"type,omitempty"`
}

type WorkerVehicleType

type WorkerVehicleType string
const (
	WorkerVehicleTypeCar        WorkerVehicleType = "CAR"
	WorkerVehicleTypeBicycle    WorkerVehicleType = "BICYCLE"
	WorkerVehicleTypeMotorcycle WorkerVehicleType = "MOTORCYCLE"
	WorkerVehicleTypeTruck      WorkerVehicleType = "TRUCK"
)

type WorkersByLocation

type WorkersByLocation struct {
	Workers []Worker `json:"workers"`
}

type WorkersByLocationListQueryParams

type WorkersByLocationListQueryParams struct {
	Longitude float64 `json:"longitude,string"`
	Latitude  float64 `json:"latitude,string"`
	Radius    float64 `json:"radius,omitempty,string"`
}

Jump to

Keyboard shortcuts

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