Documentation ¶
Index ¶
- type AuthHandler
- type CreatePostRequest
- type CreatePostResponse
- type GetProfileResponse
- type PostHandler
- func (h *PostHandler) Create(w http.ResponseWriter, r *http.Request)
- func (h *PostHandler) GetFeed(w http.ResponseWriter, r *http.Request)
- func (h *PostHandler) GetPost(w http.ResponseWriter, r *http.Request)
- func (h *PostHandler) Like(w http.ResponseWriter, r *http.Request)
- func (h *PostHandler) Unlike(w http.ResponseWriter, r *http.Request)
- type RegisterUserResponse
- type RegisterUserToken
- type TokenRequest
- type UserHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthHandler ¶
AuthHandler provides functions to handle authentication of the platform, including registrations and logging in.
func NewAuthHandler ¶
func NewAuthHandler(users users.Client, auth auth.Client) *AuthHandler
NewAuthHandler returns a new instance of AuthHandler, taking the following parameters as dependencies.
func (*AuthHandler) Register ¶
func (h *AuthHandler) Register(w http.ResponseWriter, r *http.Request)
Register handles requests to register a user.
func (*AuthHandler) Token ¶
func (h *AuthHandler) Token(w http.ResponseWriter, r *http.Request)
Token is a http.HandlerFunc used to provider an access token for a user, with the credentials given by the TokenRequest body.
type CreatePostRequest ¶
type CreatePostRequest struct {
Caption string `json:"caption"`
}
CreatePostRequest is the body of the request.
type CreatePostResponse ¶
type CreatePostResponse struct {
ID string `json:"id"`
}
CreatePostResponse contains the reference id of the newly created post.
type GetProfileResponse ¶
GetProfileResponse returns a user's profile data.
type PostHandler ¶
PostHandler handles requests to the post domain.
func NewPostHandler ¶
func NewPostHandler(client posts.Client, media media.Client) *PostHandler
NewPostHandler returns a new instance of PostHandler.
func (*PostHandler) Create ¶
func (h *PostHandler) Create(w http.ResponseWriter, r *http.Request)
Create handles requests to create a post.
func (*PostHandler) GetFeed ¶
func (h *PostHandler) GetFeed(w http.ResponseWriter, r *http.Request)
GetFeed returns a user's feed.
func (*PostHandler) GetPost ¶
func (h *PostHandler) GetPost(w http.ResponseWriter, r *http.Request)
GetPost returns a post.
func (*PostHandler) Like ¶
func (h *PostHandler) Like(w http.ResponseWriter, r *http.Request)
Like marks a post as liked by the current user.
func (*PostHandler) Unlike ¶
func (h *PostHandler) Unlike(w http.ResponseWriter, r *http.Request)
Unlike marks a post as unliked by the current user.
type RegisterUserResponse ¶
type RegisterUserResponse struct { ReferenceID string `json:"referenceId"` Username string `json:"username"` AccessToken *RegisterUserToken `json:"accessToken"` }
RegisterUserResponse is the response body of the register request.
type RegisterUserToken ¶
RegisterUserToken represents a user's access token in the register user response body.
type TokenRequest ¶
TokenRequest is a type used to unmarshal a token request's body to.
type UserHandler ¶
UserHandler handles requests to the user domain.
func NewUserHandler ¶
NewUserHandler returns a new instance of UserHandler.
func (*UserHandler) Follow ¶
func (h *UserHandler) Follow(w http.ResponseWriter, r *http.Request)
Follow handles requests to make the current user follow the user with the given id.
func (*UserHandler) GetInfo ¶
func (h *UserHandler) GetInfo(w http.ResponseWriter, r *http.Request)
GetInfo handles requests to get information for a user.
func (*UserHandler) GetProfile ¶
func (h *UserHandler) GetProfile(w http.ResponseWriter, r *http.Request)
GetProfile handles requests to get a user's profile.
func (*UserHandler) Unfollow ¶
func (h *UserHandler) Unfollow(w http.ResponseWriter, r *http.Request)
Unfollow handles requests to make the current user unfollow the user with the given id.