Update for 0.18.0

This commit is contained in:
Elara 2023-07-03 17:47:46 -07:00
parent ff36330625
commit 058b3879ae
36 changed files with 603 additions and 1027 deletions

3
.gitignore vendored
View File

@ -1,2 +1,3 @@
/test /test
/gen /gen
/lemmy/

View File

@ -118,6 +118,7 @@ func (s *StructParser) Parse() ([]Item, error) {
} }
func (s *StructParser) parseStructFields() ([]Field, error) { func (s *StructParser) parseStructFields() ([]Field, error) {
encountered := map[string]struct{}{}
var out []Field var out []Field
for { for {
line, err := s.r.ReadString('\n') line, err := s.r.ReadString('\n')
@ -144,6 +145,12 @@ func (s *StructParser) parseStructFields() ([]Field, error) {
continue continue
} }
if _, ok := encountered[sm[1]]; ok {
continue
} else {
encountered[sm[1]] = struct{}{}
}
out = append(out, Field{ out = append(out, Field{
OrigName: sm[1], OrigName: sm[1],
Name: s.TransformName(sm[1]), Name: s.TransformName(sm[1]),

View File

@ -224,21 +224,9 @@ func (c *Client) AddModToCommunity(ctx context.Context, data types.AddModToCommu
} }
return resData, nil return resData, nil
} }
func (c *Client) CommunityJoin(ctx context.Context, data types.CommunityJoin) (*types.CommunityJoinResponse, error) { func (c *Client) FederatedInstances(ctx context.Context, data types.GetFederatedInstances) (*types.GetFederatedInstancesResponse, error) {
resData := &types.CommunityJoinResponse{} resData := &types.GetFederatedInstancesResponse{}
res, err := c.req(ctx, "POST", "/community/join", data, &resData) res, err := c.getReq(ctx, "GET", "/federated_instances", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
func (c *Client) ModJoin(ctx context.Context, data types.ModJoin) (*types.ModJoinResponse, error) {
resData := &types.ModJoinResponse{}
res, err := c.req(ctx, "POST", "/community/mod/join", data, &resData)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -380,18 +368,6 @@ func (c *Client) SavePost(ctx context.Context, data types.SavePost) (*types.Post
} }
return resData, nil return resData, nil
} }
func (c *Client) PostJoin(ctx context.Context, data types.PostJoin) (*types.PostJoinResponse, error) {
resData := &types.PostJoinResponse{}
res, err := c.req(ctx, "POST", "/post/join", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
func (c *Client) CreatePostReport(ctx context.Context, data types.CreatePostReport) (*types.PostReportResponse, error) { func (c *Client) CreatePostReport(ctx context.Context, data types.CreatePostReport) (*types.PostReportResponse, error) {
resData := &types.PostReportResponse{} resData := &types.PostReportResponse{}
res, err := c.req(ctx, "POST", "/post/report", data, &resData) res, err := c.req(ctx, "POST", "/post/report", data, &resData)
@ -512,6 +488,18 @@ func (c *Client) MarkCommentReplyAsRead(ctx context.Context, data types.MarkComm
} }
return resData, nil return resData, nil
} }
func (c *Client) DistinguishComment(ctx context.Context, data types.DistinguishComment) (*types.CommentResponse, error) {
resData := &types.CommentResponse{}
res, err := c.req(ctx, "POST", "/comment/distinguish", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
func (c *Client) CreateCommentLike(ctx context.Context, data types.CreateCommentLike) (*types.CommentResponse, error) { func (c *Client) CreateCommentLike(ctx context.Context, data types.CreateCommentLike) (*types.CommentResponse, error) {
resData := &types.CommentResponse{} resData := &types.CommentResponse{}
res, err := c.req(ctx, "POST", "/comment/like", data, &resData) res, err := c.req(ctx, "POST", "/comment/like", data, &resData)
@ -692,18 +680,6 @@ func (c *Client) Register(ctx context.Context, data types.Register) (*types.Logi
} }
return resData, nil return resData, nil
} }
func (c *Client) Captcha(ctx context.Context, data types.GetCaptcha) (*types.GetCaptchaResponse, error) {
resData := &types.GetCaptchaResponse{}
res, err := c.getReq(ctx, "GET", "/user/get_captcha", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
func (c *Client) PersonDetails(ctx context.Context, data types.GetPersonDetails) (*types.GetPersonDetailsResponse, error) { func (c *Client) PersonDetails(ctx context.Context, data types.GetPersonDetails) (*types.GetPersonDetailsResponse, error) {
resData := &types.GetPersonDetailsResponse{} resData := &types.GetPersonDetailsResponse{}
res, err := c.getReq(ctx, "GET", "/user", data, &resData) res, err := c.getReq(ctx, "GET", "/user", data, &resData)
@ -752,18 +728,6 @@ func (c *Client) Replies(ctx context.Context, data types.GetReplies) (*types.Get
} }
return resData, nil return resData, nil
} }
func (c *Client) UserJoin(ctx context.Context, data types.UserJoin) (*types.UserJoinResponse, error) {
resData := &types.UserJoinResponse{}
res, err := c.req(ctx, "POST", "/user/join", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
func (c *Client) BanPerson(ctx context.Context, data types.BanPerson) (*types.BanPersonResponse, error) { func (c *Client) BanPerson(ctx context.Context, data types.BanPerson) (*types.BanPersonResponse, error) {
resData := &types.BanPersonResponse{} resData := &types.BanPersonResponse{}
res, err := c.req(ctx, "POST", "/user/ban", data, &resData) res, err := c.req(ctx, "POST", "/user/ban", data, &resData)
@ -982,7 +946,7 @@ func (c *Client) ApproveRegistrationApplication(ctx context.Context, data types.
} }
func (c *Client) PurgePerson(ctx context.Context, data types.PurgePerson) (*types.PurgeItemResponse, error) { func (c *Client) PurgePerson(ctx context.Context, data types.PurgePerson) (*types.PurgeItemResponse, error) {
resData := &types.PurgeItemResponse{} resData := &types.PurgeItemResponse{}
res, err := c.req(ctx, "POST", "/admin/purge/person", data, &resData) res, err := c.req(ctx, "POST", "/admin/person", data, &resData)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -994,7 +958,7 @@ func (c *Client) PurgePerson(ctx context.Context, data types.PurgePerson) (*type
} }
func (c *Client) PurgeCommunity(ctx context.Context, data types.PurgeCommunity) (*types.PurgeItemResponse, error) { func (c *Client) PurgeCommunity(ctx context.Context, data types.PurgeCommunity) (*types.PurgeItemResponse, error) {
resData := &types.PurgeItemResponse{} resData := &types.PurgeItemResponse{}
res, err := c.req(ctx, "POST", "/admin/purge/community", data, &resData) res, err := c.req(ctx, "POST", "/admin/community", data, &resData)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -1006,7 +970,7 @@ func (c *Client) PurgeCommunity(ctx context.Context, data types.PurgeCommunity)
} }
func (c *Client) PurgePost(ctx context.Context, data types.PurgePost) (*types.PurgeItemResponse, error) { func (c *Client) PurgePost(ctx context.Context, data types.PurgePost) (*types.PurgeItemResponse, error) {
resData := &types.PurgeItemResponse{} resData := &types.PurgeItemResponse{}
res, err := c.req(ctx, "POST", "/admin/purge/post", data, &resData) res, err := c.req(ctx, "POST", "/admin/post", data, &resData)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -1018,7 +982,43 @@ func (c *Client) PurgePost(ctx context.Context, data types.PurgePost) (*types.Pu
} }
func (c *Client) PurgeComment(ctx context.Context, data types.PurgeComment) (*types.PurgeItemResponse, error) { func (c *Client) PurgeComment(ctx context.Context, data types.PurgeComment) (*types.PurgeItemResponse, error) {
resData := &types.PurgeItemResponse{} resData := &types.PurgeItemResponse{}
res, err := c.req(ctx, "POST", "/admin/purge/comment", data, &resData) res, err := c.req(ctx, "POST", "/admin/comment", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
func (c *Client) CreateCustomEmoji(ctx context.Context, data types.CreateCustomEmoji) (*types.CustomEmojiResponse, error) {
resData := &types.CustomEmojiResponse{}
res, err := c.req(ctx, "POST", "/custom_emoji", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
func (c *Client) EditCustomEmoji(ctx context.Context, data types.EditCustomEmoji) (*types.CustomEmojiResponse, error) {
resData := &types.CustomEmojiResponse{}
res, err := c.req(ctx, "PUT", "/custom_emoji", data, &resData)
if err != nil {
return nil, err
}
err = resError(res, resData.LemmyResponse)
if err != nil {
return nil, err
}
return resData, nil
}
func (c *Client) DeleteCustomEmoji(ctx context.Context, data types.DeleteCustomEmoji) (*types.DeleteCustomEmojiResponse, error) {
resData := &types.DeleteCustomEmojiResponse{}
res, err := c.req(ctx, "POST", "/custom_emoji/delete", data, &resData)
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@ -4,13 +4,13 @@
package types package types
type Activity struct { type Activity struct {
ID int32 `json:"id" url:"id,omitempty"` ID int32 `json:"id" url:"id,omitempty"`
Data any `json:"data" url:"data,omitempty"` Data any `json:"data" url:"data,omitempty"`
Local bool `json:"local" url:"local,omitempty"` Local bool `json:"local" url:"local,omitempty"`
Published LemmyTime `json:"published" url:"published,omitempty"` Published LemmyTime `json:"published" url:"published,omitempty"`
Updated LemmyTime `json:"updated" url:"updated,omitempty"` Updated LemmyTime `json:"updated" url:"updated,omitempty"`
ApID string `json:"ap_id" url:"ap_id,omitempty"` ApID string `json:"ap_id" url:"ap_id,omitempty"`
Sensitive Optional[bool] `json:"sensitive" url:"sensitive,omitempty"` Sensitive bool `json:"sensitive" url:"sensitive,omitempty"`
} }
type ActivityInsertForm struct { type ActivityInsertForm struct {
Data any `json:"data" url:"data,omitempty"` Data any `json:"data" url:"data,omitempty"`
@ -20,8 +20,8 @@ type ActivityInsertForm struct {
Sensitive Optional[bool] `json:"sensitive" url:"sensitive,omitempty"` Sensitive Optional[bool] `json:"sensitive" url:"sensitive,omitempty"`
} }
type ActivityUpdateForm struct { type ActivityUpdateForm struct {
Data any `json:"data" url:"data,omitempty"` Data any `json:"data" url:"data,omitempty"`
Local Optional[bool] `json:"local" url:"local,omitempty"` Local Optional[bool] `json:"local" url:"local,omitempty"`
Updated LemmyTime `json:"updated" url:"updated,omitempty"` Updated LemmyTime `json:"updated" url:"updated,omitempty"`
Sensitive Optional[Optional[bool]] `json:"sensitive" url:"sensitive,omitempty"` Sensitive Optional[bool] `json:"sensitive" url:"sensitive,omitempty"`
} }

View File

@ -1,4 +1,4 @@
// Source: lemmy/crates/db_schema/src/source/mod.rs // Source: lemmy/crates/api_common/src/build_response.rs
// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. // Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT.
package types package types

View File

@ -1,12 +0,0 @@
// Source: lemmy/crates/api_common/src/websocket/handlers/captcha.rs
// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT.
package types
type AddCaptcha struct {
Captcha CaptchaItem `json:"captcha" url:"captcha,omitempty"`
}
type CheckCaptcha struct {
Uuid string `json:"uuid" url:"uuid,omitempty"`
Answer string `json:"answer" url:"answer,omitempty"`
}

View File

@ -16,12 +16,16 @@ type GetComment struct {
Auth Optional[string] `json:"auth" url:"auth,omitempty"` Auth Optional[string] `json:"auth" url:"auth,omitempty"`
} }
type EditComment struct { type EditComment struct {
CommentID int `json:"comment_id" url:"comment_id,omitempty"` CommentID int `json:"comment_id" url:"comment_id,omitempty"`
Content Optional[string] `json:"content" url:"content,omitempty"` Content Optional[string] `json:"content" url:"content,omitempty"`
Distinguished Optional[bool] `json:"distinguished" url:"distinguished,omitempty"` LanguageID Optional[int] `json:"language_id" url:"language_id,omitempty"`
LanguageID Optional[int] `json:"language_id" url:"language_id,omitempty"` FormID Optional[string] `json:"form_id" url:"form_id,omitempty"`
FormID Optional[string] `json:"form_id" url:"form_id,omitempty"` Auth string `json:"auth" url:"auth,omitempty"`
Auth string `json:"auth" url:"auth,omitempty"` }
type DistinguishComment struct {
CommentID int `json:"comment_id" url:"comment_id,omitempty"`
Distinguished bool `json:"distinguished" url:"distinguished,omitempty"`
Auth string `json:"auth" url:"auth,omitempty"`
} }
type DeleteComment struct { type DeleteComment struct {
CommentID int `json:"comment_id" url:"comment_id,omitempty"` CommentID int `json:"comment_id" url:"comment_id,omitempty"`

View File

@ -23,29 +23,11 @@ type Community struct {
FollowersURL string `json:"followers_url" url:"followers_url,omitempty"` FollowersURL string `json:"followers_url" url:"followers_url,omitempty"`
InboxURL string `json:"inbox_url" url:"inbox_url,omitempty"` InboxURL string `json:"inbox_url" url:"inbox_url,omitempty"`
SharedInboxURL Optional[string] `json:"shared_inbox_url" url:"shared_inbox_url,omitempty"` SharedInboxURL Optional[string] `json:"shared_inbox_url" url:"shared_inbox_url,omitempty"`
Hidden bool `json:"hidden" url:"hidden,omitempty"`
PostingRestrictedToMods bool `json:"posting_restricted_to_mods" url:"posting_restricted_to_mods,omitempty"`
InstanceID int `json:"instance_id" url:"instance_id,omitempty"`
ModeratorsURL Optional[string] `json:"moderators_url" url:"moderators_url,omitempty"` ModeratorsURL Optional[string] `json:"moderators_url" url:"moderators_url,omitempty"`
FeaturedURL Optional[string] `json:"featured_url" url:"featured_url,omitempty"` FeaturedURL Optional[string] `json:"featured_url" url:"featured_url,omitempty"`
Hidden bool `json:"hidden" url:"hidden,omitempty"`
PostingRestrictedToMods bool `json:"posting_restricted_to_mods" url:"posting_restricted_to_mods,omitempty"`
InstanceID int `json:"instance_id" url:"instance_id,omitempty"`
}
type CommunitySafe struct {
ID int `json:"id" url:"id,omitempty"`
Name string `json:"name" url:"name,omitempty"`
Title string `json:"title" url:"title,omitempty"`
Description Optional[string] `json:"description" url:"description,omitempty"`
Removed bool `json:"removed" url:"removed,omitempty"`
Published LemmyTime `json:"published" url:"published,omitempty"`
Updated LemmyTime `json:"updated" url:"updated,omitempty"`
Deleted bool `json:"deleted" url:"deleted,omitempty"`
NSFW bool `json:"nsfw" url:"nsfw,omitempty"`
ActorID string `json:"actor_id" url:"actor_id,omitempty"`
Local bool `json:"local" url:"local,omitempty"`
Icon Optional[string] `json:"icon" url:"icon,omitempty"`
Banner Optional[string] `json:"banner" url:"banner,omitempty"`
Hidden bool `json:"hidden" url:"hidden,omitempty"`
PostingRestrictedToMods bool `json:"posting_restricted_to_mods" url:"posting_restricted_to_mods,omitempty"`
InstanceID int `json:"instance_id" url:"instance_id,omitempty"`
} }
type CommunityInsertForm struct { type CommunityInsertForm struct {
Name string `json:"name" url:"name,omitempty"` Name string `json:"name" url:"name,omitempty"`

View File

@ -12,9 +12,7 @@ type GetCommunityResponse struct {
CommunityView CommunityView `json:"community_view" url:"community_view,omitempty"` CommunityView CommunityView `json:"community_view" url:"community_view,omitempty"`
Site Optional[Site] `json:"site" url:"site,omitempty"` Site Optional[Site] `json:"site" url:"site,omitempty"`
Moderators []CommunityModeratorView `json:"moderators" url:"moderators,omitempty"` Moderators []CommunityModeratorView `json:"moderators" url:"moderators,omitempty"`
Online uint `json:"online" url:"online,omitempty"`
DiscussionLanguages []int `json:"discussion_languages" url:"discussion_languages,omitempty"` DiscussionLanguages []int `json:"discussion_languages" url:"discussion_languages,omitempty"`
DefaultPostLanguage Optional[int] `json:"default_post_language" url:"default_post_language,omitempty"`
LemmyResponse LemmyResponse
} }
type CreateCommunity struct { type CreateCommunity struct {
@ -54,8 +52,8 @@ type BanFromCommunity struct {
Auth string `json:"auth" url:"auth,omitempty"` Auth string `json:"auth" url:"auth,omitempty"`
} }
type BanFromCommunityResponse struct { type BanFromCommunityResponse struct {
PersonView PersonViewSafe `json:"person_view" url:"person_view,omitempty"` PersonView PersonView `json:"person_view" url:"person_view,omitempty"`
Banned bool `json:"banned" url:"banned,omitempty"` Banned bool `json:"banned" url:"banned,omitempty"`
LemmyResponse LemmyResponse
} }
type AddModToCommunity struct { type AddModToCommunity struct {

View File

@ -1,8 +0,0 @@
// Source: lemmy/crates/api_common/src/websocket/handlers/connect.rs
// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT.
package types
type Disconnect struct {
ID int `json:"id" url:"id,omitempty"`
}

View File

@ -0,0 +1,28 @@
// Source: lemmy/crates/db_schema/src/source/custom_emoji.rs
// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT.
package types
type CustomEmoji struct {
ID int `json:"id" url:"id,omitempty"`
LocalSiteID int `json:"local_site_id" url:"local_site_id,omitempty"`
Shortcode string `json:"shortcode" url:"shortcode,omitempty"`
ImageURL string `json:"image_url" url:"image_url,omitempty"`
AltText string `json:"alt_text" url:"alt_text,omitempty"`
Category string `json:"category" url:"category,omitempty"`
Published LemmyTime `json:"published" url:"published,omitempty"`
Updated LemmyTime `json:"updated" url:"updated,omitempty"`
}
type CustomEmojiInsertForm struct {
LocalSiteID int `json:"local_site_id" url:"local_site_id,omitempty"`
Shortcode string `json:"shortcode" url:"shortcode,omitempty"`
ImageURL string `json:"image_url" url:"image_url,omitempty"`
AltText string `json:"alt_text" url:"alt_text,omitempty"`
Category string `json:"category" url:"category,omitempty"`
}
type CustomEmojiUpdateForm struct {
LocalSiteID int `json:"local_site_id" url:"local_site_id,omitempty"`
ImageURL string `json:"image_url" url:"image_url,omitempty"`
AltText string `json:"alt_text" url:"alt_text,omitempty"`
Category string `json:"category" url:"category,omitempty"`
}

34
types/custom_emoji.gen.go Normal file
View File

@ -0,0 +1,34 @@
// Source: lemmy/crates/api_common/src/custom_emoji.rs
// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT.
package types
type CreateCustomEmoji struct {
Category string `json:"category" url:"category,omitempty"`
Shortcode string `json:"shortcode" url:"shortcode,omitempty"`
ImageURL string `json:"image_url" url:"image_url,omitempty"`
AltText string `json:"alt_text" url:"alt_text,omitempty"`
Keywords []string `json:"keywords" url:"keywords,omitempty"`
Auth string `json:"auth" url:"auth,omitempty"`
}
type EditCustomEmoji struct {
ID int `json:"id" url:"id,omitempty"`
Category string `json:"category" url:"category,omitempty"`
ImageURL string `json:"image_url" url:"image_url,omitempty"`
AltText string `json:"alt_text" url:"alt_text,omitempty"`
Keywords []string `json:"keywords" url:"keywords,omitempty"`
Auth string `json:"auth" url:"auth,omitempty"`
}
type DeleteCustomEmoji struct {
ID int `json:"id" url:"id,omitempty"`
Auth string `json:"auth" url:"auth,omitempty"`
}
type DeleteCustomEmojiResponse struct {
ID int `json:"id" url:"id,omitempty"`
Success bool `json:"success" url:"success,omitempty"`
LemmyResponse
}
type CustomEmojiResponse struct {
CustomEmoji CustomEmojiView `json:"custom_emoji" url:"custom_emoji,omitempty"`
LemmyResponse
}

View File

@ -0,0 +1,14 @@
// Source: lemmy/crates/db_schema/src/source/custom_emoji_keyword.rs
// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT.
package types
type CustomEmojiKeyword struct {
ID int32 `json:"id" url:"id,omitempty"`
CustomEmojiID int `json:"custom_emoji_id" url:"custom_emoji_id,omitempty"`
Keyword string `json:"keyword" url:"keyword,omitempty"`
}
type CustomEmojiKeywordInsertForm struct {
CustomEmojiID int `json:"custom_emoji_id" url:"custom_emoji_id,omitempty"`
Keyword string `json:"keyword" url:"keyword,omitempty"`
}

View File

@ -4,12 +4,16 @@
package types package types
type Instance struct { type Instance struct {
ID int `json:"id" url:"id,omitempty"` ID int `json:"id" url:"id,omitempty"`
Domain string `json:"domain" url:"domain,omitempty"` Domain string `json:"domain" url:"domain,omitempty"`
Published LemmyTime `json:"published" url:"published,omitempty"` Published LemmyTime `json:"published" url:"published,omitempty"`
Updated LemmyTime `json:"updated" url:"updated,omitempty"` Updated LemmyTime `json:"updated" url:"updated,omitempty"`
Software Optional[string] `json:"software" url:"software,omitempty"`
Version Optional[string] `json:"version" url:"version,omitempty"`
} }
type InstanceForm struct { type InstanceForm struct {
Domain string `json:"domain" url:"domain,omitempty"` Domain string `json:"domain" url:"domain,omitempty"`
Updated LemmyTime `json:"updated" url:"updated,omitempty"` Software Optional[string] `json:"software" url:"software,omitempty"`
Version Optional[string] `json:"version" url:"version,omitempty"`
Updated LemmyTime `json:"updated" url:"updated,omitempty"`
} }

View File

@ -1,21 +0,0 @@
// Source: lemmy/crates/api_common/src/websocket/handlers/join_rooms.rs
// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT.
package types
type JoinPostRoom struct {
PostID int `json:"post_id" url:"post_id,omitempty"`
ID int `json:"id" url:"id,omitempty"`
}
type JoinCommunityRoom struct {
CommunityID int `json:"community_id" url:"community_id,omitempty"`
ID int `json:"id" url:"id,omitempty"`
}
type JoinModRoom struct {
CommunityID int `json:"community_id" url:"community_id,omitempty"`
ID int `json:"id" url:"id,omitempty"`
}
type JoinUserRoom struct {
UserID int `json:"user_id" url:"user_id,omitempty"`
ID int `json:"id" url:"id,omitempty"`
}

View File

@ -6,17 +6,20 @@ package types
type SortType string type SortType string
const ( const (
SortTypeActive SortType = "Active" SortTypeActive SortType = "Active"
SortTypeHot SortType = "Hot" SortTypeHot SortType = "Hot"
SortTypeNew SortType = "New" SortTypeNew SortType = "New"
SortTypeOld SortType = "Old" SortTypeOld SortType = "Old"
SortTypeTopDay SortType = "TopDay" SortTypeTopDay SortType = "TopDay"
SortTypeTopWeek SortType = "TopWeek" SortTypeTopWeek SortType = "TopWeek"
SortTypeTopMonth SortType = "TopMonth" SortTypeTopMonth SortType = "TopMonth"
SortTypeTopYear SortType = "TopYear" SortTypeTopYear SortType = "TopYear"
SortTypeTopAll SortType = "TopAll" SortTypeTopAll SortType = "TopAll"
SortTypeMostComments SortType = "MostComments" SortTypeMostComments SortType = "MostComments"
SortTypeNewComments SortType = "NewComments" SortTypeNewComments SortType = "NewComments"
SortTypeTopHour SortType = "TopHour"
SortTypeTopSixHour SortType = "TopSixHour"
SortTypeTopTwelveHour SortType = "TopTwelveHour"
) )
type CommentSortType string type CommentSortType string
@ -36,6 +39,14 @@ const (
ListingTypeSubscribed ListingType = "Subscribed" ListingTypeSubscribed ListingType = "Subscribed"
) )
type RegistrationMode string
const (
RegistrationModeClosed RegistrationMode = "Closed"
RegistrationModeRequireApplication RegistrationMode = "RequireApplication"
RegistrationModeOpen RegistrationMode = "Open"
)
type SearchType string type SearchType string
const ( const (

View File

@ -14,21 +14,20 @@ type LocalSite struct {
ApplicationQuestion Optional[string] `json:"application_question" url:"application_question,omitempty"` ApplicationQuestion Optional[string] `json:"application_question" url:"application_question,omitempty"`
PrivateInstance bool `json:"private_instance" url:"private_instance,omitempty"` PrivateInstance bool `json:"private_instance" url:"private_instance,omitempty"`
DefaultTheme string `json:"default_theme" url:"default_theme,omitempty"` DefaultTheme string `json:"default_theme" url:"default_theme,omitempty"`
DefaultPostListingType string `json:"default_post_listing_type" url:"default_post_listing_type,omitempty"` DefaultPostListingType ListingType `json:"default_post_listing_type" url:"default_post_listing_type,omitempty"`
LegalInformation Optional[string] `json:"legal_information" url:"legal_information,omitempty"` LegalInformation Optional[string] `json:"legal_information" url:"legal_information,omitempty"`
HideModlogModNames bool `json:"hide_modlog_mod_names" url:"hide_modlog_mod_names,omitempty"` HideModlogModNames bool `json:"hide_modlog_mod_names" url:"hide_modlog_mod_names,omitempty"`
ApplicationEmailAdmins bool `json:"application_email_admins" url:"application_email_admins,omitempty"` ApplicationEmailAdmins bool `json:"application_email_admins" url:"application_email_admins,omitempty"`
SlurFilterRegex Optional[string] `json:"slur_filter_regex" url:"slur_filter_regex,omitempty"` SlurFilterRegex Optional[string] `json:"slur_filter_regex" url:"slur_filter_regex,omitempty"`
ActorNameMaxLength int32 `json:"actor_name_max_length" url:"actor_name_max_length,omitempty"` ActorNameMaxLength int32 `json:"actor_name_max_length" url:"actor_name_max_length,omitempty"`
FederationEnabled bool `json:"federation_enabled" url:"federation_enabled,omitempty"` FederationEnabled bool `json:"federation_enabled" url:"federation_enabled,omitempty"`
FederationDebug bool `json:"federation_debug" url:"federation_debug,omitempty"`
FederationWorkerCount int32 `json:"federation_worker_count" url:"federation_worker_count,omitempty"` FederationWorkerCount int32 `json:"federation_worker_count" url:"federation_worker_count,omitempty"`
CaptchaEnabled bool `json:"captcha_enabled" url:"captcha_enabled,omitempty"` CaptchaEnabled bool `json:"captcha_enabled" url:"captcha_enabled,omitempty"`
CaptchaDifficulty string `json:"captcha_difficulty" url:"captcha_difficulty,omitempty"` CaptchaDifficulty string `json:"captcha_difficulty" url:"captcha_difficulty,omitempty"`
RegistrationMode RegistrationMode `json:"registration_mode" url:"registration_mode,omitempty"`
ReportsEmailAdmins bool `json:"reports_email_admins" url:"reports_email_admins,omitempty"`
Published LemmyTime `json:"published" url:"published,omitempty"` Published LemmyTime `json:"published" url:"published,omitempty"`
Updated LemmyTime `json:"updated" url:"updated,omitempty"` Updated LemmyTime `json:"updated" url:"updated,omitempty"`
RegistrationMode RegistrationMode `json:"registration_mode" url:"registration_mode,omitempty"`
ReportsEmailAdmins bool `json:"reports_email_admins" url:"reports_email_admins,omitempty"`
} }
type LocalSiteInsertForm struct { type LocalSiteInsertForm struct {
SiteID int `json:"site_id" url:"site_id,omitempty"` SiteID int `json:"site_id" url:"site_id,omitempty"`
@ -40,14 +39,13 @@ type LocalSiteInsertForm struct {
ApplicationQuestion Optional[string] `json:"application_question" url:"application_question,omitempty"` ApplicationQuestion Optional[string] `json:"application_question" url:"application_question,omitempty"`
PrivateInstance Optional[bool] `json:"private_instance" url:"private_instance,omitempty"` PrivateInstance Optional[bool] `json:"private_instance" url:"private_instance,omitempty"`
DefaultTheme Optional[string] `json:"default_theme" url:"default_theme,omitempty"` DefaultTheme Optional[string] `json:"default_theme" url:"default_theme,omitempty"`
DefaultPostListingType Optional[string] `json:"default_post_listing_type" url:"default_post_listing_type,omitempty"` DefaultPostListingType Optional[ListingType] `json:"default_post_listing_type" url:"default_post_listing_type,omitempty"`
LegalInformation Optional[string] `json:"legal_information" url:"legal_information,omitempty"` LegalInformation Optional[string] `json:"legal_information" url:"legal_information,omitempty"`
HideModlogModNames Optional[bool] `json:"hide_modlog_mod_names" url:"hide_modlog_mod_names,omitempty"` HideModlogModNames Optional[bool] `json:"hide_modlog_mod_names" url:"hide_modlog_mod_names,omitempty"`
ApplicationEmailAdmins Optional[bool] `json:"application_email_admins" url:"application_email_admins,omitempty"` ApplicationEmailAdmins Optional[bool] `json:"application_email_admins" url:"application_email_admins,omitempty"`
SlurFilterRegex Optional[string] `json:"slur_filter_regex" url:"slur_filter_regex,omitempty"` SlurFilterRegex Optional[string] `json:"slur_filter_regex" url:"slur_filter_regex,omitempty"`
ActorNameMaxLength Optional[int32] `json:"actor_name_max_length" url:"actor_name_max_length,omitempty"` ActorNameMaxLength Optional[int32] `json:"actor_name_max_length" url:"actor_name_max_length,omitempty"`
FederationEnabled Optional[bool] `json:"federation_enabled" url:"federation_enabled,omitempty"` FederationEnabled Optional[bool] `json:"federation_enabled" url:"federation_enabled,omitempty"`
FederationDebug Optional[bool] `json:"federation_debug" url:"federation_debug,omitempty"`
FederationWorkerCount Optional[int32] `json:"federation_worker_count" url:"federation_worker_count,omitempty"` FederationWorkerCount Optional[int32] `json:"federation_worker_count" url:"federation_worker_count,omitempty"`
CaptchaEnabled Optional[bool] `json:"captcha_enabled" url:"captcha_enabled,omitempty"` CaptchaEnabled Optional[bool] `json:"captcha_enabled" url:"captcha_enabled,omitempty"`
CaptchaDifficulty Optional[string] `json:"captcha_difficulty" url:"captcha_difficulty,omitempty"` CaptchaDifficulty Optional[string] `json:"captcha_difficulty" url:"captcha_difficulty,omitempty"`
@ -63,14 +61,13 @@ type LocalSiteUpdateForm struct {
ApplicationQuestion Optional[Optional[string]] `json:"application_question" url:"application_question,omitempty"` ApplicationQuestion Optional[Optional[string]] `json:"application_question" url:"application_question,omitempty"`
PrivateInstance Optional[bool] `json:"private_instance" url:"private_instance,omitempty"` PrivateInstance Optional[bool] `json:"private_instance" url:"private_instance,omitempty"`
DefaultTheme Optional[string] `json:"default_theme" url:"default_theme,omitempty"` DefaultTheme Optional[string] `json:"default_theme" url:"default_theme,omitempty"`
DefaultPostListingType Optional[string] `json:"default_post_listing_type" url:"default_post_listing_type,omitempty"` DefaultPostListingType Optional[ListingType] `json:"default_post_listing_type" url:"default_post_listing_type,omitempty"`
LegalInformation Optional[Optional[string]] `json:"legal_information" url:"legal_information,omitempty"` LegalInformation Optional[Optional[string]] `json:"legal_information" url:"legal_information,omitempty"`
HideModlogModNames Optional[bool] `json:"hide_modlog_mod_names" url:"hide_modlog_mod_names,omitempty"` HideModlogModNames Optional[bool] `json:"hide_modlog_mod_names" url:"hide_modlog_mod_names,omitempty"`
ApplicationEmailAdmins Optional[bool] `json:"application_email_admins" url:"application_email_admins,omitempty"` ApplicationEmailAdmins Optional[bool] `json:"application_email_admins" url:"application_email_admins,omitempty"`
SlurFilterRegex Optional[Optional[string]] `json:"slur_filter_regex" url:"slur_filter_regex,omitempty"` SlurFilterRegex Optional[Optional[string]] `json:"slur_filter_regex" url:"slur_filter_regex,omitempty"`
ActorNameMaxLength Optional[int32] `json:"actor_name_max_length" url:"actor_name_max_length,omitempty"` ActorNameMaxLength Optional[int32] `json:"actor_name_max_length" url:"actor_name_max_length,omitempty"`
FederationEnabled Optional[bool] `json:"federation_enabled" url:"federation_enabled,omitempty"` FederationEnabled Optional[bool] `json:"federation_enabled" url:"federation_enabled,omitempty"`
FederationDebug Optional[bool] `json:"federation_debug" url:"federation_debug,omitempty"`
FederationWorkerCount Optional[int32] `json:"federation_worker_count" url:"federation_worker_count,omitempty"` FederationWorkerCount Optional[int32] `json:"federation_worker_count" url:"federation_worker_count,omitempty"`
CaptchaEnabled Optional[bool] `json:"captcha_enabled" url:"captcha_enabled,omitempty"` CaptchaEnabled Optional[bool] `json:"captcha_enabled" url:"captcha_enabled,omitempty"`
CaptchaDifficulty Optional[string] `json:"captcha_difficulty" url:"captcha_difficulty,omitempty"` CaptchaDifficulty Optional[string] `json:"captcha_difficulty" url:"captcha_difficulty,omitempty"`
@ -78,10 +75,3 @@ type LocalSiteUpdateForm struct {
ReportsEmailAdmins Optional[bool] `json:"reports_email_admins" url:"reports_email_admins,omitempty"` ReportsEmailAdmins Optional[bool] `json:"reports_email_admins" url:"reports_email_admins,omitempty"`
Updated LemmyTime `json:"updated" url:"updated,omitempty"` Updated LemmyTime `json:"updated" url:"updated,omitempty"`
} }
type RegistrationMode string
const (
RegistrationModeClosed RegistrationMode = "Closed"
RegistrationModeRequireApplication RegistrationMode = "RequireApplication"
RegistrationModeOpen RegistrationMode = "Open"
)

View File

@ -10,63 +10,29 @@ type LocalUser struct {
Email Optional[string] `json:"email" url:"email,omitempty"` Email Optional[string] `json:"email" url:"email,omitempty"`
ShowNSFW bool `json:"show_nsfw" url:"show_nsfw,omitempty"` ShowNSFW bool `json:"show_nsfw" url:"show_nsfw,omitempty"`
Theme string `json:"theme" url:"theme,omitempty"` Theme string `json:"theme" url:"theme,omitempty"`
DefaultSortType int16 `json:"default_sort_type" url:"default_sort_type,omitempty"` DefaultSortType SortType `json:"default_sort_type" url:"default_sort_type,omitempty"`
DefaultListingType int16 `json:"default_listing_type" url:"default_listing_type,omitempty"` DefaultListingType ListingType `json:"default_listing_type" url:"default_listing_type,omitempty"`
InterfaceLanguage string `json:"interface_language" url:"interface_language,omitempty"` InterfaceLanguage string `json:"interface_language" url:"interface_language,omitempty"`
ShowAvatars bool `json:"show_avatars" url:"show_avatars,omitempty"` ShowAvatars bool `json:"show_avatars" url:"show_avatars,omitempty"`
SendNotificationsToEmail bool `json:"send_notifications_to_email" url:"send_notifications_to_email,omitempty"` SendNotificationsToEmail bool `json:"send_notifications_to_email" url:"send_notifications_to_email,omitempty"`
ValidatorTime LemmyTime `json:"validator_time" url:"validator_time,omitempty"` ValidatorTime LemmyTime `json:"validator_time" url:"validator_time,omitempty"`
ShowBotAccounts bool `json:"show_bot_accounts" url:"show_bot_accounts,omitempty"`
ShowScores bool `json:"show_scores" url:"show_scores,omitempty"`
ShowReadPosts bool `json:"show_read_posts" url:"show_read_posts,omitempty"`
ShowNewPostNotifs bool `json:"show_new_post_notifs" url:"show_new_post_notifs,omitempty"`
EmailVerified bool `json:"email_verified" url:"email_verified,omitempty"`
AcceptedApplication bool `json:"accepted_application" url:"accepted_application,omitempty"`
}
type LocalUserSettings struct {
ID int `json:"id" url:"id,omitempty"`
PersonID int `json:"person_id" url:"person_id,omitempty"`
Email Optional[string] `json:"email" url:"email,omitempty"`
ShowNSFW bool `json:"show_nsfw" url:"show_nsfw,omitempty"`
Theme string `json:"theme" url:"theme,omitempty"`
DefaultSortType int16 `json:"default_sort_type" url:"default_sort_type,omitempty"`
DefaultListingType int16 `json:"default_listing_type" url:"default_listing_type,omitempty"`
InterfaceLanguage string `json:"interface_language" url:"interface_language,omitempty"`
ShowAvatars bool `json:"show_avatars" url:"show_avatars,omitempty"`
SendNotificationsToEmail bool `json:"send_notifications_to_email" url:"send_notifications_to_email,omitempty"`
ValidatorTime LemmyTime `json:"validator_time" url:"validator_time,omitempty"`
ShowBotAccounts bool `json:"show_bot_accounts" url:"show_bot_accounts,omitempty"`
ShowScores bool `json:"show_scores" url:"show_scores,omitempty"` ShowScores bool `json:"show_scores" url:"show_scores,omitempty"`
ShowBotAccounts bool `json:"show_bot_accounts" url:"show_bot_accounts,omitempty"`
ShowReadPosts bool `json:"show_read_posts" url:"show_read_posts,omitempty"` ShowReadPosts bool `json:"show_read_posts" url:"show_read_posts,omitempty"`
ShowNewPostNotifs bool `json:"show_new_post_notifs" url:"show_new_post_notifs,omitempty"` ShowNewPostNotifs bool `json:"show_new_post_notifs" url:"show_new_post_notifs,omitempty"`
EmailVerified bool `json:"email_verified" url:"email_verified,omitempty"` EmailVerified bool `json:"email_verified" url:"email_verified,omitempty"`
AcceptedApplication bool `json:"accepted_application" url:"accepted_application,omitempty"` AcceptedApplication bool `json:"accepted_application" url:"accepted_application,omitempty"`
Totp2faSecret Optional[string] `json:"totp_2fa_secret" url:"totp_2fa_secret,omitempty"`
Totp2faURL Optional[string] `json:"totp_2fa_url" url:"totp_2fa_url,omitempty"`
} }
type LocalUserInsertForm struct { type LocalUserInsertForm struct {
PersonID int `json:"person_id" url:"person_id,omitempty"` PersonID int `json:"person_id" url:"person_id,omitempty"`
PasswordEncrypted string `json:"password_encrypted" url:"password_encrypted,omitempty"` PasswordEncrypted string `json:"password_encrypted" url:"password_encrypted,omitempty"`
Email Optional[string] `json:"email" url:"email,omitempty"` Email Optional[string] `json:"email" url:"email,omitempty"`
ShowNSFW Optional[bool] `json:"show_nsfw" url:"show_nsfw,omitempty"`
Theme Optional[string] `json:"theme" url:"theme,omitempty"`
DefaultSortType Optional[int16] `json:"default_sort_type" url:"default_sort_type,omitempty"`
DefaultListingType Optional[int16] `json:"default_listing_type" url:"default_listing_type,omitempty"`
InterfaceLanguage Optional[string] `json:"interface_language" url:"interface_language,omitempty"`
ShowAvatars Optional[bool] `json:"show_avatars" url:"show_avatars,omitempty"`
SendNotificationsToEmail Optional[bool] `json:"send_notifications_to_email" url:"send_notifications_to_email,omitempty"`
ShowBotAccounts Optional[bool] `json:"show_bot_accounts" url:"show_bot_accounts,omitempty"`
ShowScores Optional[bool] `json:"show_scores" url:"show_scores,omitempty"`
ShowReadPosts Optional[bool] `json:"show_read_posts" url:"show_read_posts,omitempty"`
ShowNewPostNotifs Optional[bool] `json:"show_new_post_notifs" url:"show_new_post_notifs,omitempty"`
EmailVerified Optional[bool] `json:"email_verified" url:"email_verified,omitempty"`
AcceptedApplication Optional[bool] `json:"accepted_application" url:"accepted_application,omitempty"`
}
type LocalUserUpdateForm struct {
PasswordEncrypted Optional[string] `json:"password_encrypted" url:"password_encrypted,omitempty"`
Email Optional[Optional[string]] `json:"email" url:"email,omitempty"`
ShowNSFW Optional[bool] `json:"show_nsfw" url:"show_nsfw,omitempty"` ShowNSFW Optional[bool] `json:"show_nsfw" url:"show_nsfw,omitempty"`
Theme Optional[string] `json:"theme" url:"theme,omitempty"` Theme Optional[string] `json:"theme" url:"theme,omitempty"`
DefaultSortType Optional[int16] `json:"default_sort_type" url:"default_sort_type,omitempty"` DefaultSortType Optional[SortType] `json:"default_sort_type" url:"default_sort_type,omitempty"`
DefaultListingType Optional[int16] `json:"default_listing_type" url:"default_listing_type,omitempty"` DefaultListingType Optional[ListingType] `json:"default_listing_type" url:"default_listing_type,omitempty"`
InterfaceLanguage Optional[string] `json:"interface_language" url:"interface_language,omitempty"` InterfaceLanguage Optional[string] `json:"interface_language" url:"interface_language,omitempty"`
ShowAvatars Optional[bool] `json:"show_avatars" url:"show_avatars,omitempty"` ShowAvatars Optional[bool] `json:"show_avatars" url:"show_avatars,omitempty"`
SendNotificationsToEmail Optional[bool] `json:"send_notifications_to_email" url:"send_notifications_to_email,omitempty"` SendNotificationsToEmail Optional[bool] `json:"send_notifications_to_email" url:"send_notifications_to_email,omitempty"`
@ -76,4 +42,25 @@ type LocalUserUpdateForm struct {
ShowNewPostNotifs Optional[bool] `json:"show_new_post_notifs" url:"show_new_post_notifs,omitempty"` ShowNewPostNotifs Optional[bool] `json:"show_new_post_notifs" url:"show_new_post_notifs,omitempty"`
EmailVerified Optional[bool] `json:"email_verified" url:"email_verified,omitempty"` EmailVerified Optional[bool] `json:"email_verified" url:"email_verified,omitempty"`
AcceptedApplication Optional[bool] `json:"accepted_application" url:"accepted_application,omitempty"` AcceptedApplication Optional[bool] `json:"accepted_application" url:"accepted_application,omitempty"`
Totp2faSecret Optional[Optional[string]] `json:"totp_2fa_secret" url:"totp_2fa_secret,omitempty"`
Totp2faURL Optional[Optional[string]] `json:"totp_2fa_url" url:"totp_2fa_url,omitempty"`
}
type LocalUserUpdateForm struct {
PasswordEncrypted Optional[string] `json:"password_encrypted" url:"password_encrypted,omitempty"`
Email Optional[Optional[string]] `json:"email" url:"email,omitempty"`
ShowNSFW Optional[bool] `json:"show_nsfw" url:"show_nsfw,omitempty"`
Theme Optional[string] `json:"theme" url:"theme,omitempty"`
DefaultSortType Optional[SortType] `json:"default_sort_type" url:"default_sort_type,omitempty"`
DefaultListingType Optional[ListingType] `json:"default_listing_type" url:"default_listing_type,omitempty"`
InterfaceLanguage Optional[string] `json:"interface_language" url:"interface_language,omitempty"`
ShowAvatars Optional[bool] `json:"show_avatars" url:"show_avatars,omitempty"`
SendNotificationsToEmail Optional[bool] `json:"send_notifications_to_email" url:"send_notifications_to_email,omitempty"`
ShowBotAccounts Optional[bool] `json:"show_bot_accounts" url:"show_bot_accounts,omitempty"`
ShowScores Optional[bool] `json:"show_scores" url:"show_scores,omitempty"`
ShowReadPosts Optional[bool] `json:"show_read_posts" url:"show_read_posts,omitempty"`
ShowNewPostNotifs Optional[bool] `json:"show_new_post_notifs" url:"show_new_post_notifs,omitempty"`
EmailVerified Optional[bool] `json:"email_verified" url:"email_verified,omitempty"`
AcceptedApplication Optional[bool] `json:"accepted_application" url:"accepted_application,omitempty"`
Totp2faSecret Optional[Optional[string]] `json:"totp_2fa_secret" url:"totp_2fa_secret,omitempty"`
Totp2faURL Optional[Optional[string]] `json:"totp_2fa_url" url:"totp_2fa_url,omitempty"`
} }

View File

@ -1,29 +0,0 @@
// Source: lemmy/crates/api_common/src/websocket/handlers/messages.rs
// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT.
package types
type SendPostRoomMessage struct {
PostID int `json:"post_id" url:"post_id,omitempty"`
Message string `json:"message" url:"message,omitempty"`
WebsocketID Optional[int] `json:"websocket_id" url:"websocket_id,omitempty"`
}
type SendCommunityRoomMessage struct {
CommunityID int `json:"community_id" url:"community_id,omitempty"`
Message string `json:"message" url:"message,omitempty"`
WebsocketID Optional[int] `json:"websocket_id" url:"websocket_id,omitempty"`
}
type SendModRoomMessage struct {
CommunityID int `json:"community_id" url:"community_id,omitempty"`
Message string `json:"message" url:"message,omitempty"`
WebsocketID Optional[int] `json:"websocket_id" url:"websocket_id,omitempty"`
}
type SendUserRoomMessage struct {
RecipientID int `json:"recipient_id" url:"recipient_id,omitempty"`
Message string `json:"message" url:"message,omitempty"`
WebsocketID Optional[int] `json:"websocket_id" url:"websocket_id,omitempty"`
}
type SendAllMessage struct {
Message string `json:"message" url:"message,omitempty"`
WebsocketID Optional[int] `json:"websocket_id" url:"websocket_id,omitempty"`
}

View File

@ -1,103 +0,0 @@
// Source: lemmy/crates/api_common/src/websocket/mod.rs
// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT.
package types
type UserOperation string
const (
UserOperationLogin UserOperation = "Login"
UserOperationGetCaptcha UserOperation = "GetCaptcha"
UserOperationSaveComment UserOperation = "SaveComment"
UserOperationCreateCommentLike UserOperation = "CreateCommentLike"
UserOperationCreateCommentReport UserOperation = "CreateCommentReport"
UserOperationResolveCommentReport UserOperation = "ResolveCommentReport"
UserOperationListCommentReports UserOperation = "ListCommentReports"
UserOperationCreatePostLike UserOperation = "CreatePostLike"
UserOperationLockPost UserOperation = "LockPost"
UserOperationFeaturePost UserOperation = "FeaturePost"
UserOperationMarkPostAsRead UserOperation = "MarkPostAsRead"
UserOperationSavePost UserOperation = "SavePost"
UserOperationCreatePostReport UserOperation = "CreatePostReport"
UserOperationResolvePostReport UserOperation = "ResolvePostReport"
UserOperationListPostReports UserOperation = "ListPostReports"
UserOperationGetReportCount UserOperation = "GetReportCount"
UserOperationGetUnreadCount UserOperation = "GetUnreadCount"
UserOperationVerifyEmail UserOperation = "VerifyEmail"
UserOperationFollowCommunity UserOperation = "FollowCommunity"
UserOperationGetReplies UserOperation = "GetReplies"
UserOperationGetPersonMentions UserOperation = "GetPersonMentions"
UserOperationMarkPersonMentionAsRead UserOperation = "MarkPersonMentionAsRead"
UserOperationMarkCommentReplyAsRead UserOperation = "MarkCommentReplyAsRead"
UserOperationGetModlog UserOperation = "GetModlog"
UserOperationBanFromCommunity UserOperation = "BanFromCommunity"
UserOperationAddModToCommunity UserOperation = "AddModToCommunity"
UserOperationAddAdmin UserOperation = "AddAdmin"
UserOperationGetUnreadRegistrationApplicationCount UserOperation = "GetUnreadRegistrationApplicationCount"
UserOperationListRegistrationApplications UserOperation = "ListRegistrationApplications"
UserOperationApproveRegistrationApplication UserOperation = "ApproveRegistrationApplication"
UserOperationBanPerson UserOperation = "BanPerson"
UserOperationGetBannedPersons UserOperation = "GetBannedPersons"
UserOperationMarkAllAsRead UserOperation = "MarkAllAsRead"
UserOperationSaveUserSettings UserOperation = "SaveUserSettings"
UserOperationTransferCommunity UserOperation = "TransferCommunity"
UserOperationLeaveAdmin UserOperation = "LeaveAdmin"
UserOperationPasswordReset UserOperation = "PasswordReset"
UserOperationPasswordChange UserOperation = "PasswordChange"
UserOperationMarkPrivateMessageAsRead UserOperation = "MarkPrivateMessageAsRead"
UserOperationCreatePrivateMessageReport UserOperation = "CreatePrivateMessageReport"
UserOperationResolvePrivateMessageReport UserOperation = "ResolvePrivateMessageReport"
UserOperationListPrivateMessageReports UserOperation = "ListPrivateMessageReports"
UserOperationUserJoin UserOperation = "UserJoin"
UserOperationPostJoin UserOperation = "PostJoin"
UserOperationCommunityJoin UserOperation = "CommunityJoin"
UserOperationModJoin UserOperation = "ModJoin"
UserOperationChangePassword UserOperation = "ChangePassword"
UserOperationGetSiteMetadata UserOperation = "GetSiteMetadata"
UserOperationBlockCommunity UserOperation = "BlockCommunity"
UserOperationBlockPerson UserOperation = "BlockPerson"
UserOperationPurgePerson UserOperation = "PurgePerson"
UserOperationPurgeCommunity UserOperation = "PurgeCommunity"
UserOperationPurgePost UserOperation = "PurgePost"
UserOperationPurgeComment UserOperation = "PurgeComment"
)
type UserOperationCRUD string
const (
UserOperationCRUDCreateSite UserOperationCRUD = "CreateSite"
UserOperationCRUDGetSite UserOperationCRUD = "GetSite"
UserOperationCRUDEditSite UserOperationCRUD = "EditSite"
UserOperationCRUDCreateCommunity UserOperationCRUD = "CreateCommunity"
UserOperationCRUDListCommunities UserOperationCRUD = "ListCommunities"
UserOperationCRUDEditCommunity UserOperationCRUD = "EditCommunity"
UserOperationCRUDDeleteCommunity UserOperationCRUD = "DeleteCommunity"
UserOperationCRUDRemoveCommunity UserOperationCRUD = "RemoveCommunity"
UserOperationCRUDCreatePost UserOperationCRUD = "CreatePost"
UserOperationCRUDGetPost UserOperationCRUD = "GetPost"
UserOperationCRUDEditPost UserOperationCRUD = "EditPost"
UserOperationCRUDDeletePost UserOperationCRUD = "DeletePost"
UserOperationCRUDRemovePost UserOperationCRUD = "RemovePost"
UserOperationCRUDCreateComment UserOperationCRUD = "CreateComment"
UserOperationCRUDGetComment UserOperationCRUD = "GetComment"
UserOperationCRUDEditComment UserOperationCRUD = "EditComment"
UserOperationCRUDDeleteComment UserOperationCRUD = "DeleteComment"
UserOperationCRUDRemoveComment UserOperationCRUD = "RemoveComment"
UserOperationCRUDRegister UserOperationCRUD = "Register"
UserOperationCRUDDeleteAccount UserOperationCRUD = "DeleteAccount"
UserOperationCRUDCreatePrivateMessage UserOperationCRUD = "CreatePrivateMessage"
UserOperationCRUDGetPrivateMessages UserOperationCRUD = "GetPrivateMessages"
UserOperationCRUDEditPrivateMessage UserOperationCRUD = "EditPrivateMessage"
UserOperationCRUDDeletePrivateMessage UserOperationCRUD = "DeletePrivateMessage"
)
type UserOperationApub string
const (
UserOperationApubGetPosts UserOperationApub = "GetPosts"
UserOperationApubGetCommunity UserOperationApub = "GetCommunity"
UserOperationApubGetComments UserOperationApub = "GetComments"
UserOperationApubGetPersonDetails UserOperationApub = "GetPersonDetails"
UserOperationApubSearch UserOperationApub = "Search"
UserOperationApubResolveObject UserOperationApub = "ResolveObject"
)

View File

@ -1,4 +1,4 @@
// Source: lemmy/crates/api_common/src/websocket/handlers/mod.rs // Source: lemmy/crates/db_schema/src/source/mod.rs
// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. // Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT.
package types package types

View File

@ -8,7 +8,7 @@ type ModRemovePost struct {
ModPersonID int `json:"mod_person_id" url:"mod_person_id,omitempty"` ModPersonID int `json:"mod_person_id" url:"mod_person_id,omitempty"`
PostID int `json:"post_id" url:"post_id,omitempty"` PostID int `json:"post_id" url:"post_id,omitempty"`
Reason Optional[string] `json:"reason" url:"reason,omitempty"` Reason Optional[string] `json:"reason" url:"reason,omitempty"`
Removed Optional[bool] `json:"removed" url:"removed,omitempty"` Removed bool `json:"removed" url:"removed,omitempty"`
When LemmyTime `json:"when_" url:"when_,omitempty"` When LemmyTime `json:"when_" url:"when_,omitempty"`
} }
type ModRemovePostForm struct { type ModRemovePostForm struct {
@ -18,11 +18,11 @@ type ModRemovePostForm struct {
Removed Optional[bool] `json:"removed" url:"removed,omitempty"` Removed Optional[bool] `json:"removed" url:"removed,omitempty"`
} }
type ModLockPost struct { type ModLockPost struct {
ID int32 `json:"id" url:"id,omitempty"` ID int32 `json:"id" url:"id,omitempty"`
ModPersonID int `json:"mod_person_id" url:"mod_person_id,omitempty"` ModPersonID int `json:"mod_person_id" url:"mod_person_id,omitempty"`
PostID int `json:"post_id" url:"post_id,omitempty"` PostID int `json:"post_id" url:"post_id,omitempty"`
Locked Optional[bool] `json:"locked" url:"locked,omitempty"` Locked bool `json:"locked" url:"locked,omitempty"`
When LemmyTime `json:"when_" url:"when_,omitempty"` When LemmyTime `json:"when_" url:"when_,omitempty"`
} }
type ModLockPostForm struct { type ModLockPostForm struct {
ModPersonID int `json:"mod_person_id" url:"mod_person_id,omitempty"` ModPersonID int `json:"mod_person_id" url:"mod_person_id,omitempty"`
@ -48,7 +48,7 @@ type ModRemoveComment struct {
ModPersonID int `json:"mod_person_id" url:"mod_person_id,omitempty"` ModPersonID int `json:"mod_person_id" url:"mod_person_id,omitempty"`
CommentID int `json:"comment_id" url:"comment_id,omitempty"` CommentID int `json:"comment_id" url:"comment_id,omitempty"`
Reason Optional[string] `json:"reason" url:"reason,omitempty"` Reason Optional[string] `json:"reason" url:"reason,omitempty"`
Removed Optional[bool] `json:"removed" url:"removed,omitempty"` Removed bool `json:"removed" url:"removed,omitempty"`
When LemmyTime `json:"when_" url:"when_,omitempty"` When LemmyTime `json:"when_" url:"when_,omitempty"`
} }
type ModRemoveCommentForm struct { type ModRemoveCommentForm struct {
@ -62,7 +62,7 @@ type ModRemoveCommunity struct {
ModPersonID int `json:"mod_person_id" url:"mod_person_id,omitempty"` ModPersonID int `json:"mod_person_id" url:"mod_person_id,omitempty"`
CommunityID int `json:"community_id" url:"community_id,omitempty"` CommunityID int `json:"community_id" url:"community_id,omitempty"`
Reason Optional[string] `json:"reason" url:"reason,omitempty"` Reason Optional[string] `json:"reason" url:"reason,omitempty"`
Removed Optional[bool] `json:"removed" url:"removed,omitempty"` Removed bool `json:"removed" url:"removed,omitempty"`
Expires LemmyTime `json:"expires" url:"expires,omitempty"` Expires LemmyTime `json:"expires" url:"expires,omitempty"`
When LemmyTime `json:"when_" url:"when_,omitempty"` When LemmyTime `json:"when_" url:"when_,omitempty"`
} }
@ -79,7 +79,7 @@ type ModBanFromCommunity struct {
OtherPersonID int `json:"other_person_id" url:"other_person_id,omitempty"` OtherPersonID int `json:"other_person_id" url:"other_person_id,omitempty"`
CommunityID int `json:"community_id" url:"community_id,omitempty"` CommunityID int `json:"community_id" url:"community_id,omitempty"`
Reason Optional[string] `json:"reason" url:"reason,omitempty"` Reason Optional[string] `json:"reason" url:"reason,omitempty"`
Banned Optional[bool] `json:"banned" url:"banned,omitempty"` Banned bool `json:"banned" url:"banned,omitempty"`
Expires LemmyTime `json:"expires" url:"expires,omitempty"` Expires LemmyTime `json:"expires" url:"expires,omitempty"`
When LemmyTime `json:"when_" url:"when_,omitempty"` When LemmyTime `json:"when_" url:"when_,omitempty"`
} }
@ -96,7 +96,7 @@ type ModBan struct {
ModPersonID int `json:"mod_person_id" url:"mod_person_id,omitempty"` ModPersonID int `json:"mod_person_id" url:"mod_person_id,omitempty"`
OtherPersonID int `json:"other_person_id" url:"other_person_id,omitempty"` OtherPersonID int `json:"other_person_id" url:"other_person_id,omitempty"`
Reason Optional[string] `json:"reason" url:"reason,omitempty"` Reason Optional[string] `json:"reason" url:"reason,omitempty"`
Banned Optional[bool] `json:"banned" url:"banned,omitempty"` Banned bool `json:"banned" url:"banned,omitempty"`
Expires LemmyTime `json:"expires" url:"expires,omitempty"` Expires LemmyTime `json:"expires" url:"expires,omitempty"`
When LemmyTime `json:"when_" url:"when_,omitempty"` When LemmyTime `json:"when_" url:"when_,omitempty"`
} }
@ -110,9 +110,9 @@ type ModHideCommunity struct {
ID int32 `json:"id" url:"id,omitempty"` ID int32 `json:"id" url:"id,omitempty"`
CommunityID int `json:"community_id" url:"community_id,omitempty"` CommunityID int `json:"community_id" url:"community_id,omitempty"`
ModPersonID int `json:"mod_person_id" url:"mod_person_id,omitempty"` ModPersonID int `json:"mod_person_id" url:"mod_person_id,omitempty"`
Reason Optional[string] `json:"reason" url:"reason,omitempty"`
Hidden Optional[bool] `json:"hidden" url:"hidden,omitempty"`
When LemmyTime `json:"when_" url:"when_,omitempty"` When LemmyTime `json:"when_" url:"when_,omitempty"`
Reason Optional[string] `json:"reason" url:"reason,omitempty"`
Hidden bool `json:"hidden" url:"hidden,omitempty"`
} }
type ModBanForm struct { type ModBanForm struct {
ModPersonID int `json:"mod_person_id" url:"mod_person_id,omitempty"` ModPersonID int `json:"mod_person_id" url:"mod_person_id,omitempty"`
@ -122,12 +122,12 @@ type ModBanForm struct {
Expires LemmyTime `json:"expires" url:"expires,omitempty"` Expires LemmyTime `json:"expires" url:"expires,omitempty"`
} }
type ModAddCommunity struct { type ModAddCommunity struct {
ID int32 `json:"id" url:"id,omitempty"` ID int32 `json:"id" url:"id,omitempty"`
ModPersonID int `json:"mod_person_id" url:"mod_person_id,omitempty"` ModPersonID int `json:"mod_person_id" url:"mod_person_id,omitempty"`
OtherPersonID int `json:"other_person_id" url:"other_person_id,omitempty"` OtherPersonID int `json:"other_person_id" url:"other_person_id,omitempty"`
CommunityID int `json:"community_id" url:"community_id,omitempty"` CommunityID int `json:"community_id" url:"community_id,omitempty"`
Removed Optional[bool] `json:"removed" url:"removed,omitempty"` Removed bool `json:"removed" url:"removed,omitempty"`
When LemmyTime `json:"when_" url:"when_,omitempty"` When LemmyTime `json:"when_" url:"when_,omitempty"`
} }
type ModAddCommunityForm struct { type ModAddCommunityForm struct {
ModPersonID int `json:"mod_person_id" url:"mod_person_id,omitempty"` ModPersonID int `json:"mod_person_id" url:"mod_person_id,omitempty"`
@ -136,25 +136,23 @@ type ModAddCommunityForm struct {
Removed Optional[bool] `json:"removed" url:"removed,omitempty"` Removed Optional[bool] `json:"removed" url:"removed,omitempty"`
} }
type ModTransferCommunity struct { type ModTransferCommunity struct {
ID int32 `json:"id" url:"id,omitempty"` ID int32 `json:"id" url:"id,omitempty"`
ModPersonID int `json:"mod_person_id" url:"mod_person_id,omitempty"` ModPersonID int `json:"mod_person_id" url:"mod_person_id,omitempty"`
OtherPersonID int `json:"other_person_id" url:"other_person_id,omitempty"` OtherPersonID int `json:"other_person_id" url:"other_person_id,omitempty"`
CommunityID int `json:"community_id" url:"community_id,omitempty"` CommunityID int `json:"community_id" url:"community_id,omitempty"`
Removed Optional[bool] `json:"removed" url:"removed,omitempty"` When LemmyTime `json:"when_" url:"when_,omitempty"`
When LemmyTime `json:"when_" url:"when_,omitempty"`
} }
type ModTransferCommunityForm struct { type ModTransferCommunityForm struct {
ModPersonID int `json:"mod_person_id" url:"mod_person_id,omitempty"` ModPersonID int `json:"mod_person_id" url:"mod_person_id,omitempty"`
OtherPersonID int `json:"other_person_id" url:"other_person_id,omitempty"` OtherPersonID int `json:"other_person_id" url:"other_person_id,omitempty"`
CommunityID int `json:"community_id" url:"community_id,omitempty"` CommunityID int `json:"community_id" url:"community_id,omitempty"`
Removed Optional[bool] `json:"removed" url:"removed,omitempty"`
} }
type ModAdd struct { type ModAdd struct {
ID int32 `json:"id" url:"id,omitempty"` ID int32 `json:"id" url:"id,omitempty"`
ModPersonID int `json:"mod_person_id" url:"mod_person_id,omitempty"` ModPersonID int `json:"mod_person_id" url:"mod_person_id,omitempty"`
OtherPersonID int `json:"other_person_id" url:"other_person_id,omitempty"` OtherPersonID int `json:"other_person_id" url:"other_person_id,omitempty"`
Removed Optional[bool] `json:"removed" url:"removed,omitempty"` Removed bool `json:"removed" url:"removed,omitempty"`
When LemmyTime `json:"when_" url:"when_,omitempty"` When LemmyTime `json:"when_" url:"when_,omitempty"`
} }
type ModAddForm struct { type ModAddForm struct {
ModPersonID int `json:"mod_person_id" url:"mod_person_id,omitempty"` ModPersonID int `json:"mod_person_id" url:"mod_person_id,omitempty"`

View File

@ -1,11 +0,0 @@
// Source: lemmy/crates/api_common/src/websocket/handlers/online_users.rs
// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT.
package types
type GetPostUsersOnline struct {
PostID int `json:"post_id" url:"post_id,omitempty"`
}
type GetCommunityUsersOnline struct {
CommunityID int `json:"community_id" url:"community_id,omitempty"`
}

View File

@ -27,27 +27,6 @@ type Person struct {
BanExpires LemmyTime `json:"ban_expires" url:"ban_expires,omitempty"` BanExpires LemmyTime `json:"ban_expires" url:"ban_expires,omitempty"`
InstanceID int `json:"instance_id" url:"instance_id,omitempty"` InstanceID int `json:"instance_id" url:"instance_id,omitempty"`
} }
type PersonSafe struct {
ID int `json:"id" url:"id,omitempty"`
Name string `json:"name" url:"name,omitempty"`
DisplayName Optional[string] `json:"display_name" url:"display_name,omitempty"`
Avatar Optional[string] `json:"avatar" url:"avatar,omitempty"`
Banned bool `json:"banned" url:"banned,omitempty"`
Published LemmyTime `json:"published" url:"published,omitempty"`
Updated LemmyTime `json:"updated" url:"updated,omitempty"`
ActorID string `json:"actor_id" url:"actor_id,omitempty"`
Bio Optional[string] `json:"bio" url:"bio,omitempty"`
Local bool `json:"local" url:"local,omitempty"`
Banner Optional[string] `json:"banner" url:"banner,omitempty"`
Deleted bool `json:"deleted" url:"deleted,omitempty"`
InboxURL string `json:"inbox_url" url:"inbox_url,omitempty"`
SharedInboxURL Optional[string] `json:"shared_inbox_url" url:"shared_inbox_url,omitempty"`
MatrixUserID Optional[string] `json:"matrix_user_id" url:"matrix_user_id,omitempty"`
Admin bool `json:"admin" url:"admin,omitempty"`
BotAccount bool `json:"bot_account" url:"bot_account,omitempty"`
BanExpires LemmyTime `json:"ban_expires" url:"ban_expires,omitempty"`
InstanceID int `json:"instance_id" url:"instance_id,omitempty"`
}
type PersonInsertForm struct { type PersonInsertForm struct {
Name string `json:"name" url:"name,omitempty"` Name string `json:"name" url:"name,omitempty"`
PublicKey string `json:"public_key" url:"public_key,omitempty"` PublicKey string `json:"public_key" url:"public_key,omitempty"`

View File

@ -4,8 +4,9 @@
package types package types
type Login struct { type Login struct {
UsernameOrEmail string `json:"username_or_email" url:"username_or_email,omitempty"` UsernameOrEmail string `json:"username_or_email" url:"username_or_email,omitempty"`
Password string `json:"password" url:"password,omitempty"` Password string `json:"password" url:"password,omitempty"`
Totp2faToken Optional[string] `json:"totp_2fa_token" url:"totp_2fa_token,omitempty"`
} }
type Register struct { type Register struct {
Username string `json:"username" url:"username,omitempty"` Username string `json:"username" url:"username,omitempty"`
@ -32,26 +33,27 @@ type CaptchaResponse struct {
LemmyResponse LemmyResponse
} }
type SaveUserSettings struct { type SaveUserSettings struct {
ShowNSFW Optional[bool] `json:"show_nsfw" url:"show_nsfw,omitempty"` ShowNSFW Optional[bool] `json:"show_nsfw" url:"show_nsfw,omitempty"`
ShowScores Optional[bool] `json:"show_scores" url:"show_scores,omitempty"` ShowScores Optional[bool] `json:"show_scores" url:"show_scores,omitempty"`
Theme Optional[string] `json:"theme" url:"theme,omitempty"` Theme Optional[string] `json:"theme" url:"theme,omitempty"`
DefaultSortType Optional[int16] `json:"default_sort_type" url:"default_sort_type,omitempty"` DefaultSortType Optional[SortType] `json:"default_sort_type" url:"default_sort_type,omitempty"`
DefaultListingType Optional[int16] `json:"default_listing_type" url:"default_listing_type,omitempty"` DefaultListingType Optional[ListingType] `json:"default_listing_type" url:"default_listing_type,omitempty"`
InterfaceLanguage Optional[string] `json:"interface_language" url:"interface_language,omitempty"` InterfaceLanguage Optional[string] `json:"interface_language" url:"interface_language,omitempty"`
Avatar Optional[string] `json:"avatar" url:"avatar,omitempty"` Avatar Optional[string] `json:"avatar" url:"avatar,omitempty"`
Banner Optional[string] `json:"banner" url:"banner,omitempty"` Banner Optional[string] `json:"banner" url:"banner,omitempty"`
DisplayName Optional[string] `json:"display_name" url:"display_name,omitempty"` DisplayName Optional[string] `json:"display_name" url:"display_name,omitempty"`
Email Optional[string] `json:"email" url:"email,omitempty"` Email Optional[string] `json:"email" url:"email,omitempty"`
Bio Optional[string] `json:"bio" url:"bio,omitempty"` Bio Optional[string] `json:"bio" url:"bio,omitempty"`
MatrixUserID Optional[string] `json:"matrix_user_id" url:"matrix_user_id,omitempty"` MatrixUserID Optional[string] `json:"matrix_user_id" url:"matrix_user_id,omitempty"`
ShowAvatars Optional[bool] `json:"show_avatars" url:"show_avatars,omitempty"` ShowAvatars Optional[bool] `json:"show_avatars" url:"show_avatars,omitempty"`
SendNotificationsToEmail Optional[bool] `json:"send_notifications_to_email" url:"send_notifications_to_email,omitempty"` SendNotificationsToEmail Optional[bool] `json:"send_notifications_to_email" url:"send_notifications_to_email,omitempty"`
BotAccount Optional[bool] `json:"bot_account" url:"bot_account,omitempty"` BotAccount Optional[bool] `json:"bot_account" url:"bot_account,omitempty"`
ShowBotAccounts Optional[bool] `json:"show_bot_accounts" url:"show_bot_accounts,omitempty"` ShowBotAccounts Optional[bool] `json:"show_bot_accounts" url:"show_bot_accounts,omitempty"`
ShowReadPosts Optional[bool] `json:"show_read_posts" url:"show_read_posts,omitempty"` ShowReadPosts Optional[bool] `json:"show_read_posts" url:"show_read_posts,omitempty"`
ShowNewPostNotifs Optional[bool] `json:"show_new_post_notifs" url:"show_new_post_notifs,omitempty"` ShowNewPostNotifs Optional[bool] `json:"show_new_post_notifs" url:"show_new_post_notifs,omitempty"`
DiscussionLanguages Optional[[]int] `json:"discussion_languages" url:"discussion_languages,omitempty"` DiscussionLanguages Optional[[]int] `json:"discussion_languages" url:"discussion_languages,omitempty"`
Auth string `json:"auth" url:"auth,omitempty"` GenerateTotp2fa Optional[bool] `json:"generate_totp_2fa" url:"generate_totp_2fa,omitempty"`
Auth string `json:"auth" url:"auth,omitempty"`
} }
type ChangePassword struct { type ChangePassword struct {
NewPassword string `json:"new_password" url:"new_password,omitempty"` NewPassword string `json:"new_password" url:"new_password,omitempty"`
@ -76,20 +78,12 @@ type GetPersonDetails struct {
Auth Optional[string] `json:"auth" url:"auth,omitempty"` Auth Optional[string] `json:"auth" url:"auth,omitempty"`
} }
type GetPersonDetailsResponse struct { type GetPersonDetailsResponse struct {
PersonView PersonViewSafe `json:"person_view" url:"person_view,omitempty"` PersonView PersonView `json:"person_view" url:"person_view,omitempty"`
Comments []CommentView `json:"comments" url:"comments,omitempty"` Comments []CommentView `json:"comments" url:"comments,omitempty"`
Posts []PostView `json:"posts" url:"posts,omitempty"` Posts []PostView `json:"posts" url:"posts,omitempty"`
Moderates []CommunityModeratorView `json:"moderates" url:"moderates,omitempty"` Moderates []CommunityModeratorView `json:"moderates" url:"moderates,omitempty"`
LemmyResponse LemmyResponse
} }
type GetRepliesResponse struct {
Replies []CommentReplyView `json:"replies" url:"replies,omitempty"`
LemmyResponse
}
type GetPersonMentionsResponse struct {
Mentions []PersonMentionView `json:"mentions" url:"mentions,omitempty"`
LemmyResponse
}
type MarkAllAsRead struct { type MarkAllAsRead struct {
Auth string `json:"auth" url:"auth,omitempty"` Auth string `json:"auth" url:"auth,omitempty"`
} }
@ -99,7 +93,7 @@ type AddAdmin struct {
Auth string `json:"auth" url:"auth,omitempty"` Auth string `json:"auth" url:"auth,omitempty"`
} }
type AddAdminResponse struct { type AddAdminResponse struct {
Admins []PersonViewSafe `json:"admins" url:"admins,omitempty"` Admins []PersonView `json:"admins" url:"admins,omitempty"`
LemmyResponse LemmyResponse
} }
type BanPerson struct { type BanPerson struct {
@ -114,12 +108,12 @@ type GetBannedPersons struct {
Auth string `json:"auth" url:"auth,omitempty"` Auth string `json:"auth" url:"auth,omitempty"`
} }
type BannedPersonsResponse struct { type BannedPersonsResponse struct {
Banned []PersonViewSafe `json:"banned" url:"banned,omitempty"` Banned []PersonView `json:"banned" url:"banned,omitempty"`
LemmyResponse LemmyResponse
} }
type BanPersonResponse struct { type BanPersonResponse struct {
PersonView PersonViewSafe `json:"person_view" url:"person_view,omitempty"` PersonView PersonView `json:"person_view" url:"person_view,omitempty"`
Banned bool `json:"banned" url:"banned,omitempty"` Banned bool `json:"banned" url:"banned,omitempty"`
LemmyResponse LemmyResponse
} }
type BlockPerson struct { type BlockPerson struct {
@ -128,8 +122,8 @@ type BlockPerson struct {
Auth string `json:"auth" url:"auth,omitempty"` Auth string `json:"auth" url:"auth,omitempty"`
} }
type BlockPersonResponse struct { type BlockPersonResponse struct {
PersonView PersonViewSafe `json:"person_view" url:"person_view,omitempty"` PersonView PersonView `json:"person_view" url:"person_view,omitempty"`
Blocked bool `json:"blocked" url:"blocked,omitempty"` Blocked bool `json:"blocked" url:"blocked,omitempty"`
LemmyResponse LemmyResponse
} }
type GetReplies struct { type GetReplies struct {
@ -139,6 +133,10 @@ type GetReplies struct {
UnreadOnly Optional[bool] `json:"unread_only" url:"unread_only,omitempty"` UnreadOnly Optional[bool] `json:"unread_only" url:"unread_only,omitempty"`
Auth string `json:"auth" url:"auth,omitempty"` Auth string `json:"auth" url:"auth,omitempty"`
} }
type GetRepliesResponse struct {
Replies []CommentReplyView `json:"replies" url:"replies,omitempty"`
LemmyResponse
}
type GetPersonMentions struct { type GetPersonMentions struct {
Sort Optional[CommentSortType] `json:"sort" url:"sort,omitempty"` Sort Optional[CommentSortType] `json:"sort" url:"sort,omitempty"`
Page Optional[int64] `json:"page" url:"page,omitempty"` Page Optional[int64] `json:"page" url:"page,omitempty"`
@ -146,6 +144,10 @@ type GetPersonMentions struct {
UnreadOnly Optional[bool] `json:"unread_only" url:"unread_only,omitempty"` UnreadOnly Optional[bool] `json:"unread_only" url:"unread_only,omitempty"`
Auth string `json:"auth" url:"auth,omitempty"` Auth string `json:"auth" url:"auth,omitempty"`
} }
type GetPersonMentionsResponse struct {
Mentions []PersonMentionView `json:"mentions" url:"mentions,omitempty"`
LemmyResponse
}
type MarkPersonMentionAsRead struct { type MarkPersonMentionAsRead struct {
PersonMentionID int `json:"person_mention_id" url:"person_mention_id,omitempty"` PersonMentionID int `json:"person_mention_id" url:"person_mention_id,omitempty"`
Read bool `json:"read" url:"read,omitempty"` Read bool `json:"read" url:"read,omitempty"`

View File

@ -18,10 +18,10 @@ type Post struct {
NSFW bool `json:"nsfw" url:"nsfw,omitempty"` NSFW bool `json:"nsfw" url:"nsfw,omitempty"`
EmbedTitle Optional[string] `json:"embed_title" url:"embed_title,omitempty"` EmbedTitle Optional[string] `json:"embed_title" url:"embed_title,omitempty"`
EmbedDescription Optional[string] `json:"embed_description" url:"embed_description,omitempty"` EmbedDescription Optional[string] `json:"embed_description" url:"embed_description,omitempty"`
EmbedVideoURL Optional[string] `json:"embed_video_url" url:"embed_video_url,omitempty"`
ThumbnailURL Optional[string] `json:"thumbnail_url" url:"thumbnail_url,omitempty"` ThumbnailURL Optional[string] `json:"thumbnail_url" url:"thumbnail_url,omitempty"`
ApID string `json:"ap_id" url:"ap_id,omitempty"` ApID string `json:"ap_id" url:"ap_id,omitempty"`
Local bool `json:"local" url:"local,omitempty"` Local bool `json:"local" url:"local,omitempty"`
EmbedVideoURL Optional[string] `json:"embed_video_url" url:"embed_video_url,omitempty"`
LanguageID int `json:"language_id" url:"language_id,omitempty"` LanguageID int `json:"language_id" url:"language_id,omitempty"`
FeaturedCommunity bool `json:"featured_community" url:"featured_community,omitempty"` FeaturedCommunity bool `json:"featured_community" url:"featured_community,omitempty"`
FeaturedLocal bool `json:"featured_local" url:"featured_local,omitempty"` FeaturedLocal bool `json:"featured_local" url:"featured_local,omitempty"`

View File

@ -26,7 +26,7 @@ type GetPostResponse struct {
PostView PostView `json:"post_view" url:"post_view,omitempty"` PostView PostView `json:"post_view" url:"post_view,omitempty"`
CommunityView CommunityView `json:"community_view" url:"community_view,omitempty"` CommunityView CommunityView `json:"community_view" url:"community_view,omitempty"`
Moderators []CommunityModeratorView `json:"moderators" url:"moderators,omitempty"` Moderators []CommunityModeratorView `json:"moderators" url:"moderators,omitempty"`
Online uint `json:"online" url:"online,omitempty"` CrossPosts []PostView `json:"cross_posts" url:"cross_posts,omitempty"`
LemmyResponse LemmyResponse
} }
type GetPosts struct { type GetPosts struct {

View File

@ -1,4 +0,0 @@
// Source: lemmy/crates/api_common/src/websocket/send.rs
// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT.
package types

View File

@ -16,22 +16,22 @@ type Search struct {
Auth Optional[string] `json:"auth" url:"auth,omitempty"` Auth Optional[string] `json:"auth" url:"auth,omitempty"`
} }
type SearchResponse struct { type SearchResponse struct {
Type string `json:"type_" url:"type_,omitempty"` Type SearchType `json:"type_" url:"type_,omitempty"`
Comments []CommentView `json:"comments" url:"comments,omitempty"` Comments []CommentView `json:"comments" url:"comments,omitempty"`
Posts []PostView `json:"posts" url:"posts,omitempty"` Posts []PostView `json:"posts" url:"posts,omitempty"`
Communities []CommunityView `json:"communities" url:"communities,omitempty"` Communities []CommunityView `json:"communities" url:"communities,omitempty"`
Users []PersonViewSafe `json:"users" url:"users,omitempty"` Users []PersonView `json:"users" url:"users,omitempty"`
LemmyResponse LemmyResponse
} }
type ResolveObject struct { type ResolveObject struct {
Q string `json:"q" url:"q,omitempty"` Q string `json:"q" url:"q,omitempty"`
Auth Optional[string] `json:"auth" url:"auth,omitempty"` Auth string `json:"auth" url:"auth,omitempty"`
} }
type ResolveObjectResponse struct { type ResolveObjectResponse struct {
Comment Optional[CommentView] `json:"comment" url:"comment,omitempty"` Comment Optional[CommentView] `json:"comment" url:"comment,omitempty"`
Post Optional[PostView] `json:"post" url:"post,omitempty"` Post Optional[PostView] `json:"post" url:"post,omitempty"`
Community Optional[CommunityView] `json:"community" url:"community,omitempty"` Community Optional[CommunityView] `json:"community" url:"community,omitempty"`
Person Optional[PersonViewSafe] `json:"person" url:"person,omitempty"` Person Optional[PersonView] `json:"person" url:"person,omitempty"`
LemmyResponse LemmyResponse
} }
type GetModlog struct { type GetModlog struct {
@ -39,9 +39,9 @@ type GetModlog struct {
CommunityID Optional[int] `json:"community_id" url:"community_id,omitempty"` CommunityID Optional[int] `json:"community_id" url:"community_id,omitempty"`
Page Optional[int64] `json:"page" url:"page,omitempty"` Page Optional[int64] `json:"page" url:"page,omitempty"`
Limit Optional[int64] `json:"limit" url:"limit,omitempty"` Limit Optional[int64] `json:"limit" url:"limit,omitempty"`
Auth Optional[string] `json:"auth" url:"auth,omitempty"`
Type Optional[ModlogActionType] `json:"type_" url:"type_,omitempty"` Type Optional[ModlogActionType] `json:"type_" url:"type_,omitempty"`
OtherPersonID Optional[int] `json:"other_person_id" url:"other_person_id,omitempty"` OtherPersonID Optional[int] `json:"other_person_id" url:"other_person_id,omitempty"`
Auth Optional[string] `json:"auth" url:"auth,omitempty"`
} }
type GetModlogResponse struct { type GetModlogResponse struct {
RemovedPosts []ModRemovePostView `json:"removed_posts" url:"removed_posts,omitempty"` RemovedPosts []ModRemovePostView `json:"removed_posts" url:"removed_posts,omitempty"`
@ -74,7 +74,7 @@ type CreateSite struct {
ApplicationQuestion Optional[string] `json:"application_question" url:"application_question,omitempty"` ApplicationQuestion Optional[string] `json:"application_question" url:"application_question,omitempty"`
PrivateInstance Optional[bool] `json:"private_instance" url:"private_instance,omitempty"` PrivateInstance Optional[bool] `json:"private_instance" url:"private_instance,omitempty"`
DefaultTheme Optional[string] `json:"default_theme" url:"default_theme,omitempty"` DefaultTheme Optional[string] `json:"default_theme" url:"default_theme,omitempty"`
DefaultPostListingType Optional[string] `json:"default_post_listing_type" url:"default_post_listing_type,omitempty"` DefaultPostListingType Optional[ListingType] `json:"default_post_listing_type" url:"default_post_listing_type,omitempty"`
LegalInformation Optional[string] `json:"legal_information" url:"legal_information,omitempty"` LegalInformation Optional[string] `json:"legal_information" url:"legal_information,omitempty"`
ApplicationEmailAdmins Optional[bool] `json:"application_email_admins" url:"application_email_admins,omitempty"` ApplicationEmailAdmins Optional[bool] `json:"application_email_admins" url:"application_email_admins,omitempty"`
HideModlogModNames Optional[bool] `json:"hide_modlog_mod_names" url:"hide_modlog_mod_names,omitempty"` HideModlogModNames Optional[bool] `json:"hide_modlog_mod_names" url:"hide_modlog_mod_names,omitempty"`
@ -117,7 +117,7 @@ type EditSite struct {
ApplicationQuestion Optional[string] `json:"application_question" url:"application_question,omitempty"` ApplicationQuestion Optional[string] `json:"application_question" url:"application_question,omitempty"`
PrivateInstance Optional[bool] `json:"private_instance" url:"private_instance,omitempty"` PrivateInstance Optional[bool] `json:"private_instance" url:"private_instance,omitempty"`
DefaultTheme Optional[string] `json:"default_theme" url:"default_theme,omitempty"` DefaultTheme Optional[string] `json:"default_theme" url:"default_theme,omitempty"`
DefaultPostListingType Optional[string] `json:"default_post_listing_type" url:"default_post_listing_type,omitempty"` DefaultPostListingType Optional[ListingType] `json:"default_post_listing_type" url:"default_post_listing_type,omitempty"`
LegalInformation Optional[string] `json:"legal_information" url:"legal_information,omitempty"` LegalInformation Optional[string] `json:"legal_information" url:"legal_information,omitempty"`
ApplicationEmailAdmins Optional[bool] `json:"application_email_admins" url:"application_email_admins,omitempty"` ApplicationEmailAdmins Optional[bool] `json:"application_email_admins" url:"application_email_admins,omitempty"`
HideModlogModNames Optional[bool] `json:"hide_modlog_mod_names" url:"hide_modlog_mod_names,omitempty"` HideModlogModNames Optional[bool] `json:"hide_modlog_mod_names" url:"hide_modlog_mod_names,omitempty"`
@ -152,19 +152,19 @@ type GetSite struct {
Auth Optional[string] `json:"auth" url:"auth,omitempty"` Auth Optional[string] `json:"auth" url:"auth,omitempty"`
} }
type SiteResponse struct { type SiteResponse struct {
SiteView SiteView `json:"site_view" url:"site_view,omitempty"` SiteView SiteView `json:"site_view" url:"site_view,omitempty"`
Taglines []Tagline `json:"taglines" url:"taglines,omitempty"`
LemmyResponse LemmyResponse
} }
type GetSiteResponse struct { type GetSiteResponse struct {
SiteView SiteView `json:"site_view" url:"site_view,omitempty"` SiteView SiteView `json:"site_view" url:"site_view,omitempty"`
Admins []PersonViewSafe `json:"admins" url:"admins,omitempty"` Admins []PersonView `json:"admins" url:"admins,omitempty"`
Online uint `json:"online" url:"online,omitempty"` Version string `json:"version" url:"version,omitempty"`
Version string `json:"version" url:"version,omitempty"` MyUser Optional[MyUserInfo] `json:"my_user" url:"my_user,omitempty"`
MyUser Optional[MyUserInfo] `json:"my_user" url:"my_user,omitempty"` AllLanguages []Language `json:"all_languages" url:"all_languages,omitempty"`
FederatedInstances Optional[FederatedInstances] `json:"federated_instances" url:"federated_instances,omitempty"` DiscussionLanguages []int `json:"discussion_languages" url:"discussion_languages,omitempty"`
AllLanguages []Language `json:"all_languages" url:"all_languages,omitempty"` Taglines []Tagline `json:"taglines" url:"taglines,omitempty"`
DiscussionLanguages []int `json:"discussion_languages" url:"discussion_languages,omitempty"` CustomEmojis []CustomEmojiView `json:"custom_emojis" url:"custom_emojis,omitempty"`
Taglines Optional[[]Tagline] `json:"taglines" url:"taglines,omitempty"`
LemmyResponse LemmyResponse
} }
type GetFederatedInstances struct { type GetFederatedInstances struct {
@ -175,7 +175,7 @@ type GetFederatedInstancesResponse struct {
LemmyResponse LemmyResponse
} }
type MyUserInfo struct { type MyUserInfo struct {
LocalUserView LocalUserSettingsView `json:"local_user_view" url:"local_user_view,omitempty"` LocalUserView LocalUserView `json:"local_user_view" url:"local_user_view,omitempty"`
Follows []CommunityFollowerView `json:"follows" url:"follows,omitempty"` Follows []CommunityFollowerView `json:"follows" url:"follows,omitempty"`
Moderates []CommunityModeratorView `json:"moderates" url:"moderates,omitempty"` Moderates []CommunityModeratorView `json:"moderates" url:"moderates,omitempty"`
CommunityBlocks []CommunityBlockView `json:"community_blocks" url:"community_blocks,omitempty"` CommunityBlocks []CommunityBlockView `json:"community_blocks" url:"community_blocks,omitempty"`
@ -186,9 +186,9 @@ type LeaveAdmin struct {
Auth string `json:"auth" url:"auth,omitempty"` Auth string `json:"auth" url:"auth,omitempty"`
} }
type FederatedInstances struct { type FederatedInstances struct {
Linked []string `json:"linked" url:"linked,omitempty"` Linked []Instance `json:"linked" url:"linked,omitempty"`
Allowed Optional[[]string] `json:"allowed" url:"allowed,omitempty"` Allowed []Instance `json:"allowed" url:"allowed,omitempty"`
Blocked Optional[[]string] `json:"blocked" url:"blocked,omitempty"` Blocked []Instance `json:"blocked" url:"blocked,omitempty"`
} }
type PurgePerson struct { type PurgePerson struct {
PersonID int `json:"person_id" url:"person_id,omitempty"` PersonID int `json:"person_id" url:"person_id,omitempty"`

View File

@ -1,41 +1,25 @@
// Source: lemmy/crates/db_views_actor/src/structs.rs // Source: lemmy/crates/db_views/src/structs.rs
// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. // Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT.
package types package types
type CommunityBlockView struct { type CommentReportView struct {
Person PersonSafe `json:"person" url:"person,omitempty"` CommentReport CommentReport `json:"comment_report" url:"comment_report,omitempty"`
Community CommunitySafe `json:"community" url:"community,omitempty"`
}
type CommunityFollowerView struct {
Community CommunitySafe `json:"community" url:"community,omitempty"`
Follower PersonSafe `json:"follower" url:"follower,omitempty"`
}
type CommunityModeratorView struct {
Community CommunitySafe `json:"community" url:"community,omitempty"`
Moderator PersonSafe `json:"moderator" url:"moderator,omitempty"`
}
type CommunityPersonBanView struct {
Community CommunitySafe `json:"community" url:"community,omitempty"`
Person PersonSafe `json:"person" url:"person,omitempty"`
}
type CommunityView struct {
Community CommunitySafe `json:"community" url:"community,omitempty"`
Subscribed SubscribedType `json:"subscribed" url:"subscribed,omitempty"`
Blocked bool `json:"blocked" url:"blocked,omitempty"`
Counts CommunityAggregates `json:"counts" url:"counts,omitempty"`
}
type PersonBlockView struct {
Person PersonSafe `json:"person" url:"person,omitempty"`
Target PersonSafe `json:"target" url:"target,omitempty"`
}
type PersonMentionView struct {
PersonMention PersonMention `json:"person_mention" url:"person_mention,omitempty"`
Comment Comment `json:"comment" url:"comment,omitempty"` Comment Comment `json:"comment" url:"comment,omitempty"`
Creator PersonSafe `json:"creator" url:"creator,omitempty"`
Post Post `json:"post" url:"post,omitempty"` Post Post `json:"post" url:"post,omitempty"`
Community CommunitySafe `json:"community" url:"community,omitempty"` Community Community `json:"community" url:"community,omitempty"`
Recipient PersonSafe `json:"recipient" url:"recipient,omitempty"` Creator Person `json:"creator" url:"creator,omitempty"`
CommentCreator Person `json:"comment_creator" url:"comment_creator,omitempty"`
Counts CommentAggregates `json:"counts" url:"counts,omitempty"`
CreatorBannedFromCommunity bool `json:"creator_banned_from_community" url:"creator_banned_from_community,omitempty"`
MyVote Optional[int16] `json:"my_vote" url:"my_vote,omitempty"`
Resolver Optional[Person] `json:"resolver" url:"resolver,omitempty"`
}
type CommentView struct {
Comment Comment `json:"comment" url:"comment,omitempty"`
Creator Person `json:"creator" url:"creator,omitempty"`
Post Post `json:"post" url:"post,omitempty"`
Community Community `json:"community" url:"community,omitempty"`
Counts CommentAggregates `json:"counts" url:"counts,omitempty"` Counts CommentAggregates `json:"counts" url:"counts,omitempty"`
CreatorBannedFromCommunity bool `json:"creator_banned_from_community" url:"creator_banned_from_community,omitempty"` CreatorBannedFromCommunity bool `json:"creator_banned_from_community" url:"creator_banned_from_community,omitempty"`
Subscribed SubscribedType `json:"subscribed" url:"subscribed,omitempty"` Subscribed SubscribedType `json:"subscribed" url:"subscribed,omitempty"`
@ -43,21 +27,60 @@ type PersonMentionView struct {
CreatorBlocked bool `json:"creator_blocked" url:"creator_blocked,omitempty"` CreatorBlocked bool `json:"creator_blocked" url:"creator_blocked,omitempty"`
MyVote Optional[int16] `json:"my_vote" url:"my_vote,omitempty"` MyVote Optional[int16] `json:"my_vote" url:"my_vote,omitempty"`
} }
type CommentReplyView struct { type LocalUserView struct {
CommentReply CommentReply `json:"comment_reply" url:"comment_reply,omitempty"` LocalUser LocalUser `json:"local_user" url:"local_user,omitempty"`
Comment Comment `json:"comment" url:"comment,omitempty"` Person Person `json:"person" url:"person,omitempty"`
Creator PersonSafe `json:"creator" url:"creator,omitempty"` Counts PersonAggregates `json:"counts" url:"counts,omitempty"`
Post Post `json:"post" url:"post,omitempty"`
Community CommunitySafe `json:"community" url:"community,omitempty"`
Recipient PersonSafe `json:"recipient" url:"recipient,omitempty"`
Counts CommentAggregates `json:"counts" url:"counts,omitempty"`
CreatorBannedFromCommunity bool `json:"creator_banned_from_community" url:"creator_banned_from_community,omitempty"`
Subscribed SubscribedType `json:"subscribed" url:"subscribed,omitempty"`
Saved bool `json:"saved" url:"saved,omitempty"`
CreatorBlocked bool `json:"creator_blocked" url:"creator_blocked,omitempty"`
MyVote Optional[int16] `json:"my_vote" url:"my_vote,omitempty"`
} }
type PersonViewSafe struct { type PostReportView struct {
Person PersonSafe `json:"person" url:"person,omitempty"` PostReport PostReport `json:"post_report" url:"post_report,omitempty"`
Counts PersonAggregates `json:"counts" url:"counts,omitempty"` Post Post `json:"post" url:"post,omitempty"`
Community Community `json:"community" url:"community,omitempty"`
Creator Person `json:"creator" url:"creator,omitempty"`
PostCreator Person `json:"post_creator" url:"post_creator,omitempty"`
CreatorBannedFromCommunity bool `json:"creator_banned_from_community" url:"creator_banned_from_community,omitempty"`
MyVote Optional[int16] `json:"my_vote" url:"my_vote,omitempty"`
Counts PostAggregates `json:"counts" url:"counts,omitempty"`
Resolver Optional[Person] `json:"resolver" url:"resolver,omitempty"`
}
type PostView struct {
Post Post `json:"post" url:"post,omitempty"`
Creator Person `json:"creator" url:"creator,omitempty"`
Community Community `json:"community" url:"community,omitempty"`
CreatorBannedFromCommunity bool `json:"creator_banned_from_community" url:"creator_banned_from_community,omitempty"`
Counts PostAggregates `json:"counts" url:"counts,omitempty"`
Subscribed SubscribedType `json:"subscribed" url:"subscribed,omitempty"`
Saved bool `json:"saved" url:"saved,omitempty"`
Read bool `json:"read" url:"read,omitempty"`
CreatorBlocked bool `json:"creator_blocked" url:"creator_blocked,omitempty"`
MyVote Optional[int16] `json:"my_vote" url:"my_vote,omitempty"`
UnreadComments int64 `json:"unread_comments" url:"unread_comments,omitempty"`
}
type PrivateMessageView struct {
PrivateMessage PrivateMessage `json:"private_message" url:"private_message,omitempty"`
Creator Person `json:"creator" url:"creator,omitempty"`
Recipient Person `json:"recipient" url:"recipient,omitempty"`
}
type PrivateMessageReportView struct {
PrivateMessageReport PrivateMessageReport `json:"private_message_report" url:"private_message_report,omitempty"`
PrivateMessage PrivateMessage `json:"private_message" url:"private_message,omitempty"`
PrivateMessageCreator Person `json:"private_message_creator" url:"private_message_creator,omitempty"`
Creator Person `json:"creator" url:"creator,omitempty"`
Resolver Optional[Person] `json:"resolver" url:"resolver,omitempty"`
}
type RegistrationApplicationView struct {
RegistrationApplication RegistrationApplication `json:"registration_application" url:"registration_application,omitempty"`
CreatorLocalUser LocalUser `json:"creator_local_user" url:"creator_local_user,omitempty"`
Creator Person `json:"creator" url:"creator,omitempty"`
Admin Optional[Person] `json:"admin" url:"admin,omitempty"`
}
type SiteView struct {
Site Site `json:"site" url:"site,omitempty"`
LocalSite LocalSite `json:"local_site" url:"local_site,omitempty"`
LocalSiteRateLimit LocalSiteRateLimit `json:"local_site_rate_limit" url:"local_site_rate_limit,omitempty"`
Counts SiteAggregates `json:"counts" url:"counts,omitempty"`
}
type CustomEmojiView struct {
CustomEmoji CustomEmoji `json:"custom_emoji" url:"custom_emoji,omitempty"`
Keywords []CustomEmojiKeyword `json:"keywords" url:"keywords,omitempty"`
} }

View File

@ -1,87 +1,95 @@
// Source: lemmy/crates/db_views/src/structs.rs // Source: lemmy/crates/db_views_moderator/src/structs.rs
// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. // Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT.
package types package types
type CommentReportView struct { type ModAddCommunityView struct {
CommentReport CommentReport `json:"comment_report" url:"comment_report,omitempty"` ModAddCommunity ModAddCommunity `json:"mod_add_community" url:"mod_add_community,omitempty"`
Comment Comment `json:"comment" url:"comment,omitempty"` Moderator Optional[Person] `json:"moderator" url:"moderator,omitempty"`
Post Post `json:"post" url:"post,omitempty"` Community Community `json:"community" url:"community,omitempty"`
Community CommunitySafe `json:"community" url:"community,omitempty"` ModdedPerson Person `json:"modded_person" url:"modded_person,omitempty"`
Creator PersonSafe `json:"creator" url:"creator,omitempty"`
CommentCreator PersonSafe `json:"comment_creator" url:"comment_creator,omitempty"`
Counts CommentAggregates `json:"counts" url:"counts,omitempty"`
CreatorBannedFromCommunity bool `json:"creator_banned_from_community" url:"creator_banned_from_community,omitempty"`
MyVote Optional[int16] `json:"my_vote" url:"my_vote,omitempty"`
Resolver Optional[PersonSafe] `json:"resolver" url:"resolver,omitempty"`
} }
type CommentView struct { type ModAddView struct {
Comment Comment `json:"comment" url:"comment,omitempty"` ModAdd ModAdd `json:"mod_add" url:"mod_add,omitempty"`
Creator PersonSafe `json:"creator" url:"creator,omitempty"` Moderator Optional[Person] `json:"moderator" url:"moderator,omitempty"`
Post Post `json:"post" url:"post,omitempty"` ModdedPerson Person `json:"modded_person" url:"modded_person,omitempty"`
Community CommunitySafe `json:"community" url:"community,omitempty"`
Counts CommentAggregates `json:"counts" url:"counts,omitempty"`
CreatorBannedFromCommunity bool `json:"creator_banned_from_community" url:"creator_banned_from_community,omitempty"`
Subscribed SubscribedType `json:"subscribed" url:"subscribed,omitempty"`
Saved bool `json:"saved" url:"saved,omitempty"`
CreatorBlocked bool `json:"creator_blocked" url:"creator_blocked,omitempty"`
MyVote Optional[int16] `json:"my_vote" url:"my_vote,omitempty"`
} }
type LocalUserView struct { type ModBanFromCommunityView struct {
LocalUser LocalUser `json:"local_user" url:"local_user,omitempty"` ModBanFromCommunity ModBanFromCommunity `json:"mod_ban_from_community" url:"mod_ban_from_community,omitempty"`
Person Person `json:"person" url:"person,omitempty"` Moderator Optional[Person] `json:"moderator" url:"moderator,omitempty"`
Counts PersonAggregates `json:"counts" url:"counts,omitempty"` Community Community `json:"community" url:"community,omitempty"`
BannedPerson Person `json:"banned_person" url:"banned_person,omitempty"`
} }
type LocalUserSettingsView struct { type ModBanView struct {
LocalUser LocalUserSettings `json:"local_user" url:"local_user,omitempty"` ModBan ModBan `json:"mod_ban" url:"mod_ban,omitempty"`
Person PersonSafe `json:"person" url:"person,omitempty"` Moderator Optional[Person] `json:"moderator" url:"moderator,omitempty"`
Counts PersonAggregates `json:"counts" url:"counts,omitempty"` BannedPerson Person `json:"banned_person" url:"banned_person,omitempty"`
} }
type PostReportView struct { type ModHideCommunityView struct {
PostReport PostReport `json:"post_report" url:"post_report,omitempty"` ModHideCommunity ModHideCommunity `json:"mod_hide_community" url:"mod_hide_community,omitempty"`
Post Post `json:"post" url:"post,omitempty"` Admin Optional[Person] `json:"admin" url:"admin,omitempty"`
Community CommunitySafe `json:"community" url:"community,omitempty"` Community Community `json:"community" url:"community,omitempty"`
Creator PersonSafe `json:"creator" url:"creator,omitempty"`
PostCreator PersonSafe `json:"post_creator" url:"post_creator,omitempty"`
CreatorBannedFromCommunity bool `json:"creator_banned_from_community" url:"creator_banned_from_community,omitempty"`
MyVote Optional[int16] `json:"my_vote" url:"my_vote,omitempty"`
Counts PostAggregates `json:"counts" url:"counts,omitempty"`
Resolver Optional[PersonSafe] `json:"resolver" url:"resolver,omitempty"`
} }
type PostView struct { type ModLockPostView struct {
Post Post `json:"post" url:"post,omitempty"` ModLockPost ModLockPost `json:"mod_lock_post" url:"mod_lock_post,omitempty"`
Creator PersonSafe `json:"creator" url:"creator,omitempty"` Moderator Optional[Person] `json:"moderator" url:"moderator,omitempty"`
Community CommunitySafe `json:"community" url:"community,omitempty"` Post Post `json:"post" url:"post,omitempty"`
CreatorBannedFromCommunity bool `json:"creator_banned_from_community" url:"creator_banned_from_community,omitempty"` Community Community `json:"community" url:"community,omitempty"`
Counts PostAggregates `json:"counts" url:"counts,omitempty"`
Subscribed SubscribedType `json:"subscribed" url:"subscribed,omitempty"`
Saved bool `json:"saved" url:"saved,omitempty"`
Read bool `json:"read" url:"read,omitempty"`
CreatorBlocked bool `json:"creator_blocked" url:"creator_blocked,omitempty"`
MyVote Optional[int16] `json:"my_vote" url:"my_vote,omitempty"`
UnreadComments int64 `json:"unread_comments" url:"unread_comments,omitempty"`
} }
type PrivateMessageView struct { type ModRemoveCommentView struct {
PrivateMessage PrivateMessage `json:"private_message" url:"private_message,omitempty"` ModRemoveComment ModRemoveComment `json:"mod_remove_comment" url:"mod_remove_comment,omitempty"`
Creator PersonSafe `json:"creator" url:"creator,omitempty"` Moderator Optional[Person] `json:"moderator" url:"moderator,omitempty"`
Recipient PersonSafe `json:"recipient" url:"recipient,omitempty"` Comment Comment `json:"comment" url:"comment,omitempty"`
Commenter Person `json:"commenter" url:"commenter,omitempty"`
Post Post `json:"post" url:"post,omitempty"`
Community Community `json:"community" url:"community,omitempty"`
} }
type PrivateMessageReportView struct { type ModRemoveCommunityView struct {
PrivateMessageReport PrivateMessageReport `json:"private_message_report" url:"private_message_report,omitempty"` ModRemoveCommunity ModRemoveCommunity `json:"mod_remove_community" url:"mod_remove_community,omitempty"`
PrivateMessage PrivateMessage `json:"private_message" url:"private_message,omitempty"` Moderator Optional[Person] `json:"moderator" url:"moderator,omitempty"`
PrivateMessageCreator PersonSafe `json:"private_message_creator" url:"private_message_creator,omitempty"` Community Community `json:"community" url:"community,omitempty"`
Creator PersonSafe `json:"creator" url:"creator,omitempty"`
Resolver Optional[PersonSafe] `json:"resolver" url:"resolver,omitempty"`
} }
type RegistrationApplicationView struct { type ModRemovePostView struct {
RegistrationApplication RegistrationApplication `json:"registration_application" url:"registration_application,omitempty"` ModRemovePost ModRemovePost `json:"mod_remove_post" url:"mod_remove_post,omitempty"`
CreatorLocalUser LocalUserSettings `json:"creator_local_user" url:"creator_local_user,omitempty"` Moderator Optional[Person] `json:"moderator" url:"moderator,omitempty"`
Creator PersonSafe `json:"creator" url:"creator,omitempty"` Post Post `json:"post" url:"post,omitempty"`
Admin Optional[PersonSafe] `json:"admin" url:"admin,omitempty"` Community Community `json:"community" url:"community,omitempty"`
} }
type SiteView struct { type ModFeaturePostView struct {
Site Site `json:"site" url:"site,omitempty"` ModFeaturePost ModFeaturePost `json:"mod_feature_post" url:"mod_feature_post,omitempty"`
LocalSite LocalSite `json:"local_site" url:"local_site,omitempty"` Moderator Optional[Person] `json:"moderator" url:"moderator,omitempty"`
LocalSiteRateLimit LocalSiteRateLimit `json:"local_site_rate_limit" url:"local_site_rate_limit,omitempty"` Post Post `json:"post" url:"post,omitempty"`
Counts SiteAggregates `json:"counts" url:"counts,omitempty"` Community Community `json:"community" url:"community,omitempty"`
}
type ModTransferCommunityView struct {
ModTransferCommunity ModTransferCommunity `json:"mod_transfer_community" url:"mod_transfer_community,omitempty"`
Moderator Optional[Person] `json:"moderator" url:"moderator,omitempty"`
Community Community `json:"community" url:"community,omitempty"`
ModdedPerson Person `json:"modded_person" url:"modded_person,omitempty"`
}
type AdminPurgeCommentView struct {
AdminPurgeComment AdminPurgeComment `json:"admin_purge_comment" url:"admin_purge_comment,omitempty"`
Admin Optional[Person] `json:"admin" url:"admin,omitempty"`
Post Post `json:"post" url:"post,omitempty"`
}
type AdminPurgeCommunityView struct {
AdminPurgeCommunity AdminPurgeCommunity `json:"admin_purge_community" url:"admin_purge_community,omitempty"`
Admin Optional[Person] `json:"admin" url:"admin,omitempty"`
}
type AdminPurgePersonView struct {
AdminPurgePerson AdminPurgePerson `json:"admin_purge_person" url:"admin_purge_person,omitempty"`
Admin Optional[Person] `json:"admin" url:"admin,omitempty"`
}
type AdminPurgePostView struct {
AdminPurgePost AdminPurgePost `json:"admin_purge_post" url:"admin_purge_post,omitempty"`
Admin Optional[Person] `json:"admin" url:"admin,omitempty"`
Community Community `json:"community" url:"community,omitempty"`
}
type ModlogListParams struct {
CommunityID Optional[int] `json:"community_id" url:"community_id,omitempty"`
ModPersonID Optional[int] `json:"mod_person_id" url:"mod_person_id,omitempty"`
OtherPersonID Optional[int] `json:"other_person_id" url:"other_person_id,omitempty"`
Page Optional[int64] `json:"page" url:"page,omitempty"`
Limit Optional[int64] `json:"limit" url:"limit,omitempty"`
HideModlogNames bool `json:"hide_modlog_names" url:"hide_modlog_names,omitempty"`
} }

View File

@ -1,95 +1,76 @@
// Source: lemmy/crates/db_views_moderator/src/structs.rs // Source: lemmy/crates/db_schema/src/aggregates/structs.rs
// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. // Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT.
package types package types
type ModAddCommunityView struct { type CommentAggregates struct {
ModAddCommunity ModAddCommunity `json:"mod_add_community" url:"mod_add_community,omitempty"` ID int32 `json:"id" url:"id,omitempty"`
Moderator Optional[PersonSafe] `json:"moderator" url:"moderator,omitempty"` CommentID int `json:"comment_id" url:"comment_id,omitempty"`
Community CommunitySafe `json:"community" url:"community,omitempty"` Score int64 `json:"score" url:"score,omitempty"`
ModdedPerson PersonSafe `json:"modded_person" url:"modded_person,omitempty"` Upvotes int64 `json:"upvotes" url:"upvotes,omitempty"`
Downvotes int64 `json:"downvotes" url:"downvotes,omitempty"`
Published LemmyTime `json:"published" url:"published,omitempty"`
ChildCount int32 `json:"child_count" url:"child_count,omitempty"`
HotRank int32 `json:"hot_rank" url:"hot_rank,omitempty"`
} }
type ModAddView struct { type CommunityAggregates struct {
ModAdd ModAdd `json:"mod_add" url:"mod_add,omitempty"` ID int32 `json:"id" url:"id,omitempty"`
Moderator Optional[PersonSafe] `json:"moderator" url:"moderator,omitempty"` CommunityID int `json:"community_id" url:"community_id,omitempty"`
ModdedPerson PersonSafe `json:"modded_person" url:"modded_person,omitempty"` Subscribers int64 `json:"subscribers" url:"subscribers,omitempty"`
Posts int64 `json:"posts" url:"posts,omitempty"`
Comments int64 `json:"comments" url:"comments,omitempty"`
Published LemmyTime `json:"published" url:"published,omitempty"`
UsersActiveDay int64 `json:"users_active_day" url:"users_active_day,omitempty"`
UsersActiveWeek int64 `json:"users_active_week" url:"users_active_week,omitempty"`
UsersActiveMonth int64 `json:"users_active_month" url:"users_active_month,omitempty"`
UsersActiveHalfYear int64 `json:"users_active_half_year" url:"users_active_half_year,omitempty"`
HotRank int32 `json:"hot_rank" url:"hot_rank,omitempty"`
} }
type ModBanFromCommunityView struct { type PersonAggregates struct {
ModBanFromCommunity ModBanFromCommunity `json:"mod_ban_from_community" url:"mod_ban_from_community,omitempty"` ID int32 `json:"id" url:"id,omitempty"`
Moderator Optional[PersonSafe] `json:"moderator" url:"moderator,omitempty"` PersonID int `json:"person_id" url:"person_id,omitempty"`
Community CommunitySafe `json:"community" url:"community,omitempty"` PostCount int64 `json:"post_count" url:"post_count,omitempty"`
BannedPerson PersonSafe `json:"banned_person" url:"banned_person,omitempty"` PostScore int64 `json:"post_score" url:"post_score,omitempty"`
CommentCount int64 `json:"comment_count" url:"comment_count,omitempty"`
CommentScore int64 `json:"comment_score" url:"comment_score,omitempty"`
} }
type ModBanView struct { type PostAggregates struct {
ModBan ModBan `json:"mod_ban" url:"mod_ban,omitempty"` ID int32 `json:"id" url:"id,omitempty"`
Moderator Optional[PersonSafe] `json:"moderator" url:"moderator,omitempty"` PostID int `json:"post_id" url:"post_id,omitempty"`
BannedPerson PersonSafe `json:"banned_person" url:"banned_person,omitempty"` Comments int64 `json:"comments" url:"comments,omitempty"`
Score int64 `json:"score" url:"score,omitempty"`
Upvotes int64 `json:"upvotes" url:"upvotes,omitempty"`
Downvotes int64 `json:"downvotes" url:"downvotes,omitempty"`
Published LemmyTime `json:"published" url:"published,omitempty"`
NewestCommentTimeNecro LemmyTime `json:"newest_comment_time_necro" url:"newest_comment_time_necro,omitempty"`
NewestCommentTime LemmyTime `json:"newest_comment_time" url:"newest_comment_time,omitempty"`
FeaturedCommunity bool `json:"featured_community" url:"featured_community,omitempty"`
FeaturedLocal bool `json:"featured_local" url:"featured_local,omitempty"`
HotRank int32 `json:"hot_rank" url:"hot_rank,omitempty"`
HotRankActive int32 `json:"hot_rank_active" url:"hot_rank_active,omitempty"`
} }
type ModHideCommunityView struct { type PersonPostAggregates struct {
ModHideCommunity ModHideCommunity `json:"mod_hide_community" url:"mod_hide_community,omitempty"` ID int32 `json:"id" url:"id,omitempty"`
Admin Optional[PersonSafe] `json:"admin" url:"admin,omitempty"` PersonID int `json:"person_id" url:"person_id,omitempty"`
Community CommunitySafe `json:"community" url:"community,omitempty"` PostID int `json:"post_id" url:"post_id,omitempty"`
ReadComments int64 `json:"read_comments" url:"read_comments,omitempty"`
Published LemmyTime `json:"published" url:"published,omitempty"`
} }
type ModLockPostView struct { type PersonPostAggregatesForm struct {
ModLockPost ModLockPost `json:"mod_lock_post" url:"mod_lock_post,omitempty"` PersonID int `json:"person_id" url:"person_id,omitempty"`
Moderator Optional[PersonSafe] `json:"moderator" url:"moderator,omitempty"` PostID int `json:"post_id" url:"post_id,omitempty"`
Post Post `json:"post" url:"post,omitempty"` ReadComments int64 `json:"read_comments" url:"read_comments,omitempty"`
Community CommunitySafe `json:"community" url:"community,omitempty"` Published LemmyTime `json:"published" url:"published,omitempty"`
} }
type ModRemoveCommentView struct { type SiteAggregates struct {
ModRemoveComment ModRemoveComment `json:"mod_remove_comment" url:"mod_remove_comment,omitempty"` ID int32 `json:"id" url:"id,omitempty"`
Moderator Optional[PersonSafe] `json:"moderator" url:"moderator,omitempty"` SiteID int `json:"site_id" url:"site_id,omitempty"`
Comment Comment `json:"comment" url:"comment,omitempty"` Users int64 `json:"users" url:"users,omitempty"`
Commenter PersonSafe `json:"commenter" url:"commenter,omitempty"` Posts int64 `json:"posts" url:"posts,omitempty"`
Post Post `json:"post" url:"post,omitempty"` Comments int64 `json:"comments" url:"comments,omitempty"`
Community CommunitySafe `json:"community" url:"community,omitempty"` Communities int64 `json:"communities" url:"communities,omitempty"`
} UsersActiveDay int64 `json:"users_active_day" url:"users_active_day,omitempty"`
type ModRemoveCommunityView struct { UsersActiveWeek int64 `json:"users_active_week" url:"users_active_week,omitempty"`
ModRemoveCommunity ModRemoveCommunity `json:"mod_remove_community" url:"mod_remove_community,omitempty"` UsersActiveMonth int64 `json:"users_active_month" url:"users_active_month,omitempty"`
Moderator Optional[PersonSafe] `json:"moderator" url:"moderator,omitempty"` UsersActiveHalfYear int64 `json:"users_active_half_year" url:"users_active_half_year,omitempty"`
Community CommunitySafe `json:"community" url:"community,omitempty"`
}
type ModRemovePostView struct {
ModRemovePost ModRemovePost `json:"mod_remove_post" url:"mod_remove_post,omitempty"`
Moderator Optional[PersonSafe] `json:"moderator" url:"moderator,omitempty"`
Post Post `json:"post" url:"post,omitempty"`
Community CommunitySafe `json:"community" url:"community,omitempty"`
}
type ModFeaturePostView struct {
ModFeaturePost ModFeaturePost `json:"mod_feature_post" url:"mod_feature_post,omitempty"`
Moderator Optional[PersonSafe] `json:"moderator" url:"moderator,omitempty"`
Post Post `json:"post" url:"post,omitempty"`
Community CommunitySafe `json:"community" url:"community,omitempty"`
}
type ModTransferCommunityView struct {
ModTransferCommunity ModTransferCommunity `json:"mod_transfer_community" url:"mod_transfer_community,omitempty"`
Moderator Optional[PersonSafe] `json:"moderator" url:"moderator,omitempty"`
Community CommunitySafe `json:"community" url:"community,omitempty"`
ModdedPerson PersonSafe `json:"modded_person" url:"modded_person,omitempty"`
}
type AdminPurgeCommentView struct {
AdminPurgeComment AdminPurgeComment `json:"admin_purge_comment" url:"admin_purge_comment,omitempty"`
Admin Optional[PersonSafe] `json:"admin" url:"admin,omitempty"`
Post Post `json:"post" url:"post,omitempty"`
}
type AdminPurgeCommunityView struct {
AdminPurgeCommunity AdminPurgeCommunity `json:"admin_purge_community" url:"admin_purge_community,omitempty"`
Admin Optional[PersonSafe] `json:"admin" url:"admin,omitempty"`
}
type AdminPurgePersonView struct {
AdminPurgePerson AdminPurgePerson `json:"admin_purge_person" url:"admin_purge_person,omitempty"`
Admin Optional[PersonSafe] `json:"admin" url:"admin,omitempty"`
}
type AdminPurgePostView struct {
AdminPurgePost AdminPurgePost `json:"admin_purge_post" url:"admin_purge_post,omitempty"`
Admin Optional[PersonSafe] `json:"admin" url:"admin,omitempty"`
Community CommunitySafe `json:"community" url:"community,omitempty"`
}
type ModlogListParams struct {
CommunityID Optional[int] `json:"community_id" url:"community_id,omitempty"`
ModPersonID Optional[int] `json:"mod_person_id" url:"mod_person_id,omitempty"`
OtherPersonID Optional[int] `json:"other_person_id" url:"other_person_id,omitempty"`
Page Optional[int64] `json:"page" url:"page,omitempty"`
Limit Optional[int64] `json:"limit" url:"limit,omitempty"`
HideModlogNames bool `json:"hide_modlog_names" url:"hide_modlog_names,omitempty"`
} }

View File

@ -1,72 +0,0 @@
// Source: lemmy/crates/db_schema/src/aggregates/structs.rs
// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT.
package types
type CommentAggregates struct {
ID int32 `json:"id" url:"id,omitempty"`
CommentID int `json:"comment_id" url:"comment_id,omitempty"`
Score int64 `json:"score" url:"score,omitempty"`
Upvotes int64 `json:"upvotes" url:"upvotes,omitempty"`
Downvotes int64 `json:"downvotes" url:"downvotes,omitempty"`
Published LemmyTime `json:"published" url:"published,omitempty"`
ChildCount int32 `json:"child_count" url:"child_count,omitempty"`
}
type CommunityAggregates struct {
ID int32 `json:"id" url:"id,omitempty"`
CommunityID int `json:"community_id" url:"community_id,omitempty"`
Subscribers int64 `json:"subscribers" url:"subscribers,omitempty"`
Posts int64 `json:"posts" url:"posts,omitempty"`
Comments int64 `json:"comments" url:"comments,omitempty"`
Published LemmyTime `json:"published" url:"published,omitempty"`
UsersActiveDay int64 `json:"users_active_day" url:"users_active_day,omitempty"`
UsersActiveWeek int64 `json:"users_active_week" url:"users_active_week,omitempty"`
UsersActiveMonth int64 `json:"users_active_month" url:"users_active_month,omitempty"`
UsersActiveHalfYear int64 `json:"users_active_half_year" url:"users_active_half_year,omitempty"`
}
type PersonAggregates struct {
ID int32 `json:"id" url:"id,omitempty"`
PersonID int `json:"person_id" url:"person_id,omitempty"`
PostCount int64 `json:"post_count" url:"post_count,omitempty"`
PostScore int64 `json:"post_score" url:"post_score,omitempty"`
CommentCount int64 `json:"comment_count" url:"comment_count,omitempty"`
CommentScore int64 `json:"comment_score" url:"comment_score,omitempty"`
}
type PostAggregates struct {
ID int32 `json:"id" url:"id,omitempty"`
PostID int `json:"post_id" url:"post_id,omitempty"`
Comments int64 `json:"comments" url:"comments,omitempty"`
Score int64 `json:"score" url:"score,omitempty"`
Upvotes int64 `json:"upvotes" url:"upvotes,omitempty"`
Downvotes int64 `json:"downvotes" url:"downvotes,omitempty"`
Published LemmyTime `json:"published" url:"published,omitempty"`
NewestCommentTimeNecro LemmyTime `json:"newest_comment_time_necro" url:"newest_comment_time_necro,omitempty"`
NewestCommentTime LemmyTime `json:"newest_comment_time" url:"newest_comment_time,omitempty"`
FeaturedCommunity bool `json:"featured_community" url:"featured_community,omitempty"`
FeaturedLocal bool `json:"featured_local" url:"featured_local,omitempty"`
}
type PersonPostAggregates struct {
ID int32 `json:"id" url:"id,omitempty"`
PersonID int `json:"person_id" url:"person_id,omitempty"`
PostID int `json:"post_id" url:"post_id,omitempty"`
ReadComments int64 `json:"read_comments" url:"read_comments,omitempty"`
Published LemmyTime `json:"published" url:"published,omitempty"`
}
type PersonPostAggregatesForm struct {
PersonID int `json:"person_id" url:"person_id,omitempty"`
PostID int `json:"post_id" url:"post_id,omitempty"`
ReadComments int64 `json:"read_comments" url:"read_comments,omitempty"`
Published LemmyTime `json:"published" url:"published,omitempty"`
}
type SiteAggregates struct {
ID int32 `json:"id" url:"id,omitempty"`
SiteID int `json:"site_id" url:"site_id,omitempty"`
Users int64 `json:"users" url:"users,omitempty"`
Posts int64 `json:"posts" url:"posts,omitempty"`
Comments int64 `json:"comments" url:"comments,omitempty"`
Communities int64 `json:"communities" url:"communities,omitempty"`
UsersActiveDay int64 `json:"users_active_day" url:"users_active_day,omitempty"`
UsersActiveWeek int64 `json:"users_active_week" url:"users_active_week,omitempty"`
UsersActiveMonth int64 `json:"users_active_month" url:"users_active_month,omitempty"`
UsersActiveHalfYear int64 `json:"users_active_half_year" url:"users_active_half_year,omitempty"`
}

View File

@ -1,38 +1,63 @@
// Source: lemmy/crates/api_common/src/websocket/structs.rs // Source: lemmy/crates/db_views_actor/src/structs.rs
// Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT. // Code generated by go.elara.ws/go-lemmy/cmd/gen (struct generator). DO NOT EDIT.
package types package types
type UserJoin struct { type CommunityBlockView struct {
Auth string `json:"auth" url:"auth,omitempty"` Person Person `json:"person" url:"person,omitempty"`
Community Community `json:"community" url:"community,omitempty"`
} }
type UserJoinResponse struct { type CommunityFollowerView struct {
Joined bool `json:"joined" url:"joined,omitempty"` Community Community `json:"community" url:"community,omitempty"`
LemmyResponse Follower Person `json:"follower" url:"follower,omitempty"`
} }
type CommunityJoin struct { type CommunityModeratorView struct {
CommunityID int `json:"community_id" url:"community_id,omitempty"` Community Community `json:"community" url:"community,omitempty"`
Moderator Person `json:"moderator" url:"moderator,omitempty"`
} }
type CommunityJoinResponse struct { type CommunityPersonBanView struct {
Joined bool `json:"joined" url:"joined,omitempty"` Community Community `json:"community" url:"community,omitempty"`
LemmyResponse Person Person `json:"person" url:"person,omitempty"`
} }
type ModJoin struct { type CommunityView struct {
CommunityID int `json:"community_id" url:"community_id,omitempty"` Community Community `json:"community" url:"community,omitempty"`
Subscribed SubscribedType `json:"subscribed" url:"subscribed,omitempty"`
Blocked bool `json:"blocked" url:"blocked,omitempty"`
Counts CommunityAggregates `json:"counts" url:"counts,omitempty"`
} }
type ModJoinResponse struct { type PersonBlockView struct {
Joined bool `json:"joined" url:"joined,omitempty"` Person Person `json:"person" url:"person,omitempty"`
LemmyResponse Target Person `json:"target" url:"target,omitempty"`
} }
type PostJoin struct { type PersonMentionView struct {
PostID int `json:"post_id" url:"post_id,omitempty"` PersonMention PersonMention `json:"person_mention" url:"person_mention,omitempty"`
Comment Comment `json:"comment" url:"comment,omitempty"`
Creator Person `json:"creator" url:"creator,omitempty"`
Post Post `json:"post" url:"post,omitempty"`
Community Community `json:"community" url:"community,omitempty"`
Recipient Person `json:"recipient" url:"recipient,omitempty"`
Counts CommentAggregates `json:"counts" url:"counts,omitempty"`
CreatorBannedFromCommunity bool `json:"creator_banned_from_community" url:"creator_banned_from_community,omitempty"`
Subscribed SubscribedType `json:"subscribed" url:"subscribed,omitempty"`
Saved bool `json:"saved" url:"saved,omitempty"`
CreatorBlocked bool `json:"creator_blocked" url:"creator_blocked,omitempty"`
MyVote Optional[int16] `json:"my_vote" url:"my_vote,omitempty"`
} }
type PostJoinResponse struct { type CommentReplyView struct {
Joined bool `json:"joined" url:"joined,omitempty"` CommentReply CommentReply `json:"comment_reply" url:"comment_reply,omitempty"`
LemmyResponse Comment Comment `json:"comment" url:"comment,omitempty"`
Creator Person `json:"creator" url:"creator,omitempty"`
Post Post `json:"post" url:"post,omitempty"`
Community Community `json:"community" url:"community,omitempty"`
Recipient Person `json:"recipient" url:"recipient,omitempty"`
Counts CommentAggregates `json:"counts" url:"counts,omitempty"`
CreatorBannedFromCommunity bool `json:"creator_banned_from_community" url:"creator_banned_from_community,omitempty"`
Subscribed SubscribedType `json:"subscribed" url:"subscribed,omitempty"`
Saved bool `json:"saved" url:"saved,omitempty"`
CreatorBlocked bool `json:"creator_blocked" url:"creator_blocked,omitempty"`
MyVote Optional[int16] `json:"my_vote" url:"my_vote,omitempty"`
} }
type CaptchaItem struct { type PersonView struct {
Uuid string `json:"uuid" url:"uuid,omitempty"` Person Person `json:"person" url:"person,omitempty"`
Answer string `json:"answer" url:"answer,omitempty"` Counts PersonAggregates `json:"counts" url:"counts,omitempty"`
Expires LemmyTime `json:"expires" url:"expires,omitempty"`
} }

View File

@ -57,29 +57,3 @@ type LemmyWebSocketMsg struct {
Op string `json:"op"` Op string `json:"op"`
Data json.RawMessage `json:"data"` Data json.RawMessage `json:"data"`
} }
// IsOneOf checks if the message is one of the given operations.
func (msg LemmyWebSocketMsg) IsOneOf(ops ...Operation) bool {
for _, op := range ops {
if op.Operation() == msg.Op {
return true
}
}
return false
}
type Operation interface {
Operation() string
}
func (u UserOperation) Operation() string {
return string(u)
}
func (u UserOperationCRUD) Operation() string {
return string(u)
}
func (u UserOperationApub) Operation() string {
return string(u)
}

View File

@ -1,214 +0,0 @@
package lemmy
import (
"context"
"encoding/json"
"fmt"
"net"
"net/http"
"net/url"
"reflect"
"time"
"github.com/cenkalti/backoff/v4"
"github.com/gorilla/websocket"
"go.elara.ws/go-lemmy/types"
)
type authData struct {
Auth string `json:"auth"`
}
// WSClient is a client for Lemmy's WebSocket API
type WSClient struct {
conn *websocket.Conn
baseURL *url.URL
respCh chan types.LemmyWebSocketMsg
errCh chan error
recHandler func(c *WSClient)
Token string
}
// NewWebSocket creates and returns a new WSClient, and
// starts a goroutine to read server responses and errors
func NewWebSocket(baseURL string) (*WSClient, error) {
u, err := url.Parse(baseURL)
if err != nil {
return nil, err
}
u = u.JoinPath("/api/v3")
conn, _, err := keepaliveDialer().Dial(u.JoinPath("ws").String(), nil)
if err != nil {
return nil, err
}
out := &WSClient{
conn: conn,
baseURL: u,
respCh: make(chan types.LemmyWebSocketMsg, 10),
errCh: make(chan error, 10),
}
go func() {
for {
var msg types.LemmyWebSocketMsg
err = conn.ReadJSON(&msg)
if err != nil {
out.errCh <- err
conn.Close()
err = backoff.RetryNotify(
func() error {
conn, _, err = keepaliveDialer().Dial(u.JoinPath("ws").String(), nil)
if err != nil {
out.errCh <- err
return err
}
out.conn = conn
out.recHandler(out)
return nil
},
backoff.NewExponentialBackOff(),
func(err error, d time.Duration) {
out.errCh <- fmt.Errorf("reconnect backoff (%s): %w", d, err)
},
)
if err != nil {
out.errCh <- err
}
continue
}
out.respCh <- msg
}
}()
return out, nil
}
// ClientLogin logs in to Lemmy by sending an HTTP request to the
// login endpoint. It stores the returned token in the client
// for future use.
func (c *WSClient) ClientLogin(ctx context.Context, l types.Login) error {
u := &url.URL{}
*u = *c.baseURL
if u.Scheme == "ws" {
u.Scheme = "http"
} else if u.Scheme == "wss" {
u.Scheme = "https"
}
hc := &Client{baseURL: u, client: http.DefaultClient}
err := hc.ClientLogin(ctx, l)
if err != nil {
return err
}
c.Token = hc.Token
return nil
}
// Request sends a request to the server. If data is nil,
// the authentication token will be sent instead. If data
// has an Auth field, it will be set to the authentication
// token automatically.
func (c *WSClient) Request(op types.Operation, data any) error {
if data == nil {
data = authData{}
}
data = c.setAuth(data)
d, err := json.Marshal(data)
if err != nil {
return err
}
return c.conn.WriteJSON(types.LemmyWebSocketMsg{
Op: op.Operation(),
Data: d,
})
}
// Responses returns a channel that receives messages from
// Lemmy.
func (c *WSClient) Responses() <-chan types.LemmyWebSocketMsg {
return c.respCh
}
// Errors returns a channel that receives errors
// received while attempting to read responses
func (c *WSClient) Errors() <-chan error {
return c.errCh
}
func (c *WSClient) OnReconnect(rh func(c *WSClient)) {
c.recHandler = rh
}
// setAuth uses reflection to automatically
// set struct fields called Auth of type
// string or types.Optional[string] to the
// authentication token, then returns the
// updated struct
func (c *WSClient) setAuth(data any) any {
val := reflect.New(reflect.TypeOf(data))
val.Elem().Set(reflect.ValueOf(data))
authField := val.Elem().FieldByName("Auth")
if !authField.IsValid() {
return data
}
switch authField.Type().String() {
case "string":
authField.SetString(c.Token)
case "types.Optional[string]":
setMtd := authField.MethodByName("Set")
out := setMtd.Call([]reflect.Value{reflect.ValueOf(c.Token)})
authField.Set(out[0])
default:
return data
}
return val.Elem().Interface()
}
func DecodeResponse(data json.RawMessage, out any) error {
return json.Unmarshal(data, out)
}
func keepaliveDialer() *websocket.Dialer {
d := &websocket.Dialer{
NetDial: func(network, addr string) (net.Conn, error) {
tcpAddr, err := net.ResolveTCPAddr(network, addr)
if err != nil {
return nil, err
}
conn, err := net.DialTCP(network, nil, tcpAddr)
if err != nil {
return nil, err
}
err = conn.SetKeepAlive(true)
if err != nil {
return nil, err
}
err = conn.SetKeepAlivePeriod(10 * time.Second)
if err != nil {
return nil, err
}
return conn, nil
},
}
d.NetDialContext = func(ctx context.Context, network, addr string) (net.Conn, error) {
return d.NetDial(network, addr)
}
return d
}