synology

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Call

func Call(
	rsp Response,
	synology *Synology,
	session string,
	url string,
	method MethodCall,
	body interface{},
) (err error)

func CallApi added in v1.2.0

func CallApi(
	rsp Response,
	synology *Synology,
	session string,
	method MethodCall,
	body interface{},
) (err error)

CallApi Api调用

Types

type BaseRequest

type BaseRequest struct {
	Api     string
	Version int
	Method  string
}

BaseRequest 请求基类

func NewBaseRequest

func NewBaseRequest(api string, method string, version int) BaseRequest

NewBaseRequest 创建基础请求

type BaseResponse

type BaseResponse struct {
	Success bool
	Error   struct {
		Code Code
	}
}

BaseResponse 返回基类

func NewSuccessResponse added in v1.1.4

func NewSuccessResponse() *BaseResponse

NewSuccessResponse 创建新的成功的响应

func (*BaseResponse) Code

func (rsp *BaseResponse) Code() Code

func (*BaseResponse) IsSuccess

func (rsp *BaseResponse) IsSuccess() bool

type Code

type Code int
const (
	CodeNeedLogin Code = 119
)

type LoginRequest

type LoginRequest struct {
	BaseRequest

	Account string
	Passwd  string
	Session string
	Format  string
}

LoginRequest 登录请求

func NewDSLoginRequest

func NewDSLoginRequest(username string, password string) LoginRequest

NewDSLoginRequest 创建新的DownloadStation登录请求

func NewLoginRequest

func NewLoginRequest(username string, password string, session string) LoginRequest

NewLoginRequest 创建登录请求

type LoginResponse

type LoginResponse struct {
	BaseResponse

	Data struct {
		Sid string
	}
}

LoginResponse 登录响应

type MethodCall added in v1.2.0

type MethodCall string

Call 统一请求,增加重试机制等

const (
	MethodGet  MethodCall = "GET"
	MethodPost MethodCall = "POST"
)

type Response

type Response interface {
	// IsSuccess 响应是否成功
	IsSuccess() bool
	// Code 响应码
	Code() Code
}

Response 响应接口

type Synology

type Synology struct {
	Url      string
	Username string
	Password string
}

Synology 群晖NAS

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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