Documentation
¶
Index ¶
- func NotAllowed(c *gin.Context)
- func NotFound(c *gin.Context)
- type APIv1
- func (s *APIv1) AppCreate(ctx context.Context, in *App) (out *App, err error)
- func (s *APIv1) AppDelete(ctx context.Context, id string) (err error)
- func (s *APIv1) AppDetail(ctx context.Context, id string) (out *App, err error)
- func (s *APIv1) AppList(ctx context.Context, in *AppQuery) (out *AppPage, err error)
- func (s *APIv1) Do(req *http.Request, data interface{}, checkStatus bool) (rep *http.Response, 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) SignUp(ctx context.Context, in *ContactInfo) (err error)
- func (s *APIv1) Status(ctx context.Context) (out *StatusReply, err error)
- func (s *APIv1) TopicCreate(ctx context.Context, in *Topic) (out *Topic, err error)
- func (s *APIv1) TopicDelete(ctx context.Context, id string) (err error)
- func (s *APIv1) TopicDetail(ctx context.Context, id string) (out *Topic, err error)
- func (s *APIv1) TopicList(ctx context.Context, in *TopicQuery) (out *TopicPage, err error)
- func (s *APIv1) UserCreate(ctx context.Context, in *User) (out *User, err error)
- func (s *APIv1) UserDelete(ctx context.Context, id string) (err error)
- func (s *APIv1) UserDetail(ctx context.Context, id string) (out *User, err error)
- func (s *APIv1) UserList(ctx context.Context, in *UserQuery) (out *UserPage, err error)
- func (s *APIv1) UserUpdate(ctx context.Context, in *User) (out *User, err error)
- type App
- type AppPage
- type AppQuery
- type ClientOption
- type ContactInfo
- type Reply
- type StatusReply
- type TenantClient
- type Topic
- type TopicPage
- type TopicQuery
- type User
- type UserPage
- type UserQuery
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 TenantClient interface
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 response data into the specified struct.
func (*APIv1) NewRequest ¶
func (*APIv1) TopicCreate ¶
func (*APIv1) TopicDetail ¶
func (*APIv1) UserCreate ¶
func (*APIv1) UserDetail ¶
type ClientOption ¶
ClientOptions allows us to configure the APIv1 client when it is created.
func WithClient ¶
func WithClient(client *http.Client) ClientOption
type ContactInfo ¶
type ContactInfo struct {
FirstName string `json:"firstName"`
LastName string `json:"lastName"`
Email string `json:"email"`
Country string `json:"country"`
Title string `json:"title"`
Organization string `json:"organization"`
}
ContactInfo allows users to sign up for email notifications from SendGrid and is specifically used to allow users to request Ensign Private Beta access.
type Reply ¶
Reply contains standard fields that are used for generic API responses and errors.
func ErrorResponse ¶
func ErrorResponse(err interface{}) Reply
Constructs a new response for an error or returns unsuccessful.
type StatusReply ¶
type StatusReply struct {
Status string `json:"status"`
Uptime string `json:"uptime,omitempty"`
Version string `json:"version,omitempty"`
}
Returned on status requests.
type TenantClient ¶
type TenantClient interface {
Status(context.Context) (*StatusReply, error)
SignUp(context.Context, *ContactInfo) error
UserList(context.Context, *UserQuery) (*UserPage, error)
UserCreate(context.Context, *User) (*User, error)
UserDetail(ctx context.Context, id string) (*User, error)
UserUpdate(context.Context, *User) (*User, error)
UserDelete(ctx context.Context, id string) error
AppList(context.Context, *AppQuery) (*AppPage, error)
AppCreate(context.Context, *App) (*App, error)
AppDetail(ctx context.Context, id string) (*App, error)
AppDelete(ctx context.Context, id string) error
TopicList(context.Context, *TopicQuery) (*TopicPage, error)
TopicCreate(context.Context, *Topic) (*Topic, error)
TopicDetail(ctx context.Context, id string) (*Topic, error)
TopicDelete(ctx context.Context, id string) error
}
func New ¶
func New(endpoint string, opts ...ClientOption) (_ TenantClient, err error)
New creates a new API v1 client that implements the Tenant Client interface.