Documentation
¶
Index ¶
- Variables
- func BoolAddr(v bool) *bool
- func IntAddr(v int) *int
- func StringAddr(v string) *string
- type BaseObject
- type CInP
- func (cinp *CInP) Call(ctx context.Context, uri string, args *map[string]interface{}, ...) error
- func (cinp *CInP) CallMulti(ctx context.Context, uri string, args *map[string]interface{}) (*map[string]map[string]interface{}, error)
- func (cinp *CInP) ClearHeader(name string)
- func (cinp *CInP) Create(ctx context.Context, uri string, object Object) (*Object, error)
- func (cinp *CInP) Delete(ctx context.Context, object Object) error
- func (cinp *CInP) DeleteURI(ctx context.Context, uri string) error
- func (cinp *CInP) Describe(ctx context.Context, uri string) (*Describe, string, error)
- func (cinp *CInP) Get(ctx context.Context, uri string) (*Object, error)
- func (cinp *CInP) GetURI() *URI
- func (cinp *CInP) List(ctx context.Context, uri string, filterName string, ...) ([]string, int, int, int, error)
- func (cinp *CInP) ListIds(ctx context.Context, uri string, filterName string, ...) <-chan string
- func (cinp *CInP) ListObjects(ctx context.Context, uri string, objectType reflect.Type, filterName string, ...) <-chan *Object
- func (cinp *CInP) RegisterType(uri string, objectType reflect.Type)
- func (cinp *CInP) SetHeader(name string, value string)
- func (cinp *CInP) Update(ctx context.Context, object Object) (*Object, error)
- func (cinp *CInP) UpdateMulti(ctx context.Context, uri string, values *map[string]interface{}, ...) error
- type CInPClient
- type Describe
- type FieldParamater
- type InvalidRequest
- type InvalidSession
- type MappedObject
- type NotAuthorized
- type NotFound
- type Object
- type ReaderForLogging
- type ServerError
- type URI
Constants ¶
This section is empty.
Variables ¶
var MappedObjectType = reflect.TypeOf((*MappedObject)(nil)).Elem()
MappedObjectType is the type used for the MappedObject which is used if a uri is not found in the type table
Functions ¶
Types ¶
type BaseObject ¶
type BaseObject struct {
// contains filtered or unexported fields
}
BaseObject is
func (*BaseObject) GetURI ¶ added in v1.2.0
func (baseobject *BaseObject) GetURI() string
GetURI return the URI of the object
func (*BaseObject) SetURI ¶ added in v1.2.0
func (baseobject *BaseObject) SetURI(uri string)
SetURI sets the URI of the object
type CInP ¶
type CInP struct {
// contains filtered or unexported fields
}
CInP client struct
func (*CInP) Call ¶
func (cinp *CInP) Call(ctx context.Context, uri string, args *map[string]interface{}, result interface{}) error
Call calls an object/class method from the URI, if the Multi-Object header is set on the result, this will error out
func (*CInP) CallMulti ¶
func (cinp *CInP) CallMulti(ctx context.Context, uri string, args *map[string]interface{}) (*map[string]map[string]interface{}, error)
CallMulti calls an object/class method from the URI, forces the Muti-Object header
func (*CInP) ClearHeader ¶ added in v1.1.5
ClearHeader sets a request header
func (*CInP) Get ¶
Get gets an object from the URI, if the Multi-Object header is set on the result, this will error out
func (*CInP) List ¶
func (cinp *CInP) List(ctx context.Context, uri string, filterName string, filterValues map[string]interface{}, position int, count int) ([]string, int, int, int, error)
List objects
func (*CInP) ListIds ¶
func (cinp *CInP) ListIds(ctx context.Context, uri string, filterName string, filterValues map[string]interface{}, chunkSize int) <-chan string
ListIds List Objects and return in a channel
func (*CInP) ListObjects ¶
func (cinp *CInP) ListObjects(ctx context.Context, uri string, objectType reflect.Type, filterName string, filterValues map[string]interface{}, chunkSize int) <-chan *Object
ListObjects List Objects and return in a channel
func (*CInP) RegisterType ¶
RegisterType registeres the type to use for a url
type CInPClient ¶ added in v1.2.2
type CInPClient interface { SetHeader(name string, value string) ClearHeader(name string) RegisterType(uri string, objectType reflect.Type) Describe(ctx context.Context, uri string) (*Describe, string, error) List(ctx context.Context, uri string, filterName string, filterValues map[string]interface{}, position int, count int) ([]string, int, int, int, error) ListIds(ctx context.Context, uri string, filterName string, filterValues map[string]interface{}, chunkSize int) <-chan string ListObjects(ctx context.Context, uri string, objectType reflect.Type, filterName string, filterValues map[string]interface{}, chunkSize int) <-chan *Object Get(ctx context.Context, uri string) (*Object, error) Create(ctx context.Context, uri string, object Object) (*Object, error) Update(ctx context.Context, object Object) (*Object, error) UpdateMulti(ctx context.Context, uri string, values *map[string]interface{}, result *map[string]Object) error Delete(ctx context.Context, object Object) error DeleteURI(ctx context.Context, uri string) error Call(ctx context.Context, uri string, args *map[string]interface{}, result interface{}) error CallMulti(ctx context.Context, uri string, args *map[string]interface{}) (*map[string]map[string]interface{}, error) GetURI() *URI }
type Describe ¶
type Describe struct { Name string `json:"name"` Doc string `json:"doc"` Path string `json:"path"` // Namespace APIVersion string `json:"api-version"` MultiURIMax int `json:"multi-uri-max"` Namespaces []string `json:"namespaces"` Models []string `json:"models"` // Model Constants map[string]string `json:"constants"` Fields []FieldParamater `json:"fields"` Actions []string `json:"actions"` NotAllowedMethods []string `json:"not-allowed-methods"` ListFilters map[string][]FieldParamater `json:"list-filters"` // Actions ReturnType FieldParamater `json:"return-type"` Static bool `json:"static"` Paramaters []FieldParamater `json:"paramaters"` }
Describe struct definiation
type FieldParamater ¶
type FieldParamater struct { Name string `json:"name"` Doc string `json:"doc"` Path string `json:"path"` Type string `json:"type"` Length int `json:"length"` URI string `json:"uri"` AllowedSchemes []string `json:"allowed_schemes"` Choices []interface{} `json:"choices"` IsArray bool `json:"is_array"` Default interface{} `json:"default"` Mode string `json:"mode"` Required bool `json:"required"` }
FieldParamater defines a Field or Paramater from the describe
type InvalidRequest ¶
type InvalidRequest struct {
// contains filtered or unexported fields
}
InvalidRequest is a error that is returned when the request is Invalid, this needs to be updated to match the rust/python clients
func (*InvalidRequest) Error ¶
func (e *InvalidRequest) Error() string
type InvalidSession ¶
type InvalidSession struct{}
InvalidSession is a error that is returned when the AuthId and AuthToken do not specifiy a valid session
func (*InvalidSession) Error ¶
func (e *InvalidSession) Error() string
type MappedObject ¶
type MappedObject struct { BaseObject Data map[string]interface{} }
MappedObject for generic Object Manipluation
func (*MappedObject) AsMap ¶
func (mo *MappedObject) AsMap(isCreate bool) *map[string]interface{}
AsMap exports the Object's Data as a map
type NotAuthorized ¶
type NotAuthorized struct{}
NotAuthorized is a error that is returned when the Session is not Authorized to make the request
func (*NotAuthorized) Error ¶
func (e *NotAuthorized) Error() string
type NotFound ¶
type NotFound struct{}
NotFound is a error that is returned when the request referes to a namespace/model/object/action that does not exist
type ReaderForLogging ¶ added in v1.2.1
type ReaderForLogging struct {
// contains filtered or unexported fields
}
func NewReaderForLogging ¶ added in v1.2.1
func NewReaderForLogging(cap int) *ReaderForLogging
func (*ReaderForLogging) LogValue ¶ added in v1.2.1
func (r *ReaderForLogging) LogValue() []byte
type ServerError ¶
type ServerError struct {
// contains filtered or unexported fields
}
ServerError is a error that is returned when the request causes a ServerError
func (*ServerError) Error ¶
func (e *ServerError) Error() string
type URI ¶
type URI struct {
// contains filtered or unexported fields
}
URI is for parsing and checking CNiP URIs
func (*URI) Build ¶
Build constructs a URI from the paramaters, NOTE: if model is "", ids and action are skiped
func (*URI) ExtractIds ¶
ExtractIds extract the id(s) from a list of URI