dcimsdk

package module
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

README

dcimsdk

The customized DCIM SDK for Go.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	IdTypeFixedOptFn      = func(opt *Option) { opt.Transformer(idTypeFixed) }
	DeviceTypeFixedOptFn  = func(opt *Option) { opt.Transformer(deviceTypeFixed) }
	PowerStatusFixedOptFn = func(opt *Option) { opt.Transformer(powerStatusFixed) }
	GidTypeFixedOptFn     = func(opt *Option) { opt.Transformer(gidTypeFixed) }
)

Functions

func AddCtx

func AddCtx(ctx ...*Context)

func DelCtxByID

func DelCtxByID(id uint)

func Execute

func Execute[REQ Request, RESP any](ctx *Context, request REQ, opts ...OptionFunc) (resp RESP, err error)

func OptionalId

func OptionalId(resp IdResponse) (id uint)

func UpCtxByID

func UpCtxByID(ctx *Context)

Types

type Context

type Context struct {
	ID      uint
	BaseUrl string
	Key     string
	Secret  string
	// contains filtered or unexported fields
}

func GetCtxByID

func GetCtxByID(id uint) *Context

func GetCtxByUrl

func GetCtxByUrl(baseUrl string) *Context

type CreateUpdateResp

type CreateUpdateResp struct {
	Success bool   `json:"success"`
	Error   string `json:"error"`
	Id      uint   `json:"id"`
}

func (CreateUpdateResp) Err

func (c CreateUpdateResp) Err() (err error)

func (CreateUpdateResp) ID

func (c CreateUpdateResp) ID() uint

func (CreateUpdateResp) Ok

func (c CreateUpdateResp) Ok() (ok bool)

type IdResponse

type IdResponse interface {
	Response
	ID() (id uint)
}

type OnlyIdType

type OnlyIdType struct {
	Id uint `json:"id"`
}

func NewOnlyIdType

func NewOnlyIdType(id uint) OnlyIdType

type Option added in v1.0.2

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

func (*Option) Timeout added in v1.0.2

func (o *Option) Timeout(timeout time.Duration) *Option

func (*Option) Transformer added in v1.0.2

func (o *Option) Transformer(transformer Transformer) *Option

type OptionFunc added in v1.0.2

type OptionFunc func(opt *Option)

func JoinOptFunc added in v1.0.4

func JoinOptFunc(opt OptionFunc, opts ...OptionFunc) []OptionFunc

func Timeout added in v1.0.4

func Timeout(timeout time.Duration) OptionFunc

type Request

type Request interface {
	Url() (url string)
	Method() (method string)
	Values() (values url.Values)
	Body() (body any)
}

type Response

type Response interface {
	Ok() (ok bool)
	Err() (err error)
}

type Transformer added in v1.0.2

type Transformer func(inBody string) (outBody string)

Directories

Path Synopsis
network
ip

Jump to

Keyboard shortcuts

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