Update for 0.18.0
This commit is contained in:
parent
ff36330625
commit
058b3879ae
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,2 +1,3 @@
|
||||
/test
|
||||
/gen
|
||||
/gen
|
||||
/lemmy/
|
||||
|
@ -118,6 +118,7 @@ func (s *StructParser) Parse() ([]Item, error) {
|
||||
}
|
||||
|
||||
func (s *StructParser) parseStructFields() ([]Field, error) {
|
||||
encountered := map[string]struct{}{}
|
||||
var out []Field
|
||||
for {
|
||||
line, err := s.r.ReadString('\n')
|
||||
@ -144,6 +145,12 @@ func (s *StructParser) parseStructFields() ([]Field, error) {
|
||||
continue
|
||||
}
|
||||
|
||||
if _, ok := encountered[sm[1]]; ok {
|
||||
continue
|
||||
} else {
|
||||
encountered[sm[1]] = struct{}{}
|
||||
}
|
||||
|
||||
out = append(out, Field{
|
||||
OrigName: sm[1],
|
||||
Name: s.TransformName(sm[1]),
|
||||
|
110
routes.gen.go
110
routes.gen.go
@ -224,21 +224,9 @@ func (c *Client) AddModToCommunity(ctx context.Context, data types.AddModToCommu
|
||||
}
|
||||
return resData, nil
|
||||
}
|
||||
func (c *Client) CommunityJoin(ctx context.Context, data types.CommunityJoin) (*types.CommunityJoinResponse, error) {
|
||||
resData := &types.CommunityJoinResponse{}
|
||||
res, err := c.req(ctx, "POST", "/community/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) ModJoin(ctx context.Context, data types.ModJoin) (*types.ModJoinResponse, error) {
|
||||
resData := &types.ModJoinResponse{}
|
||||
res, err := c.req(ctx, "POST", "/community/mod/join", data, &resData)
|
||||
func (c *Client) FederatedInstances(ctx context.Context, data types.GetFederatedInstances) (*types.GetFederatedInstancesResponse, error) {
|
||||
resData := &types.GetFederatedInstancesResponse{}
|
||||
res, err := c.getReq(ctx, "GET", "/federated_instances", data, &resData)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -380,18 +368,6 @@ func (c *Client) SavePost(ctx context.Context, data types.SavePost) (*types.Post
|
||||
}
|
||||
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) {
|
||||
resData := &types.PostReportResponse{}
|
||||
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
|
||||
}
|
||||
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) {
|
||||
resData := &types.CommentResponse{}
|
||||
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
|
||||
}
|
||||
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) {
|
||||
resData := &types.GetPersonDetailsResponse{}
|
||||
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
|
||||
}
|
||||
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) {
|
||||
resData := &types.BanPersonResponse{}
|
||||
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) {
|
||||
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 {
|
||||
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) {
|
||||
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 {
|
||||
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) {
|
||||
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 {
|
||||
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) {
|
||||
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 {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -4,13 +4,13 @@
|
||||
package types
|
||||
|
||||
type Activity struct {
|
||||
ID int32 `json:"id" url:"id,omitempty"`
|
||||
Data any `json:"data" url:"data,omitempty"`
|
||||
Local bool `json:"local" url:"local,omitempty"`
|
||||
Published LemmyTime `json:"published" url:"published,omitempty"`
|
||||
Updated LemmyTime `json:"updated" url:"updated,omitempty"`
|
||||
ApID string `json:"ap_id" url:"ap_id,omitempty"`
|
||||
Sensitive Optional[bool] `json:"sensitive" url:"sensitive,omitempty"`
|
||||
ID int32 `json:"id" url:"id,omitempty"`
|
||||
Data any `json:"data" url:"data,omitempty"`
|
||||
Local bool `json:"local" url:"local,omitempty"`
|
||||
Published LemmyTime `json:"published" url:"published,omitempty"`
|
||||
Updated LemmyTime `json:"updated" url:"updated,omitempty"`
|
||||
ApID string `json:"ap_id" url:"ap_id,omitempty"`
|
||||
Sensitive bool `json:"sensitive" url:"sensitive,omitempty"`
|
||||
}
|
||||
type ActivityInsertForm struct {
|
||||
Data any `json:"data" url:"data,omitempty"`
|
||||
@ -20,8 +20,8 @@ type ActivityInsertForm struct {
|
||||
Sensitive Optional[bool] `json:"sensitive" url:"sensitive,omitempty"`
|
||||
}
|
||||
type ActivityUpdateForm struct {
|
||||
Data any `json:"data" url:"data,omitempty"`
|
||||
Local Optional[bool] `json:"local" url:"local,omitempty"`
|
||||
Updated LemmyTime `json:"updated" url:"updated,omitempty"`
|
||||
Sensitive Optional[Optional[bool]] `json:"sensitive" url:"sensitive,omitempty"`
|
||||
Data any `json:"data" url:"data,omitempty"`
|
||||
Local Optional[bool] `json:"local" url:"local,omitempty"`
|
||||
Updated LemmyTime `json:"updated" url:"updated,omitempty"`
|
||||
Sensitive Optional[bool] `json:"sensitive" url:"sensitive,omitempty"`
|
||||
}
|
||||
|
@ -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.
|
||||
|
||||
package types
|
@ -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"`
|
||||
}
|
@ -16,12 +16,16 @@ type GetComment struct {
|
||||
Auth Optional[string] `json:"auth" url:"auth,omitempty"`
|
||||
}
|
||||
type EditComment struct {
|
||||
CommentID int `json:"comment_id" url:"comment_id,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"`
|
||||
FormID Optional[string] `json:"form_id" url:"form_id,omitempty"`
|
||||
Auth string `json:"auth" url:"auth,omitempty"`
|
||||
CommentID int `json:"comment_id" url:"comment_id,omitempty"`
|
||||
Content Optional[string] `json:"content" url:"content,omitempty"`
|
||||
LanguageID Optional[int] `json:"language_id" url:"language_id,omitempty"`
|
||||
FormID Optional[string] `json:"form_id" url:"form_id,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 {
|
||||
CommentID int `json:"comment_id" url:"comment_id,omitempty"`
|
||||
|
@ -23,29 +23,11 @@ type Community struct {
|
||||
FollowersURL string `json:"followers_url" url:"followers_url,omitempty"`
|
||||
InboxURL string `json:"inbox_url" url:"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"`
|
||||
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 {
|
||||
Name string `json:"name" url:"name,omitempty"`
|
||||
|
@ -12,9 +12,7 @@ type GetCommunityResponse struct {
|
||||
CommunityView CommunityView `json:"community_view" url:"community_view,omitempty"`
|
||||
Site Optional[Site] `json:"site" url:"site,omitempty"`
|
||||
Moderators []CommunityModeratorView `json:"moderators" url:"moderators,omitempty"`
|
||||
Online uint `json:"online" url:"online,omitempty"`
|
||||
DiscussionLanguages []int `json:"discussion_languages" url:"discussion_languages,omitempty"`
|
||||
DefaultPostLanguage Optional[int] `json:"default_post_language" url:"default_post_language,omitempty"`
|
||||
LemmyResponse
|
||||
}
|
||||
type CreateCommunity struct {
|
||||
@ -54,8 +52,8 @@ type BanFromCommunity struct {
|
||||
Auth string `json:"auth" url:"auth,omitempty"`
|
||||
}
|
||||
type BanFromCommunityResponse struct {
|
||||
PersonView PersonViewSafe `json:"person_view" url:"person_view,omitempty"`
|
||||
Banned bool `json:"banned" url:"banned,omitempty"`
|
||||
PersonView PersonView `json:"person_view" url:"person_view,omitempty"`
|
||||
Banned bool `json:"banned" url:"banned,omitempty"`
|
||||
LemmyResponse
|
||||
}
|
||||
type AddModToCommunity struct {
|
||||
|
@ -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"`
|
||||
}
|
28
types/custom_emoji.1.gen.go
Normal file
28
types/custom_emoji.1.gen.go
Normal 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
34
types/custom_emoji.gen.go
Normal 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
|
||||
}
|
14
types/custom_emoji_keyword.gen.go
Normal file
14
types/custom_emoji_keyword.gen.go
Normal 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"`
|
||||
}
|
@ -4,12 +4,16 @@
|
||||
package types
|
||||
|
||||
type Instance struct {
|
||||
ID int `json:"id" url:"id,omitempty"`
|
||||
Domain string `json:"domain" url:"domain,omitempty"`
|
||||
Published LemmyTime `json:"published" url:"published,omitempty"`
|
||||
Updated LemmyTime `json:"updated" url:"updated,omitempty"`
|
||||
ID int `json:"id" url:"id,omitempty"`
|
||||
Domain string `json:"domain" url:"domain,omitempty"`
|
||||
Published LemmyTime `json:"published" url:"published,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 {
|
||||
Domain string `json:"domain" url:"domain,omitempty"`
|
||||
Updated LemmyTime `json:"updated" url:"updated,omitempty"`
|
||||
Domain string `json:"domain" url:"domain,omitempty"`
|
||||
Software Optional[string] `json:"software" url:"software,omitempty"`
|
||||
Version Optional[string] `json:"version" url:"version,omitempty"`
|
||||
Updated LemmyTime `json:"updated" url:"updated,omitempty"`
|
||||
}
|
||||
|
@ -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"`
|
||||
}
|
@ -6,17 +6,20 @@ package types
|
||||
type SortType string
|
||||
|
||||
const (
|
||||
SortTypeActive SortType = "Active"
|
||||
SortTypeHot SortType = "Hot"
|
||||
SortTypeNew SortType = "New"
|
||||
SortTypeOld SortType = "Old"
|
||||
SortTypeTopDay SortType = "TopDay"
|
||||
SortTypeTopWeek SortType = "TopWeek"
|
||||
SortTypeTopMonth SortType = "TopMonth"
|
||||
SortTypeTopYear SortType = "TopYear"
|
||||
SortTypeTopAll SortType = "TopAll"
|
||||
SortTypeMostComments SortType = "MostComments"
|
||||
SortTypeNewComments SortType = "NewComments"
|
||||
SortTypeActive SortType = "Active"
|
||||
SortTypeHot SortType = "Hot"
|
||||
SortTypeNew SortType = "New"
|
||||
SortTypeOld SortType = "Old"
|
||||
SortTypeTopDay SortType = "TopDay"
|
||||
SortTypeTopWeek SortType = "TopWeek"
|
||||
SortTypeTopMonth SortType = "TopMonth"
|
||||
SortTypeTopYear SortType = "TopYear"
|
||||
SortTypeTopAll SortType = "TopAll"
|
||||
SortTypeMostComments SortType = "MostComments"
|
||||
SortTypeNewComments SortType = "NewComments"
|
||||
SortTypeTopHour SortType = "TopHour"
|
||||
SortTypeTopSixHour SortType = "TopSixHour"
|
||||
SortTypeTopTwelveHour SortType = "TopTwelveHour"
|
||||
)
|
||||
|
||||
type CommentSortType string
|
||||
@ -36,6 +39,14 @@ const (
|
||||
ListingTypeSubscribed ListingType = "Subscribed"
|
||||
)
|
||||
|
||||
type RegistrationMode string
|
||||
|
||||
const (
|
||||
RegistrationModeClosed RegistrationMode = "Closed"
|
||||
RegistrationModeRequireApplication RegistrationMode = "RequireApplication"
|
||||
RegistrationModeOpen RegistrationMode = "Open"
|
||||
)
|
||||
|
||||
type SearchType string
|
||||
|
||||
const (
|
||||
|
@ -14,21 +14,20 @@ type LocalSite struct {
|
||||
ApplicationQuestion Optional[string] `json:"application_question" url:"application_question,omitempty"`
|
||||
PrivateInstance bool `json:"private_instance" url:"private_instance,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"`
|
||||
HideModlogModNames bool `json:"hide_modlog_mod_names" url:"hide_modlog_mod_names,omitempty"`
|
||||
ApplicationEmailAdmins bool `json:"application_email_admins" url:"application_email_admins,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"`
|
||||
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"`
|
||||
CaptchaEnabled bool `json:"captcha_enabled" url:"captcha_enabled,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"`
|
||||
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 {
|
||||
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"`
|
||||
PrivateInstance Optional[bool] `json:"private_instance" url:"private_instance,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"`
|
||||
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"`
|
||||
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"`
|
||||
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"`
|
||||
CaptchaEnabled Optional[bool] `json:"captcha_enabled" url:"captcha_enabled,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"`
|
||||
PrivateInstance Optional[bool] `json:"private_instance" url:"private_instance,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"`
|
||||
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"`
|
||||
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"`
|
||||
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"`
|
||||
CaptchaEnabled Optional[bool] `json:"captcha_enabled" url:"captcha_enabled,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"`
|
||||
Updated LemmyTime `json:"updated" url:"updated,omitempty"`
|
||||
}
|
||||
type RegistrationMode string
|
||||
|
||||
const (
|
||||
RegistrationModeClosed RegistrationMode = "Closed"
|
||||
RegistrationModeRequireApplication RegistrationMode = "RequireApplication"
|
||||
RegistrationModeOpen RegistrationMode = "Open"
|
||||
)
|
||||
|
@ -10,63 +10,29 @@ type LocalUser struct {
|
||||
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"`
|
||||
DefaultSortType SortType `json:"default_sort_type" url:"default_sort_type,omitempty"`
|
||||
DefaultListingType ListingType `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"`
|
||||
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"`
|
||||
ShowBotAccounts bool `json:"show_bot_accounts" url:"show_bot_accounts,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"`
|
||||
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 {
|
||||
PersonID int `json:"person_id" url:"person_id,omitempty"`
|
||||
PasswordEncrypted string `json:"password_encrypted" url:"password_encrypted,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"`
|
||||
PersonID int `json:"person_id" url:"person_id,omitempty"`
|
||||
PasswordEncrypted string `json:"password_encrypted" url:"password_encrypted,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"`
|
||||
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"`
|
||||
@ -76,4 +42,25 @@ type LocalUserUpdateForm struct {
|
||||
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"`
|
||||
}
|
||||
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"`
|
||||
}
|
||||
|
@ -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"`
|
||||
}
|
@ -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"
|
||||
)
|
@ -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.
|
||||
|
||||
package types
|
||||
|
@ -8,7 +8,7 @@ type ModRemovePost struct {
|
||||
ModPersonID int `json:"mod_person_id" url:"mod_person_id,omitempty"`
|
||||
PostID int `json:"post_id" url:"post_id,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"`
|
||||
}
|
||||
type ModRemovePostForm struct {
|
||||
@ -18,11 +18,11 @@ type ModRemovePostForm struct {
|
||||
Removed Optional[bool] `json:"removed" url:"removed,omitempty"`
|
||||
}
|
||||
type ModLockPost struct {
|
||||
ID int32 `json:"id" url:"id,omitempty"`
|
||||
ModPersonID int `json:"mod_person_id" url:"mod_person_id,omitempty"`
|
||||
PostID int `json:"post_id" url:"post_id,omitempty"`
|
||||
Locked Optional[bool] `json:"locked" url:"locked,omitempty"`
|
||||
When LemmyTime `json:"when_" url:"when_,omitempty"`
|
||||
ID int32 `json:"id" url:"id,omitempty"`
|
||||
ModPersonID int `json:"mod_person_id" url:"mod_person_id,omitempty"`
|
||||
PostID int `json:"post_id" url:"post_id,omitempty"`
|
||||
Locked bool `json:"locked" url:"locked,omitempty"`
|
||||
When LemmyTime `json:"when_" url:"when_,omitempty"`
|
||||
}
|
||||
type ModLockPostForm struct {
|
||||
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"`
|
||||
CommentID int `json:"comment_id" url:"comment_id,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"`
|
||||
}
|
||||
type ModRemoveCommentForm struct {
|
||||
@ -62,7 +62,7 @@ type ModRemoveCommunity struct {
|
||||
ModPersonID int `json:"mod_person_id" url:"mod_person_id,omitempty"`
|
||||
CommunityID int `json:"community_id" url:"community_id,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"`
|
||||
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"`
|
||||
CommunityID int `json:"community_id" url:"community_id,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"`
|
||||
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"`
|
||||
OtherPersonID int `json:"other_person_id" url:"other_person_id,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"`
|
||||
When LemmyTime `json:"when_" url:"when_,omitempty"`
|
||||
}
|
||||
@ -110,9 +110,9 @@ type ModHideCommunity struct {
|
||||
ID int32 `json:"id" url:"id,omitempty"`
|
||||
CommunityID int `json:"community_id" url:"community_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"`
|
||||
Reason Optional[string] `json:"reason" url:"reason,omitempty"`
|
||||
Hidden bool `json:"hidden" url:"hidden,omitempty"`
|
||||
}
|
||||
type ModBanForm struct {
|
||||
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"`
|
||||
}
|
||||
type ModAddCommunity struct {
|
||||
ID int32 `json:"id" url:"id,omitempty"`
|
||||
ModPersonID int `json:"mod_person_id" url:"mod_person_id,omitempty"`
|
||||
OtherPersonID int `json:"other_person_id" url:"other_person_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"`
|
||||
ID int32 `json:"id" url:"id,omitempty"`
|
||||
ModPersonID int `json:"mod_person_id" url:"mod_person_id,omitempty"`
|
||||
OtherPersonID int `json:"other_person_id" url:"other_person_id,omitempty"`
|
||||
CommunityID int `json:"community_id" url:"community_id,omitempty"`
|
||||
Removed bool `json:"removed" url:"removed,omitempty"`
|
||||
When LemmyTime `json:"when_" url:"when_,omitempty"`
|
||||
}
|
||||
type ModAddCommunityForm struct {
|
||||
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"`
|
||||
}
|
||||
type ModTransferCommunity struct {
|
||||
ID int32 `json:"id" url:"id,omitempty"`
|
||||
ModPersonID int `json:"mod_person_id" url:"mod_person_id,omitempty"`
|
||||
OtherPersonID int `json:"other_person_id" url:"other_person_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"`
|
||||
ID int32 `json:"id" url:"id,omitempty"`
|
||||
ModPersonID int `json:"mod_person_id" url:"mod_person_id,omitempty"`
|
||||
OtherPersonID int `json:"other_person_id" url:"other_person_id,omitempty"`
|
||||
CommunityID int `json:"community_id" url:"community_id,omitempty"`
|
||||
When LemmyTime `json:"when_" url:"when_,omitempty"`
|
||||
}
|
||||
type ModTransferCommunityForm struct {
|
||||
ModPersonID int `json:"mod_person_id" url:"mod_person_id,omitempty"`
|
||||
OtherPersonID int `json:"other_person_id" url:"other_person_id,omitempty"`
|
||||
CommunityID int `json:"community_id" url:"community_id,omitempty"`
|
||||
Removed Optional[bool] `json:"removed" url:"removed,omitempty"`
|
||||
ModPersonID int `json:"mod_person_id" url:"mod_person_id,omitempty"`
|
||||
OtherPersonID int `json:"other_person_id" url:"other_person_id,omitempty"`
|
||||
CommunityID int `json:"community_id" url:"community_id,omitempty"`
|
||||
}
|
||||
type ModAdd struct {
|
||||
ID int32 `json:"id" url:"id,omitempty"`
|
||||
ModPersonID int `json:"mod_person_id" url:"mod_person_id,omitempty"`
|
||||
OtherPersonID int `json:"other_person_id" url:"other_person_id,omitempty"`
|
||||
Removed Optional[bool] `json:"removed" url:"removed,omitempty"`
|
||||
When LemmyTime `json:"when_" url:"when_,omitempty"`
|
||||
ID int32 `json:"id" url:"id,omitempty"`
|
||||
ModPersonID int `json:"mod_person_id" url:"mod_person_id,omitempty"`
|
||||
OtherPersonID int `json:"other_person_id" url:"other_person_id,omitempty"`
|
||||
Removed bool `json:"removed" url:"removed,omitempty"`
|
||||
When LemmyTime `json:"when_" url:"when_,omitempty"`
|
||||
}
|
||||
type ModAddForm struct {
|
||||
ModPersonID int `json:"mod_person_id" url:"mod_person_id,omitempty"`
|
||||
|
@ -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"`
|
||||
}
|
@ -27,27 +27,6 @@ type Person struct {
|
||||
BanExpires LemmyTime `json:"ban_expires" url:"ban_expires,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 {
|
||||
Name string `json:"name" url:"name,omitempty"`
|
||||
PublicKey string `json:"public_key" url:"public_key,omitempty"`
|
||||
|
@ -4,8 +4,9 @@
|
||||
package types
|
||||
|
||||
type Login struct {
|
||||
UsernameOrEmail string `json:"username_or_email" url:"username_or_email,omitempty"`
|
||||
Password string `json:"password" url:"password,omitempty"`
|
||||
UsernameOrEmail string `json:"username_or_email" url:"username_or_email,omitempty"`
|
||||
Password string `json:"password" url:"password,omitempty"`
|
||||
Totp2faToken Optional[string] `json:"totp_2fa_token" url:"totp_2fa_token,omitempty"`
|
||||
}
|
||||
type Register struct {
|
||||
Username string `json:"username" url:"username,omitempty"`
|
||||
@ -32,26 +33,27 @@ type CaptchaResponse struct {
|
||||
LemmyResponse
|
||||
}
|
||||
type SaveUserSettings struct {
|
||||
ShowNSFW Optional[bool] `json:"show_nsfw" url:"show_nsfw,omitempty"`
|
||||
ShowScores Optional[bool] `json:"show_scores" url:"show_scores,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"`
|
||||
Avatar Optional[string] `json:"avatar" url:"avatar,omitempty"`
|
||||
Banner Optional[string] `json:"banner" url:"banner,omitempty"`
|
||||
DisplayName Optional[string] `json:"display_name" url:"display_name,omitempty"`
|
||||
Email Optional[string] `json:"email" url:"email,omitempty"`
|
||||
Bio Optional[string] `json:"bio" url:"bio,omitempty"`
|
||||
MatrixUserID Optional[string] `json:"matrix_user_id" url:"matrix_user_id,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"`
|
||||
BotAccount Optional[bool] `json:"bot_account" url:"bot_account,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"`
|
||||
ShowNewPostNotifs Optional[bool] `json:"show_new_post_notifs" url:"show_new_post_notifs,omitempty"`
|
||||
DiscussionLanguages Optional[[]int] `json:"discussion_languages" url:"discussion_languages,omitempty"`
|
||||
Auth string `json:"auth" url:"auth,omitempty"`
|
||||
ShowNSFW Optional[bool] `json:"show_nsfw" url:"show_nsfw,omitempty"`
|
||||
ShowScores Optional[bool] `json:"show_scores" url:"show_scores,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"`
|
||||
Avatar Optional[string] `json:"avatar" url:"avatar,omitempty"`
|
||||
Banner Optional[string] `json:"banner" url:"banner,omitempty"`
|
||||
DisplayName Optional[string] `json:"display_name" url:"display_name,omitempty"`
|
||||
Email Optional[string] `json:"email" url:"email,omitempty"`
|
||||
Bio Optional[string] `json:"bio" url:"bio,omitempty"`
|
||||
MatrixUserID Optional[string] `json:"matrix_user_id" url:"matrix_user_id,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"`
|
||||
BotAccount Optional[bool] `json:"bot_account" url:"bot_account,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"`
|
||||
ShowNewPostNotifs Optional[bool] `json:"show_new_post_notifs" url:"show_new_post_notifs,omitempty"`
|
||||
DiscussionLanguages Optional[[]int] `json:"discussion_languages" url:"discussion_languages,omitempty"`
|
||||
GenerateTotp2fa Optional[bool] `json:"generate_totp_2fa" url:"generate_totp_2fa,omitempty"`
|
||||
Auth string `json:"auth" url:"auth,omitempty"`
|
||||
}
|
||||
type ChangePassword struct {
|
||||
NewPassword string `json:"new_password" url:"new_password,omitempty"`
|
||||
@ -76,20 +78,12 @@ type GetPersonDetails struct {
|
||||
Auth Optional[string] `json:"auth" url:"auth,omitempty"`
|
||||
}
|
||||
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"`
|
||||
Posts []PostView `json:"posts" url:"posts,omitempty"`
|
||||
Moderates []CommunityModeratorView `json:"moderates" url:"moderates,omitempty"`
|
||||
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 {
|
||||
Auth string `json:"auth" url:"auth,omitempty"`
|
||||
}
|
||||
@ -99,7 +93,7 @@ type AddAdmin struct {
|
||||
Auth string `json:"auth" url:"auth,omitempty"`
|
||||
}
|
||||
type AddAdminResponse struct {
|
||||
Admins []PersonViewSafe `json:"admins" url:"admins,omitempty"`
|
||||
Admins []PersonView `json:"admins" url:"admins,omitempty"`
|
||||
LemmyResponse
|
||||
}
|
||||
type BanPerson struct {
|
||||
@ -114,12 +108,12 @@ type GetBannedPersons struct {
|
||||
Auth string `json:"auth" url:"auth,omitempty"`
|
||||
}
|
||||
type BannedPersonsResponse struct {
|
||||
Banned []PersonViewSafe `json:"banned" url:"banned,omitempty"`
|
||||
Banned []PersonView `json:"banned" url:"banned,omitempty"`
|
||||
LemmyResponse
|
||||
}
|
||||
type BanPersonResponse struct {
|
||||
PersonView PersonViewSafe `json:"person_view" url:"person_view,omitempty"`
|
||||
Banned bool `json:"banned" url:"banned,omitempty"`
|
||||
PersonView PersonView `json:"person_view" url:"person_view,omitempty"`
|
||||
Banned bool `json:"banned" url:"banned,omitempty"`
|
||||
LemmyResponse
|
||||
}
|
||||
type BlockPerson struct {
|
||||
@ -128,8 +122,8 @@ type BlockPerson struct {
|
||||
Auth string `json:"auth" url:"auth,omitempty"`
|
||||
}
|
||||
type BlockPersonResponse struct {
|
||||
PersonView PersonViewSafe `json:"person_view" url:"person_view,omitempty"`
|
||||
Blocked bool `json:"blocked" url:"blocked,omitempty"`
|
||||
PersonView PersonView `json:"person_view" url:"person_view,omitempty"`
|
||||
Blocked bool `json:"blocked" url:"blocked,omitempty"`
|
||||
LemmyResponse
|
||||
}
|
||||
type GetReplies struct {
|
||||
@ -139,6 +133,10 @@ type GetReplies struct {
|
||||
UnreadOnly Optional[bool] `json:"unread_only" url:"unread_only,omitempty"`
|
||||
Auth string `json:"auth" url:"auth,omitempty"`
|
||||
}
|
||||
type GetRepliesResponse struct {
|
||||
Replies []CommentReplyView `json:"replies" url:"replies,omitempty"`
|
||||
LemmyResponse
|
||||
}
|
||||
type GetPersonMentions struct {
|
||||
Sort Optional[CommentSortType] `json:"sort" url:"sort,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"`
|
||||
Auth string `json:"auth" url:"auth,omitempty"`
|
||||
}
|
||||
type GetPersonMentionsResponse struct {
|
||||
Mentions []PersonMentionView `json:"mentions" url:"mentions,omitempty"`
|
||||
LemmyResponse
|
||||
}
|
||||
type MarkPersonMentionAsRead struct {
|
||||
PersonMentionID int `json:"person_mention_id" url:"person_mention_id,omitempty"`
|
||||
Read bool `json:"read" url:"read,omitempty"`
|
||||
|
@ -18,10 +18,10 @@ type Post struct {
|
||||
NSFW bool `json:"nsfw" url:"nsfw,omitempty"`
|
||||
EmbedTitle Optional[string] `json:"embed_title" url:"embed_title,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"`
|
||||
ApID string `json:"ap_id" url:"ap_id,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"`
|
||||
FeaturedCommunity bool `json:"featured_community" url:"featured_community,omitempty"`
|
||||
FeaturedLocal bool `json:"featured_local" url:"featured_local,omitempty"`
|
||||
|
@ -26,7 +26,7 @@ type GetPostResponse struct {
|
||||
PostView PostView `json:"post_view" url:"post_view,omitempty"`
|
||||
CommunityView CommunityView `json:"community_view" url:"community_view,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
|
||||
}
|
||||
type GetPosts struct {
|
||||
|
@ -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
|
@ -16,22 +16,22 @@ type Search struct {
|
||||
Auth Optional[string] `json:"auth" url:"auth,omitempty"`
|
||||
}
|
||||
type SearchResponse struct {
|
||||
Type string `json:"type_" url:"type_,omitempty"`
|
||||
Comments []CommentView `json:"comments" url:"comments,omitempty"`
|
||||
Posts []PostView `json:"posts" url:"posts,omitempty"`
|
||||
Communities []CommunityView `json:"communities" url:"communities,omitempty"`
|
||||
Users []PersonViewSafe `json:"users" url:"users,omitempty"`
|
||||
Type SearchType `json:"type_" url:"type_,omitempty"`
|
||||
Comments []CommentView `json:"comments" url:"comments,omitempty"`
|
||||
Posts []PostView `json:"posts" url:"posts,omitempty"`
|
||||
Communities []CommunityView `json:"communities" url:"communities,omitempty"`
|
||||
Users []PersonView `json:"users" url:"users,omitempty"`
|
||||
LemmyResponse
|
||||
}
|
||||
type ResolveObject struct {
|
||||
Q string `json:"q" url:"q,omitempty"`
|
||||
Auth Optional[string] `json:"auth" url:"auth,omitempty"`
|
||||
Q string `json:"q" url:"q,omitempty"`
|
||||
Auth string `json:"auth" url:"auth,omitempty"`
|
||||
}
|
||||
type ResolveObjectResponse struct {
|
||||
Comment Optional[CommentView] `json:"comment" url:"comment,omitempty"`
|
||||
Post Optional[PostView] `json:"post" url:"post,omitempty"`
|
||||
Community Optional[CommunityView] `json:"community" url:"community,omitempty"`
|
||||
Person Optional[PersonViewSafe] `json:"person" url:"person,omitempty"`
|
||||
Comment Optional[CommentView] `json:"comment" url:"comment,omitempty"`
|
||||
Post Optional[PostView] `json:"post" url:"post,omitempty"`
|
||||
Community Optional[CommunityView] `json:"community" url:"community,omitempty"`
|
||||
Person Optional[PersonView] `json:"person" url:"person,omitempty"`
|
||||
LemmyResponse
|
||||
}
|
||||
type GetModlog struct {
|
||||
@ -39,9 +39,9 @@ type GetModlog struct {
|
||||
CommunityID Optional[int] `json:"community_id" url:"community_id,omitempty"`
|
||||
Page Optional[int64] `json:"page" url:"page,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"`
|
||||
OtherPersonID Optional[int] `json:"other_person_id" url:"other_person_id,omitempty"`
|
||||
Auth Optional[string] `json:"auth" url:"auth,omitempty"`
|
||||
}
|
||||
type GetModlogResponse struct {
|
||||
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"`
|
||||
PrivateInstance Optional[bool] `json:"private_instance" url:"private_instance,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"`
|
||||
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"`
|
||||
@ -117,7 +117,7 @@ type EditSite struct {
|
||||
ApplicationQuestion Optional[string] `json:"application_question" url:"application_question,omitempty"`
|
||||
PrivateInstance Optional[bool] `json:"private_instance" url:"private_instance,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"`
|
||||
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"`
|
||||
@ -152,19 +152,19 @@ type GetSite struct {
|
||||
Auth Optional[string] `json:"auth" url:"auth,omitempty"`
|
||||
}
|
||||
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
|
||||
}
|
||||
type GetSiteResponse struct {
|
||||
SiteView SiteView `json:"site_view" url:"site_view,omitempty"`
|
||||
Admins []PersonViewSafe `json:"admins" url:"admins,omitempty"`
|
||||
Online uint `json:"online" url:"online,omitempty"`
|
||||
Version string `json:"version" url:"version,omitempty"`
|
||||
MyUser Optional[MyUserInfo] `json:"my_user" url:"my_user,omitempty"`
|
||||
FederatedInstances Optional[FederatedInstances] `json:"federated_instances" url:"federated_instances,omitempty"`
|
||||
AllLanguages []Language `json:"all_languages" url:"all_languages,omitempty"`
|
||||
DiscussionLanguages []int `json:"discussion_languages" url:"discussion_languages,omitempty"`
|
||||
Taglines Optional[[]Tagline] `json:"taglines" url:"taglines,omitempty"`
|
||||
SiteView SiteView `json:"site_view" url:"site_view,omitempty"`
|
||||
Admins []PersonView `json:"admins" url:"admins,omitempty"`
|
||||
Version string `json:"version" url:"version,omitempty"`
|
||||
MyUser Optional[MyUserInfo] `json:"my_user" url:"my_user,omitempty"`
|
||||
AllLanguages []Language `json:"all_languages" url:"all_languages,omitempty"`
|
||||
DiscussionLanguages []int `json:"discussion_languages" url:"discussion_languages,omitempty"`
|
||||
Taglines []Tagline `json:"taglines" url:"taglines,omitempty"`
|
||||
CustomEmojis []CustomEmojiView `json:"custom_emojis" url:"custom_emojis,omitempty"`
|
||||
LemmyResponse
|
||||
}
|
||||
type GetFederatedInstances struct {
|
||||
@ -175,7 +175,7 @@ type GetFederatedInstancesResponse struct {
|
||||
LemmyResponse
|
||||
}
|
||||
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"`
|
||||
Moderates []CommunityModeratorView `json:"moderates" url:"moderates,omitempty"`
|
||||
CommunityBlocks []CommunityBlockView `json:"community_blocks" url:"community_blocks,omitempty"`
|
||||
@ -186,9 +186,9 @@ type LeaveAdmin struct {
|
||||
Auth string `json:"auth" url:"auth,omitempty"`
|
||||
}
|
||||
type FederatedInstances struct {
|
||||
Linked []string `json:"linked" url:"linked,omitempty"`
|
||||
Allowed Optional[[]string] `json:"allowed" url:"allowed,omitempty"`
|
||||
Blocked Optional[[]string] `json:"blocked" url:"blocked,omitempty"`
|
||||
Linked []Instance `json:"linked" url:"linked,omitempty"`
|
||||
Allowed []Instance `json:"allowed" url:"allowed,omitempty"`
|
||||
Blocked []Instance `json:"blocked" url:"blocked,omitempty"`
|
||||
}
|
||||
type PurgePerson struct {
|
||||
PersonID int `json:"person_id" url:"person_id,omitempty"`
|
||||
|
@ -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.
|
||||
|
||||
package types
|
||||
|
||||
type CommunityBlockView struct {
|
||||
Person PersonSafe `json:"person" url:"person,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"`
|
||||
type CommentReportView struct {
|
||||
CommentReport CommentReport `json:"comment_report" url:"comment_report,omitempty"`
|
||||
Comment Comment `json:"comment" url:"comment,omitempty"`
|
||||
Creator PersonSafe `json:"creator" url:"creator,omitempty"`
|
||||
Post Post `json:"post" url:"post,omitempty"`
|
||||
Community CommunitySafe `json:"community" url:"community,omitempty"`
|
||||
Recipient PersonSafe `json:"recipient" url:"recipient,omitempty"`
|
||||
Community Community `json:"community" url:"community,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"`
|
||||
CreatorBannedFromCommunity bool `json:"creator_banned_from_community" url:"creator_banned_from_community,omitempty"`
|
||||
Subscribed SubscribedType `json:"subscribed" url:"subscribed,omitempty"`
|
||||
@ -43,21 +27,60 @@ type PersonMentionView struct {
|
||||
CreatorBlocked bool `json:"creator_blocked" url:"creator_blocked,omitempty"`
|
||||
MyVote Optional[int16] `json:"my_vote" url:"my_vote,omitempty"`
|
||||
}
|
||||
type CommentReplyView struct {
|
||||
CommentReply CommentReply `json:"comment_reply" url:"comment_reply,omitempty"`
|
||||
Comment Comment `json:"comment" url:"comment,omitempty"`
|
||||
Creator PersonSafe `json:"creator" url:"creator,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 LocalUserView struct {
|
||||
LocalUser LocalUser `json:"local_user" url:"local_user,omitempty"`
|
||||
Person Person `json:"person" url:"person,omitempty"`
|
||||
Counts PersonAggregates `json:"counts" url:"counts,omitempty"`
|
||||
}
|
||||
type PersonViewSafe struct {
|
||||
Person PersonSafe `json:"person" url:"person,omitempty"`
|
||||
Counts PersonAggregates `json:"counts" url:"counts,omitempty"`
|
||||
type PostReportView struct {
|
||||
PostReport PostReport `json:"post_report" url:"post_report,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"`
|
||||
}
|
||||
|
@ -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.
|
||||
|
||||
package types
|
||||
|
||||
type CommentReportView struct {
|
||||
CommentReport CommentReport `json:"comment_report" url:"comment_report,omitempty"`
|
||||
Comment Comment `json:"comment" url:"comment,omitempty"`
|
||||
Post Post `json:"post" url:"post,omitempty"`
|
||||
Community CommunitySafe `json:"community" url:"community,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 ModAddCommunityView struct {
|
||||
ModAddCommunity ModAddCommunity `json:"mod_add_community" url:"mod_add_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 CommentView struct {
|
||||
Comment Comment `json:"comment" url:"comment,omitempty"`
|
||||
Creator PersonSafe `json:"creator" url:"creator,omitempty"`
|
||||
Post Post `json:"post" url:"post,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 ModAddView struct {
|
||||
ModAdd ModAdd `json:"mod_add" url:"mod_add,omitempty"`
|
||||
Moderator Optional[Person] `json:"moderator" url:"moderator,omitempty"`
|
||||
ModdedPerson Person `json:"modded_person" url:"modded_person,omitempty"`
|
||||
}
|
||||
type LocalUserView struct {
|
||||
LocalUser LocalUser `json:"local_user" url:"local_user,omitempty"`
|
||||
Person Person `json:"person" url:"person,omitempty"`
|
||||
Counts PersonAggregates `json:"counts" url:"counts,omitempty"`
|
||||
type ModBanFromCommunityView struct {
|
||||
ModBanFromCommunity ModBanFromCommunity `json:"mod_ban_from_community" url:"mod_ban_from_community,omitempty"`
|
||||
Moderator Optional[Person] `json:"moderator" url:"moderator,omitempty"`
|
||||
Community Community `json:"community" url:"community,omitempty"`
|
||||
BannedPerson Person `json:"banned_person" url:"banned_person,omitempty"`
|
||||
}
|
||||
type LocalUserSettingsView struct {
|
||||
LocalUser LocalUserSettings `json:"local_user" url:"local_user,omitempty"`
|
||||
Person PersonSafe `json:"person" url:"person,omitempty"`
|
||||
Counts PersonAggregates `json:"counts" url:"counts,omitempty"`
|
||||
type ModBanView struct {
|
||||
ModBan ModBan `json:"mod_ban" url:"mod_ban,omitempty"`
|
||||
Moderator Optional[Person] `json:"moderator" url:"moderator,omitempty"`
|
||||
BannedPerson Person `json:"banned_person" url:"banned_person,omitempty"`
|
||||
}
|
||||
type PostReportView struct {
|
||||
PostReport PostReport `json:"post_report" url:"post_report,omitempty"`
|
||||
Post Post `json:"post" url:"post,omitempty"`
|
||||
Community CommunitySafe `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 ModHideCommunityView struct {
|
||||
ModHideCommunity ModHideCommunity `json:"mod_hide_community" url:"mod_hide_community,omitempty"`
|
||||
Admin Optional[Person] `json:"admin" url:"admin,omitempty"`
|
||||
Community Community `json:"community" url:"community,omitempty"`
|
||||
}
|
||||
type PostView struct {
|
||||
Post Post `json:"post" url:"post,omitempty"`
|
||||
Creator PersonSafe `json:"creator" url:"creator,omitempty"`
|
||||
Community CommunitySafe `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 ModLockPostView struct {
|
||||
ModLockPost ModLockPost `json:"mod_lock_post" url:"mod_lock_post,omitempty"`
|
||||
Moderator Optional[Person] `json:"moderator" url:"moderator,omitempty"`
|
||||
Post Post `json:"post" url:"post,omitempty"`
|
||||
Community Community `json:"community" url:"community,omitempty"`
|
||||
}
|
||||
type PrivateMessageView struct {
|
||||
PrivateMessage PrivateMessage `json:"private_message" url:"private_message,omitempty"`
|
||||
Creator PersonSafe `json:"creator" url:"creator,omitempty"`
|
||||
Recipient PersonSafe `json:"recipient" url:"recipient,omitempty"`
|
||||
type ModRemoveCommentView struct {
|
||||
ModRemoveComment ModRemoveComment `json:"mod_remove_comment" url:"mod_remove_comment,omitempty"`
|
||||
Moderator Optional[Person] `json:"moderator" url:"moderator,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 {
|
||||
PrivateMessageReport PrivateMessageReport `json:"private_message_report" url:"private_message_report,omitempty"`
|
||||
PrivateMessage PrivateMessage `json:"private_message" url:"private_message,omitempty"`
|
||||
PrivateMessageCreator PersonSafe `json:"private_message_creator" url:"private_message_creator,omitempty"`
|
||||
Creator PersonSafe `json:"creator" url:"creator,omitempty"`
|
||||
Resolver Optional[PersonSafe] `json:"resolver" url:"resolver,omitempty"`
|
||||
type ModRemoveCommunityView struct {
|
||||
ModRemoveCommunity ModRemoveCommunity `json:"mod_remove_community" url:"mod_remove_community,omitempty"`
|
||||
Moderator Optional[Person] `json:"moderator" url:"moderator,omitempty"`
|
||||
Community Community `json:"community" url:"community,omitempty"`
|
||||
}
|
||||
type RegistrationApplicationView struct {
|
||||
RegistrationApplication RegistrationApplication `json:"registration_application" url:"registration_application,omitempty"`
|
||||
CreatorLocalUser LocalUserSettings `json:"creator_local_user" url:"creator_local_user,omitempty"`
|
||||
Creator PersonSafe `json:"creator" url:"creator,omitempty"`
|
||||
Admin Optional[PersonSafe] `json:"admin" url:"admin,omitempty"`
|
||||
type ModRemovePostView struct {
|
||||
ModRemovePost ModRemovePost `json:"mod_remove_post" url:"mod_remove_post,omitempty"`
|
||||
Moderator Optional[Person] `json:"moderator" url:"moderator,omitempty"`
|
||||
Post Post `json:"post" url:"post,omitempty"`
|
||||
Community Community `json:"community" url:"community,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 ModFeaturePostView struct {
|
||||
ModFeaturePost ModFeaturePost `json:"mod_feature_post" url:"mod_feature_post,omitempty"`
|
||||
Moderator Optional[Person] `json:"moderator" url:"moderator,omitempty"`
|
||||
Post Post `json:"post" url:"post,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"`
|
||||
}
|
||||
|
@ -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.
|
||||
|
||||
package types
|
||||
|
||||
type ModAddCommunityView struct {
|
||||
ModAddCommunity ModAddCommunity `json:"mod_add_community" url:"mod_add_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 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"`
|
||||
HotRank int32 `json:"hot_rank" url:"hot_rank,omitempty"`
|
||||
}
|
||||
type ModAddView struct {
|
||||
ModAdd ModAdd `json:"mod_add" url:"mod_add,omitempty"`
|
||||
Moderator Optional[PersonSafe] `json:"moderator" url:"moderator,omitempty"`
|
||||
ModdedPerson PersonSafe `json:"modded_person" url:"modded_person,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"`
|
||||
HotRank int32 `json:"hot_rank" url:"hot_rank,omitempty"`
|
||||
}
|
||||
type ModBanFromCommunityView struct {
|
||||
ModBanFromCommunity ModBanFromCommunity `json:"mod_ban_from_community" url:"mod_ban_from_community,omitempty"`
|
||||
Moderator Optional[PersonSafe] `json:"moderator" url:"moderator,omitempty"`
|
||||
Community CommunitySafe `json:"community" url:"community,omitempty"`
|
||||
BannedPerson PersonSafe `json:"banned_person" url:"banned_person,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 ModBanView struct {
|
||||
ModBan ModBan `json:"mod_ban" url:"mod_ban,omitempty"`
|
||||
Moderator Optional[PersonSafe] `json:"moderator" url:"moderator,omitempty"`
|
||||
BannedPerson PersonSafe `json:"banned_person" url:"banned_person,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"`
|
||||
HotRank int32 `json:"hot_rank" url:"hot_rank,omitempty"`
|
||||
HotRankActive int32 `json:"hot_rank_active" url:"hot_rank_active,omitempty"`
|
||||
}
|
||||
type ModHideCommunityView struct {
|
||||
ModHideCommunity ModHideCommunity `json:"mod_hide_community" url:"mod_hide_community,omitempty"`
|
||||
Admin Optional[PersonSafe] `json:"admin" url:"admin,omitempty"`
|
||||
Community CommunitySafe `json:"community" url:"community,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 ModLockPostView struct {
|
||||
ModLockPost ModLockPost `json:"mod_lock_post" url:"mod_lock_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 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 ModRemoveCommentView struct {
|
||||
ModRemoveComment ModRemoveComment `json:"mod_remove_comment" url:"mod_remove_comment,omitempty"`
|
||||
Moderator Optional[PersonSafe] `json:"moderator" url:"moderator,omitempty"`
|
||||
Comment Comment `json:"comment" url:"comment,omitempty"`
|
||||
Commenter PersonSafe `json:"commenter" url:"commenter,omitempty"`
|
||||
Post Post `json:"post" url:"post,omitempty"`
|
||||
Community CommunitySafe `json:"community" url:"community,omitempty"`
|
||||
}
|
||||
type ModRemoveCommunityView struct {
|
||||
ModRemoveCommunity ModRemoveCommunity `json:"mod_remove_community" url:"mod_remove_community,omitempty"`
|
||||
Moderator Optional[PersonSafe] `json:"moderator" url:"moderator,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"`
|
||||
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"`
|
||||
}
|
||||
|
@ -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"`
|
||||
}
|
@ -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.
|
||||
|
||||
package types
|
||||
|
||||
type UserJoin struct {
|
||||
Auth string `json:"auth" url:"auth,omitempty"`
|
||||
type CommunityBlockView struct {
|
||||
Person Person `json:"person" url:"person,omitempty"`
|
||||
Community Community `json:"community" url:"community,omitempty"`
|
||||
}
|
||||
type UserJoinResponse struct {
|
||||
Joined bool `json:"joined" url:"joined,omitempty"`
|
||||
LemmyResponse
|
||||
type CommunityFollowerView struct {
|
||||
Community Community `json:"community" url:"community,omitempty"`
|
||||
Follower Person `json:"follower" url:"follower,omitempty"`
|
||||
}
|
||||
type CommunityJoin struct {
|
||||
CommunityID int `json:"community_id" url:"community_id,omitempty"`
|
||||
type CommunityModeratorView struct {
|
||||
Community Community `json:"community" url:"community,omitempty"`
|
||||
Moderator Person `json:"moderator" url:"moderator,omitempty"`
|
||||
}
|
||||
type CommunityJoinResponse struct {
|
||||
Joined bool `json:"joined" url:"joined,omitempty"`
|
||||
LemmyResponse
|
||||
type CommunityPersonBanView struct {
|
||||
Community Community `json:"community" url:"community,omitempty"`
|
||||
Person Person `json:"person" url:"person,omitempty"`
|
||||
}
|
||||
type ModJoin struct {
|
||||
CommunityID int `json:"community_id" url:"community_id,omitempty"`
|
||||
type CommunityView struct {
|
||||
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 {
|
||||
Joined bool `json:"joined" url:"joined,omitempty"`
|
||||
LemmyResponse
|
||||
type PersonBlockView struct {
|
||||
Person Person `json:"person" url:"person,omitempty"`
|
||||
Target Person `json:"target" url:"target,omitempty"`
|
||||
}
|
||||
type PostJoin struct {
|
||||
PostID int `json:"post_id" url:"post_id,omitempty"`
|
||||
type PersonMentionView struct {
|
||||
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 {
|
||||
Joined bool `json:"joined" url:"joined,omitempty"`
|
||||
LemmyResponse
|
||||
type CommentReplyView struct {
|
||||
CommentReply CommentReply `json:"comment_reply" url:"comment_reply,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 CaptchaItem struct {
|
||||
Uuid string `json:"uuid" url:"uuid,omitempty"`
|
||||
Answer string `json:"answer" url:"answer,omitempty"`
|
||||
Expires LemmyTime `json:"expires" url:"expires,omitempty"`
|
||||
type PersonView struct {
|
||||
Person Person `json:"person" url:"person,omitempty"`
|
||||
Counts PersonAggregates `json:"counts" url:"counts,omitempty"`
|
||||
}
|
||||
|
@ -57,29 +57,3 @@ type LemmyWebSocketMsg struct {
|
||||
Op string `json:"op"`
|
||||
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)
|
||||
}
|
||||
|
214
websocket.go
214
websocket.go
@ -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
|
||||
}
|
Loading…
Reference in New Issue
Block a user