Documentation
¶
Index ¶
Constants ¶
View Source
const ErrorType mft.ErrorLabelName = "error_type"
View Source
const ErrorTypeInternalError string = "internal_error"
View Source
const ErrorTypeInvalidParams string = "invalid_params"
Variables ¶
View Source
var Errors map[int]string = map[int]string{
20000000: "api_json_types.CommandRequest.Unmarshal: fail",
20000010: "api_json_types.CreateRequest: Marshal fail",
20000011: "api_json_types.CreateUserRequest: Marshal fail",
20000020: "api_json_types.CommandResponce.Unmarshal: fail",
20000030: "api_json_types.CreateResponce: fail",
}
Errors codes and description
Functions ¶
This section is empty.
Types ¶
type Api ¶
type Api interface {
AllowedCommands() []CommandDescription
DoRequest(ctx context.Context, req *CommandRequest) *CommandResponce
}
type CommandDescription ¶
type CommandDescription struct {
ObjectType ObjectType `json:"object_type,omitempty"`
Action Action `json:"action,omitempty"`
Description string `json:"description,omitempty"`
}
type CommandRequest ¶
type CommandRequest struct {
ObjectType ObjectType `json:"object_type,omitempty"`
Action Action `json:"action,omitempty"`
ObjectName string `json:"object_name,omitempty"`
Params json.RawMessage `json:"params,omitempty"`
User string `json:"user,omitempty"`
}
func CreateRequest ¶
func CreateRequest(objectType ObjectType, action Action, objectName string, v interface{}) (cr *CommandRequest, err *mft.Error)
func CreateUserRequest ¶
func CreateUserRequest(objectType ObjectType, action Action, objectName string, v interface{}, userName string) (cr *CommandRequest, err *mft.Error)
func (*CommandRequest) Unmarshal ¶
func (cr *CommandRequest) Unmarshal(v interface{}) *mft.Error
func (*CommandRequest) UserName ¶
func (cr *CommandRequest) UserName() string
type CommandResponce ¶
type CommandResponce struct {
Error *mft.Error `json:"error,omitempty"`
Result json.RawMessage `json:"result,omitempty"`
}
func CreateResponce ¶
func CreateResponce(v interface{}, err *mft.Error) (cr *CommandResponce)
func (*CommandResponce) Unmarshal ¶
func (cr *CommandResponce) Unmarshal(v interface{}) *mft.Error
type ObjectType ¶ added in v0.0.3
type ObjectType string
Click to show internal directories.
Click to hide internal directories.