Use correct type for enum generation
This commit is contained in:
parent
a355158d88
commit
a8997d12ee
@ -4,8 +4,8 @@ import (
|
||||
"io"
|
||||
"strings"
|
||||
|
||||
"go.arsenm.dev/go-lemmy/cmd/gen/parser"
|
||||
"github.com/dave/jennifer/jen"
|
||||
"go.arsenm.dev/go-lemmy/cmd/gen/parser"
|
||||
)
|
||||
|
||||
type StructGenerator struct {
|
||||
@ -47,7 +47,7 @@ func (s *StructGenerator) Generate(items []parser.Item) error {
|
||||
|
||||
f.Const().DefsFunc(func(g *jen.Group) {
|
||||
for _, member := range e.Members {
|
||||
g.Id(e.Name + string(member)).Op("=").Lit(string(member))
|
||||
g.Id(e.Name + string(member)).Id(e.Name).Op("=").Lit(string(member))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -3,34 +3,34 @@ package types
|
||||
type SortType string
|
||||
|
||||
const (
|
||||
SortTypeActive = "Active"
|
||||
SortTypeHot = "Hot"
|
||||
SortTypeNew = "New"
|
||||
SortTypeTopDay = "TopDay"
|
||||
SortTypeTopWeek = "TopWeek"
|
||||
SortTypeTopMonth = "TopMonth"
|
||||
SortTypeTopYear = "TopYear"
|
||||
SortTypeTopAll = "TopAll"
|
||||
SortTypeMostComments = "MostComments"
|
||||
SortTypeNewComments = "NewComments"
|
||||
SortTypeActive SortType = "Active"
|
||||
SortTypeHot SortType = "Hot"
|
||||
SortTypeNew SortType = "New"
|
||||
SortTypeTopDay SortType = "TopDay"
|
||||
SortTypeTopWeek SortType = "TopWeek"
|
||||
SortTypeTopMonth SortType = "TopMonth"
|
||||
SortTypeTopYear SortType = "TopYear"
|
||||
SortTypeTopAll SortType = "TopAll"
|
||||
SortTypeMostComments SortType = "MostComments"
|
||||
SortTypeNewComments SortType = "NewComments"
|
||||
)
|
||||
|
||||
type ListingType string
|
||||
|
||||
const (
|
||||
ListingTypeAll = "All"
|
||||
ListingTypeLocal = "Local"
|
||||
ListingTypeSubscribed = "Subscribed"
|
||||
ListingTypeCommunity = "Community"
|
||||
ListingTypeAll ListingType = "All"
|
||||
ListingTypeLocal ListingType = "Local"
|
||||
ListingTypeSubscribed ListingType = "Subscribed"
|
||||
ListingTypeCommunity ListingType = "Community"
|
||||
)
|
||||
|
||||
type SearchType string
|
||||
|
||||
const (
|
||||
SearchTypeAll = "All"
|
||||
SearchTypeComments = "Comments"
|
||||
SearchTypePosts = "Posts"
|
||||
SearchTypeCommunities = "Communities"
|
||||
SearchTypeUsers = "Users"
|
||||
SearchTypeUrl = "Url"
|
||||
SearchTypeAll SearchType = "All"
|
||||
SearchTypeComments SearchType = "Comments"
|
||||
SearchTypePosts SearchType = "Posts"
|
||||
SearchTypeCommunities SearchType = "Communities"
|
||||
SearchTypeUsers SearchType = "Users"
|
||||
SearchTypeUrl SearchType = "Url"
|
||||
)
|
||||
|
@ -3,88 +3,88 @@ package types
|
||||
type UserOperation string
|
||||
|
||||
const (
|
||||
UserOperationLogin = "Login"
|
||||
UserOperationGetCaptcha = "GetCaptcha"
|
||||
UserOperationMarkCommentAsRead = "MarkCommentAsRead"
|
||||
UserOperationSaveComment = "SaveComment"
|
||||
UserOperationCreateCommentLike = "CreateCommentLike"
|
||||
UserOperationCreateCommentReport = "CreateCommentReport"
|
||||
UserOperationResolveCommentReport = "ResolveCommentReport"
|
||||
UserOperationListCommentReports = "ListCommentReports"
|
||||
UserOperationCreatePostLike = "CreatePostLike"
|
||||
UserOperationLockPost = "LockPost"
|
||||
UserOperationStickyPost = "StickyPost"
|
||||
UserOperationMarkPostAsRead = "MarkPostAsRead"
|
||||
UserOperationSavePost = "SavePost"
|
||||
UserOperationCreatePostReport = "CreatePostReport"
|
||||
UserOperationResolvePostReport = "ResolvePostReport"
|
||||
UserOperationListPostReports = "ListPostReports"
|
||||
UserOperationGetReportCount = "GetReportCount"
|
||||
UserOperationGetUnreadCount = "GetUnreadCount"
|
||||
UserOperationVerifyEmail = "VerifyEmail"
|
||||
UserOperationFollowCommunity = "FollowCommunity"
|
||||
UserOperationGetReplies = "GetReplies"
|
||||
UserOperationGetPersonMentions = "GetPersonMentions"
|
||||
UserOperationMarkPersonMentionAsRead = "MarkPersonMentionAsRead"
|
||||
UserOperationGetModlog = "GetModlog"
|
||||
UserOperationBanFromCommunity = "BanFromCommunity"
|
||||
UserOperationAddModToCommunity = "AddModToCommunity"
|
||||
UserOperationAddAdmin = "AddAdmin"
|
||||
UserOperationGetUnreadRegistrationApplicationCount = "GetUnreadRegistrationApplicationCount"
|
||||
UserOperationListRegistrationApplications = "ListRegistrationApplications"
|
||||
UserOperationApproveRegistrationApplication = "ApproveRegistrationApplication"
|
||||
UserOperationBanPerson = "BanPerson"
|
||||
UserOperationGetBannedPersons = "GetBannedPersons"
|
||||
UserOperationSearch = "Search"
|
||||
UserOperationResolveObject = "ResolveObject"
|
||||
UserOperationMarkAllAsRead = "MarkAllAsRead"
|
||||
UserOperationSaveUserSettings = "SaveUserSettings"
|
||||
UserOperationTransferCommunity = "TransferCommunity"
|
||||
UserOperationLeaveAdmin = "LeaveAdmin"
|
||||
UserOperationPasswordReset = "PasswordReset"
|
||||
UserOperationPasswordChange = "PasswordChange"
|
||||
UserOperationMarkPrivateMessageAsRead = "MarkPrivateMessageAsRead"
|
||||
UserOperationUserJoin = "UserJoin"
|
||||
UserOperationGetSiteConfig = "GetSiteConfig"
|
||||
UserOperationSaveSiteConfig = "SaveSiteConfig"
|
||||
UserOperationPostJoin = "PostJoin"
|
||||
UserOperationCommunityJoin = "CommunityJoin"
|
||||
UserOperationModJoin = "ModJoin"
|
||||
UserOperationChangePassword = "ChangePassword"
|
||||
UserOperationGetSiteMetadata = "GetSiteMetadata"
|
||||
UserOperationBlockCommunity = "BlockCommunity"
|
||||
UserOperationBlockPerson = "BlockPerson"
|
||||
UserOperationLogin UserOperation = "Login"
|
||||
UserOperationGetCaptcha UserOperation = "GetCaptcha"
|
||||
UserOperationMarkCommentAsRead UserOperation = "MarkCommentAsRead"
|
||||
UserOperationSaveComment UserOperation = "SaveComment"
|
||||
UserOperationCreateCommentLike UserOperation = "CreateCommentLike"
|
||||
UserOperationCreateCommentReport UserOperation = "CreateCommentReport"
|
||||
UserOperationResolveCommentReport UserOperation = "ResolveCommentReport"
|
||||
UserOperationListCommentReports UserOperation = "ListCommentReports"
|
||||
UserOperationCreatePostLike UserOperation = "CreatePostLike"
|
||||
UserOperationLockPost UserOperation = "LockPost"
|
||||
UserOperationStickyPost UserOperation = "StickyPost"
|
||||
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"
|
||||
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"
|
||||
UserOperationSearch UserOperation = "Search"
|
||||
UserOperationResolveObject UserOperation = "ResolveObject"
|
||||
UserOperationMarkAllAsRead UserOperation = "MarkAllAsRead"
|
||||
UserOperationSaveUserSettings UserOperation = "SaveUserSettings"
|
||||
UserOperationTransferCommunity UserOperation = "TransferCommunity"
|
||||
UserOperationLeaveAdmin UserOperation = "LeaveAdmin"
|
||||
UserOperationPasswordReset UserOperation = "PasswordReset"
|
||||
UserOperationPasswordChange UserOperation = "PasswordChange"
|
||||
UserOperationMarkPrivateMessageAsRead UserOperation = "MarkPrivateMessageAsRead"
|
||||
UserOperationUserJoin UserOperation = "UserJoin"
|
||||
UserOperationGetSiteConfig UserOperation = "GetSiteConfig"
|
||||
UserOperationSaveSiteConfig UserOperation = "SaveSiteConfig"
|
||||
UserOperationPostJoin UserOperation = "PostJoin"
|
||||
UserOperationCommunityJoin UserOperation = "CommunityJoin"
|
||||
UserOperationModJoin UserOperation = "ModJoin"
|
||||
UserOperationChangePassword UserOperation = "ChangePassword"
|
||||
UserOperationGetSiteMetadata UserOperation = "GetSiteMetadata"
|
||||
UserOperationBlockCommunity UserOperation = "BlockCommunity"
|
||||
UserOperationBlockPerson UserOperation = "BlockPerson"
|
||||
)
|
||||
|
||||
type UserOperationCrud string
|
||||
|
||||
const (
|
||||
UserOperationCrudCreateSite = "CreateSite"
|
||||
UserOperationCrudGetSite = "GetSite"
|
||||
UserOperationCrudEditSite = "EditSite"
|
||||
UserOperationCrudCreateCommunity = "CreateCommunity"
|
||||
UserOperationCrudListCommunities = "ListCommunities"
|
||||
UserOperationCrudGetCommunity = "GetCommunity"
|
||||
UserOperationCrudEditCommunity = "EditCommunity"
|
||||
UserOperationCrudDeleteCommunity = "DeleteCommunity"
|
||||
UserOperationCrudRemoveCommunity = "RemoveCommunity"
|
||||
UserOperationCrudCreatePost = "CreatePost"
|
||||
UserOperationCrudGetPost = "GetPost"
|
||||
UserOperationCrudGetPosts = "GetPosts"
|
||||
UserOperationCrudEditPost = "EditPost"
|
||||
UserOperationCrudDeletePost = "DeletePost"
|
||||
UserOperationCrudRemovePost = "RemovePost"
|
||||
UserOperationCrudCreateComment = "CreateComment"
|
||||
UserOperationCrudGetComment = "GetComment"
|
||||
UserOperationCrudGetComments = "GetComments"
|
||||
UserOperationCrudEditComment = "EditComment"
|
||||
UserOperationCrudDeleteComment = "DeleteComment"
|
||||
UserOperationCrudRemoveComment = "RemoveComment"
|
||||
UserOperationCrudRegister = "Register"
|
||||
UserOperationCrudGetPersonDetails = "GetPersonDetails"
|
||||
UserOperationCrudDeleteAccount = "DeleteAccount"
|
||||
UserOperationCrudCreatePrivateMessage = "CreatePrivateMessage"
|
||||
UserOperationCrudGetPrivateMessages = "GetPrivateMessages"
|
||||
UserOperationCrudEditPrivateMessage = "EditPrivateMessage"
|
||||
UserOperationCrudDeletePrivateMessage = "DeletePrivateMessage"
|
||||
UserOperationCrudCreateSite UserOperationCrud = "CreateSite"
|
||||
UserOperationCrudGetSite UserOperationCrud = "GetSite"
|
||||
UserOperationCrudEditSite UserOperationCrud = "EditSite"
|
||||
UserOperationCrudCreateCommunity UserOperationCrud = "CreateCommunity"
|
||||
UserOperationCrudListCommunities UserOperationCrud = "ListCommunities"
|
||||
UserOperationCrudGetCommunity UserOperationCrud = "GetCommunity"
|
||||
UserOperationCrudEditCommunity UserOperationCrud = "EditCommunity"
|
||||
UserOperationCrudDeleteCommunity UserOperationCrud = "DeleteCommunity"
|
||||
UserOperationCrudRemoveCommunity UserOperationCrud = "RemoveCommunity"
|
||||
UserOperationCrudCreatePost UserOperationCrud = "CreatePost"
|
||||
UserOperationCrudGetPost UserOperationCrud = "GetPost"
|
||||
UserOperationCrudGetPosts UserOperationCrud = "GetPosts"
|
||||
UserOperationCrudEditPost UserOperationCrud = "EditPost"
|
||||
UserOperationCrudDeletePost UserOperationCrud = "DeletePost"
|
||||
UserOperationCrudRemovePost UserOperationCrud = "RemovePost"
|
||||
UserOperationCrudCreateComment UserOperationCrud = "CreateComment"
|
||||
UserOperationCrudGetComment UserOperationCrud = "GetComment"
|
||||
UserOperationCrudGetComments UserOperationCrud = "GetComments"
|
||||
UserOperationCrudEditComment UserOperationCrud = "EditComment"
|
||||
UserOperationCrudDeleteComment UserOperationCrud = "DeleteComment"
|
||||
UserOperationCrudRemoveComment UserOperationCrud = "RemoveComment"
|
||||
UserOperationCrudRegister UserOperationCrud = "Register"
|
||||
UserOperationCrudGetPersonDetails UserOperationCrud = "GetPersonDetails"
|
||||
UserOperationCrudDeleteAccount UserOperationCrud = "DeleteAccount"
|
||||
UserOperationCrudCreatePrivateMessage UserOperationCrud = "CreatePrivateMessage"
|
||||
UserOperationCrudGetPrivateMessages UserOperationCrud = "GetPrivateMessages"
|
||||
UserOperationCrudEditPrivateMessage UserOperationCrud = "EditPrivateMessage"
|
||||
UserOperationCrudDeletePrivateMessage UserOperationCrud = "DeletePrivateMessage"
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user