sdkgen

package module
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: MIT Imports: 15 Imported by: 1

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

func HttpClientFactory(authenticator AuthenticatorInterface) *http.Client

func ToString

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

func (accessToken *AccessToken) GetExpiresInTimestamp() int64

type Anonymous

type Anonymous struct {
	CredentialsInterface
}

type AnonymousAuthenticator

type AnonymousAuthenticator struct {
}

func (*AnonymousAuthenticator) RoundTrip

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

type ApiKey

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

type ApiKeyAuthenticator

type ApiKeyAuthenticator struct {
	Credentials ApiKey
}

func (*ApiKeyAuthenticator) RoundTrip

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

type AuthenticatorInterface

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

func AuthenticatorFactory

func AuthenticatorFactory(credentials CredentialsInterface) (AuthenticatorInterface, error)

type ClientAbstract

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

func NewClient

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

type CredentialsInterface

type CredentialsInterface interface {
}

type FieldPart

type FieldPart struct {
	Name   string
	Reader io.Reader
}

type FilePart

type FilePart struct {
	Name     string
	FileName string
	Reader   io.Reader
}

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

type HttpBasicAuthenticator struct {
	Credentials HttpBasic
}

func (*HttpBasicAuthenticator) RoundTrip

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

type HttpBearer

type HttpBearer struct {
	CredentialsInterface
	Token string
}

type HttpBearerAuthenticator

type HttpBearerAuthenticator struct {
	Credentials HttpBearer
}

func (*HttpBearerAuthenticator) RoundTrip

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 Multipart

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

func (*Multipart) AddField

func (multi *Multipart) AddField(name string, reader io.Reader)

func (*Multipart) AddFile

func (multi *Multipart) AddFile(name string, fileName string, reader io.Reader)

func (*Multipart) Build

func (multi *Multipart) Build() *bytes.Buffer

func (*Multipart) GetContentType

func (multi *Multipart) GetContentType() string

type OAuth2

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

type OAuth2Authenticator

type OAuth2Authenticator struct {
	Credentials OAuth2
}

func (*OAuth2Authenticator) BuildRedirectUrl

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

func (*OAuth2Authenticator) FetchAccessTokenByClientCredentials

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

func (*OAuth2Authenticator) FetchAccessTokenByCode

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

func (*OAuth2Authenticator) FetchAccessTokenByRefresh

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

func (*OAuth2Authenticator) GetAccessToken

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

func (*OAuth2Authenticator) ParseTokenResponse

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

func (*OAuth2Authenticator) RoundTrip

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

type Parser

type Parser struct {
	BaseUrl string
}

func NewParser

func NewParser(baseUrl string) *Parser

func (*Parser) Contains

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

func (*Parser) Parse

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

func (*Parser) Query

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

func (*Parser) QueryWithStruct

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

func (*Parser) SubstituteParameters

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

func (*Parser) Url

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

type TagAbstract

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

type TokenStoreInterface

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

Directories

Path Synopsis
tests

Jump to

Keyboard shortcuts

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