onfleet

package
v1.0.11 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Float64

func Float64(f float64) *float64

Types

type Address

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

type Admin added in v1.0.6

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

type AdminServiceInterface added in v1.0.8

type AdminServiceInterface interface {
	List(ctx context.Context) ([]Admin, error)
}

type AdminsService added in v1.0.6

type AdminsService service

func (*AdminsService) List added in v1.0.6

func (s *AdminsService) List(ctx context.Context) ([]Admin, error)

type Client

type Client struct {
	// contains filtered or unexported fields
}

func (*Client) Admins added in v1.0.7

func (c *Client) Admins() AdminServiceInterface

func (*Client) Do

func (c *Client) Do(ctx context.Context, req *http.Request, v interface{}) error

func (*Client) Hubs

func (c *Client) Hubs() HubsServiceInterface

func (*Client) Init added in v1.0.8

func (c *Client) Init(apiKey string)

func (*Client) NewRequest

func (c *Client) NewRequest(method string, path string, body interface{}) (*http.Request, error)

func (*Client) Organization

func (c *Client) Organization() OrganizationServiceInterface

func (*Client) Tasks added in v0.3.0

func (c *Client) Tasks() TasksServiceInterface

func (*Client) Teams

func (c *Client) Teams() TeamServiceInterface

func (*Client) WithBaseURL

func (c *Client) WithBaseURL(baseURL string)

func (*Client) Workers

func (c *Client) Workers() WorkersServiceInterface

type ClientInterface added in v1.0.8

type ClientInterface interface {
	Init(apiKey string)
	WithBaseURL(baseURL string)
	NewRequest(method string, path string, body interface{}) (*http.Request, error)
	Do(ctx context.Context, req *http.Request, v interface{}) error
	Organization() OrganizationServiceInterface
	Workers() WorkersServiceInterface
	Hubs() HubsServiceInterface
	Teams() TeamServiceInterface
	Tasks() TasksServiceInterface
	Admins() AdminServiceInterface
}

type CompletionDetails added in v0.2.0

type CompletionDetails struct {
	Success       bool          `json:"success"`
	Notes         string        `json:"notes"`
	Events        []interface{} `json:"events"`
	Time          interface{}   `json:"time"`
	FailureReason string        `json:"failureReason"`
}

type Container added in v0.2.0

type Container struct {
	Type   string `json:"type"`
	Worker string `json:"worker"`
	Team   string `json:"team"`
}

type Destination added in v0.2.0

type Destination struct {
	Id               string        `json:"id"`
	TimeCreated      int64         `json:"timeCreated"`
	TimeLastModified int64         `json:"timeLastModified"`
	Address          Address       `json:"address"`
	Notes            string        `json:"notes"`
	Metadata         []interface{} `json:"metadata"`
}

type Hub

type Hub struct {
	Id       string    `json:"id"`
	Name     string    `json:"name"`
	Location []float64 `json:"location"`
	Address  Address   `json:"address"`
	Teams    []string  `json:"teams,omitempty"`
}

type HubsService

type HubsService service

func (*HubsService) List

func (s *HubsService) List(ctx context.Context) ([]Hub, error)

type HubsServiceInterface added in v1.0.8

type HubsServiceInterface interface {
	List(ctx context.Context) ([]Hub, error)
}

type Metadata added in v0.9.0

type Metadata struct {
	Name       string      `json:"name"`
	Type       string      `json:"type"`
	Value      interface{} `json:"value"`
	Visibility []string    `json:"visibility"`
}

type Organization

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

type OrganizationService

type OrganizationService service

func (*OrganizationService) Get

type OrganizationServiceInterface added in v1.0.8

type OrganizationServiceInterface interface {
	Get(ctx context.Context) (*Organization, error)
}

type Overrides added in v0.2.0

type Overrides struct {
	RecipientSkipSMSNotifications interface{} `json:"recipientSkipSMSNotifications"`
	RecipientNotes                interface{} `json:"recipientNotes"`
	RecipientName                 interface{} `json:"recipientName"`
}

type Recipients added in v0.2.0

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

type Task added in v0.2.0

type Task struct {
	Id                      string            `json:"id"`
	TimeCreated             int64             `json:"timeCreated"`
	TimeLastModified        int64             `json:"timeLastModified"`
	Organization            string            `json:"organization"`
	ShortID                 string            `json:"shortId"`
	TrackingURL             string            `json:"trackingURL"`
	Worker                  string            `json:"worker"`
	Merchant                string            `json:"merchant"`
	Executor                string            `json:"executor"`
	Creator                 string            `json:"creator"`
	Dependencies            []interface{}     `json:"dependencies"`
	State                   int               `json:"state"`
	CompleteAfter           int64             `json:"completeAfter"`
	CompleteBefore          interface{}       `json:"completeBefore"`
	PickupTask              bool              `json:"pickupTask"`
	Notes                   string            `json:"notes"`
	CompletionDetails       CompletionDetails `json:"completionDetails"`
	Feedback                []interface{}     `json:"feedback"`
	Metadata                []interface{}     `json:"metadata"`
	Overrides               Overrides         `json:"overrides"`
	Container               Container         `json:"container"`
	Recipients              []Recipients      `json:"recipients"`
	EstimatedCompletionTime int64             `json:"estimatedCompletionTime"`
	EstimatedArrivalTime    int64             `json:"estimatedArrivalTime"`
	Destination             Destination       `json:"destination"`
	DidAutoAssign           bool              `json:"didAutoAssign"`
}

type TaskCompletePayload added in v1.0.1

type TaskCompletePayload struct {
	CompletionDetails CompletionDetails `json:"completionDetails"`
}

type TaskCreatePayload added in v0.2.0

type TaskCreatePayload struct {
	Destination    *Destination  `json:"destination"`
	Recipients     []*Recipients `json:"recipients"`
	CompleteAfter  int64         `json:"completeAfter"`
	CompleteBefore int64         `json:"completeBefore"`
	Notes          string        `json:"notes"`
	Container      Container     `json:"container"`
	Metadata       []Metadata    `json:"metadata"`
	Quantity       int64         `json:"quantity"`
	ServiceTime    int64         `json:"serviceTime"`
}

type TaskError added in v0.3.0

type TaskError struct {
	StatusCode int    `json:"statusCode"`
	Error      int    `json:"error"`
	Message    string `json:"message"`
	Cause      string `json:"cause"`
}

type TaskUpdatePayload added in v0.4.0

type TaskUpdatePayload struct {
	Destination       *Destination      `json:"destination,omitempty"`
	Recipients        []*Recipients     `json:"recipients,omitempty"`
	CompleteAfter     int64             `json:"completeAfter,omitempty"`
	Notes             string            `json:"notes,omitempty"`
	Container         Container         `json:"container,omitempty"`
	CompletionDetails CompletionDetails `json:"completionDetails"`
	State             int               `json:"state"`
}

type TasksCreatePayload added in v0.2.0

type TasksCreatePayload struct {
	Tasks []TaskCreatePayload `json:"tasks"`
}

type TasksCreateReturn added in v0.3.0

type TasksCreateReturn struct {
	Tasks  []Task `json:"tasks"`
	Errors []struct {
		Error TaskError         `json:"error"`
		Task  TaskCreatePayload `json:"task"`
	} `json:"errors"`
}

type TasksListOptions added in v0.2.0

type TasksListOptions struct {
	From   int64            `url:"from"`
	States []TasksListState `url:"state,omitempty"`
	Worker string           `url:"worker,omitempty"`
}

type TasksListState added in v0.2.0

type TasksListState string
var (
	TasksListStateUnassigned TasksListState = "0"
	TasksListStateAssigned   TasksListState = "1"
	TasksListStateActive     TasksListState = "2"
	TasksListStateCompleted  TasksListState = "3"
)

type TasksService added in v0.2.0

type TasksService service

func (*TasksService) Complete added in v1.0.1

func (s *TasksService) Complete(ctx context.Context, taskId string, payload *TaskCompletePayload) (*Task, error)

func (*TasksService) Create added in v0.2.0

func (s *TasksService) Create(ctx context.Context, payload *TasksCreatePayload) ([]Task, error)

Create tasks https://docs.onfleet.com/reference#create-tasks-in-batch

func (*TasksService) Delete added in v1.0.3

func (s *TasksService) Delete(ctx context.Context, taskId string) (*Task, error)

Delete task https://docs.onfleet.com/reference/delete-task

func (*TasksService) Get added in v0.6.0

func (s *TasksService) Get(ctx context.Context, taskId string) (*Task, error)

Get task https://docs.onfleet.com/reference#get-single-task

func (*TasksService) List added in v0.2.0

func (s *TasksService) List(ctx context.Context, opts *TasksListOptions) ([]Task, error)

List all tasks https://docs.onfleet.com/reference#list-tasks

func (*TasksService) Update added in v0.4.0

func (s *TasksService) Update(ctx context.Context, taskId string, payload *TaskUpdatePayload) (*Task, error)

Update task https://docs.onfleet.com/reference#update-task

type TasksServiceInterface added in v1.0.8

type TasksServiceInterface interface {
	List(ctx context.Context, opts *TasksListOptions) ([]Task, error)
	Create(ctx context.Context, payload *TasksCreatePayload) ([]Task, error)
	Update(ctx context.Context, taskId string, payload *TaskUpdatePayload) (*Task, error)
	Complete(ctx context.Context, taskId string, payload *TaskCompletePayload) (*Task, error)
	Get(ctx context.Context, taskId string) (*Task, error)
	Delete(ctx context.Context, taskId string) (*Task, error)
}

type Team

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

type TeamService added in v1.0.8

type TeamService service

func (*TeamService) List added in v1.0.8

func (s *TeamService) List(ctx context.Context) ([]Team, error)

type TeamServiceInterface added in v1.0.8

type TeamServiceInterface interface {
	List(ctx context.Context) ([]Team, error)
}

type UserData

type UserData struct {
	Platform          string  `json:"platform"`
	DeviceDescription string  `json:"deviceDescription"`
	BatteryLevel      float64 `json:"batteryLevel"`
	AppVersion        string  `json:"appVersion"`
}

type Vehicle

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

type Worker

type Worker struct {
	Id               string    `json:"id"`
	TimeCreated      int64     `json:"timeCreated"`
	TimeLastModified int64     `json:"timeLastModified"`
	Organization     string    `json:"organization"`
	Name             string    `json:"name"`
	DisplayName      string    `json:"displayName"`
	Phone            string    `json:"phone"`
	ActiveTask       *string   `json:"activeTask"`
	Tasks            []string  `json:"tasks"`
	OnDuty           bool      `json:"onDuty"`
	IsResponding     bool      `json:"isResponding"`
	TimeLastSeen     *int64    `json:"timeLastSeen"`
	Capacity         int       `json:"capacity"`
	AccountStatus    string    `json:"accountStatus"`
	ImageUrl         *string   `json:"imageUrl"`
	Location         []float64 `json:"location"`
	DelayTime        *float64  `json:"delayTime"`
	Timezone         *string   `json:"timezone"`
	Teams            []string  `json:"teams"`
	UserData         UserData  `json:"userData"`
	Vehicle          *Vehicle  `json:"vehicle"`

	HasRecentlyUsedSpoofedLocations bool `json:"hasRecentlyUsedSpoofedLocations"`
}

type WorkersListOptions

type WorkersListOptions struct {
	Teams  []string           `url:"teams,omitempty"`
	States []WorkersListState `url:"states,omitempty"`
	Phones []string           `url:"phones,omitempty"`
}

type WorkersListState

type WorkersListState string
var (
	WorkersListStateOffDuty WorkersListState = "0"
	WorkersListStateIdle    WorkersListState = "1"
	WorkersListStateActive  WorkersListState = "2"
)

type WorkersLocationOptions

type WorkersLocationOptions struct {
	Longitude float64  `url:"longitude,omitempty"`
	Latitude  float64  `url:"latitude,omitempty"`
	Radius    *float64 `url:"radius,omitempty"`
}

type WorkersService

type WorkersService service

func (*WorkersService) Get added in v0.7.0

func (s *WorkersService) Get(ctx context.Context, workerId string) (*Worker, error)

Get worker https://docs.onfleet.com/reference#get-single-worker

func (*WorkersService) List

func (s *WorkersService) List(ctx context.Context, opts *WorkersListOptions) ([]Worker, error)

List list all workers https://docs.onfleet.com/reference#list-workers

func (*WorkersService) Location

func (s *WorkersService) Location(ctx context.Context, opts *WorkersLocationOptions) ([]Worker, error)

Location get workers by location https://docs.onfleet.com/reference#get-workers-by-location

type WorkersServiceInterface added in v1.0.8

type WorkersServiceInterface interface {
	List(ctx context.Context, opts *WorkersListOptions) ([]Worker, error)
	Location(ctx context.Context, opts *WorkersLocationOptions) ([]Worker, error)
	Get(ctx context.Context, workerId string) (*Worker, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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