[Feature Enhancement]: Re-organize Lexicon Models
Summary
No response
Pain points
Currently, the structure of the models work out like this:
- The file name of the applicable model(s) contains the domain name, the subdomain, and the name of the lexicon's file name from bluesky-social's atproto repository.
- The model contains the subdomain of the lexicon, followed by the name of the lexicon's action, according to the lexicon itself.
This creates an issue of inconsistencies in naming (as a few models may end up having the same names) which can lead to user confusion.
The solution is to re-organize them in the following way:
- Create four
structs:AppBskyLexicon,ComAtprotoLexicon,ToolsOzoneLexicon, andChatBskyLexicon. - Create extensions for each, which will contain
structs for the subdomain. - Create extensions for each action
struct, which will also containstructs. This time, thestructnames will be the name of the lexicon action. - Anything that the lexicon has which are relevant to the specific action will be within the applicable action
struct. - The main
structwithin the subdomainstructwill have a prefix or suffix attached to it, depending on the kind of model it is:- Models that are used for request bodies will have the
RequestBodysuffix. - Models that are used as an output will have the
Outputsuffix. - Models that are records will have the
Recordsuffix. - Models that are definitions will have the
Definitionsuffix. - Models that represent the part of the lexicon that's under the
mainproperty will have theMainprefix, unless it's used for any of the above use cases.
- Models that are used for request bodies will have the
- Anything in the lexicon that's under the
queryproperty will not be part of this reorganization.- These properties resides in the lexicon methods as parameters.
Below are a few examples.
app.bsky.graph.getMutes
- A file named
Lexicons.swiftwill contain the followingstructs:AppBskyLexicon,ComAtprotoLexicon,ToolsOzoneLexicon, andChatBskyLexicon. - Another file that's named
AppBskyLexicon.swiftwill contain an extension toAppBskyLexicon. In it will contain the structs for all of the subdomains (examples:Actor,Embed,Feed,Graph, etc.). - Another file named
AppBskyGraphGetMutes.swiftwill contain an extension toAppBskyLexicon.Graph. In it, thestructwill be namedGetMutesOutput.
app.bsky.embed.external
- A file named
Lexicons.swiftwill contain the followingstructs:AppBskyLexicon,ComAtprotoLexicon,ToolsOzoneLexicon, andChatBskyLexicon. - Another file that's named
AppBskyLexicon.swiftwill contain an extension toAppBskyLexicon. In it will contain the structs for all of the subdomains (examples:Actor,Embed,Feed,Graph, etc.). - Another file named
AppBskyEmbedExternal.swiftwill contain an extension toAppBskyLexicon.Embed. In it are severalstructs, which are named the following:MainExternalExternalExternalViewViewExternal
app.bsky.actor.defs
- A file named
Lexicons.swiftwill contain the followingstructs:AppBskyLexicon,ComAtprotoLexicon,ToolsOzoneLexicon, andChatBskyLexicon. - Another file that's named
AppBskyLexicon.swiftwill contain an extension toAppBskyLexicon. In it will contain the structs for all of the subdomains (examples:Actor,Embed,Feed,Graph, etc.). - Another file named
AppBskyActorDefs.swiftwill contain an extension toAppBskyLexicon.Actor. The list will be too long to write, but examples would include:ProfileViewBasicDefinitionProfileAssociatedDefinitionAdultContentPreferencesDefinitionInterestViewPreferencesDefinitionMutedWordsPreferencesDefinitionMutedWord(since this is related toMutedWordsPreferencesDefinition)
app.bsky.graph.unmuteActor
- A file named
Lexicons.swiftwill contain the followingstructs:AppBskyLexicon,ComAtprotoLexicon,ToolsOzoneLexicon, andChatBskyLexicon. - Another file that's named
AppBskyLexicon.swiftwill contain an extension toAppBskyLexicon. In it will contain the structs for all of the subdomains (examples:Actor,Embed,Feed,Graph, etc.). - Another file named
AppBskyGraphUnmuteActor.swiftwill contain an extension toAppBskyLexicon.Graph. In it is astruct, namedUnmuteActorRequestBody.
Considered Alternatives
No response
Is this a breaking change?
Yes
Library Examples
No response
Additional Context
Please note that this should not be started until version 0.11.0 is out. This should also be in a specific branch, which should be merged into the lexicon branch.
The tasks include:
-
[ ] Update the ATProtoKit API Design Guidelines to follow the design changes being made in here.
-
[x] Create a file named
Lexicons.swift- [x] Add
AppBskyLexicon - [x] Add
ComAtprotoLexicon - [x] Add
ToolsOzoneLexicon - [x] Add
ChatBskyLexicon
- [x] Add
-
[x] Create files named
[TLD][Domain]Lexicon.swiftand include the followingstructs:- [x] For
AppBskyLexicon.swift:- [x]
Actor - [x]
Embed - [x]
Feed - [x]
Labeler - [x]
Notification - [x]
RichText - [x]
Unspecced
- [x]
- [x] For
ComAtprotoLexicon.swift:- [x]
Admin - [x]
Identity - [x]
Label - [x]
Moderation - [x]
Repo - [x]
Server - [x]
Sync - [x]
Temp
- [x]
- [x] For
ToolsOzoneLexicon.swift:- [x]
Communication - [x]
Moderation
- [x]
- [x] For
ChatBskyLexicon.swift:- [x]
Actor - [x]
Convo - [x]
Moderation
- [x]
- [x] For
Lexicons to re-organize:
-
[x]
app.bsky.actor.*- [x]
app.bsky.actor.defs - [x]
app.bsky.actor.getPreferences - [x]
app.bsky.actor.getProfile - [x]
app.bsky.actor.getProfiles - [x]
app.bsky.actor.getSuggestions - [x]
app.bsky.actor.profile - [x]
app.bsky.actor.putPreferences - [x]
app.bsky.actor.searchActors - [x]
app.bsky.actor.searchActorsTypeahead
- [x]
-
[x]
app.bsky.embed.*- [x]
app.bsky.embed.external - [x]
app.bsky.embed.images - [x]
app.bsky.embed.record - [x]
app.bsky.embed.recordWithMedia
- [x]
-
[x]
app.bsky.feed.*- [x]
app.bsky.feed.defs - [x]
app.bsky.feed.describeFeedGenerator - [x]
app.bsky.feed.generator - [x]
app.bsky.feed.getActorFeeds - [x]
app.bsky.feed.getActorLikes - [x]
app.bsky.feed.getAuthorFeed - [x]
app.bsky.feed.getFeed - [x]
app.bsky.feed.getFeedGenerator - [x]
app.bsky.feed.getFeedGenerators - [x]
app.bsky.feed.getFeedSkeleton - [x]
app.bsky.feed.getLikes - [x]
app.bsky.feed.getListFeed - [x]
app.bsky.feed.getPosts - [x]
app.bsky.feed.getPostThread - [x]
app.bsky.feed.getRepostedBy - [x]
app.bsky.feed.getSuggestedFeeds - [x]
app.bsky.feed.getTimeline - [x]
app.bsky.feed.like - [x]
app.bsky.feed.post - [x]
app.bsky.feed.repost - [x]
app.bsky.feed.searchPosts - [x]
app.bsky.feed.sendInteractions - [x]
app.bsky.feed.threadgate
- [x]
-
[x]
app.bsky.graph.*- [x]
app.bsky.graph.block - [x]
app.bsky.graph.defs - [x]
app.bsky.graph.follow - [x]
app.bsky.graph.getBlocks - [x]
app.bsky.graph.getFollowers - [x]
app.bsky.graph.getFollows - [x]
app.bsky.graph.getList - [x]
app.bsky.graph.getListBlocks - [x]
app.bsky.graph.getListMutes - [x]
app.bsky.graph.getLists - [x]
app.bsky.graph.getMutes - [x]
app.bsky.graph.getRelationships - [x]
app.bsky.graph.getSuggestedFollowsByActor - [x]
app.bsky.graph.list - [x]
app.bsky.graph.listblock - [x]
app.bsky.graph.listitem - [x]
app.bsky.graph.muteActor - [x]
app.bsky.graph.muteActorList - [x]
app.bsky.graph.unmuteActor - [x]
app.bsky.graph.unmuteActorList
- [x]
-
[x]
app.bsky.labeler.*- [x]
app.bsky.labeler.defs - [x]
app.bsky.labeler.getServices - [x]
app.bsky.labeler.service
- [x]
-
[x]
app.bsky.notification.*- [x]
app.bsky.notification.updateSeen - [x]
app.bsky.notification.getUnreadCount - [x]
app.bsky.notification.listNotifications - [x]
app.bsky.notification.registerPush
- [x]
-
[x]
app.bsky.richtext.*- [x]
app.bsky.richtext.facet
- [x]
-
[x]
app.bsky.unspecced.*- [x]
app.bsky.unspecced.defs - [x]
app.bsky.unspecced.getPopularFeedGenerators - [x]
app.bsky.unspecced.getSuggestionsSkeleton - [x]
app.bsky.unspecced.getTaggedSuggestions - [x]
app.bsky.unspecced.searchActorsSkeleton - [x]
app.bsky.unspecced.searchPostsSkeleton
- [x]
-
[x]
com.atproto.admin.*- [x]
com.atproto.admin.defs - [x]
com.atproto.admin.deleteAccount - [x]
com.atproto.admin.disableAccountInvites - [x]
com.atproto.admin.disableInviteCodes - [x]
com.atproto.admin.enableAccountInvites - [x]
com.atproto.admin.getAccountInfos - [x]
com.atproto.admin.getInviteCodes - [x]
com.atproto.admin.getSubjectStatus - [x]
com.atproto.admin.queryModerationStatuses - [x]
com.atproto.admin.searchRepos - [x]
com.atproto.admin.sendEmail - [x]
com.atproto.admin.updateAccountEmail - [x]
com.atproto.admin.updateAccountHandle - [x]
com.atproto.admin.updateAccountPassword - [x]
com.atproto.admin.updateSubjectStatus
- [x]
-
[x]
com.atproto.identity.*- [x]
com.atproto.identity.getRecommendedDidCredentials - [x]
com.atproto.identity.resolveHandle - [x]
com.atproto.identity.signPlcOperation - [x]
com.atproto.identity.submitPlcOperation - [x]
com.atproto.identity.updateHandle
- [x]
-
[x]
com.atproto.label.*- [x]
com.atproto.label.defs - [x]
com.atproto.label.queryLabels
- [x]
-
[x]
com.atproto.moderation.*- [x]
com.atproto.moderation.createReport - [x]
com.atproto.moderation.defs
- [x]
-
[x]
com.atproto.repo.*- [x]
com.atproto.repo.applyWrites - [x]
com.atproto.repo.createRecord - [x]
com.atproto.repo.deleteRecord - [x]
com.atproto.repo.describeRepo - [x]
com.atproto.repo.getRecord - [x]
com.atproto.repo.importRepo - [x]
com.atproto.repo.listMissingBlobs - [x]
com.atproto.repo.listRecords - [x]
com.atproto.repo.putRecord - [x]
com.atproto.repo.strongRef - [x]
com.atproto.repo.uploadBlob
- [x]
-
[x]
com.atproto.server.*- [x]
com.atproto.server.checkAccountStatus - [x]
com.atproto.server.confirmEmail - [x]
com.atproto.server.createAccount - [x]
com.atproto.server.createAppPassword - [x]
com.atproto.server.createInviteCode - [x]
com.atproto.server.createInviteCodes - [x]
com.atproto.server.createSession - [x]
com.atproto.server.deactivateAccount - [x]
com.atproto.server.defs - [x]
com.atproto.server.deleteAccount - [x]
com.atproto.server.describeServer - [x]
com.atproto.server.getAccountInviteCodes - [x]
com.atproto.server.getServiceAuth - [x]
com.atproto.server.listAppPasswords - [x]
com.atproto.server.requestEmailUpdate - [x]
com.atproto.server.requestPasswordReset - [x]
com.atproto.server.reserveSigningKey - [x]
com.atproto.server.resetPassword - [x]
com.atproto.server.revokeAppPassword - [x]
com.atproto.server.updateEmail
- [x]
-
[x]
com.atproto.sync.*- [x]
com.atproto.sync.notifyOfUpdate - [x]
com.atproto.sync.requestCrawl - [x]
com.atproto.sync.getBlob - [x]
com.atproto.sync.getBlocks - [x]
com.atproto.sync.getLatestCommit - [x]
com.atproto.sync.listBlobs - [x]
com.atproto.sync.listRepos
- [x]
-
[x]
com.atproto.temp.*- [x]
com.atproto.temp.checkSignupQueue - [x]
com.atproto.temp.requestPhoneVerification
- [x]
-
[x]
tools.ozone.communication.*- [x]
tools.ozone.communication.createTemplate - [x]
tools.ozone.communication.defs - [x]
tools.ozone.communication.deleteTemplate - [x]
tools.ozone.communication.listTemplates - [x]
tools.ozone.communication.updateTemplate
- [x]
-
[x]
tools.ozone.moderation.*- [x]
tools.ozone.moderation.defs - [x]
tools.ozone.moderation.emitEvent - [x]
tools.ozone.moderation.queryEvents - [x]
tools.ozone.moderation.queryStatuses - [x]
tools.ozone.moderation.searchRepos
- [x]
-
[x]
chat.bsky.actor.*- [x]
chat.bsky.actor.declaration - [x]
chat.bsky.actor.defs - [x]
chat.bsky.actor.deleteAccount - [x]
chat.bsky.actor.exportAccountData
- [x]
-
[x]
chat.bsky.convo.*- [x]
chat.bsky.convo.defs - [x]
chat.bsky.convo.deleteMessageForSelf - [x]
chat.bsky.convo.getConvo - [x]
chat.bsky.convo.getConvoForMembers - [x]
chat.bsky.convo.getLog - [x]
chat.bsky.convo.getMessages - [x]
chat.bsky.convo.leaveConvo - [x]
chat.bsky.convo.listConvos - [x]
chat.bsky.convo.muteConvo - [x]
chat.bsky.convo.sendMessage - [x]
chat.bsky.convo.sendMessageBatch - [x]
chat.bsky.convo.unmuteConvo - [x]
chat.bsky.convo.updateRead
- [x]
-
[x]
chat.bsky.moderation.*- [x]
chat.bsky.moderation.getActorMetadata - [x]
chat.bsky.moderation.getMessageContext - [x]
chat.bsky.moderation.updateActorAccess
- [x]