sdkgen

package module
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2024 License: MIT Imports: 12 Imported by: 7

README

SDKgen client

Go implementation of the SDKgen client library. This library is used at our automatically generated Go clients. More information about SDKgen at https://sdkgen.app

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HttpClientFactory added in v1.0.0

func HttpClientFactory(authenticator AuthenticatorInterface) *http.Client

func ToString added in v1.0.0

func ToString(value interface{}) string

Types

type AccessToken

type AccessToken struct {
	TokenType    string `json:"token_type"`
	AccessToken  string `json:"access_token"`
	ExpiresIn    int64  `json:"expires_in"`
	RefreshToken string `json:"refresh_token"`
	Scope        string `json:"scope"`
}

func (*AccessToken) GetExpiresInTimestamp added in v1.0.2

func (accessToken *AccessToken) GetExpiresInTimestamp() int64

type Anonymous added in v1.0.1

type Anonymous struct {
	CredentialsInterface
}

type AnonymousAuthenticator added in v1.0.1

type AnonymousAuthenticator struct {
}

func (*AnonymousAuthenticator) RoundTrip added in v1.0.1

func (authenticator *AnonymousAuthenticator) RoundTrip(req *http.Request) (*http.Response, error)

type ApiKey

type ApiKey struct {
	CredentialsInterface
	Token string
	Name  string
	In    string
}

type ApiKeyAuthenticator added in v1.0.0

type ApiKeyAuthenticator struct {
	Credentials ApiKey
}

func (*ApiKeyAuthenticator) RoundTrip added in v1.0.0

func (authenticator *ApiKeyAuthenticator) RoundTrip(req *http.Request) (*http.Response, error)

type AuthenticatorInterface added in v1.0.0

type AuthenticatorInterface interface {
	http.RoundTripper
	RoundTrip(*http.Request) (*http.Response, error)
}

func AuthenticatorFactory added in v1.0.0

func AuthenticatorFactory(credentials CredentialsInterface) (AuthenticatorInterface, error)

type ClientAbstract

type ClientAbstract struct {
	Authenticator AuthenticatorInterface
	HttpClient    *http.Client
	Parser        *Parser
}

func NewClient added in v0.1.6

func NewClient(baseUrl string, credentials CredentialsInterface) (*ClientAbstract, error)

type CredentialsInterface

type CredentialsInterface interface {
}

type FileTokenStore

type FileTokenStore struct {
	// contains filtered or unexported fields
}

func NewFileTokenStore

func NewFileTokenStore(path string) FileTokenStore

func (FileTokenStore) Get

func (store FileTokenStore) Get() (AccessToken, error)

func (FileTokenStore) Persist

func (store FileTokenStore) Persist(token AccessToken) error

func (FileTokenStore) Remove

func (store FileTokenStore) Remove() error

type HttpBasic

type HttpBasic struct {
	CredentialsInterface
	UserName string
	Password string
}

type HttpBasicAuthenticator added in v1.0.0

type HttpBasicAuthenticator struct {
	Credentials HttpBasic
}

func (*HttpBasicAuthenticator) RoundTrip added in v1.0.0

func (authenticator *HttpBasicAuthenticator) RoundTrip(req *http.Request) (*http.Response, error)

type HttpBearer

type HttpBearer struct {
	CredentialsInterface
	Token string
}

type HttpBearerAuthenticator added in v1.0.0

type HttpBearerAuthenticator struct {
	Credentials HttpBearer
}

func (*HttpBearerAuthenticator) RoundTrip added in v1.0.0

func (authenticator *HttpBearerAuthenticator) RoundTrip(req *http.Request) (*http.Response, error)

type MemoryTokenStore

type MemoryTokenStore struct {
	Token AccessToken
}

func NewMemoryTokenStore

func NewMemoryTokenStore() MemoryTokenStore

func (MemoryTokenStore) Get

func (store MemoryTokenStore) Get() (AccessToken, error)

func (MemoryTokenStore) Persist

func (store MemoryTokenStore) Persist(token AccessToken) error

func (MemoryTokenStore) Remove

func (store MemoryTokenStore) Remove() error

type OAuth2 added in v1.0.0

type OAuth2 struct {
	CredentialsInterface
	ClientId         string
	ClientSecret     string
	TokenUrl         string
	AuthorizationUrl string
	TokenStore       TokenStoreInterface
	Scopes           []string
}

type OAuth2Authenticator added in v1.0.0

type OAuth2Authenticator struct {
	Credentials OAuth2
}

func (*OAuth2Authenticator) BuildRedirectUrl added in v1.0.0

func (authenticator *OAuth2Authenticator) BuildRedirectUrl(redirectUrl string, scopes []string, state string) (string, error)

func (*OAuth2Authenticator) FetchAccessTokenByClientCredentials added in v1.0.0

func (authenticator *OAuth2Authenticator) FetchAccessTokenByClientCredentials() (AccessToken, error)

func (*OAuth2Authenticator) FetchAccessTokenByCode added in v1.0.0

func (authenticator *OAuth2Authenticator) FetchAccessTokenByCode(code string) (AccessToken, error)

func (*OAuth2Authenticator) FetchAccessTokenByRefresh added in v1.0.0

func (authenticator *OAuth2Authenticator) FetchAccessTokenByRefresh(refreshToken string) (AccessToken, error)

func (*OAuth2Authenticator) GetAccessToken added in v1.0.0

func (authenticator *OAuth2Authenticator) GetAccessToken(automaticRefresh bool, expireThreshold int64) (string, error)

func (*OAuth2Authenticator) ParseTokenResponse added in v1.0.0

func (authenticator *OAuth2Authenticator) ParseTokenResponse(resp *http.Response) (AccessToken, error)

func (*OAuth2Authenticator) RoundTrip added in v1.0.0

func (authenticator *OAuth2Authenticator) RoundTrip(req *http.Request) (*http.Response, error)

type Parser added in v1.0.0

type Parser struct {
	BaseUrl string
}

func NewParser added in v1.0.0

func NewParser(baseUrl string) *Parser

func (*Parser) Contains added in v1.0.3

func (parser *Parser) Contains(haystack []string, needle string) bool

func (*Parser) Parse added in v1.0.0

func (parser *Parser) Parse(data string, model *interface{}) error

func (*Parser) Query added in v1.0.0

func (parser *Parser) Query(parameters map[string]interface{}) url.Values

func (*Parser) QueryWithStruct added in v1.0.3

func (parser *Parser) QueryWithStruct(parameters map[string]interface{}, structNames []string) url.Values

func (*Parser) SubstituteParameters added in v1.0.0

func (parser *Parser) SubstituteParameters(path string, parameters map[string]interface{}) string

func (*Parser) Url added in v1.0.0

func (parser *Parser) Url(path string, parameters map[string]interface{}) string

type TagAbstract added in v1.0.0

type TagAbstract struct {
	HttpClient *http.Client
	Parser     *Parser
}

type TokenStoreInterface

type TokenStoreInterface interface {
	Get() (AccessToken, error)
	Persist(token AccessToken) error
	Remove() error
}

Jump to

Keyboard shortcuts

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