psdk

package
v0.0.0-...-e50d1ec Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2022 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LoginFake     = "/login/fake"
	UserInfo      = "/user/info"
	DeviceReg     = "/device/reg"
	DeviceList    = "/device/list"
	DeviceRemove  = "/device/remove"
	KeyGen        = "/key/gen"
	KeyRegen      = "/key/regen"
	KeyList       = "/key/list"
	KeyRemove     = "/key/remove"
	MessagePush   = "/message/push"
	MessageList   = "/message/list"
	MessageRemove = "/message/remove"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseReq

type BaseReq struct {
	Token string `json:"token"`
}

type BaseRsp

type BaseRsp struct {
	Code  int    `json:"code"`
	Error string `json:"error"`
}

func (BaseRsp) GetCode

func (p BaseRsp) GetCode() int

func (BaseRsp) GetErrorMsg

func (p BaseRsp) GetErrorMsg() string

type DeviceListReq

type DeviceListReq struct {
	BaseReq
}

type DeviceListRsp

type DeviceListRsp struct {
	BaseRsp
	Content struct {
		Devices []struct {
			Id       int    `json:"id"`
			Uid      string `json:"uid"`
			Name     string `json:"name"`
			Type     string `json:"type"`
			DeviceId string `json:"device_id"`
			IsClip   int    `json:"is_clip"`
		} `json:"devices"`
	} `json:"content"`
}

type DeviceRegReq

type DeviceRegReq struct {
	BaseReq
	Name     string `json:"name,omitempty"`
	DeviceId string `json:"device_id,omitempty"`
	IsClip   int    `json:"is_clip,omitempty"`
}

type DeviceRegRsp

type DeviceRegRsp struct {
	BaseRsp
	Content struct {
		Devices []struct {
			Id       int    `json:"id"`
			Uid      string `json:"uid"`
			Name     string `json:"name"`
			Type     string `json:"type"`
			DeviceId string `json:"device_id"`
			IsClip   int    `json:"is_clip"`
		} `json:"devices"`
	} `json:"content"`
}

type DeviceRemoveReq

type DeviceRemoveReq struct {
	BaseReq
	Id int64 `json:"id,omitempty"`
}

type DeviceRemoveRsp

type DeviceRemoveRsp struct {
	BaseRsp
	Content struct {
		Message string `json:"message"`
	} `json:"content"`
}

type KeyGenReq

type KeyGenReq struct {
	BaseReq
}

type KeyGenRsp

type KeyGenRsp struct {
	BaseRsp
	Content struct {
		Keys []struct {
			Id  int    `json:"id"`
			Uid string `json:"uid"`
			Key string `json:"key"`
		} `json:"keys"`
	} `json:"content"`
}

type KeyListReq

type KeyListReq struct {
	BaseReq
	Id int64 `json:"id,omitempty"`
}

type KeyListRsp

type KeyListRsp struct {
	BaseRsp
	Content struct {
		Keys []struct {
			Id  int    `json:"id"`
			Uid string `json:"uid"`
			Key string `json:"key"`
		} `json:"keys"`
	} `json:"content"`
}

type KeyRegenReq

type KeyRegenReq struct {
	BaseReq
}

type KeyRegenRsp

type KeyRegenRsp struct {
	BaseRsp
	Content struct {
		Message string `json:"message"`
	} `json:"content"`
}

type KeyRemoveReq

type KeyRemoveReq struct {
	BaseReq
	Id int64 `json:"id,omitempty"`
}

type KeyRemoveRsp

type KeyRemoveRsp struct {
	BaseRsp
	Content struct {
		Message string `json:"message"`
	} `json:"content"`
}

type LoginFakeRsp

type LoginFakeRsp struct {
	Code int `json:"code"`

	Content struct {
		Token string `json:"token"`
	} `json:"content"`
}

type MessageListReq

type MessageListReq struct {
	BaseReq
	Limit uint32 `json:"limit,omitempty" validate:"max=100"`
}

type MessageListRsp

type MessageListRsp struct {
	BaseRsp
	Content struct {
		Messages []struct {
			Id        int64     `json:"id"`
			Uid       string    `json:"uid"`
			Text      string    `json:"text"`
			Desp      string    `json:"desp"`
			Type      string    `json:"type"`
			CreatedAt time.Time `json:"created_at"`
		} `json:"messages"`
	} `json:"content"`
}

type MessagePushReq

type MessagePushReq struct {
	BaseReq
	PushKey string  `json:"pushkey,omitempty"`
	Text    string  `json:"text,omitempty"`
	Desp    string  `json:"desp,omitempty"`
	Type    MsgType `json:"type,omitempty"`
}

type MessagePushRsp

type MessagePushRsp struct {
	BaseRsp
	Result []string `json:"result"`
}

type MessageRemoveReq

type MessageRemoveReq struct {
	BaseReq
	Id int64 `json:"id,omitempty"`
}

type MessageRemoveRsp

type MessageRemoveRsp struct {
	BaseRsp
	Content struct {
		Message string `json:"message"`
	} `json:"content"`
}

type MsgType

type MsgType string
const (
	MsgMarkdown MsgType = "markdown"
	MsgText     MsgType = "text"
	MsgImage    MsgType = "image"
)

type PushdeerClient

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

func New

func New(apiBase string, token string) (*PushdeerClient, error)

func NewFaker

func NewFaker(apiBase string) (*PushdeerClient, error)

不需要传入token,会候通过 `/login/fake` 生成一个token

func (*PushdeerClient) DeviceList

func (p *PushdeerClient) DeviceList(req *DeviceListReq) (*DeviceListRsp, error)

func (*PushdeerClient) DeviceReg

func (p *PushdeerClient) DeviceReg(req *DeviceRegReq) (*DeviceRegRsp, error)

func (*PushdeerClient) DeviceRemove

func (p *PushdeerClient) DeviceRemove(req *DeviceRemoveReq) (*DeviceRemoveRsp, error)

func (*PushdeerClient) KeyGen

func (p *PushdeerClient) KeyGen(req *KeyGenReq) (*KeyGenRsp, error)

func (*PushdeerClient) KeyList

func (p *PushdeerClient) KeyList(req *KeyListReq) (*KeyListRsp, error)

func (*PushdeerClient) KeyRegen

func (p *PushdeerClient) KeyRegen(req *KeyRegenReq) (*KeyRegenRsp, error)

func (*PushdeerClient) KeyRemove

func (p *PushdeerClient) KeyRemove(req *KeyRemoveReq) (*KeyRemoveRsp, error)

func (*PushdeerClient) LoginFaker

func (p *PushdeerClient) LoginFaker() (*LoginFakeRsp, error)

func (*PushdeerClient) MessageList

func (p *PushdeerClient) MessageList(req *MessageListReq) (*MessageListRsp, error)

func (*PushdeerClient) MessagePush

func (p *PushdeerClient) MessagePush(req *MessagePushReq) (*MessagePushRsp, error)

func (*PushdeerClient) MessageRemove

func (p *PushdeerClient) MessageRemove(req *MessageRemoveReq) (*MessageRemoveRsp, error)

func (*PushdeerClient) Post

func (p *PushdeerClient) Post(path string, req interface{}, rsp Response) error

func (*PushdeerClient) UserInfo

func (p *PushdeerClient) UserInfo(req *UserInfoReq) (*UserInfoRsp, error)

type Response

type Response interface {
	GetCode() int
	GetErrorMsg() string
}

type UserInfoReq

type UserInfoReq struct {
	BaseReq
}

type UserInfoRsp

type UserInfoRsp struct {
	BaseRsp
	Content []struct {
		Id        int         `json:"id"`
		Name      string      `json:"name"`
		Email     string      `json:"email"`
		AppleId   string      `json:"apple_id"`
		WechatId  interface{} `json:"wechat_id"`
		Level     int         `json:"level"`
		CreatedAt time.Time   `json:"created_at"`
		UpdatedAt time.Time   `json:"updated_at"`
	} `json:"content"`
}

Jump to

Keyboard shortcuts

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