Documentation
¶
Index ¶
- Constants
- func MaskString(input string) string
- func UnwrapNullableType(input schema.Type) (schema.TypeEncoder, bool, error)
- type DataURI
- type DistributedError
- type DistributedResponse
- type DistributedResult
- type Doer
- type HTTPClient
- type HTTPOptions
- type Key
- type Keys
- type MetadataCollection
- type MultipartWriter
- type ParameterItem
- func (ssp *ParameterItem) Add(key Key, value string)
- func (ssp *ParameterItem) AddKey(key Key)
- func (ssp *ParameterItem) AddKeys(keys []Key)
- func (ssp *ParameterItem) AddValue(value string)
- func (ssp *ParameterItem) AddValues(values []string)
- func (ssp ParameterItem) Keys() Keys
- func (ssp *ParameterItem) PrependKey(key Key)
- func (ssp *ParameterItem) PrependKeys(keys []Key)
- func (ssp *ParameterItem) PrependValue(value string)
- func (ssp *ParameterItem) PrependValues(values []string)
- func (ssp ParameterItem) String() string
- func (ssp ParameterItem) Values() []string
- type ParameterItems
- type RequestBuilder
- type RetryableRequest
- type XMLDecoder
- type XMLEncoder
Constants ¶
const ( // EncodingBase64 is base64 encoding for the data url EncodingBase64 = "base64" // EncodingASCII is ascii encoding for the data url EncodingASCII = "ascii" )
Variables ¶
This section is empty.
Functions ¶
func MaskString ¶
MaskString masks the string value for security
func UnwrapNullableType ¶
UnwrapNullableType unwraps the underlying type of the nullable type
Types ¶
type DataURI ¶
DataURI represents the Data URI scheme
func DecodeDataURI ¶
DecodeDataURI decodes data URI scheme data:[<media type>][;<key>=<value>][;<extension>],<data>
type DistributedError ¶
type DistributedError struct {
schema.ConnectorError
// Identity of the remote server
Server string `json:"server" yaml:"server"`
}
DistributedError represents the error response of the remote request
func (DistributedError) Error ¶
func (de DistributedError) Error() string
Error implements the Error interface
type DistributedResponse ¶
type DistributedResponse[T any] struct { Results []DistributedResult[T] `json:"results" yaml:"results"` Errors []DistributedError `json:"errors" yaml:"errors"` }
DistributedResponse represents the response object of distributed operations
func NewDistributedResponse ¶
func NewDistributedResponse[T any]() *DistributedResponse[T]
NewDistributedResponse creates an empty DistributedResponse instance
type DistributedResult ¶
type DistributedResult[T any] struct { Server string `json:"server" yaml:"server"` Data T `json:"data" yaml:"data"` }
DistributedResult contains the success response of remote requests with a server identity
type HTTPClient ¶
type HTTPClient struct {
// contains filtered or unexported fields
}
HTTPClient represents a http client wrapper with advanced methods
func NewHTTPClient ¶
func NewHTTPClient(client Doer, httpSchema *rest.NDCHttpSchema, forwardHeaders configuration.ForwardHeadersSettings, tracer *connector.Tracer) *HTTPClient
NewHTTPClient creates a http client wrapper
func (*HTTPClient) Send ¶
func (client *HTTPClient) Send(ctx context.Context, request *RetryableRequest, selection schema.NestedField, resultType schema.Type, httpOptions *HTTPOptions) (any, http.Header, error)
Send creates and executes the request and evaluate response selection
func (*HTTPClient) SetTracer ¶
func (client *HTTPClient) SetTracer(tracer *connector.Tracer)
SetTracer sets the tracer instance
type HTTPOptions ¶
type HTTPOptions struct {
Servers []string `json:"serverIds" yaml:"serverIds"`
Parallel bool `json:"parallel" yaml:"parallel"`
Explain bool `json:"-" yaml:"-"`
Distributed bool `json:"-" yaml:"-"`
Concurrency uint `json:"-" yaml:"-"`
Settings *rest.NDCHttpSettings `json:"-" yaml:"-"`
}
HTTPOptions represent execution options for HTTP requests
func (*HTTPOptions) FromValue ¶
func (ro *HTTPOptions) FromValue(value any) error
FromValue parses http execution options from any value
type Key ¶
type Key struct {
// contains filtered or unexported fields
}
Key represents a key string or index
type MetadataCollection ¶
type MetadataCollection []configuration.NDCHttpRuntimeSchema
MetadataCollection stores list of HTTP metadata with helper methods
func (MetadataCollection) GetFunction ¶
func (rms MetadataCollection) GetFunction(name string) (*rest.OperationInfo, configuration.NDCHttpRuntimeSchema, error)
GetFunction gets the NDC function by name
func (MetadataCollection) GetProcedure ¶
func (rms MetadataCollection) GetProcedure(name string) (*rest.OperationInfo, configuration.NDCHttpRuntimeSchema, error)
GetProcedure gets the NDC procedure by name
type MultipartWriter ¶
MultipartWriter extends multipart.Writer with helpers
func NewMultipartWriter ¶
func NewMultipartWriter(w io.Writer) *MultipartWriter
NewMultipartWriter creates a MultipartWriter instance
func (*MultipartWriter) WriteDataURI ¶
WriteDataURI write a file from data URI string
func (*MultipartWriter) WriteField ¶
func (w *MultipartWriter) WriteField(fieldName, value string, headers http.Header) error
WriteField calls CreateFormField and then writes the given value.
type ParameterItem ¶
type ParameterItem struct {
// contains filtered or unexported fields
}
ParameterItem represents the key-value slice pair
func NewParameterItem ¶
func NewParameterItem(keys Keys, values []string) ParameterItem
NewParameterItem creates a parameter value pair
func (*ParameterItem) Add ¶
func (ssp *ParameterItem) Add(key Key, value string)
func (*ParameterItem) AddKey ¶
func (ssp *ParameterItem) AddKey(key Key)
func (*ParameterItem) AddKeys ¶
func (ssp *ParameterItem) AddKeys(keys []Key)
func (*ParameterItem) AddValue ¶
func (ssp *ParameterItem) AddValue(value string)
func (*ParameterItem) AddValues ¶
func (ssp *ParameterItem) AddValues(values []string)
func (ParameterItem) Keys ¶
func (ssp ParameterItem) Keys() Keys
Keys returns keys of the parameter item
func (*ParameterItem) PrependKey ¶
func (ssp *ParameterItem) PrependKey(key Key)
func (*ParameterItem) PrependKeys ¶
func (ssp *ParameterItem) PrependKeys(keys []Key)
func (*ParameterItem) PrependValue ¶
func (ssp *ParameterItem) PrependValue(value string)
func (*ParameterItem) PrependValues ¶
func (ssp *ParameterItem) PrependValues(values []string)
func (ParameterItem) String ¶
func (ssp ParameterItem) String() string
String implements fmt.Stringer interface
func (ParameterItem) Values ¶
func (ssp ParameterItem) Values() []string
type ParameterItems ¶
type ParameterItems []ParameterItem
func (*ParameterItems) Add ¶
func (ssp *ParameterItems) Add(keys []Key, values []string)
func (ParameterItems) Find ¶
func (ssp ParameterItems) Find(keys []Key) *ParameterItem
func (ParameterItems) FindDefault ¶
func (ssp ParameterItems) FindDefault() *ParameterItem
func (ParameterItems) FindIndex ¶
func (ssp ParameterItems) FindIndex(keys []Key) int
func (ParameterItems) String ¶
func (ssp ParameterItems) String() string
String implements fmt.Stringer interface
type RequestBuilder ¶
type RequestBuilder struct {
Schema *rest.NDCHttpSchema
Operation *rest.OperationInfo
Arguments map[string]any
Runtime rest.RuntimeSettings
}
RequestBuilder builds requests to the remote service
func NewRequestBuilder ¶
func NewRequestBuilder(restSchema *rest.NDCHttpSchema, operation *rest.OperationInfo, arguments map[string]any, runtime rest.RuntimeSettings) *RequestBuilder
NewRequestBuilder creates a new RequestBuilder instance
func (*RequestBuilder) Build ¶
func (c *RequestBuilder) Build() (*RetryableRequest, error)
Build evaluates and builds a RetryableRequest
type RetryableRequest ¶
type RetryableRequest struct {
RawRequest *rest.Request
URL url.URL
ServerID string
ContentType string
ContentLength int64
Headers http.Header
Body io.ReadSeeker
Runtime rest.RuntimeSettings
}
RetryableRequest wraps the raw request with retryable
func BuildDistributedRequestsWithOptions ¶
func BuildDistributedRequestsWithOptions(request *RetryableRequest, httpOptions *HTTPOptions) ([]RetryableRequest, error)
BuildDistributedRequestsWithOptions builds distributed requests with options
func (*RetryableRequest) CreateRequest ¶
func (r *RetryableRequest) CreateRequest(ctx context.Context) (*http.Request, context.CancelFunc, error)
CreateRequest creates an HTTP request with body copied
type XMLDecoder ¶
type XMLDecoder struct {
// contains filtered or unexported fields
}
XMLDecoder implements a dynamic XML decoder from the HTTP schema.
func NewXMLDecoder ¶
func NewXMLDecoder(httpSchema *rest.NDCHttpSchema) *XMLDecoder
NewXMLDecoder creates a new XML encoder.
type XMLEncoder ¶
type XMLEncoder struct {
// contains filtered or unexported fields
}
XMLEncoder implements a dynamic XML encoder from the HTTP schema.
func NewXMLEncoder ¶
func NewXMLEncoder(httpSchema *rest.NDCHttpSchema) *XMLEncoder
NewXMLEncoder creates a new XML encoder.
func (*XMLEncoder) Encode ¶
func (c *XMLEncoder) Encode(bodyInfo *rest.ArgumentInfo, bodyData any) ([]byte, error)
Encode marshals the body to xml bytes.