Documentation ¶
Index ¶
- Variables
- func IsRetriable(err error) bool
- func NewOAuth2Config(clientID, clientSecret, redirectURL string) *oauth2.Config
- type AvatarSize
- type Client
- type ConnectionStatusRequest
- type ConnectionStatusResponse
- type DeviceInfo
- type DeviceService
- func (s *DeviceService) GetConnectionStatus(ctx context.Context, data *ConnectionStatusRequest) (*ConnectionStatusResponse, error)
- func (s *DeviceService) GetListDevices(ctx context.Context) (*ListDevicesResponse, error)
- func (s *DeviceService) GetListDevicesByPlace(ctx context.Context, data *ListDevicesByPlaceRequest) (*ListDevicesResponse, error)
- func (s *DeviceService) SetDeviceMQTT(ctx context.Context, data *SetDeviceMQTTRequest) error
- func (s *DeviceService) UpdateDevice(ctx context.Context, data *UpdateDeviceRequest) error
- type DeviceStatus
- type HttpClient
- type ListByAliasIDAllPlaceRequest
- type ListDevicesByPlaceRequest
- type ListDevicesResponse
- type Person
- type PersonFaceURLUpdateRequest
- type PersonFaceUpdateRequest
- type PersonListByPlaceRequest
- type PersonListItem
- type PersonListItemWithPlace
- type PersonRegisterRequest
- type PersonRegisterResponse
- type PersonRegisterURLRequest
- type PersonRemoveByIDRequest
- type PersonRemoveByListAliasIDRequest
- type PersonRemoveByPlaceRequest
- type PersonRemoveRequest
- type PersonService
- func (s *PersonService) ListByAliasIDAllPlace(ctx context.Context, data ListByAliasIDAllPlaceRequest) ([]PersonListItemWithPlace, error)
- func (s *PersonService) ListByPlace(ctx context.Context, data PersonListByPlaceRequest) ([]PersonListItem, error)
- func (s *PersonService) Register(ctx context.Context, pu PersonRegisterRequest) (*PersonRegisterResponse, error)
- func (s *PersonService) RegisterByURL(ctx context.Context, pu PersonRegisterURLRequest) (*PersonRegisterResponse, error)
- func (s *PersonService) Remove(ctx context.Context, data PersonRemoveRequest) error
- func (s *PersonService) RemoveByID(ctx context.Context, data PersonRemoveByIDRequest) error
- func (s *PersonService) RemoveByListAliasID(ctx context.Context, data PersonRemoveByListAliasIDRequest) error
- func (s *PersonService) RemoveByPlace(ctx context.Context, data PersonRemoveByPlaceRequest) error
- func (s *PersonService) TakeFacePicture(ctx context.Context, data TakeFacePictureRequest) error
- func (s *PersonService) Update(ctx context.Context, data PersonUpdateRequest) error
- func (s *PersonService) UpdateAliasID(ctx context.Context, data PersonUpdateAliasRequest) error
- func (s *PersonService) UpdateByFaceImage(ctx context.Context, pu PersonFaceUpdateRequest) error
- func (s *PersonService) UpdateByFaceURL(ctx context.Context, pu PersonFaceURLUpdateRequest) error
- func (s *PersonService) UserInfoByAliasID(ctx context.Context, data UserInfoByAliasIDRequest) ([]PersonListItemWithPlace, error)
- type PersonUpdateAliasRequest
- type PersonUpdateRequest
- type Place
- type PlaceService
- type Profile
- type ProfileService
- type ServerError
- type SetDeviceMQTTRequest
- type TakeFacePictureRequest
- type UpdateDeviceRequest
- type UrlValuesSetter
- type UserInfoByAliasIDRequest
Constants ¶
This section is empty.
Variables ¶
var DefaultAvatarSize = AvatarSize{
Height: 736,
Width: 1280,
}
Functions ¶
func IsRetriable ¶
IsRetriable checks if a given error is an Hanet retriable error
func NewOAuth2Config ¶
Types ¶
type AvatarSize ¶
AvatarSize store avatar size in height*width
func (AvatarSize) SetUrlValues ¶
func (s AvatarSize) SetUrlValues(setter UrlValuesSetter)
type Client ¶
type Client struct { // Base URL for API requests. BaseURL *url.URL // User agent used when communicating with the Hanet AI API. UserAgent string Devices *DeviceService Persons *PersonService Places *PlaceService Profile *ProfileService // contains filtered or unexported fields }
func NewClient ¶
func NewClient(httpClient HttpClient, ts oauth2.TokenSource) *Client
func (*Client) Do ¶
Do sends an API request and returns the API response. The API response is JSON decoded and stored in the value pointed to by v, or returned as an error if an API error has occurred.
The provided ctx must be non-nil, if it is nil an error is returned. If it is canceled or times out, ctx.Err() will be returned.
func (*Client) NewRequest ¶
NewRequest creates an API request. A relative URL can be provided in urlStr, in which case it is resolved relative to the BaseURL of the Client. Relative URLs should always be specified without a preceding slash. If specified, the value pointed to by body is JSON encoded and included as the request body.
type ConnectionStatusRequest ¶
type ConnectionStatusRequest struct {
DeviceIDs []string `json:"deviceIDs" url:"deviceIDs,comma"`
}
type ConnectionStatusResponse ¶
type ConnectionStatusResponse struct {
Devices []DeviceStatus
}
type DeviceInfo ¶
type DeviceService ¶
type DeviceService service
func (*DeviceService) GetConnectionStatus ¶
func (s *DeviceService) GetConnectionStatus(ctx context.Context, data *ConnectionStatusRequest) (*ConnectionStatusResponse, error)
func (*DeviceService) GetListDevices ¶
func (s *DeviceService) GetListDevices(ctx context.Context) (*ListDevicesResponse, error)
func (*DeviceService) GetListDevicesByPlace ¶
func (s *DeviceService) GetListDevicesByPlace(ctx context.Context, data *ListDevicesByPlaceRequest) (*ListDevicesResponse, error)
func (*DeviceService) SetDeviceMQTT ¶ added in v0.2.0
func (s *DeviceService) SetDeviceMQTT(ctx context.Context, data *SetDeviceMQTTRequest) error
func (*DeviceService) UpdateDevice ¶
func (s *DeviceService) UpdateDevice(ctx context.Context, data *UpdateDeviceRequest) error
type DeviceStatus ¶
type ListByAliasIDAllPlaceRequest ¶ added in v0.2.1
type ListByAliasIDAllPlaceRequest struct {
AliasID string `url:"aliasID"`
}
type ListDevicesByPlaceRequest ¶
type ListDevicesByPlaceRequest struct {
PlaceID int `url:"placeID"`
}
type ListDevicesResponse ¶
type ListDevicesResponse struct {
Devices []DeviceInfo
}
type PersonFaceURLUpdateRequest ¶ added in v0.1.1
type PersonFaceUpdateRequest ¶
type PersonListItem ¶
type PersonListItemWithPlace ¶ added in v0.2.1
type PersonListItemWithPlace struct { PersonListItem PlaceID int `json:"placeID"` }
type PersonRegisterRequest ¶
type PersonRegisterRequest struct { *PersonFaceUpdateRequest Name string `json:"name"` Title string `json:"title"` Type string `json:"type"` }
type PersonRegisterResponse ¶
type PersonRegisterURLRequest ¶ added in v0.1.1
type PersonRegisterURLRequest struct { *PersonFaceURLUpdateRequest Name string `json:"name"` Title string `json:"title"` Type string `json:"type"` }
type PersonRemoveByIDRequest ¶ added in v0.2.1
type PersonRemoveByIDRequest struct {
PersonID string `url:"personID"`
}
type PersonRemoveByListAliasIDRequest ¶ added in v0.2.1
type PersonRemoveRequest ¶
type PersonRemoveRequest struct {
AliasID string `url:"aliasID"`
}
type PersonService ¶
type PersonService service
func (*PersonService) ListByAliasIDAllPlace ¶ added in v0.2.1
func (s *PersonService) ListByAliasIDAllPlace(ctx context.Context, data ListByAliasIDAllPlaceRequest) ([]PersonListItemWithPlace, error)
func (*PersonService) ListByPlace ¶
func (s *PersonService) ListByPlace(ctx context.Context, data PersonListByPlaceRequest) ([]PersonListItem, error)
func (*PersonService) Register ¶
func (s *PersonService) Register(ctx context.Context, pu PersonRegisterRequest) (*PersonRegisterResponse, error)
func (*PersonService) RegisterByURL ¶ added in v0.1.1
func (s *PersonService) RegisterByURL(ctx context.Context, pu PersonRegisterURLRequest) (*PersonRegisterResponse, error)
func (*PersonService) Remove ¶
func (s *PersonService) Remove(ctx context.Context, data PersonRemoveRequest) error
func (*PersonService) RemoveByID ¶ added in v0.2.1
func (s *PersonService) RemoveByID(ctx context.Context, data PersonRemoveByIDRequest) error
func (*PersonService) RemoveByListAliasID ¶ added in v0.2.1
func (s *PersonService) RemoveByListAliasID(ctx context.Context, data PersonRemoveByListAliasIDRequest) error
func (*PersonService) RemoveByPlace ¶
func (s *PersonService) RemoveByPlace(ctx context.Context, data PersonRemoveByPlaceRequest) error
func (*PersonService) TakeFacePicture ¶ added in v0.1.1
func (s *PersonService) TakeFacePicture(ctx context.Context, data TakeFacePictureRequest) error
func (*PersonService) Update ¶
func (s *PersonService) Update(ctx context.Context, data PersonUpdateRequest) error
func (*PersonService) UpdateAliasID ¶
func (s *PersonService) UpdateAliasID(ctx context.Context, data PersonUpdateAliasRequest) error
func (*PersonService) UpdateByFaceImage ¶
func (s *PersonService) UpdateByFaceImage(ctx context.Context, pu PersonFaceUpdateRequest) error
func (*PersonService) UpdateByFaceURL ¶ added in v0.1.1
func (s *PersonService) UpdateByFaceURL(ctx context.Context, pu PersonFaceURLUpdateRequest) error
func (*PersonService) UserInfoByAliasID ¶ added in v0.2.1
func (s *PersonService) UserInfoByAliasID(ctx context.Context, data UserInfoByAliasIDRequest) ([]PersonListItemWithPlace, error)
type PersonUpdateRequest ¶
type PlaceService ¶
type PlaceService service
func (*PlaceService) UpdatePlace ¶
func (s *PlaceService) UpdatePlace(ctx context.Context, place Place) error
type ProfileService ¶ added in v0.2.1
type ProfileService service
type ServerError ¶
type ServerError struct { Code int Message string // Person is set if the error is caused by a duplicated Person *Person }
func (ServerError) Error ¶
func (se ServerError) Error() string
type SetDeviceMQTTRequest ¶ added in v0.2.0
type SetDeviceMQTTRequest struct { DeviceID string `json:"deviceID" url:"deviceID"` Enable bool `json:"enable" url:"enable,int"` URL string `json:"url" url:"url"` Username string `json:"username" url:"username"` Password string `json:"password" url:"password"` Base64Image bool `json:"image" url:"image,int"` }
type TakeFacePictureRequest ¶ added in v0.1.1
type TakeFacePictureRequest struct {
DeviceID string `url:"deviceID"`
}
type UpdateDeviceRequest ¶
type UrlValuesSetter ¶
type UserInfoByAliasIDRequest ¶ added in v0.2.1
type UserInfoByAliasIDRequest struct {
AliasID string `url:"aliasID"`
}