api

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const API_ACTIVITY = API_V1 + "/activity"
View Source
const API_AUTH = "/oauth2/token"
View Source
const API_PATROLS = API_ACTIVITY + "/patrols"
View Source
const API_SUBJECT = API_V1 + "/subject"
View Source
const API_SUBJECTS = API_V1 + "/subjects"
View Source
const API_SUBJECT_TRACKS = "/tracks"
View Source
const API_USER = API_V1 + "/user"
View Source
const API_USER_ME = API_USER + "/me"
View Source
const API_USER_PROFILES = "/profiles"
View Source
const API_V1 = "/api/v1.0"
View Source
const DOMAIN = ".pamdas.org"

---------------------------------------------- const endpoints ----------------------------------------------

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthResponse

type AuthResponse struct {
	AccessToken      string `json:"access_token"`
	ExpiresIn        int    `json:"expires_in"`
	TokenType        string `json:"token_type"`
	Scope            string `json:"scope"`
	RefreshToken     string `json:"refresh_token"`
	ErrorDescription string `json:"error_description"`
}

---------------------------------------------- structs ----------------------------------------------

func Authenticate

func Authenticate(sitename, username, password string) (*AuthResponse, error)

---------------------------------------------- exported functions ----------------------------------------------

type Client

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

func ERClient

func ERClient(sitename, token string, opts ...string) *Client

func (*Client) Patrols added in v0.0.3

func (c *Client) Patrols(days int, status string) (*PatrolsResponse, error)

func (*Client) SubjectTracks added in v0.0.2

func (c *Client) SubjectTracks(subjectID string, daysAgo int) (*TracksResponse, error)

func (*Client) Subjects added in v0.0.2

func (c *Client) Subjects(updatedSince string) (*SubjectsResponse, error)

func (*Client) User added in v0.0.2

func (c *Client) User() (*UserResponse, error)

func (*Client) UserProfiles added in v0.0.2

func (c *Client) UserProfiles(userID string) (*UserProfilesResponse, error)

type Coordinate added in v0.0.2

type Coordinate struct {
	Time string `json:"time"`
}

type DateRangeFilter added in v0.0.3

type DateRangeFilter struct {
	DateRange struct {
		Lower string `json:"lower"`
		Upper string `json:"upper"`
	} `json:"date_range"`
	PatrolsOverlapDaterange bool `json:"patrols_overlap_daterange"`
}

type Feature added in v0.0.2

type Feature struct {
	Geometry   TrackGeometry   `json:"geometry"`
	Properties TrackProperties `json:"properties"`
	Type       string          `json:"type"`
}

type Geometry added in v0.0.2

type Geometry struct {
	Coordinates []float64 `json:"coordinates"`
	Type        string    `json:"type"`
}

type LastPosition added in v0.0.2

type LastPosition struct {
	Geometry   Geometry   `json:"geometry"`
	Properties Properties `json:"properties"`
	Type       string     `json:"type"`
}

type Location added in v0.0.3

type Location struct {
	Latitude  float64 `json:"latitude"`
	Longitude float64 `json:"longitude"`
}

type Patrol added in v0.0.3

type Patrol struct {
	ID             string          `json:"id"`
	SerialNumber   int             `json:"serial_number"`
	State          string          `json:"state"`
	Title          *string         `json:"title"`
	PatrolSegments []PatrolSegment `json:"patrol_segments"`
}

type PatrolSegment added in v0.0.3

type PatrolSegment struct {
	Leader *struct {
		Name string `json:"name"`
	} `json:"leader"`
	PatrolType    string    `json:"patrol_type"`
	StartLocation *Location `json:"start_location"`
	TimeRange     TimeRange `json:"time_range"`
}

type PatrolsResponse added in v0.0.3

type PatrolsResponse struct {
	Data struct {
		Count    int      `json:"count"`
		Next     string   `json:"next"`
		Previous string   `json:"previous"`
		Results  []Patrol `json:"results"`
	} `json:"data"`
	Status struct {
		Code    int    `json:"code"`
		Message string `json:"message"`
	} `json:"status"`
}

type Properties added in v0.0.2

type Properties struct {
	DateTime             string     `json:"DateTime"`
	CoordinateProperties Coordinate `json:"coordinateProperties"`
	ID                   string     `json:"id"`
	Image                string     `json:"image"`
	LastVoiceCallStartAt *string    `json:"last_voice_call_start_at"`
	LocationRequestedAt  *string    `json:"location_requested_at"`
	RadioState           string     `json:"radio_state"`
	RadioStateAt         string     `json:"radio_state_at"`
	Stroke               string     `json:"stroke"`
	StrokeOpacity        float64    `json:"stroke-opacity"`
	StrokeWidth          int        `json:"stroke-width"`
	SubjectSubtype       string     `json:"subject_subtype"`
	SubjectType          string     `json:"subject_type"`
	Title                string     `json:"title"`
}

type Subject added in v0.0.2

type Subject struct {
	ID               string       `json:"id"`
	LastPosition     LastPosition `json:"last_position"`
	LastPositionDate string       `json:"last_position_date"`
	Name             string       `json:"name"`
	SubjectSubtype   string       `json:"subject_subtype"`
	SubjectType      string       `json:"subject_type"`
}

type SubjectsResponse added in v0.0.2

type SubjectsResponse struct {
	Data   []Subject `json:"data"`
	Status struct {
		Code    int    `json:"code"`
		Message string `json:"message"`
	} `json:"status"`
}

type TimeRange added in v0.0.3

type TimeRange struct {
	StartTime *string `json:"start_time"`
	EndTime   *string `json:"end_time"`
}

type TrackGeometry added in v0.0.2

type TrackGeometry struct {
	Coordinates [][]float64 `json:"coordinates"`
	Type        string      `json:"type"`
}

type TrackProperties added in v0.0.2

type TrackProperties struct {
	CoordinateProperties struct {
		Times []string `json:"times"`
	} `json:"coordinateProperties"`
	ID                   string  `json:"id"`
	Image                string  `json:"image"`
	LastVoiceCallStartAt *string `json:"last_voice_call_start_at"`
	LocationRequestedAt  *string `json:"location_requested_at"`
	RadioState           string  `json:"radio_state"`
	RadioStateAt         string  `json:"radio_state_at"`
	Stroke               string  `json:"stroke"`
	StrokeOpacity        float64 `json:"stroke-opacity"`
	StrokeWidth          int     `json:"stroke-width"`
	SubjectSubtype       string  `json:"subject_subtype"`
	SubjectType          string  `json:"subject_type"`
	Title                string  `json:"title"`
}

type TracksResponse added in v0.0.2

type TracksResponse struct {
	Data struct {
		Features []Feature `json:"features"`
		Type     string    `json:"type"`
	} `json:"data"`
	Status struct {
		Code    int    `json:"code"`
		Message string `json:"message"`
	} `json:"status"`
}

type UserData

type UserData struct {
	Username    string `json:"username"`
	Email       string `json:"email"`
	FirstName   string `json:"first_name"`
	LastName    string `json:"last_name"`
	Role        string `json:"role"`
	IsStaff     bool   `json:"is_staff"`
	IsSuperUser bool   `json:"is_superuser"`
	DateJoined  string `json:"date_joined"`
	ID          string `json:"id"`
	IsActive    bool   `json:"is_active"`
	LastLogin   string `json:"last_login"`
	Pin         string `json:"pin"`
	Subject     struct {
		ID string `json:"id"`
	} `json:"subject"`
	AcceptedEula bool `json:"accepted_eula"`
}

type UserProfilesResponse

type UserProfilesResponse struct {
	Data   []UserData `json:"data"`
	Status struct {
		Code    int    `json:"code"`
		Message string `json:"message"`
	} `json:"status"`
}

type UserResponse

type UserResponse struct {
	Data             UserData `json:"data"`
	ErrorDescription string   `json:"error_description"`
}

Jump to

Keyboard shortcuts

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