From ff363306256c77b17f3a298e52726c2c808319b5 Mon Sep 17 00:00:00 2001 From: Elara Musayelyan Date: Mon, 5 Jun 2023 13:30:13 -0700 Subject: [PATCH] Update for Lemmy v0.17.3 --- cmd/gen/main.go | 2 +- types/captcha.gen.go | 12 +++ types/connect.gen.go | 8 ++ types/join_rooms.gen.go | 21 +++++ types/messages.gen.go | 29 +++++++ types/mod.1.gen.go | 101 +++++++++++++++++++++++- types/{handlers.gen.go => mod.2.gen.go} | 2 +- types/mod.gen.go | 101 +----------------------- types/online_users.gen.go | 11 +++ types/person.gen.go | 4 +- types/site.gen.go | 7 ++ 11 files changed, 194 insertions(+), 104 deletions(-) create mode 100644 types/captcha.gen.go create mode 100644 types/connect.gen.go create mode 100644 types/join_rooms.gen.go create mode 100644 types/messages.gen.go rename types/{handlers.gen.go => mod.2.gen.go} (61%) create mode 100644 types/online_users.gen.go diff --git a/cmd/gen/main.go b/cmd/gen/main.go index f3af99f..386985c 100644 --- a/cmd/gen/main.go +++ b/cmd/gen/main.go @@ -44,7 +44,7 @@ func main() { baseStructDir := filepath.Join(*outDir, "types") sp := parser.NewStruct(nil) - sp.Skip = []string{"LemmyContext"} + sp.Skip = []string{"LemmyContext", "Recipient", "WsMessage", "Connect", "SessionInfo"} for _, structDir := range structDirs { dir := filepath.Join(*lemmyDir, structDir) err := filepath.WalkDir(dir, func(path string, d fs.DirEntry, err error) error { diff --git a/types/captcha.gen.go b/types/captcha.gen.go new file mode 100644 index 0000000..7ae7bd3 --- /dev/null +++ b/types/captcha.gen.go @@ -0,0 +1,12 @@ +// 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"` +} diff --git a/types/connect.gen.go b/types/connect.gen.go new file mode 100644 index 0000000..003a0a4 --- /dev/null +++ b/types/connect.gen.go @@ -0,0 +1,8 @@ +// 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"` +} diff --git a/types/join_rooms.gen.go b/types/join_rooms.gen.go new file mode 100644 index 0000000..0a3a547 --- /dev/null +++ b/types/join_rooms.gen.go @@ -0,0 +1,21 @@ +// 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"` +} diff --git a/types/messages.gen.go b/types/messages.gen.go new file mode 100644 index 0000000..26b7962 --- /dev/null +++ b/types/messages.gen.go @@ -0,0 +1,29 @@ +// 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"` +} diff --git a/types/mod.1.gen.go b/types/mod.1.gen.go index f754535..a7bf7c4 100644 --- a/types/mod.1.gen.go +++ b/types/mod.1.gen.go @@ -1,4 +1,103 @@ -// Source: lemmy/crates/db_schema/src/source/mod.rs +// 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" +) diff --git a/types/handlers.gen.go b/types/mod.2.gen.go similarity index 61% rename from types/handlers.gen.go rename to types/mod.2.gen.go index 4532f58..f754535 100644 --- a/types/handlers.gen.go +++ b/types/mod.2.gen.go @@ -1,4 +1,4 @@ -// Source: lemmy/crates/api_common/src/websocket/handlers.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 diff --git a/types/mod.gen.go b/types/mod.gen.go index a7bf7c4..87fa099 100644 --- a/types/mod.gen.go +++ b/types/mod.gen.go @@ -1,103 +1,4 @@ -// Source: lemmy/crates/api_common/src/websocket/mod.rs +// Source: lemmy/crates/api_common/src/websocket/handlers/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" -) diff --git a/types/online_users.gen.go b/types/online_users.gen.go new file mode 100644 index 0000000..9753133 --- /dev/null +++ b/types/online_users.gen.go @@ -0,0 +1,11 @@ +// 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"` +} diff --git a/types/person.gen.go b/types/person.gen.go index 2c6fb09..7c5242c 100644 --- a/types/person.gen.go +++ b/types/person.gen.go @@ -18,7 +18,9 @@ type Register struct { Honeypot Optional[string] `json:"honeypot" url:"honeypot,omitempty"` Answer Optional[string] `json:"answer" url:"answer,omitempty"` } -type GetCaptcha struct{} +type GetCaptcha struct { + Auth Optional[string] `json:"auth" url:"auth,omitempty"` +} type GetCaptchaResponse struct { Ok Optional[CaptchaResponse] `json:"ok" url:"ok,omitempty"` LemmyResponse diff --git a/types/site.gen.go b/types/site.gen.go index 88a6c95..ef006be 100644 --- a/types/site.gen.go +++ b/types/site.gen.go @@ -167,6 +167,13 @@ type GetSiteResponse struct { Taglines Optional[[]Tagline] `json:"taglines" url:"taglines,omitempty"` LemmyResponse } +type GetFederatedInstances struct { + Auth Optional[string] `json:"auth" url:"auth,omitempty"` +} +type GetFederatedInstancesResponse struct { + FederatedInstances Optional[FederatedInstances] `json:"federated_instances" url:"federated_instances,omitempty"` + LemmyResponse +} type MyUserInfo struct { LocalUserView LocalUserSettingsView `json:"local_user_view" url:"local_user_view,omitempty"` Follows []CommunityFollowerView `json:"follows" url:"follows,omitempty"`