structs

package
v0.0.0-...-58575ba Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2016 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MidAdpID

func MidAdpID(mid string) (string, error)

MidAdpID breaks down a MID, and returns the AdpID.

func MidAreaID

func MidAreaID(mid string) (string, error)

MidAreaID breaks down a MID, and returns the AreaID.

func MidID

func MidID(mid string) (int, error)

MidID breaks down an MID, and returns the Service ID.

func MidProviderID

func MidProviderID(mid string) (int, error)

MidProviderID breaks down an MID, and returns the ProviderID.

func RIDFromString

func RIDFromString(rids string) (ReportID, NRoute, error)

RIDFromString converts a reportID string to a new ReportID struct.

func RidAdpID

func RidAdpID(rid string) (string, error)

RidAdpID breaks down a RID, and returns the AdpID.

func RidAreaID

func RidAreaID(rid string) (string, error)

RidAreaID breaks down a RID, and returns the AreaID.

func RidID

func RidID(rid string) (int, error)

RidID breaks down an RID, and returns the Report ID.

func RidProviderID

func RidProviderID(rid string) (int, error)

RidProviderID breaks down an RID, and returns the ProviderID.

func SplitMID

func SplitMID(mid string) (string, string, int, int, error)

SplitMID breaks down an MID, and returns all subfields.

func SplitRID

func SplitRID(rid string) (string, string, int, int, error)

SplitRID breaks down an RID, and returns all subfields.

func SplitRMID

func SplitRMID(mid string) (string, string, int, int, error)

SplitRMID breaks down an MID or RID, and returns all subfields.

Types

type NCreateRequest

type NCreateRequest struct {
	NRequestCommon
	MID         ServiceID
	ServiceName string
	DeviceType  string
	DeviceModel string
	DeviceID    string
	Latitude    float64
	Longitude   float64
	FullAddress string
	Address     string
	Area        string
	State       string
	Zip         string
	FirstName   string
	LastName    string
	Email       string
	Phone       string
	IsAnonymous bool
	Description string
	MediaURL    string
}

NCreateRequest is used to create a new Report. It is the "native" format of the data, and is used by the Engine and all backend Adapters.

func (NCreateRequest) GetRoutes

func (r NCreateRequest) GetRoutes() NRoutes

GetRoutes returns the routing data.

func (NCreateRequest) String

func (r NCreateRequest) String() string

Displays the NCreateRequest custom type.

type NCreateResponse

type NCreateResponse struct {
	NResponseCommon `json:"-"`
	Message         string   `json:"Message" xml:"Message"`
	RID             ReportID `json:"ReportId" xml:"ReportId"`
	// ID              string `json:"ReportId" xml:"ReportId"`
	AccountID string `json:"AuthorId" xml:"AuthorId"`
}

NCreateResponse is the response to creating or updating a report.

func (NCreateResponse) String

func (r NCreateResponse) String() string

Displays the NCreateResponse custom type.

type NID

type NID struct {
	RqstID int64
	RPCID  int64
}

NID represents the full ID for any Normalized Request or Response.

func (NID) GetNID

func (r NID) GetNID() (int64, int64)

GetNID gets the NID.

func (*NID) SetNID

func (r *NID) SetNID(rqstID, rpcID int64)

SetNID sets the NID.

func (NID) String

func (r NID) String() string

String returns the string representation NID.

type NRequestCommon

type NRequestCommon struct {
	ID    NID
	Route NRoute
	Rtype NRequestType
	NRouter
	NRequester
}

NRequestCommon represents properties common to all requests.

func (NRequestCommon) GetID

func (r NRequestCommon) GetID() (int64, int64)

GetID returns the Request ID

func (NRequestCommon) GetIDS

func (r NRequestCommon) GetIDS() string

GetIDS returns the Request ID as a string

func (NRequestCommon) GetRoute

func (r NRequestCommon) GetRoute() NRoute

GetRoute returns NRequestCommon.Route

func (NRequestCommon) GetType

func (r NRequestCommon) GetType() NRequestType

GetType returns the Request Type as a string.

func (NRequestCommon) GetTypeS

func (r NRequestCommon) GetTypeS() string

GetTypeS returns the Request Type as a string.

func (*NRequestCommon) SetID

func (r *NRequestCommon) SetID(rqstID, rpcID int64)

SetID sets the Request ID

func (*NRequestCommon) SetRoute

func (r *NRequestCommon) SetRoute(route NRoute)

SetRoute sets the route in NRequestCommon.

func (NRequestCommon) String

func (r NRequestCommon) String() string

Displays the NRequestCommon custom type.

type NRequestType

type NRequestType int

NRequestType enumerates the valid request types.

const (
	NRTUnknown NRequestType = iota
	NRTServicesAll
	NRTServicesArea
	NRTCreate
	NRTSearchLL
	NRTSearchDID
	NRTSearchRID
)

NRT* are constants enumerating the valid request types.

func (NRequestType) String

func (i NRequestType) String() string

type NRequester

type NRequester interface {
	GetID() (int64, int64)
	GetIDS() string
	SetID(int64, int64)
	GetRoute() NRoute
	SetRoute(route NRoute)
	RouteType() NRouteType
	GetType() NRequestType
	GetTypeS() string
}

NRequester defines the behavior of a Request Package.

type NResponseCommon

type NResponseCommon struct {
	ID    NID
	Route NRoute
	Rtype NResponseType
	NResponser
}

NResponseCommon represents properties common to all requests.

func (NResponseCommon) GetID

func (r NResponseCommon) GetID() (int64, int64)

GetID returns the Request ID

func (NResponseCommon) GetIDS

func (r NResponseCommon) GetIDS() string

GetIDS returns the Request ID as a string

func (NResponseCommon) GetRoute

func (r NResponseCommon) GetRoute() NRoute

GetRoute returns NResponseCommon.Route

func (NResponseCommon) GetType

func (r NResponseCommon) GetType() NResponseType

GetType returns the Response Type as a string.

func (NResponseCommon) GetTypeS

func (r NResponseCommon) GetTypeS() string

GetTypeS returns the Response Type as a string.

func (*NResponseCommon) SetID

func (r *NResponseCommon) SetID(rqstID, rpcID int64)

SetID sets the Request ID

func (*NResponseCommon) SetIDF

func (r *NResponseCommon) SetIDF(f func() (int64, int64))

SetIDF sets the Request ID using the specified function.

func (*NResponseCommon) SetRoute

func (r *NResponseCommon) SetRoute(route NRoute)

SetRoute sets the route in NResponseCommon.

func (NResponseCommon) String

func (r NResponseCommon) String() string

Displays the NResponseCommon custom type.

type NResponseType

type NResponseType int

NResponseType enumerates the valid request types.

const (
	NRspTUnknown NResponseType = iota
	NRspTServices
	NRspTServicesArea
	NRspTCreate
	NRspTSearchLL
	NRspTSearchDID
	NRspTSearchRID
)

NRspT* are constants enumerating the valid request types.

func (NResponseType) String

func (i NResponseType) String() string

type NResponser

type NResponser interface {
	GetID() (int64, int64)
	GetIDS() string
	SetID(int64, int64)
	GetType() NResponseType
	GetTypeS() string
	GetRoute() NRoute
	SetRoute(route NRoute)
}

NResponser defines the behavior of a Response Package.

type NRoute

type NRoute struct {
	AdpID      string
	AreaID     string
	ProviderID int
}

NRoute represents the data needed to route requests to Adapters.

func NRouteFromString

func NRouteFromString(rids string) (NRoute, error)

NRouteFromString converts a reportID string to a new NRoute struct.

func (NRoute) RouteType

func (r NRoute) RouteType() NRouteType

RouteType returns the validity and type of the NRoute.

func (NRoute) SString

func (r NRoute) SString() string

SString displays a Route.

func (NRoute) String

func (r NRoute) String() string

String returns a short representation of a Route.

type NRouteType

type NRouteType int

NRouteType enumerates the valid route types.

const (
	NRtTypEmpty NRouteType = iota
	NRtTypInvalid
	NRtTypFull
	NRtTypArea
	NRtTypAllAreas
	NRtTypAllAdapters
)

NRT* are constants enumerating the valid request types.

func (NRouteType) String

func (r NRouteType) String() string

type NRouter

type NRouter interface {
	GetRoutes() NRoutes
}

NRouter is the interface to retrieve the routing data (AdpID, AreaID) from any N*Request.

type NRoutes

type NRoutes []NRoute

NRoutes represents a list of Routes for a request.

func NewNRoutes

func NewNRoutes() NRoutes

NewNRoutes returns a new instance of NRoutes.

func (NRoutes) String

func (r NRoutes) String() string

type NSearchRequestDID

type NSearchRequestDID struct {
	NRequestCommon
	DeviceType string
	DeviceID   string
	MaxResults int
	RouteList  NRoutes
	AreaID     string
}

NSearchRequestDID represents the Normal struct for a request to search for all Reports authored by the specified Device ID.

func (NSearchRequestDID) GetRoutes

func (r NSearchRequestDID) GetRoutes() NRoutes

GetRoutes returns the routing data.

func (NSearchRequestDID) String

func (r NSearchRequestDID) String() string

Displays the NSearchRequestDID custom type.

type NSearchRequestLL

type NSearchRequestLL struct {
	NRequestCommon
	Latitude   float64
	Longitude  float64
	Radius     int // in meters
	AreaID     string
	MaxResults int
}

NSearchRequestLL represents the Normal struct for a location based search request.

func (NSearchRequestLL) GetRoutes

func (r NSearchRequestLL) GetRoutes() NRoutes

GetRoutes returns the routing data.

func (NSearchRequestLL) String

func (r NSearchRequestLL) String() string

Displays the NSearchRequestLL custom type.

type NSearchRequestRID

type NSearchRequestRID struct {
	NRequestCommon
	RID       ReportID
	RouteList NRoutes
	AreaID    string
}

NSearchRequestRID represents the Normal struct for a request to find a single, specific Report.

func (NSearchRequestRID) GetRoutes

func (r NSearchRequestRID) GetRoutes() NRoutes

GetRoutes returns the routing data.

func (NSearchRequestRID) String

func (r NSearchRequestRID) String() string

Displays the NSearchRequestRID custom type.

type NSearchResponse

type NSearchResponse struct {
	NResponseCommon `json:"-"`
	Message         string
	ReportCount     int
	ResponseTime    string
	Reports         []NSearchResponseReport
}

NSearchResponse contains the search results.

func (NSearchResponse) String

func (r NSearchResponse) String() string

Displays the NSearchResponse custom type.

type NSearchResponseReport

type NSearchResponseReport struct {
	RID               ReportID `xml:"ID" json:"ID"`
	DateCreated       string
	DateUpdated       string
	DeviceType        string
	DeviceModel       string
	DeviceID          string
	RequestType       string
	RequestTypeID     string
	MediaURL          string
	City              string
	State             string
	ZipCode           string
	Latitude          string
	Longitude         string
	Directionality    string
	Description       string
	AuthorNameFirst   string
	AuthorNameLast    string
	AuthorEmail       string
	AuthorTelephone   string
	AuthorIsAnonymous string
	URLDetail         string
	URLShortened      string
	Votes             string
	StatusType        string
	TicketSLA         string
}

NSearchResponseReport represents a report.

func (*NSearchResponseReport) FullAddress

func (r *NSearchResponseReport) FullAddress() string

FullAddress returns the standard formatted full address.

func (NSearchResponseReport) String

func (r NSearchResponseReport) String() string

Displays the the NSearchResponseReport custom type.

type NService

type NService struct {
	ServiceID
	Name          string   `json:"name"`
	Description   string   `json:"description"`
	Metadata      bool     `json:"metadata"`
	ResponseType  string   `json:"responseType"`
	ServiceNotice string   `json:"service_notice"`
	Keywords      []string `json:"keywords"`
	Group         string   `json:"group"`
}

NService represents a Service. The ID is a combination of the BackEnd Type (AdpID), the AreaID (i.e. the Area id), ProviderID (in case the provider has multiple interfaces), and the Service ID.

func (NService) SString

func (s NService) SString() string

SString should be used to display one NService struct.

func (NService) String

func (s NService) String() string

Displays the NService custom type.

func (*NService) UnmarshalJSON

func (srv *NService) UnmarshalJSON(value []byte) error

UnmarshalJSON implements the conversion from the JSON "ID" to the ServiceID struct.

type NServiceRequest

type NServiceRequest struct {
	NRequestCommon
	Area string
}

NServiceRequest is used to get list of services available to the user.

func (NServiceRequest) GetRoutes

func (r NServiceRequest) GetRoutes() NRoutes

GetRoutes returns the routing data.

func (NServiceRequest) String

func (r NServiceRequest) String() string

Displays the NServiceRequest custom type.

type NServices

type NServices []NService

NServices contains a list of Services.

func (NServices) String

func (r NServices) String() string

Displays the NServices custom type.

type NServicesResponse

type NServicesResponse struct {
	NResponseCommon
	AdpID    string
	Message  string
	Services NServices
}

NServicesResponse is the returned struct for a Services request.

func (NServicesResponse) String

func (r NServicesResponse) String() string

Displays the NServicesResponse custom type.

type ReportID

type ReportID struct {
	NRoute
	ID string
}

ReportID adds routing information to a ReportID returned by a call to a Service Provider.

func NewRID

func NewRID(route NRoute, id string) ReportID

NewRID creates a ReportID by concatenating a Route (NRoute string) with a message response ID.

func (ReportID) RID

func (r ReportID) RID() string

RID creates the Master ID string for the Service.

func (ReportID) String

func (r ReportID) String() string

Display the string represenation of a ReportID.

type ServiceID

type ServiceID struct {
	AdpID      string
	AreaID     string
	ProviderID int
	ID         int
}

ServiceID provides the JSON marshalling conversion between the JSON "ID" and the Backend Interface Type, AreaID (Area id), ProviderID, and Service ID.

func (ServiceID) GetRoute

func (r ServiceID) GetRoute() NRoute

GetRoute returns the NRoute for the ServiceID.

func (ServiceID) MID

func (r ServiceID) MID() string

MID creates the Master ID string for the Service.

Jump to

Keyboard shortcuts

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