Documentation ¶
Index ¶
- type Controller
- func (mc *Controller) AcceptFollow(c *fiber.Ctx) error
- func (mc *Controller) Ban(c *fiber.Ctx) error
- func (mc *Controller) CancelFollowRequest(c *fiber.Ctx) error
- func (mc *Controller) Check(c *fiber.Ctx) error
- func (mc *Controller) Export(c *fiber.Ctx) error
- func (mc *Controller) Follow(c *fiber.Ctx) error
- func (mc *Controller) FollowStatus(c *fiber.Ctx) error
- func (mc *Controller) GetFollowRequests(c *fiber.Ctx) error
- func (mc *Controller) GetFollowers(c *fiber.Ctx) error
- func (mc *Controller) GetID(c *fiber.Ctx) error
- func (mc *Controller) GetMemberByNickOrEmail(c *fiber.Ctx) error
- func (mc *Controller) GetMemberByWebfinger(c *fiber.Ctx) error
- func (mc *Controller) RejectFollow(c *fiber.Ctx) error
- func (mc *Controller) Unban(c *fiber.Ctx) error
- func (mc *Controller) Unfollow(c *fiber.Ctx) error
- func (mc *Controller) Update(c *fiber.Ctx) (err error)
- func (mc *Controller) UpdatePrefs(c *fiber.Ctx) error
- type IController
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Controller ¶ added in v0.9.13
type Controller struct {
// contains filtered or unexported fields
}
Controller is the controller for member endpoints
func NewController ¶
func (*Controller) AcceptFollow ¶ added in v0.9.13
func (mc *Controller) AcceptFollow(c *fiber.Ctx) error
@Summary Accept a follow request @Description Accept a follow request @Param Authorization header string true "The accepter's JWT" @Param id body int64 true "The ID of the follow request" @Accept json @Success 200 {object} h.ResponseHTTP{} @Failure 400 {object} h.ResponseHTTP{} @Failure 401 {object} h.ResponseHTTP{} @Failure 404 {object} h.ResponseHTTP{} @Failure 500 {object} h.ResponseHTTP{} @Router /members/follow/requests/in/{id} [put]
func (*Controller) Ban ¶ added in v0.9.13
func (mc *Controller) Ban(c *fiber.Ctx) error
@Summary Ban user @Description issues a ban to a user with the given UUID @Tags members,accounts,administration @Accept json @Produce json @Param uuid path string true "UUID of the member to ban" @Param input body member.BanInput true "Ban details" @Param X-CSRF-Token header string true "X-CSRF-Token header" @Success 200 {object} h.ResponseHTTP{} @Failure 400 {object} h.ResponseHTTP{} @Failure 400 {object} h.ResponseHTTP{} @Failure 500 {object} h.ResponseHTTP{} @Router /members/{uuid}/ban [post]
func (*Controller) CancelFollowRequest ¶ added in v0.9.13
func (mc *Controller) CancelFollowRequest(c *fiber.Ctx) error
@Summary Cancel a follow request @Description Cancel a sent follow request if it's pending @Param Authorization header string true "The requester's JWT" @Param X-CSRF-Token header string true "The CSRF token" @Param id path int64 true "The ID of the follow request" @Accept json @Success 200 {object} h.ResponseHTTP{} @Failure 400 {object} h.ResponseHTTP{} @Failure 401 {object} h.ResponseHTTP{} @Failure 404 {object} h.ResponseHTTP{} @Failure 500 {object} h.ResponseHTTP{} @Router /members/follow/requests/out/{id} [delete]
func (*Controller) Check ¶ added in v0.9.13
func (mc *Controller) Check(c *fiber.Ctx) error
check checks for the existence of a member it requires both nickname and email to be provided
func (*Controller) Export ¶ added in v0.9.13
func (mc *Controller) Export(c *fiber.Ctx) error
@Summary Export all of the member's data @Description Exports the data of a member, including profile information as well as other related data such as reviews @Tags accounts,members,metadata @Accept json @Produce json text/csv @Param Authorization header string true "JWT access token" @Param format path string true "Export format" Enums(json, csv) @Router /members/export/{format} [get]
func (*Controller) Follow ¶ added in v0.9.13
func (mc *Controller) Follow(c *fiber.Ctx) error
@Summary Send a follow request to a member (user) @Description Send a follow request to another user. If the user has automatic follow request acceptance @Description enabled, the follow request will be accepted immediately. @Param Authorization header string true "The requester's JWT. Contains encrypted claims to the webfinger" @Param followee body string true "The webfinger of the member to follow" @Param notify body bool false "Receive notifications for all content created by the followee" @Param reblogs body bool true "Show this account's reblogs in home timeline" @Accept json @Success 200 {object} h.ResponseHTTP{data=member.FollowResponse} @Success 204 {object} h.ResponseHTTP{} "When the followee is already followed" @Failure 400 {object} h.ResponseHTTP{} @Failure 401 {object} h.ResponseHTTP{} @Failure 404 {object} h.ResponseHTTP{} @Failure 403 {object} h.ResponseHTTP{} "When at least one party blocks the other" @Failure 500 {object} h.ResponseHTTP{} @Router /members/follow [post]
func (*Controller) FollowStatus ¶ added in v0.9.13
func (mc *Controller) FollowStatus(c *fiber.Ctx) error
@Summary Check if a member is followed @Description Check if a member is followed by the request initiator @Param Authorization header string true "The follower's JWT" @Param followee_webfinger path string true "The webfinger of the member to check" @Accept json @Produce json @Success 200 {object} h.ResponseHTTP{data=member.FollowResponse} @Failure 400 {object} h.ResponseHTTP{} @Failure 401 {object} h.ResponseHTTP{} @Failure 404 {object} h.ResponseHTTP{} @Failure 500 {object} h.ResponseHTTP{} @Router /members/follow/status/{followee_webfinger} [get]
func (*Controller) GetFollowRequests ¶ added in v0.9.13
func (mc *Controller) GetFollowRequests(c *fiber.Ctx) error
@Summary Get follow requests @Description Get own received follow requests or sent follow requests @Param Authorization header string true "The JWT of the member. Contains encrypted claims to webfinger" @Param type path string true "Which follow requests should be looked up" Enums(sent, received, all) @Accept json @Success 200 {object} h.ResponseHTTP{data=[]int64} @Failure 400 {object} h.ResponseHTTP{} @Failure 401 {object} h.ResponseHTTP{} @Failure 404 {object} h.ResponseHTTP{} @Failure 500 {object} h.ResponseHTTP{} @Router /members/follow/requests [get]
func (*Controller) GetFollowers ¶ added in v0.9.13
func (mc *Controller) GetFollowers(c *fiber.Ctx) error
func (*Controller) GetID ¶ added in v0.9.13
func (mc *Controller) GetID(c *fiber.Ctx) error
func (*Controller) GetMemberByNickOrEmail ¶ added in v0.9.13
func (mc *Controller) GetMemberByNickOrEmail(c *fiber.Ctx) error
@Summary Get a member (user) by nickname or email @Description Retrieve the information the requester is allowed to see about a member @Tags accounts,interactions,metadata @Param email_or_username path string true "The nickname or email of the member to get" @Accept json application/activity+json @Success 200 {object} h.ResponseHTTP{data=member.Member} @Failure 401 {object} h.ResponseHTTP{} "When certain access prerequisites are not met, e.g. a follower's only-visible metadata is requested" @Failure 404 {object} h.ResponseHTTP{} @Failure 500 {object} h.ResponseHTTP{} @Router /members/{email_or_username}/info [get]
func (*Controller) GetMemberByWebfinger ¶ added in v0.9.13
func (mc *Controller) GetMemberByWebfinger(c *fiber.Ctx) error
func (*Controller) RejectFollow ¶ added in v0.9.13
func (mc *Controller) RejectFollow(c *fiber.Ctx) error
@Summary Reject a follow request @Description Reject a follow request @Param Authorization header string true "The rejecter's JWT" @Param follower body string true "The webfinger of the member who requested to follow" @Param id path int64 true "The ID of the follow request" @Accept json @Success 200 {object} h.ResponseHTTP{} @Failure 400 {object} h.ResponseHTTP{} @Failure 401 {object} h.ResponseHTTP{} @Failure 404 {object} h.ResponseHTTP{} @Failure 500 {object} h.ResponseHTTP{} @Router /members/follow/requests/in/{id} [delete]
func (*Controller) Unban ¶ added in v0.9.13
func (mc *Controller) Unban(c *fiber.Ctx) error
@Summary Unban user @Description removes a ban from a user with the given UUID @Tags members,accounts,administration @Accept json @Produce json @Param uuid path string true "UUID of the member to unban" @Param X-CSRF-Token header string true "X-CSRF-Token header" @Success 200 {object} h.ResponseHTTP{} @Success 202 {object} h.ResponseHTTP{} "When " @Failure 400 {object} h.ResponseHTTP{} @Failure 401 {object} h.ResponseHTTP{} @Failure 500 {object} h.ResponseHTTP{} @Router /members/{uuid}/ban [delete]
func (*Controller) Unfollow ¶ added in v0.9.13
func (mc *Controller) Unfollow(c *fiber.Ctx) error
@Summary Unfollow a member @Description Unfollow a member or remove follower @Param Authorization header string true "The follower's JWT" @Param target body string true "The webfinger of the member to unfollow" @Accept json @Success 200 {object} h.ResponseHTTP{} @Failure 400 {object} h.ResponseHTTP{} @Failure 401 {object} h.ResponseHTTP{} @Failure 404 {object} h.ResponseHTTP{} @Failure 500 {object} h.ResponseHTTP{} @Router /members/follow [delete]
func (*Controller) Update ¶ added in v0.9.13
func (mc *Controller) Update(c *fiber.Ctx) (err error)
UpdateMember handles the updating of user information @Summary Update member information @Tags accounts,metadata,updating @Description Handle updating those member properties that can be exposed publicly, i.e. not settings @Accept multipart/form-data json @Param member_name path string true "The nickname of the member being updated" @Param Authorization header string true "The JWT token" @Param X-CSRF-Token header string true "CSRF token" @Param profile_pic_id query int64 false "ID of the picture that is returned after making a request to /api/upload/image" @Success 200 {object} h.ResponseHTTP{} @Failure 400 {object} h.ResponseHTTP{} @Failure 500 {object} h.ResponseHTTP{} @Router /update/{member_name} [patch]
func (*Controller) UpdatePrefs ¶ added in v0.9.13
func (mc *Controller) UpdatePrefs(c *fiber.Ctx) error
UpdatePrefs handles the updating of user preferences @Summary Update member preferences @Description Handle updating private member preferences @Tags accounts,updating,settings @Accept json multipart/form-data @Param member_name path string true "The nickname of the member being updated" @Param Authorization header string true "The JWT token" @Param X-CSRF-Token header string true "CSRF token" @Param locale formData string false "The ISO 639-1 locale to use" @Param rating_scale_lower formData int16 false "The lower bound of the rating scale" minimum(0) maximum(100) @Param rating_scale_upper formData int16 false "The upper bound of the rating scale" minimum(2) maximum(100) @Param message_autohide_words formData []string false "A comma-separated list of words to autohide in messages" @Param muted_instances formData []string false "A comma-separated list of instance domains to mute" @Param auto_accept_follow formData bool false "Whether to automatically accept follow requests" @Param locally_searchable formData bool false "Whether to allow local searches" @Param federated_searchable formData bool false "Whether to allow federated searches" @Param robots_searchable formData bool false "Whether to allow robots to index the profile" @Success 200 {object} h.ResponseHTTP{} @Failure 400 {object} h.ResponseHTTP{} @Failure 500 {object} h.ResponseHTTP{} @Router /update/{member_name}/preferences [patch]
type IController ¶ added in v0.9.13
type IController interface { GetMember(c *fiber.Ctx) error UpdateMember(c *fiber.Ctx) error DeleteMember(c *fiber.Ctx) error }
IController is the interface for the member controller It defines the methods that the member controller must implement This is useful for mocking the member controller in unit tests