Documentation ¶
Index ¶
- Constants
- type HttpRequest
- func (h *HttpRequest) Delete(rurl, contentType string, buffer *bytes.Buffer) (*http.Response, error)
- func (h *HttpRequest) Get(rurl string) (*http.Response, error)
- func (h *HttpRequest) GetToken()
- func (h *HttpRequest) Post(rurl, contentType string, buffer *bytes.Buffer) (*http.Response, error)
- func (h *HttpRequest) PostForm(rurl string, formData url.Values) (*http.Response, error)
- func (h *HttpRequest) Put(rurl, contentType string, buffer *bytes.Buffer) (*http.Response, error)
- func (h *HttpRequest) Request(method, rurl, contentType string, buffer *bytes.Buffer) (*http.Response, error)
- type MetaRecord
- type ServiceQuery
- type ServiceRequest
- type ServiceResponse
- type ServiceResults
- type Token
Constants ¶
const ( OK = 0 GenericError = iota + 100 // generic error DatabaseError // 101 database error TransactionError // 102 transaction error QueryError // 103 query error RowsScanError // 104 row scan error SessionError // 105 db session error CommitError // 106 db commit error ParseError // 107 parser error LoadError // 108 loading error, e.g. load template GetIDError // 109 get id db error InsertError // 110 db insert error UpdateError // 111 update error LastInsertError // 112 db last insert error ValidateError // 113 validation error PatternError // 114 pattern error DecodeError // 115 decode error EncodeError // 116 encode error ContentTypeError // 117 content type error ParametersError // 118 parameters error NotImplementedApiCode // 119 not implemented API error ReaderError // 120 io reader error WriterError // 121 io writer error UnmarshalError // 122 json unmarshal error MarshalError // 123 marshal error HttpRequestError // 124 HTTP request error RemoveError // 125 remove error BindError // 126 bind error SchemaError // 127 schema error ServiceError // 128 service error CredentialsError // 129 credentials error TokenError // 130 token error ScopeError // 131 token scope error NotFoundError // 132 not found error AuthError // 133 auth error MetaError // 134 meta error StorageError // 135 storage error PredictError // 136 predict (inference) error FormDataError // 137 form data error UploadError // 138 upload error MarkdownError // 139 markdown error ZenodoError // 140 zenodo error FileError // 141 file error LDAPSearchError // 142 LDAP search error LDAPGroupError // 143 LDAP group error )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HttpRequest ¶
type HttpRequest struct { Token string Scope string Expires time.Time Verbose int Headers map[string][]string }
HttpRequest manage http requests
func NewHttpRequest ¶
func NewHttpRequest(scope string, verbose int) *HttpRequest
NewHttpRequest initilizes and returns new HttpRequest object
func (*HttpRequest) Delete ¶ added in v0.1.1
func (h *HttpRequest) Delete(rurl, contentType string, buffer *bytes.Buffer) (*http.Response, error)
Delete performs HTTP PUT request
func (*HttpRequest) Get ¶
func (h *HttpRequest) Get(rurl string) (*http.Response, error)
Get performis HTTP GET request
func (*HttpRequest) GetToken ¶
func (h *HttpRequest) GetToken()
GetToken obtains token from OAuth server
type MetaRecord ¶
MetaRecord represents meta-data record used for injection
func (*MetaRecord) JsonString ¶
func (s *MetaRecord) JsonString() string
String converts ServiceResponse into string representation
type ServiceQuery ¶
type ServiceQuery struct { Query string `json:"query"` Spec any `json:"spec"` SQL string `json:"sql"` Idx int `json:"idx"` Limit int `json:"limit"` SortKeys []string `json:"sort_keys"` SortOrder int `json:"sort_order"` }
ServiceQuery represents service query along with its results
type ServiceRequest ¶
type ServiceRequest struct { Client string `json:"client"` ServiceQuery ServiceQuery `json:"service_query"` }
ServiceRequest represents service request structure
func (*ServiceRequest) String ¶
func (s *ServiceRequest) String() string
String converts ServiceRequest into string representation
type ServiceResponse ¶
type ServiceResponse struct { HttpCode int `json:"http_code"` SrvCode int `json:"service_code"` Service string `json:"service"` Status string `json:"status"` Error string `json:"error"` ServiceQuery ServiceQuery `json:"service_query,omitempty"` Results ServiceResults `json:"results,omitempty"` Timestamp string `json:"timestamp"` }
ServiceResponse represents service response structure
func Response ¶
func Response(srv string, httpCode, srvCode int, err error) ServiceResponse
Response returns service status record
func (*ServiceResponse) JsonBytes ¶ added in v0.0.2
func (s *ServiceResponse) JsonBytes() []byte
JsonBytes converts ServiceResponse into bytes representation
func (*ServiceResponse) JsonString ¶
func (s *ServiceResponse) JsonString() string
JsonString converts ServiceResponse into string representation
func (*ServiceResponse) String ¶
func (s *ServiceResponse) String() string
String converts ServiceResponse into string representation
type ServiceResults ¶
type ServiceResults struct { NRecords int `json:"nrecords"` Records []map[string]any `json:"records"` }
ServiceResults represents service results