api

package
v0.0.23 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2026 License: AGPL-3.0 Imports: 52 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TYPE_STATUS = "status"
)

Functions

func AddRoutesRMO

func AddRoutesRMO(r *mux.Router)

func AddRoutesSync

func AddRoutesSync(r *mux.Router)

func GetVersionInfo

func GetVersionInfo() version.VersionInfo

func NewResponseServiceRequests

func NewResponseServiceRequests(requests []model.Servicerequest) []types.ServiceRequest

func SetEventChannel

func SetEventChannel(chan_envelopes <-chan platform.Envelope)

func SetVersionInfo

func SetVersionInfo(v version.VersionInfo)

Types

type Bounds

type Bounds struct {
	East  float64
	North float64
	South float64
	West  float64
}

func NewBounds

func NewBounds() Bounds

type ConnectionSSE

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

func (*ConnectionSSE) SendEvent

func (c *ConnectionSSE) SendEvent(w http.ResponseWriter, m platform.Event) error

func (*ConnectionSSE) SendHeartbeat

func (c *ConnectionSSE) SendHeartbeat(w http.ResponseWriter, t time.Time) error

type ErrorAPI

type ErrorAPI struct {
	Message string `json:"message"`
}

type FormEmail

type FormEmail struct {
	Body    string `schema:"emailBody"`
	From    string `schema:"emailFrom"`
	Subject string `schema:"emailSubject"`
	To      string `schema:"emailTo"`
}

type FormResetTextHistory

type FormResetTextHistory struct {
	E164 string `schema:"e164"`
}

type FormSMS

type FormSMS struct {
	Message string `schema:"smsMessage"`
	Phone   string `schema:"smsPhone"`
}

type FormSSE

type FormSSE struct {
	OrganizationID int32  `schema:"organizationID"`
	Resource       string `schema:"resource"`
	Type           string `schema:"type"`
	URIPath        string `schema:"uriPath"`
}

type H3Cell

type H3Cell uint64

type Message

type Message struct {
	Resource string    `json:"resource"`
	Time     time.Time `json:"time"`
	Type     string    `json:"type"`
	URI      string    `json:"uri"`
}

type NoteAudioBreadcrumbPayload

type NoteAudioBreadcrumbPayload struct {
	Cell             H3Cell    `json:"cell"`
	Created          time.Time `json:"created"`
	ManuallySelected bool      `json:"manuallySelected"`
}

type NoteAudioPayload

type NoteAudioPayload struct {
	UUID                    string                       `json:"uuid"`
	Breadcrumbs             []NoteAudioBreadcrumbPayload `json:"breadcrumbs"`
	Created                 time.Time                    `json:"created"`
	CreatorID               int                          `json:"creator_id"`
	Deleted                 *time.Time                   `json:"deleted"`
	DeletorID               *int32                       `json:"deletor_id"`
	Duration                float32                      `json:"duration"`
	Transcription           *string                      `json:"transcription"`
	TranscriptionUserEdited bool                         `json:"transcriptionUserEdited"`
	Version                 int32                        `json:"version"`
}

type NoteImagePayload

type NoteImagePayload struct {
	UUID      string     `json:"uuid"`
	Cell      H3Cell     `json:"cell"`
	Created   time.Time  `json:"created"`
	CreatorID int        `db:"creator_id"`
	Deleted   *time.Time `json:"deleted"`
	DeletorID *int32     `json:"deletor_id"`
	Version   int32      `json:"version"`
}

type OrganizationResponse

type OrganizationResponse struct {
	ID                        int32              `json:"id"`
	Name                      string             `json:"name"`
	Website                   *string            `json:"website"`
	GeneralManagerName        *string            `json:"generalManagerName"`
	OfficeAddressStreet       *string            `json:"officeAddressStreet"`
	OfficeAddressCity         *string            `json:"officeAddressCity"`
	OfficeAddressPostalCode   *string            `json:"officeAddressPostalCode"`
	OfficePhone               *string            `json:"officePhone"`
	OfficeFax                 *string            `json:"officeFax"`
	ServiceArea               *types.ServiceArea `json:"serviceArea"`
	SatelliteSurveillanceArea *types.ServiceArea `json:"satelliteSurveillanceArea"`
}

OrganizationResponse is the payload returned by GET /api/organization/{id}

type OrganizationUpdateRequest

type OrganizationUpdateRequest struct {
	Name                           *string `json:"name"`
	Website                        *string `json:"website"`
	GeneralManagerName             *string `json:"generalManagerName"`
	OfficeAddressStreet            *string `json:"officeAddressStreet"`
	OfficeAddressCity              *string `json:"officeAddressCity"`
	OfficeAddressPostalCode        *string `json:"officeAddressPostalCode"`
	OfficePhone                    *string `json:"officePhone"`
	OfficeFax                      *string `json:"officeFax"`
	ServiceAreaUploadUri           *string `json:"serviceAreaUploadUri"`
	SatelliteSurveillanceUploadUri *string `json:"satelliteSurveillanceUploadUri"`
}

OrganizationUpdateRequest is the payload accepted by PUT /api/organization/{id}

type ProviderImage

type ProviderImage struct {
	ID           string `json:"id"`
	Name         string `json:"name"`
	Description  string `json:"description"`
	Family       string `json:"family"`
	Version      string `json:"version"`
	Architecture string `json:"architecture"`
	Region       string `json:"region,omitempty"`
}

type ProviderImagesResponse

type ProviderImagesResponse struct {
	Provider string          `json:"provider"`
	Images   []ProviderImage `json:"images"`
}

type ProviderPricing

type ProviderPricing struct {
	Name  string        `json:"name"`
	Sizes []SizePricing `json:"sizes"`
}

type Renderable

type Renderable interface {
	Render(http.ResponseWriter, *http.Request) error
}

type ResponseClientIos

type ResponseClientIos struct {
	Fieldseeker ResponseFieldseeker `json:"fieldseeker"`
	Since       time.Time           `json:"since"`
}

func (ResponseClientIos) Render

type ResponseDistrict

type ResponseDistrict struct {
	Agency  string `json:"agency"`
	Manager string `json:"manager"`
	Phone   string `json:"phone"`
	Website string `json:"website"`
}

func (ResponseDistrict) Render

type ResponseErr

type ResponseErr struct {
	Error          error `json:"-"` // low-level runtime error
	HTTPStatusCode int   `json:"-"` // http response status code

	StatusText string `json:"status"`          // user-level status message
	AppCode    int64  `json:"code,omitempty"`  // application-specific error code
	ErrorText  string `json:"error,omitempty"` // application-level error message, for debugging
}

type renderer struct { }

func (ren *renderer) Render(w http.ResponseWriter, r *http.Request) error {
	return nil
}

In the best case scenario, the excellent github.com/pkg/errors package helps reveal information on the error, setting it on Err, and in the Render() method, using it to set the application-specific error code in AppCode.

func (*ResponseErr) Render

func (e *ResponseErr) Render(w http.ResponseWriter, r *http.Request) error

type ResponseFieldseeker

type ResponseFieldseeker struct {
	MosquitoSources []ResponseMosquitoSource `json:"sources"`
	ServiceRequests []types.ServiceRequest   `json:"requests"`
	TrapData        []ResponseTrapData       `json:"traps"`
}

type ResponseMosquitoInspection

type ResponseMosquitoInspection struct {
	ActionTaken     string `json:"action_taken"`
	Comments        string `json:"comments"`
	Condition       string `json:"condition"`
	Created         string `json:"created"`
	EndDateTime     string `json:"end_date_time"`
	FieldTechnician string `json:"field_technician"`
	ID              string `json:"id"`
	LocationName    string `json:"location_name"`
	SiteCondition   string `json:"site_condition"`
}

func NewResponseMosquitoInspections

func NewResponseMosquitoInspections(inspections []model.Mosquitoinspection) []ResponseMosquitoInspection

func (ResponseMosquitoInspection) Render

type ResponseMosquitoSource

type ResponseMosquitoSource struct {
	Access                  string                       `json:"access"`
	Active                  *bool                        `json:"active"`
	Comments                string                       `json:"comments"`
	Created                 string                       `json:"created"`
	Description             string                       `json:"description"`
	H3Cell                  int64                        `json:"h3cell"`
	ID                      string                       `json:"id"`
	LastInspectionDate      string                       `json:"last_inspection_date"`
	Habitat                 string                       `json:"habitat"`
	Inspections             []ResponseMosquitoInspection `json:"inspections"`
	Name                    string                       `json:"name"`
	NextActionDateScheduled string                       `json:"next_action_date_scheduled"`
	Treatments              []ResponseMosquitoTreatment  `json:"treatments"`
	UseType                 string                       `json:"use_type"`
	WaterOrigin             string                       `json:"water_origin"`
	Zone                    string                       `json:"zone"`
}

func NewResponseMosquitoSources

func NewResponseMosquitoSources(sources []platform.MosquitoSource) []ResponseMosquitoSource

func (ResponseMosquitoSource) Render

type ResponseMosquitoTreatment

type ResponseMosquitoTreatment struct {
	Comments        string  `json:"comments"`
	Created         string  `json:"created"`
	EndDateTime     string  `json:"end_date_time"`
	FieldTechnician string  `json:"field_technician"`
	Habitat         string  `json:"habitat"`
	ID              string  `json:"id"`
	Product         string  `json:"product"`
	Quantity        float64 `json:"quantity"`
	QuantityUnit    string  `json:"quantity_unit"`
	SiteCondition   string  `json:"site_condition"`
	TreatAcres      float64 `json:"treat_acres"`
	TreatHectares   float64 `json:"treat_hectares"`
}

func NewResponseMosquitoTreatment

func NewResponseMosquitoTreatment(i model.Treatment) ResponseMosquitoTreatment

func NewResponseMosquitoTreatments

func NewResponseMosquitoTreatments(treatments []model.Treatment) []ResponseMosquitoTreatment

func (ResponseMosquitoTreatment) Render

type ResponseNote

type ResponseNote struct {
	CategoryName string `json:"categoryName"`
	Content      string `json:"content"`

	H3Cell    int64  `json:"h3cell"`
	ID        string `json:"id"`
	Timestamp string `json:"timestamp"`
}

func (ResponseNote) Render

func (rtd ResponseNote) Render(w http.ResponseWriter, r *http.Request) error

type ResponseTrapData

type ResponseTrapData struct {
	Created     string `json:"created"`
	Description string `json:"description"`
	H3Cell      int64  `json:"h3cell"`
	ID          string `json:"id"`
	Name        string `json:"name"`
}

func NewResponseTrapData

func NewResponseTrapData(data []model.Traplocation) []ResponseTrapData

func NewResponseTrapDatum

func NewResponseTrapDatum(td model.Traplocation) ResponseTrapData

func (ResponseTrapData) Render

type SizePricing

type SizePricing struct {
	Slug        string   `json:"slug"`
	Regions     []string `json:"regions"`
	PriceHourly float64  `json:"price_hourly"`
	VCPUs       int      `json:"vcpus"`
	MemoryMB    int      `json:"memory_mb"`
	DiskGB      int      `json:"disk_gb"`
	GPUModel    string   `json:"gpu_model,omitempty"`
	GPUCount    int      `json:"gpu_count,omitempty"`
	GPUVRAMGb   float64  `json:"gpu_vram_gb,omitempty"`
}

type Status

type Status struct {
	BuildTime  time.Time `json:"build_time"`
	IsModified bool      `json:"is_modified"`
	Revision   string    `json:"revision"`
	Status     string    `json:"status"`
	Type       string    `json:"type"`
}

type VisionPricingResponse

type VisionPricingResponse struct {
	Providers []ProviderPricing `json:"providers"`
}

type VoipMSStatusPayload

type VoipMSStatusPayload struct {
	ID         int                   `json:"id"`
	RecordType string                `json:"record_type"`
	From       VoipMSStatusPhoneFrom `json:"from"`
	To         []VoipMSStatusPhoneTo `json:"to"`
	Text       string                `json:"text"`
	ReceivedAt string                `json:"received_at"`
	Type       string                `json:"type"`
}

type VoipMSStatusPhoneFrom

type VoipMSStatusPhoneFrom struct {
	PhoneNumber string `json:"phone_number"`
}
{
  "data": {
    "id": 101252305,
    "event_type": "message.received",
    "record_type": "event",
    "payload": {
      "id": 101252305,
      "record_type": "message",
      "from": {
	"phone_number": "+18016984649"
      },
      "to": [
	{
	  "phone_number": "+15593720139",
	  "status": "webhook_delivered"
	}
      ],
      "text": "test3",
      "received_at": "2026-01-29T20:16:23.000000+00:00",
      "type": "SMS",
      "media": []
    }
  }
}

type VoipMSStatusPhoneTo

type VoipMSStatusPhoneTo struct {
	PhoneNumber string `json:"phone_number"`
	Status      string `json:"status"`
}

type VoipMSStatusUpdate

type VoipMSStatusUpdate struct {
	ID         int                 `json:"id"`
	EventType  string              `json:"event_type"`
	RecordType string              `json:"record_type"`
	Payload    VoipMSStatusPayload `json:"payload"`
}

type VoipMSTextPostBody

type VoipMSTextPostBody struct {
	Data VoipMSStatusUpdate `json:"data"`
}

Jump to

Keyboard shortcuts

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