Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithBearerTokenContext ¶ added in v0.0.2
func WithBearerTokenContext(ctx context.Context, bearerToken *BearerToken) context.Context
WithBearerTokenContext returns a new context with the provided BearerToken.
Types ¶
type BasicAuth ¶
type BasicAuth struct {
// contains filtered or unexported fields
}
BasicAuth represents a basic authentication session for the Teamwork API.
func NewBasicAuth ¶
NewBasicAuth creates a new BasicAuth session with the provided username and password. The server parameter must identify the Teamwork installation, such as "https://yourcompany.teamwork.com".
func (*BasicAuth) Authenticate ¶
Authenticate implements the Session interface for BasicAuth.
type BearerToken ¶
type BearerToken struct {
// contains filtered or unexported fields
}
BearerToken represents a session for the Teamwork API using Bearer Token authentication. It implements the Session interface, allowing it to be used with the Teamwork Engine for authenticated requests.
func NewBearerToken ¶
func NewBearerToken(token string, server string) *BearerToken
NewBearerToken creates a new BearerToken session with the provided token. The server parameter must identify the Teamwork installation, such as "https://yourcompany.teamwork.com".
func (*BearerToken) Authenticate ¶
Authenticate implements the Session interface for BearerToken.
func (*BearerToken) Server ¶
func (b *BearerToken) Server() string
Server returns the server URL for the BearerToken session.
type BearerTokenContext ¶ added in v0.0.2
type BearerTokenContext struct{}
BearerTokenContext represents a session that uses a bearer token for authentication extracted from the context. It's possible to inject the token into the context using the WithBearerTokenContext function.
func NewBearerTokenContext ¶ added in v0.0.2
func NewBearerTokenContext() *BearerTokenContext
NewBearerTokenContext creates a new BearerTokenContext instance.
func (*BearerTokenContext) Authenticate ¶ added in v0.0.2
Authenticate implements the Session interface for BearerTokenContext.
func (*BearerTokenContext) Server ¶ added in v0.0.2
func (b *BearerTokenContext) Server() string
Server returns the server URL for the BearerTokenContext session. This is a dummy implementation since it's not accessible at this point.
type Cookie ¶
type Cookie struct {
// contains filtered or unexported fields
}
Cookie represents a session for the Teamwork API using cookie-based authentication. It implements the Session interface, allowing it to be used with the Teamwork Engine for authenticated requests.
func NewCookie ¶
NewCookie creates a new Cookie session with the provided value. The server parameter must identify the Teamwork installation, such as "https://yourcompany.teamwork.com".
func (*Cookie) Authenticate ¶
Authenticate implements the Session interface for Cookie.
type OAuth2 ¶
type OAuth2 struct {
// contains filtered or unexported fields
}
OAuth2 represents a session for the Teamwork API using OAuth2 authentication. It implements the Session interface, allowing it to be used with the Teamwork Engine for authenticated requests.
func NewOAuth2 ¶
func NewOAuth2(clientID, clientSecret string, opts ...OAuth2Option) *OAuth2
NewOAuth2 creates a new OAuth2 session with the provided client ID and client secret.
func (*OAuth2) Authenticate ¶
Authenticate implements the Session interface for OAuth2.
type OAuth2Option ¶
type OAuth2Option func(*OAuth2)
OAuth2Option defines a function type that can modify the OAuth2 initial configuration.
func WithOAuth2CallbackServerAddr ¶
func WithOAuth2CallbackServerAddr(host string) OAuth2Option
WithOAuth2CallbackServerAddr sets the OAuth2 callback host. By default, it uses "localhost:0", which means the callback will be handled on a random port on localhost.
func WithOAuth2Client ¶
func WithOAuth2Client(client *http.Client) OAuth2Option
WithOAuth2Client sets the HTTP client for the OAuth2 session. By default, it uses http.DefaultClient.
func WithOAuth2Logger ¶
func WithOAuth2Logger(logger *slog.Logger) OAuth2Option
WithOAuth2Logger sets the logger for the OAuth2 session. If not set, it uses a default logger that writes to the standard output.
func WithOAuth2Server ¶
func WithOAuth2Server(server string) OAuth2Option
WithOAuth2Server sets the OAuth2 authorization server URL. By default, it uses "https://teamwork.com".