Documentation ¶
Index ¶
- Constants
- func Ptr[T any](v T) *T
- type AuthConfig
- type AuthTransport
- type Client
- func (c *Client) CreatePost(ctx context.Context, input types.CreatePostInput) (ksuid.KSUID, error)
- func (c *Client) DeletePost(ctx context.Context, id ksuid.KSUID) (bool, error)
- func (c *Client) DeleteSession(ctx context.Context, id ksuid.KSUID) (bool, error)
- func (c *Client) ForgotPassword(ctx context.Context, input types.ForgotPasswordInput) (bool, error)
- func (c *Client) GetMe(ctx context.Context) (User, error)
- func (c *Client) GetPost(ctx context.Context, id ksuid.KSUID) (*types.Post, error)
- func (c *Client) GetSession(ctx context.Context, id ksuid.KSUID) (*types.Session, error)
- func (c *Client) GetSessionsEdges(ctx context.Context, sort types.SortOptions) ([]*types.SessionEdge, error)
- func (c *Client) GetSessionsNodes(ctx context.Context, sort types.SortOptions) ([]*types.Session, error)
- func (c *Client) GetTotalSessionsCount(ctx context.Context) (int, error)
- func (c *Client) GetTotalUserPostsCount(ctx context.Context, uid ksuid.KSUID) (int, error)
- func (c *Client) GetUser(ctx context.Context, id ksuid.KSUID) (User, error)
- func (c *Client) GetUserPostsEdges(ctx context.Context, uid ksuid.KSUID, sort types.SortOptions) ([]*types.PostEdge, error)
- func (c *Client) GetUserPostsNodes(ctx context.Context, uid ksuid.KSUID, sort types.SortOptions) ([]*types.Post, error)
- func (c *Client) MakeRequest(ctx context.Context, req *graphql.Request, resp *graphql.Response) error
- func (c *Client) RefreshToken(ctx context.Context, input types.SessionCredInput) (string, error)
- func (c *Client) SignIn(ctx context.Context, input types.SignInInput) (types.Tokens, error)
- func (c *Client) SignUp(ctx context.Context, input types.SignUpInput) (types.Tokens, error)
- func (c *Client) UpdatePost(ctx context.Context, input types.UpdatePostInput) (bool, error)
- type ClientConfig
- type DefaultClientLogger
- type DefaultTransport
- type Logger
- type TokenType
- type Transport
- type TransportType
- type User
Constants ¶
const ( // Durudex test API url. TestAPIEndpoint string = "https://api.test.durudex.com/query" // Default non-auth HTTP client transport type. DefaultTransportType TransportType = iota // Auth HTTP client transport type. AuthTransportType // Bearer authorization token type. BearerTokenType TokenType = "Bearer" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AuthConfig ¶
type AuthConfig struct { // Refresh token. Refresh string // Client secret key. Secret string // Authorization token type. TokenType TokenType // Refresh token TTL. RefreshTTL time.Duration }
Authorization client config.
type AuthTransport ¶
type AuthTransport struct {
// contains filtered or unexported fields
}
Auth client transport.
func (*AuthTransport) SetAccessToken ¶
func (t *AuthTransport) SetAccessToken(access string)
Sets authorization access token.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Durudex API client.
func (*Client) CreatePost ¶
Creating a new post.
func (*Client) DeletePost ¶
Deleting a post.
func (*Client) DeleteSession ¶
Deleting a user session.
func (*Client) ForgotPassword ¶
Forgot a user password.
func (*Client) GetSession ¶
Getting a user session.
func (*Client) GetSessionsEdges ¶
func (c *Client) GetSessionsEdges(ctx context.Context, sort types.SortOptions) ([]*types.SessionEdge, error)
Getting a user sessions edges.
func (*Client) GetSessionsNodes ¶
func (c *Client) GetSessionsNodes(ctx context.Context, sort types.SortOptions) ([]*types.Session, error)
Getting a user sessions nodes.
func (*Client) GetTotalSessionsCount ¶
Getting a total user sessions count.
func (*Client) GetTotalUserPostsCount ¶
Getting a total user posts count.
func (*Client) GetUserPostsEdges ¶
func (c *Client) GetUserPostsEdges(ctx context.Context, uid ksuid.KSUID, sort types.SortOptions) ([]*types.PostEdge, error)
Getting a user posts edges.
func (*Client) GetUserPostsNodes ¶
func (c *Client) GetUserPostsNodes(ctx context.Context, uid ksuid.KSUID, sort types.SortOptions) ([]*types.Post, error)
Getting a user posts nodes.
func (*Client) MakeRequest ¶
func (c *Client) MakeRequest(ctx context.Context, req *graphql.Request, resp *graphql.Response) error
Making a client request to GraphQL API.
func (*Client) RefreshToken ¶
Refresh authorization token.
func (*Client) UpdatePost ¶
Updating a post.
type ClientConfig ¶
type ClientConfig struct { // API endpoint. Endpoint string // HTTP client transport type. TransportType TransportType // HTTP client transport. Transport Transport // Authorization client config. AuthConfig *AuthConfig // Client logger. Logger Logger }
Durudex API client config.
type DefaultClientLogger ¶
type DefaultClientLogger struct{}
Default client logger.
func (*DefaultClientLogger) Debug ¶
func (l *DefaultClientLogger) Debug(msg string)
Debug client log message.
func (*DefaultClientLogger) Error ¶
func (l *DefaultClientLogger) Error(msg string)
Error client log message.
func (*DefaultClientLogger) Fatal ¶
func (l *DefaultClientLogger) Fatal(msg string)
Fatal client log message.
func (*DefaultClientLogger) Info ¶
func (l *DefaultClientLogger) Info(msg string)
Info client log message.
type DefaultTransport ¶
type DefaultTransport struct{}
Default non-auth client transport.
func NewDefaultTransport ¶
func NewDefaultTransport() *DefaultTransport
Creating a new default non-auth client transport.
func (*DefaultTransport) SetAccessToken ¶
func (t *DefaultTransport) SetAccessToken(access string)
Sets authorization access token.
type Logger ¶
type Logger interface { // Debug client log message. Debug(msg string) // Info client log message. Info(msg string) // Error client log message. Error(msg string) // Fatal client log message. Fatal(msg string) }
Durudex client logger interface.
var DefaultLogger Logger = &DefaultClientLogger{}
Default client logger.
type Transport ¶
type Transport interface { http.RoundTripper // Sets authorization access token. SetAccessToken(access string) }
Client transport interface.
type User ¶
User type.
func (User) GetPostsEdges ¶
Getting a user posts edges.
func (User) GetPostsNodes ¶
Getting a user posts nodes.