Documentation
¶
Overview ¶
Package n26api provides N26 API client.
Index ¶
- Constants
- Variables
- type Client
- type CredentialsProvider
- type InMemoryTokenStorage
- type Option
- func WithBaseURL(baseURL string) Option
- func WithClock(clock clock.Clock) Option
- func WithCredentials(username string, password string) Option
- func WithCredentialsProvider(provider CredentialsProvider) Option
- func WithCredentialsProviderAtLast(provider CredentialsProvider) Option
- func WithDeviceID(deviceID uuid.UUID) Option
- func WithMFATimeout(timeout time.Duration) Option
- func WithMFAWait(waitTime time.Duration) Option
- func WithPassword(password string) Option
- func WithTimeout(timeout time.Duration) Option
- func WithTokenProvider(provider auth.TokenProvider) Option
- func WithTokenStorage(storage auth.TokenStorage) Option
- func WithTransactionsPageSize(limit int64) Option
- func WithUsername(username string) Option
- type RoundTripperFunc
Constants ¶
const ( // BaseURL is N26 API Base URL. BaseURL = api.DefaultBaseURL // DefaultPageSize is the default page size while requesting to N26. DefaultPageSize int64 = 50 )
Variables ¶
var ( // ErrUsernameIsEmpty indicates that the username is empty. ErrUsernameIsEmpty = errors.New("missing username") // ErrPasswordIsEmpty indicates that the username is empty. ErrPasswordIsEmpty = errors.New("missing password") )
var ErrTokenKeyEmpty = errors.New("token key is empty")
ErrTokenKeyEmpty indicates that the key of token is empty and we can not persist that.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides all N26 APIs.
func (*Client) FindAllTransactionsInRange ¶
func (c *Client) FindAllTransactionsInRange(ctx context.Context, from time.Time, to time.Time) ([]transaction.Transaction, error)
FindAllTransactionsInRange finds all transactions in a time period.
type CredentialsProvider ¶
type CredentialsProvider interface { // Username provides a username. Username() string // Password provides a password. Password() string }
CredentialsProvider provides username and password for authentication.
func Credentials ¶
func Credentials(username string, password string) CredentialsProvider
Credentials initiates a new credentials provider.
func CredentialsFromEnv ¶
func CredentialsFromEnv() CredentialsProvider
CredentialsFromEnv initiates a new credentials provider.
type InMemoryTokenStorage ¶ added in v0.1.1
type InMemoryTokenStorage struct {
// contains filtered or unexported fields
}
InMemoryTokenStorage persists auth.OAuthToken into its memory.
func NewInMemoryTokenStorage ¶ added in v0.1.1
func NewInMemoryTokenStorage() *InMemoryTokenStorage
NewInMemoryTokenStorage initiates a new InMemoryTokenStorage.
func (*InMemoryTokenStorage) Get ¶ added in v0.1.1
func (s *InMemoryTokenStorage) Get(_ context.Context, key string) (auth.OAuthToken, error)
Get gets OAuthToken from memory.
func (*InMemoryTokenStorage) Set ¶ added in v0.1.1
func (s *InMemoryTokenStorage) Set(_ context.Context, key string, token auth.OAuthToken) error
Set sets OAuthToken to memory.
type Option ¶
type Option func(c *Client)
Option configures Client.
func WithCredentials ¶
WithCredentials sets username and password to login.
func WithCredentialsProvider ¶
func WithCredentialsProvider(provider CredentialsProvider) Option
WithCredentialsProvider chains a new credentials provider.
func WithCredentialsProviderAtLast ¶ added in v0.2.1
func WithCredentialsProviderAtLast(provider CredentialsProvider) Option
WithCredentialsProviderAtLast chains a new credentials provider at last position.
func WithDeviceID ¶
WithDeviceID sets device ID to login.
func WithMFATimeout ¶
WithMFATimeout sets the MFA Timeout for authentication.
func WithMFAWait ¶
WithMFAWait sets the MFA Wait Time for authentication.
func WithTokenProvider ¶
func WithTokenProvider(provider auth.TokenProvider) Option
WithTokenProvider chains a new token provider.
func WithTokenStorage ¶ added in v0.1.1
func WithTokenStorage(storage auth.TokenStorage) Option
WithTokenStorage sets token storage for the internal apiTokenProvider.
func WithTransactionsPageSize ¶
WithTransactionsPageSize sets page size limit for finding transactions.
type RoundTripperFunc ¶
RoundTripperFunc is an inline http.RoundTripper.
func BasicAuthRoundTripper ¶
func BasicAuthRoundTripper(username, password string, tripper http.RoundTripper) RoundTripperFunc
BasicAuthRoundTripper sets Basic Authorization header to the given request.
func BearerAuthRoundTripper ¶
func BearerAuthRoundTripper(token string, tripper http.RoundTripper) RoundTripperFunc
BearerAuthRoundTripper sets Bearer Authorization header to the given request.
func TokenRoundTripper ¶
func TokenRoundTripper(p auth.TokenProvider, tripper http.RoundTripper) RoundTripperFunc
TokenRoundTripper sets Bearer Authorization header to the given request with a token given by a auth.TokenProvider.
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
internal
|
|
api
Package api contains autogenerated REST client.
|
Package api contains autogenerated REST client. |
pkg
|
|
auth
Package auth provides contracts for N26 authentication.
|
Package auth provides contracts for N26 authentication. |
testkit
Package testkit provides functionalities for testing N26 APIs.
|
Package testkit provides functionalities for testing N26 APIs. |
testkit/auth
Package auth provides functionalities for testing N26 authentication.
|
Package auth provides functionalities for testing N26 authentication. |
testkit/transaction
Package transaction provides functionalities for testing N26 Transaction APIs.
|
Package transaction provides functionalities for testing N26 Transaction APIs. |
transaction
Package transaction provides contracts for N26 Transaction APIs.
|
Package transaction provides contracts for N26 Transaction APIs. |
util
Package util provides additional helpers.
|
Package util provides additional helpers. |