utils

package
v3.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2023 License: Apache-2.0 Imports: 15 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteRequest

func DeleteRequest(ctx context.Context, returnValuePointer interface{}, baseUrl string, requestPath string, authInjector interfaces.AuthenticationInjector) errors.EdgeX

DeleteRequest makes the delete request and return the body

func EscapeAndJoinPath

func EscapeAndJoinPath(apiRoutePath string, pathVariables ...string) string

EscapeAndJoinPath escape and join the path variables

func FromContext

func FromContext(ctx context.Context, key string) string

FromContext allows for the retrieval of the specified key's value from the supplied Context. If the value is not found, an empty string is returned.

func GetRequest

func GetRequest(ctx context.Context, returnValuePointer interface{}, baseUrl string, requestPath string, requestParams url.Values, authInjector interfaces.AuthenticationInjector) errors.EdgeX

GetRequest makes the get request and return the body

func GetRequestAndReturnBinaryRes

func GetRequestAndReturnBinaryRes(ctx context.Context, baseUrl string, requestPath string, requestParams url.Values, authInjector interfaces.AuthenticationInjector) (res []byte, contentType string, edgeXerr errors.EdgeX)

GetRequestAndReturnBinaryRes makes the get request and return the binary response and content type(i.e., application/json, application/cbor, ... )

func GetRequestWithBodyRawData

func GetRequestWithBodyRawData(ctx context.Context, returnValuePointer interface{}, baseUrl string, requestPath string, requestParams url.Values, data interface{}, authInjector interfaces.AuthenticationInjector) errors.EdgeX

GetRequestWithBodyRawData makes the GET request with JSON raw data as request body and return the response

func PatchRequest

func PatchRequest(
	ctx context.Context,
	returnValuePointer interface{},
	baseUrl string, requestPath string,
	requestParams url.Values,
	data interface{}, authInjector interfaces.AuthenticationInjector) errors.EdgeX

PatchRequest makes a PATCH request and unmarshals the response to the returnValuePointer

func PostByFileRequest

func PostByFileRequest(
	ctx context.Context,
	returnValuePointer interface{},
	baseUrl string, requestPath string,
	filePath string, authInjector interfaces.AuthenticationInjector) errors.EdgeX

PostByFileRequest makes the post file request and return the body

func PostRequest

func PostRequest(
	ctx context.Context,
	returnValuePointer interface{},
	baseUrl string, requestPath string,
	data []byte,
	encoding string, authInjector interfaces.AuthenticationInjector) errors.EdgeX

PostRequest makes the post request with encoded data and return the body

func PostRequestWithRawData

func PostRequestWithRawData(
	ctx context.Context,
	returnValuePointer interface{},
	baseUrl string, requestPath string,
	requestParams url.Values,
	data interface{}, authInjector interfaces.AuthenticationInjector) errors.EdgeX

PostRequestWithRawData makes the post JSON request with raw data and return the body

func PutByFileRequest

func PutByFileRequest(
	ctx context.Context,
	returnValuePointer interface{},
	baseUrl string, requestPath string,
	filePath string, authInjector interfaces.AuthenticationInjector) errors.EdgeX

PutByFileRequest makes the put file request and return the body

func PutRequest

func PutRequest(
	ctx context.Context,
	returnValuePointer interface{},
	baseUrl string, requestPath string,
	requestParams url.Values,
	data interface{}, authInjector interfaces.AuthenticationInjector) errors.EdgeX

PutRequest makes the put JSON request and return the body

Types

This section is empty.

Jump to

Keyboard shortcuts

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