Documentation
¶
Index ¶
- func NotAllowed(c *gin.Context)
- func NotFound(c *gin.Context)
- type APIv1
- func (s *APIv1) CreateReading(ctx context.Context, in *Reading) (out *Reading, err error)
- func (s *APIv1) DeleteReading(ctx context.Context, id int64) (err error)
- func (s *APIv1) Do(req *http.Request, data interface{}, checkStatus bool) (rep *http.Response, err error)
- func (s *APIv1) FetchReading(ctx context.Context, id int64) (out *Reading, err error)
- func (s *APIv1) ListReadings(ctx context.Context, in *PageQuery) (out *ReadingPage, err error)
- func (s *APIv1) Login(ctx context.Context, in *LoginRequest) (out *LoginReply, err error)
- func (s *APIv1) Logout(ctx context.Context) (err error)
- func (s *APIv1) NewRequest(ctx context.Context, method, path string, data interface{}, params *url.Values) (req *http.Request, err error)
- func (s *APIv1) Register(ctx context.Context, in *RegisterRequest) (err error)
- func (s *APIv1) Status(ctx context.Context) (out *StatusReply, err error)
- func (s *APIv1) UpdateReading(ctx context.Context, in *Reading) (out *Reading, err error)
- type EpistolaryClient
- type LoginReply
- type LoginRequest
- type OpenIDConfiguration
- type PageQuery
- type Reading
- type ReadingPage
- type RegisterRequest
- type Reply
- type StatusReply
- type Timestamp
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NotAllowed ¶
NotAllowed returns a JSON 405 response for the API.
Types ¶
type APIv1 ¶
type APIv1 struct {
// contains filtered or unexported fields
}
APIv1 implements the EpistolaryClient interface.
func (*APIv1) CreateReading ¶
func (*APIv1) DeleteReading ¶
func (*APIv1) Do ¶
func (s *APIv1) Do(req *http.Request, data interface{}, checkStatus bool) (rep *http.Response, err error)
Do executes an http request against the server, performs error checking, and deserializes the response data into the specified struct if requested.
func (*APIv1) FetchReading ¶
func (*APIv1) ListReadings ¶
func (*APIv1) Login ¶
func (s *APIv1) Login(ctx context.Context, in *LoginRequest) (out *LoginReply, err error)
func (*APIv1) NewRequest ¶
func (s *APIv1) NewRequest(ctx context.Context, method, path string, data interface{}, params *url.Values) (req *http.Request, err error)
NewRequest creates an http.Request with the specified context and method, resolving the path to the root endpoint of the API (e.g. /v1) and serializes the data to JSON. This method also sets the default headers of all Persona v1 client requests.
type EpistolaryClient ¶
type EpistolaryClient interface {
Register(context.Context, *RegisterRequest) error
Login(context.Context, *LoginRequest) (*LoginReply, error)
Logout(context.Context) error
Status(context.Context) (*StatusReply, error)
ListReadings(context.Context, *PageQuery) (*ReadingPage, error)
CreateReading(context.Context, *Reading) (*Reading, error)
FetchReading(_ context.Context, id int64) (*Reading, error)
UpdateReading(context.Context, *Reading) (*Reading, error)
DeleteReading(_ context.Context, id int64) error
}
func New ¶
func New(endpoint string) (_ EpistolaryClient, err error)
New creates a new api.v1 API client that implements the EpistolaryClient interface.
type LoginReply ¶
type LoginRequest ¶
type OpenIDConfiguration ¶
type OpenIDConfiguration struct {
Issuer string `json:"issuer"`
AuthorizationEP string `json:"authorization_endpoint"`
TokenEP string `json:"token_endpoint"`
DeviceAuthorizationEP string `json:"device_authorization_endpoint"`
UserInfoEP string `json:"userinfo_endpoint"`
MFAChallengeEP string `json:"mfa_challenge_endpoint"`
JWKSURI string `json:"jwks_uri"`
RegistrationEP string `json:"registration_endpoint"`
RevocationEP string `json:"revocation_endpoint"`
ScopesSupported []string `json:"scopes_supported"`
ResponseTypesSupported []string `json:"response_types_supported"`
CodeChallengeMethodsSupported []string `json:"code_challenge_methods_supported"`
ResponseModesSupported []string `json:"response_modes_supported"`
SubjectTypesSupported []string `json:"subject_types_supported"`
IDTokenSigningAlgValues []string `json:"id_token_signing_alg_values_supported"`
TokenEndpointAuthMethods []string `json:"token_endpoint_auth_methods_supported"`
ClaimsSupported []string `json:"claims_supported"`
RequestURIParameterSupported bool `json:"request_uri_parameter_supported"`
}
type PageQuery ¶
type PageQuery struct {
PageSize uint64 `url:"page_size,omitempty" form:"page_size" json:"page_size,omitempty"`
PageToken string `url:"page_token,omitempty" form:"page_token" json:"page_token,omitempty"`
}
PageQuery allows the user to request the next or previous page from a given cursor.
type Reading ¶
type Reading struct {
ID int64 `json:"id,omitempty"`
Status string `json:"status,omitempty"`
Link string `json:"link"`
Title string `json:"title,omitempty"`
Description string `json:"description,omitempty"`
Favicon string `json:"favicon,omitempty"`
Started Timestamp `json:"started,omitempty"`
Finished Timestamp `json:"finished,omitempty"`
Archived Timestamp `json:"archived,omitempty"`
Created Timestamp `json:"created,omitempty"`
Modified Timestamp `json:"modified,omitempty"`
}
type ReadingPage ¶
type RegisterRequest ¶
type Reply ¶
type Reply struct {
Success bool `json:"success"`
Error string `json:"error,omitempty" yaml:"error,omitempty"`
}
Reply contains standard fields that are used for generic API responses and errors.
func ErrorResponse ¶
func ErrorResponse(err interface{}) Reply
ErrorResponse constructs an new response from the error or returns a success: false.
type StatusReply ¶
type StatusReply struct {
Status string `json:"status"`
Uptime string `json:"uptime,omitempty"`
Version string `json:"version,omitempty"`
}
StatusReply is returned on status requests. Note that no request is needed.