api

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2022 License: Apache-2.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Serve

func Serve(ctx context.Context, wg *sync.WaitGroup, cfg *config.Config)

Serve serves the gateway service

Types

type CallbackResponse

type CallbackResponse struct {
	NotifyClient int       `json:"notify_client"`
	AccessToken  string    `json:"access_token"`
	User         *UserInfo `json:"user"`
}

type ChangeKeyRequest

type ChangeKeyRequest struct {
	Op string `json:"op"`
}

type ChangeKeyResponse

type ChangeKeyResponse struct {
}

type ChangeMemberPermissionRequest

type ChangeMemberPermissionRequest struct {
	Role string `json:"role"`
}

type ChangeMemberPermissionResponse

type ChangeMemberPermissionResponse struct {
	Role models.RoleType `json:"role"`
}

type ChangeNetworkDurationRequest

type ChangeNetworkDurationRequest struct {
	DurationType string `json:"duration_type"`
	Duration     int64  `json:"duration"`
}

type ChangeNetworkStatusRequest

type ChangeNetworkStatusRequest struct {
	Status string `json:"status"`
}

type CreateKeyRequest

type CreateKeyRequest struct {
	Type models.KeyType `json:"type"`
}

type CreateKeyResponse

type CreateKeyResponse struct {
	KeyID   models.ID      `json:"key_id"`
	Type    models.KeyType `json:"type"`
	Key     string         `json:"key"`
	Created time.Time      `json:"created"`
	Expiry  time.Time      `json:"expiry"`
	Enabled bool           `json:"enabled"`
}

type DeleteKeyResponse

type DeleteKeyResponse struct {
}

type DeleteNetworkDeviceResponse

type DeleteNetworkDeviceResponse struct {
	DeviceID models.ID `json:"device_id"`
}

type DeleteNetworkUserResponse

type DeleteNetworkUserResponse struct {
	UserID models.ID `json:"user_id"`
}

type DeviceDeleteRequest

type DeviceDeleteRequest struct {
	DeviceID models.ID `json:"device_id"`
}

type DeviceListItem

type DeviceListItem struct {
	DeviceID models.ID               `json:"device_id"`
	Name     string                  `json:"name"`
	OS       string                  `json:"os"`
	Version  string                  `json:"version"`
	Address  string                  `json:"address"`
	LastSeen time.Time               `json:"last_seen"`
	Status   models.DeviceStatusType `json:"status"`
}

type DeviceListResponse

type DeviceListResponse struct {
	Devices []DeviceListItem `json:"devices"`
}

type DeviceOperationResponse

type DeviceOperationResponse struct {
	Success bool `json:"success"`
}

type DeviceUpdateRequest

type DeviceUpdateRequest struct {
	Name string `json:"name"`
}

type ExchangeKeyResponse

type ExchangeKeyResponse struct {
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token"`
}

type HandleInvitationRequest

type HandleInvitationRequest struct {
	Action string `json:"action"`
}

type HandleInvitationResponse

type HandleInvitationResponse struct {
	InvitationID models.ID `json:"invitation_id"`
}

type InvitationListItem

type InvitationListItem struct {
	InvitationID       models.ID `json:"invitation_id"`
	NetworkID          models.ID `json:"network_id"`
	NetworkName        string    `json:"network_name"`
	InvitedByUserName  string    `json:"invited_by_user_name"`
	InvitedByUserEmail string    `json:"invited_by_user_email"`
	InviteUserName     string    `json:"invite_user_name"`
	InviteDeviceCount  uint      `json:"invite_device_count"`
}

type InvitationListResponse

type InvitationListResponse struct {
	Invitations []InvitationListItem `json:"invitations"`
}

type InviteMemberRequest

type InviteMemberRequest struct {
	Email string          `json:"email"`
	Role  models.RoleType `json:"role"`
}

type InviteMemberResponse

type InviteMemberResponse struct {
	InvitationID models.ID `json:"invitation_id"`
}

type KeyListItem

type KeyListItem struct {
	KeyID   models.ID      `json:"key_id"`
	Type    models.KeyType `json:"type"`
	Key     string         `json:"key"`
	Created time.Time      `json:"created"`
	Expiry  time.Time      `json:"expiry"`
	Enabled bool           `json:"enabled"`
}

type KeyListResponse

type KeyListResponse struct {
	Keys []KeyListItem `json:"keys"`
}

type KeyType

type KeyType string

type NetworkInfoResponse

type NetworkInfoResponse struct {
	Networks []NetworkItem `json:"networks"`
}

type NetworkItem

type NetworkItem struct {
	NetworkID   models.ID       `json:"network_id"`
	Name        string          `json:"name"`
	Description string          `json:"description"`
	CreatedAt   int64           `json:"created_at"`
	MemberCount int64           `json:"member_count"`
	DeviceCount int64           `json:"device_count"`
	Role        models.RoleType `json:"role"`
}

type NetworkMemberItem

type NetworkMemberItem struct {
	NetworkID models.ID       `json:"network_id"`
	UserID    models.ID       `json:"user_id"`
	Name      string          `json:"name"`
	Email     string          `json:"email"`
	JoinTime  int64           `json:"join_time"`
	Role      models.RoleType `json:"role"`
}

type NetworkMemberResponse

type NetworkMemberResponse struct {
	Members []NetworkMemberItem `json:"members"`
	Owner   bool                `json:"owner"`
	Admin   bool                `json:"admin"`
}

type NetworkOperationResponse

type NetworkOperationResponse struct {
	Success bool `json:"success"`
}

type NetworkRequest

type NetworkRequest struct {
	Name        string `json:"name"`
	Description string `json:"description"`
}

type NetworkResponse

type NetworkResponse struct {
	Network NetworkItem `json:"network"`
}

type SSOMethod

type SSOMethod struct {
	Name string `json:"name"`
	Link string `json:"link"`
}

type UserInfo

type UserInfo struct {
	ID     uint64 `json:"id"`
	Name   string `json:"name"`
	Avatar string `json:"avatar"`
	Origin string `json:"origin"`
}

type UserProfileResponse

type UserProfileResponse struct {
	UserID     models.ID `json:"user_id"`
	Name       string    `json:"name"`
	Email      string    `json:"email"`
	Avatar     string    `json:"avatar"`
	Origin     string    `json:"origin"`
	CreateDate int64     `json:"create_date"`
}

type UserProfileSettingRequest

type UserProfileSettingRequest struct {
	Name  string `json:"name"`
	Email string `json:"email"`
}

type UserProfileSettingResponse

type UserProfileSettingResponse struct {
	Name  string `json:"name"`
	Email string `json:"email"`
}

type Vars

type Vars map[string]string

func (Vars) ModelID

func (v Vars) ModelID(key string) models.ID

func (Vars) Uint64

func (v Vars) Uint64(key string) uint64

type VersionCheckResponse

type VersionCheckResponse struct {
	NewVersion      bool   `json:"new_version"`
	NewVersionCode  string `json:"new_version_code"`
	DownloadAddress string `json:"download_address"`
}

Jump to

Keyboard shortcuts

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