Compare commits

..

No commits in common. "61030d84a10a757b488bd687a1c7c9f90bca9e09" and "c9db49c36779cedd0c233045fa1cbfd48b430a48" have entirely different histories.

4 changed files with 16 additions and 36 deletions

View File

@ -127,7 +127,7 @@ func (c *Client) ListCommentReports(ctx context.Context, d types.ListCommentRepo
return ar, nil return ar, nil
} }
func (c *Client) MarkCommentReplyAsRead(ctx context.Context, d types.MarkCommentReplyAsRead) (*types.CommentResponse, error) { func (c *Client) MarkCommentReplyRead(ctx context.Context, d types.MarkCommentReplyAsRead) (*types.CommentResponse, error) {
ar := &types.CommentResponse{} ar := &types.CommentResponse{}
res, err := c.req(ctx, http.MethodPost, "/comment/mark_as_read", d, &ar) res, err := c.req(ctx, http.MethodPost, "/comment/mark_as_read", d, &ar)
if err != nil { if err != nil {

View File

@ -204,6 +204,21 @@ func (c *Client) MarkAllAsRead(ctx context.Context, d types.MarkAllAsRead) (*typ
return ar, nil return ar, nil
} }
func (c *Client) MarkCommentReplyAsRead(ctx context.Context, d types.MarkCommentReplyAsRead) (*types.CommentResponse, error) {
ar := &types.CommentResponse{}
res, err := c.req(ctx, http.MethodPost, "/user/mark_as_read", d, &ar)
if err != nil {
return nil, err
}
err = resError(res, ar.LemmyResponse)
if err != nil {
return nil, err
}
return ar, nil
}
func (c *Client) MarkPersonMentionAsRead(ctx context.Context, d types.MarkPersonMentionAsRead) (*types.PersonMentionResponse, error) { func (c *Client) MarkPersonMentionAsRead(ctx context.Context, d types.MarkPersonMentionAsRead) (*types.PersonMentionResponse, error) {
ar := &types.PersonMentionResponse{} ar := &types.PersonMentionResponse{}
res, err := c.req(ctx, http.MethodPost, "/user/mention/mark_as_read", d, &ar) res, err := c.req(ctx, http.MethodPost, "/user/mention/mark_as_read", d, &ar)

View File

@ -1,23 +0,0 @@
package lemmy
import (
"context"
"net/http"
"go.arsenm.dev/go-lemmy/types"
)
func (c *Client) Search(ctx context.Context, d types.Search) (*types.SearchResponse, error) {
ar := &types.SearchResponse{}
res, err := c.getReq(ctx, http.MethodGet, "/search", d, &ar)
if err != nil {
return nil, err
}
err = resError(res, ar.LemmyResponse)
if err != nil {
return nil, err
}
return ar, nil
}

View File

@ -1,17 +1,5 @@
package types package types
type Search struct {
CommunityID Optional[int] `json:"community_id" url:"community_id"`
CommunityName Optional[string] `json:"community_name" url:"community_name"`
CreatorID Optional[int] `json:"creator_id" url:"creator_id"`
Limit Optional[int] `json:"limit" url:"limit"`
ListingType Optional[ListingType] `json:"listing_type" url:"listing_type"`
Page Optional[int] `json:"page" url:"page"`
Query string `json:"q" url:"q"`
Sort Optional[SortType] `json:"sort" url:"sort"`
Type Optional[SearchType] `json:"type_" url:"type_"`
}
type SearchResponse struct { type SearchResponse struct {
Type string `json:"type,omitempty" url:"type,omitempty"` Type string `json:"type,omitempty" url:"type,omitempty"`
Comments []CommentView `json:"comments,omitempty" url:"comments,omitempty"` Comments []CommentView `json:"comments,omitempty" url:"comments,omitempty"`