package module
Version: v1.0.6 Latest Latest

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

Go to latest
Published: Feb 28, 2023 License: Apache-2.0 Imports: 36 Imported by: 92




View Source
const (
	// ContextOAuth2 takes an oauth2.TokenSource as authentication for the request.
	ContextOAuth2 = ContextKey("token")

	// ContextBasicAuth takes BasicAuth as authentication for the request.
	ContextBasicAuth = ContextKey("basic")

	// ContextAccessToken takes a string oauth2 access token as authentication for the request.
	ContextAccessToken = ContextKey("accesstoken")

	// ContextAPIKey takes an APIKey as authentication for the request
	ContextAPIKey = ContextKey("apikey")


This section is empty.


func CacheExpires

func CacheExpires(r *http.Response) time.Time

CacheExpires helper function to determine remaining time before repeating a request.

func CallAPI

func CallAPI(cfg Configuration, request *http.Request) (*http.Response, error)

callAPI do the request.

func Convert

func Convert(from interface{}, to interface{}) error

Convert - convert map[string]interface{} to openapi models

func Deserialize

func Deserialize(v interface{}, b []byte, contentType string) (err error)

func GenerateCertificate added in v1.0.6

func GenerateCertificate(
	nfType, nfId, certPemPath string,
	pubKey *rsa.PublicKey,
	rootCert *x509.Certificate,
	rootPrivKey *rsa.PrivateKey,
) (*x509.Certificate, error)

func GenerateClientCredentialAssertion added in v1.0.6

func GenerateClientCredentialAssertion(
	sub, aud, keyPath string,
) (string, error)

func GenerateRSAKeyPair added in v1.0.6

func GenerateRSAKeyPair(pubPemPath, privPemPath string) (*rsa.PrivateKey, error)

func GenerateRootCertificate added in v1.0.6

func GenerateRootCertificate(
	rootCertPath string,
	rootPrivKey *rsa.PrivateKey,
) (*x509.Certificate, error)

func GetNFCertFileName added in v1.0.6

func GetNFCertFileName(nfType string) string

func GetNFCertPath added in v1.0.6

func GetNFCertPath(base, nfType string) string

func InterceptH2CClient

func InterceptH2CClient()

func MarshToJsonString

func MarshToJsonString(v interface{}) (result []string)

func MultipartDeserialize

func MultipartDeserialize(b []byte, v interface{}, boundary string) (err error)

func MultipartEncode

func MultipartEncode(v interface{}, body io.Writer) (string, error)

func MultipartSerialize

func MultipartSerialize(v interface{}) ([]byte, string, error)

func ParameterToString

func ParameterToString(obj interface{}, collectionFormat string) string

ParameterToString convert interface{} parameters to string, using a delimiter if format is provided.

func ParseCertFromPEM added in v1.0.6

func ParseCertFromPEM(certPemPath string) (*x509.Certificate, error)

func ParsePrivateKeyFromPEM added in v1.0.6

func ParsePrivateKeyFromPEM(privPemPath string) (*rsa.PrivateKey, error)

func ParsePublicKeyFromPEM added in v1.0.6

func ParsePublicKeyFromPEM(pubPemPath string) (*rsa.PublicKey, error)

func PrepareRequest

func PrepareRequest(
	ctx context.Context,
	cfg Configuration,
	path string, method string,
	postBody interface{},
	headerParams map[string]string,
	queryParams url.Values,
	formParams url.Values,
	formFileName string,
	fileName string,
	fileBytes []byte) (localVarRequest *http.Request, err error)

prepareRequest build the request

func ProblemDetailsDataNotFound added in v1.0.2

func ProblemDetailsDataNotFound(detail string) *models.ProblemDetails

func ProblemDetailsMalformedReqSyntax added in v1.0.2

func ProblemDetailsMalformedReqSyntax(detail string) *models.ProblemDetails

func ProblemDetailsSystemFailure added in v1.0.2

func ProblemDetailsSystemFailure(detail string) *models.ProblemDetails

func ReportError

func ReportError(format string, a ...interface{}) error

Prevent trying to import "fmt"

func RestoreH2CClient

func RestoreH2CClient()

func SelectHeaderAccept

func SelectHeaderAccept(accepts []string) string

SelectHeaderAccept join all accept types and return

func Serialize

func Serialize(v interface{}, mediaType string) ([]byte, error)

Serialize - serialize data v to corresponding media type

func TypeCheckParameter

func TypeCheckParameter(obj interface{}, expected string, name string) error

Verify optional parameters are of the correct type.

func VerifyOAuth added in v1.0.6

func VerifyOAuth(
	authorization, serviceName, certPath string,
) error


type APIKey

type APIKey struct {
	Key    string
	Prefix string

APIKey provides API key based authentication to a request passed via context using ContextAPIKey

type BasicAuth

type BasicAuth struct {
	UserName string `json:"userName,omitempty"`
	Password string `json:"password,omitempty"`

BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth

type CCAClaims added in v1.0.6

type CCAClaims struct {
	Iat int32
	Exp int32

type Configuration

type Configuration interface {
	BasePath() string
	Host() string
	UserAgent() string
	DefaultHeader() map[string]string
	HTTPClient() *http.Client

type ContextKey

type ContextKey string

func (ContextKey) String

func (c ContextKey) String() string

type GenericOpenAPIError

type GenericOpenAPIError struct {
	RawBody     []byte
	ErrorStatus string
	ErrorModel  interface{}

GenericOpenAPIError Provides access to the body, error and model on returned errors.

func (GenericOpenAPIError) Body

func (e GenericOpenAPIError) Body() []byte

Body returns the raw bytes of the response

func (GenericOpenAPIError) Error

func (e GenericOpenAPIError) Error() string

Error returns non-empty string if there was an error.

func (GenericOpenAPIError) Model

func (e GenericOpenAPIError) Model() interface{}

Model returns the unpacked model of the error

type MediaKind

type MediaKind int

MediaKind - represents the sets of media type

const (
	MediaKindUnsupported MediaKind = iota
	MediaKindPlaintext   MediaKind = iota

MediaKind enums

func KindOfMediaType

func KindOfMediaType(mediaType string) MediaKind

KindOfMediaType - returns Mediakind of the media type

type MultipartRelatedBinding

type MultipartRelatedBinding struct{}

func (MultipartRelatedBinding) Bind

func (MultipartRelatedBinding) Bind(req *http.Request, obj interface{}) error

func (MultipartRelatedBinding) BindBody

func (MultipartRelatedBinding) BindBody(body []byte, obj interface{}) error

func (MultipartRelatedBinding) Name

type MultipartRelatedRender

type MultipartRelatedRender struct {
	Data interface{}
	// contains filtered or unexported fields

func (MultipartRelatedRender) Render

func (r MultipartRelatedRender) Render(w http.ResponseWriter) (err error)

func (MultipartRelatedRender) WriteContentType

func (r MultipartRelatedRender) WriteContentType(w http.ResponseWriter)

type SupportedFeature

type SupportedFeature []byte

SupportedFeature - bytes used to indicate the features supported by a API that is used as defined in subclause 6.6 in 3GPP TS 29.500

func NewSupportedFeature

func NewSupportedFeature(suppFeat string) (SupportedFeature, error)

NewSupportedFeature - new NewSupportedFeature from string

func (SupportedFeature) GetFeature

func (suppoertedFeature SupportedFeature) GetFeature(n int) bool

GetFeature - get nth feature is supported

func (SupportedFeature) NegotiateWith

func (suppoertedFeature SupportedFeature) NegotiateWith(incomingSuppFeat SupportedFeature) SupportedFeature

NegotiateWith - Negotiate with other supported feature

func (SupportedFeature) String

func (suppoertedFeature SupportedFeature) String() string

String - convert SupportedFeature to hex format

Jump to

Keyboard shortcuts

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