Documentation
¶
Index ¶
- Constants
- type Attributes
- type Client
- func (c *Client) GetServiceDefinition(code string) (ServiceDefinition, error)
- func (c *Client) GetServiceRequest(id string) (ServiceRequestResponse, error)
- func (c *Client) GetServiceRequestID(token string) (string, error)
- func (c *Client) GetServiceRequests(opts ServiceRequestOpts) ([]ServiceRequestResponse, error)
- func (c *Client) PostServiceRequest(code string, reqType int, req ServiceRequest) (ServiceRequestCreation, error)
- type KeyValue
- type Location
- type Service
- type ServiceDefinition
- type ServiceRequest
- type ServiceRequestCreation
- type ServiceRequestID
- type ServiceRequestOpts
- type ServiceRequestResponse
Constants ¶
const ( Poop = iota Needles Garbage )
ReqType is a required attribute for creating a service request
const Cleanup = "518d5892601827e3880000c5"
Cleanup is the service code for cleaning things in SF
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Attributes ¶
type Attributes struct {
Variable bool `json:"variable"`
Code string `json:"code"`
DataType string `json:"datatype"`
Required bool `json:"required"`
DataTypeDescription string `json:"string"`
Order int `json:"order"`
Description string `json:"description"`
Values []KeyValue `json:"values"`
}
Attributes are the metadata of a service
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is used for communicating with an Open311 API
func (*Client) GetServiceDefinition ¶
func (c *Client) GetServiceDefinition(code string) (ServiceDefinition, error)
GetServiceDefinition returns details about a type of service request This call is only necessary if the Service selected has metadata set as true from the GET Services response
func (*Client) GetServiceRequest ¶
func (c *Client) GetServiceRequest(id string) (ServiceRequestResponse, error)
GetServiceRequest returns details for a specific service request
func (*Client) GetServiceRequestID ¶
GetServiceRequestID returns a service request ID given a token XXX SF311 uses the token as the request ID XXX this endpoint does not return the correct format http://wiki.open311.org/GeoReport_v2/#get-service_request_id-from-a-token
func (*Client) GetServiceRequests ¶
func (c *Client) GetServiceRequests(opts ServiceRequestOpts) ([]ServiceRequestResponse, error)
GetServiceRequests returns all service requests in the jurisdiction's database
func (*Client) PostServiceRequest ¶
func (c *Client) PostServiceRequest(code string, reqType int, req ServiceRequest) (ServiceRequestCreation, error)
PostServiceRequest creates a new service request loc is lat/long or address_string or address_id attr is an array of key/values
type Location ¶
type Location struct {
Lat float64 `json:"lat"`
Long float64 `json:"long"`
Address string `json:"address_string"`
AddressID string `json:"address_id"`
}
Location is the location for a service request. Either: Lat/Long or Address or AddressID is required.
type Service ¶
type Service struct {
ServiceCode string `json:"service_code"`
ServiceName string `json:"service_name"`
Description string `json:"description"`
Metadata bool `json:"metadata"`
Type string `json:"type"`
Keywords []string `json:"keywords"`
Group string `json:"group"`
}
Service are categories that requests can be submitted to
type ServiceDefinition ¶
type ServiceDefinition struct {
ServiceCode string `json:"service_code"`
Definition []Attributes `json:"attributes"`
}
ServiceDefinition describes a service's metadata
type ServiceRequest ¶
type ServiceRequest struct {
Lat float64 `json:"lat" url:"lat,omitempty"`
Long float64 `json:"long" url:"long,omitempty"`
Address string `json:"address_string" url:"address_string,omitempty"`
AddressID string `json:"address_id" url:"address_id,omitempty"`
Email string `json:"email" url:"email"`
DeviceID string `json:"device_id" url:"device_id"`
AccountID string `json:"account_id" url:"account_id"`
FirstName string `json:"first_name" url:"first_name"`
LastName string `json:"last_name" url:"last_name"`
Phone string `json:"phone" url:"phone"`
Description string `json:"description" url:"description"`
MediaURL string `json:"media_url" url:"media_url"`
}
ServiceRequest is used to create a new service request
type ServiceRequestCreation ¶
type ServiceRequestCreation struct {
ID string `json:"service_request_id"`
Token string `json:"token"`
ServiceNotice string `json:"service_notice"`
AccountID string `json:"account_id"`
}
ServiceRequestCreation contains the response for a service request
type ServiceRequestID ¶
ServiceRequestID is returned when looking up with a token
type ServiceRequestOpts ¶
type ServiceRequestOpts struct {
ServiceRequestID string `json:"service_request_id"`
ServiceCode string `json:"service_code"`
StartDate time.Time `json:"start_date"`
EndData time.Time `json:"end_date"`
Status string `json:"status"`
}
ServiceRequestOpts contains optional arguments when getting service requests
type ServiceRequestResponse ¶
type ServiceRequestResponse struct {
ServiceRequestID string `json:"service_request_id"`
Status string `json:"status"`
StatusNotes string `json:"status_notes"`
ServiceName string `json:"service_name"`
ServiceCode string `json:"service_code"`
Description string `json:"description"`
AgencyResponsible string `json:"agency_responsible"`
ServiceNotice string `json:"service_notice"`
RequestedTime time.Time `json:"requested_datetime"`
UpdateTime time.Time `json:"updated_datetime"`
ExpectedTime time.Time `json:"expected_datetime"`
Zipcode string `json:"zipcode"`
Location
}
ServiceRequestResponse is returned after opening a service request