Documentation
¶
Overview ¶
Package client implements the minimal Ghostfolio HTTP boundary used by this sync-and-storage slice. Authored by: OpenCode
Index ¶
- type Client
- func (c *Client) Authenticate(ctx context.Context, origin string, accessToken string) (dto.AuthResponse, error)
- func (c *Client) FetchActivitiesHistory(ctx context.Context, origin string, authToken string) (dto.ActivityPageResponse, error)
- func (c *Client) FetchUser(ctx context.Context, origin string, authToken string) (dto.UserResponse, error)
- type FailureCategory
- type RequestFailure
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client executes the Ghostfolio auth and activities-history requests for this slice.
Authored by: OpenCode
func New ¶
New creates a Ghostfolio API client backed by the provided HTTP client.
Example:
transportClient := client.New(http.DefaultClient) _ = transportClient
Authored by: OpenCode
func (*Client) Authenticate ¶
func (c *Client) Authenticate(ctx context.Context, origin string, accessToken string) (dto.AuthResponse, error)
Authenticate executes the anonymous-auth boundary for this slice.
Example:
response, err := transportClient.Authenticate(ctx, "https://ghostfol.io", "token")
if err != nil {
panic(err)
}
_ = response.AuthToken
Authored by: OpenCode
func (*Client) FetchActivitiesHistory ¶
func (c *Client) FetchActivitiesHistory( ctx context.Context, origin string, authToken string, ) (dto.ActivityPageResponse, error)
FetchActivitiesHistory executes the paginated activities retrieval boundary for this slice.
Example:
response, err := transportClient.FetchActivitiesHistory(ctx, "https://ghostfol.io", "jwt")
if err != nil {
panic(err)
}
_ = len(response.Activities)
Authored by: OpenCode
func (*Client) FetchUser ¶
func (c *Client) FetchUser(ctx context.Context, origin string, authToken string) (dto.UserResponse, error)
FetchUser executes the authenticated user boundary for this slice.
Example:
response, err := transportClient.FetchUser(ctx, "https://ghostfol.io", "jwt")
if err != nil {
panic(err)
}
_ = response.Settings
Authored by: OpenCode
type FailureCategory ¶
type FailureCategory string
FailureCategory identifies one Ghostfolio boundary failure class without embedding application outcome wording.
Authored by: OpenCode
const ( // FailureRejectedToken indicates that the anonymous-auth boundary rejected the // supplied token. FailureRejectedToken FailureCategory = "auth_rejected" // FailureTimeout indicates that the Ghostfolio request exceeded its runtime // deadline before a boundary response was available. FailureTimeout FailureCategory = "deadline_exceeded" // FailureConnectivityProblem indicates that a transport-level reachability // problem prevented the request from completing. FailureConnectivityProblem FailureCategory = "transport_error" // FailureUnsuccessfulServerResponse indicates a reachable server returned a // non-success HTTP response that does not prove contract incompatibility. FailureUnsuccessfulServerResponse FailureCategory = "unexpected_http_status" // FailureIncompatibleServerContract indicates that a reachable server returned // unsupported or contradictory contract behavior. FailureIncompatibleServerContract FailureCategory = "contract_incompatible" )
type RequestFailure ¶
type RequestFailure struct {
Category FailureCategory
Operation string
StatusCode int
Detail string
Err error
}
RequestFailure captures structured Ghostfolio boundary failure data without exposing secrets or raw payload details.
Authored by: OpenCode
func (*RequestFailure) Error ¶
func (e *RequestFailure) Error() string
Error returns the safe error string for the categorized request failure.
Example:
err := &client.RequestFailure{Category: client.FailureTimeout, Detail: "ghostfolio request deadline exceeded"}
_ = err.Error()
Authored by: OpenCode
func (*RequestFailure) Unwrap ¶
func (e *RequestFailure) Unwrap() error
Unwrap returns the underlying cause for the categorized request failure.
Example:
err := &client.RequestFailure{Err: context.DeadlineExceeded}
_ = err.Unwrap()
Authored by: OpenCode