events

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("EVENTS POLL REQUEST RETURNED NOT FOUND")
View Source
var ErrReqLimitExceeded = errors.New("EVENTS POLL REQUEST LIMIT EXCEEDED")

ErrReqLimitExceeded API query limit exceeded

View Source
var ErrUnauthorized = errors.New("Unauthorized request")

ErrUnauthorized api error

View Source
var ValidEventsByCodeName = map[string]string{
	"COL": "PLACED",
	"REC": "INTEGRATED",
	"CFM": "CONFIRMED",
	"CAR": "CANCELLATION_REQUESTED",
	"CAF": "CANCELLATION_REQUEST_FAILED",
	"CAN": "CANCELLED",
	"DRE": "GOING_TO_ORIGIN",
	"NRE": "ARRIVED_AT_ORIGIN",
	"RTD": "READY_TO_DELIVER",
	"CLT": "COLLECTED",
	"DCL": "DISPATCHED",
	"NCL": "DELIVERED",
	"CON": "CONCLUDED",
	"PAA": "PICKUP_AREA_ASSIGNED",
	"DNO": "DELAY_NOTIFICATION",
	"CPT": "CHANGE_PREPARATION_TIME",
	"RDA": "REQUEST_DRIVER_AVAILABILITY",
	"RDR": "REQUEST_DRIVER",
	"RDS": "REQUEST_DRIVER_SUCCESS",
	"RDF": "REQUEST_DRIVER_FAILED",
	"ADR": "ASSIGN_DRIVER",
	"CCR": "CONSUMER_CANCELLATION_REQUESTED",
	"CCA": "CONSUMER_CANCELLATION_ACCEPTED",
	"CCD": "CONSUMER_CANCELLATION_DENIED",
	"ATG": "ADDED_TO_GROUP",
	"EWG": "EXECUTED_WITH_GROUP",
	"CWG": "CANCELLED_WITH_GROUP",
	"CIG": "COLLECTED_IN_GROUP",
	"AWG": "ASSIGNED_WITH_GROUP",
	"UPR": "UPDATE_REQUESTED",
	"UPD": "UPDATE_DENIED",
	"UPT": "UPDATED",
	"BOA": "BOX_ASSIGNED",
	"RPS": "RECOMMENDED_PREPARATION_START",
}

ValidEventsByCodeName API events by code:name

View Source
var ValidEventsByNameCode = map[string]string{
	"PLACED":                          "COL",
	"INTEGRATED":                      "REC",
	"CONFIRMED":                       "CFM",
	"CANCELLATION_REQUESTED":          "CAR",
	"CANCELLATION_REQUEST_FAILED":     "CAF",
	"CANCELLED":                       "CAN",
	"GOING_TO_ORIGIN":                 "DRE",
	"ARRIVED_AT_ORIGIN":               "NRE",
	"READY_TO_DELIVER":                "RTD",
	"COLLECTED":                       "CLT",
	"DISPATCHED":                      "DCL",
	"DELIVERED":                       "NCL",
	"CONCLUDED":                       "CON",
	"PICKUP_AREA_ASSIGNED":            "PAA",
	"DELAY_NOTIFICATION":              "DNO",
	"CHANGE_PREPARATION_TIME":         "CPT",
	"REQUEST_DRIVER_AVAILABILITY":     "RDA",
	"REQUEST_DRIVER":                  "RDR",
	"REQUEST_DRIVER_SUCCESS":          "RDS",
	"REQUEST_DRIVER_FAILED":           "RDF",
	"ASSIGN_DRIVER":                   "ADR",
	"CONSUMER_CANCELLATION_REQUESTED": "CCR",
	"CONSUMER_CANCELLATION_ACCEPTED":  "CCA",
	"CONSUMER_CANCELLATION_DENIED":    "CCD",
	"ADDED_TO_GROUP":                  "ATG",
	"EXECUTED_WITH_GROUP":             "EWG",
	"CANCELLED_WITH_GROUP":            "CWG",
	"COLLECTED_IN_GROUP":              "CIG",
	"ASSIGNED_WITH_GROUP":             "AWG",
	"UPDATE_REQUESTED":                "UPR",
	"UPDATE_DENIED":                   "UPD",
	"UPDATED":                         "UPT",
	"BOX_ASSIGNED":                    "BOA",
	"RECOMMENDED_PREPARATION_START":   "RPS",
}

ValidEventsByNameCode API events by name:code

Functions

This section is empty.

Types

type APIError added in v1.1.1

type APIError struct {
	Code    string        `json:"code"`
	Field   string        `json:"field"`
	Details []interface{} `json:"details"`
	Message string        `json:"message"`
}

type ErrV2API added in v1.1.1

type ErrV2API struct {
	Error APIError `json:"error"`
}

type Event

type Event struct {
	Code          string                 `json:"code"`
	CorrelationID string                 `json:"correlationId"`
	CreatedAt     time.Time              `json:"createdAt"`
	ID            string                 `json:"id,omitempty"`
	Metadata      map[string]interface{} `json:"metadata,omitempty"`
}

Event returned by the API

type Events

type Events []Event

Events is a group of Event

type Service

type Service interface {
	Poll() ([]Event, error)
	V2Poll() (ml []V2Event, err error)
	Acknowledge([]Event) (err error)
	V2Acknowledge([]V2Event) (err error)
}

Service describes the event abstraction

func New

func New(adapter adapters.Http, authService auth.Service, v2 bool) Service

New returns the event service implementation

type V2Event added in v1.1.1

type V2Event struct {
	Createdat time.Time              `json:"createdAt"`
	Fullcode  string                 `json:"fullCode"`
	Metadata  map[string]interface{} `json:"metadata"`
	Code      string                 `json:"code"`
	Orderid   string                 `json:"orderId"`
	ID        string                 `json:"id"`
}

type V2Events added in v1.1.1

type V2Events []V2Event

V2Events is a group of Event

Jump to

Keyboard shortcuts

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