An experimental TypeSpec syntax for Lexicon

sick

+475 -1
+116
packages/emitter/test/scenarios/atproto/input/app/bsky/unspecced/defs.tsp
··· 1 + import "@tlex/emitter"; 2 + 3 + namespace app.bsky.unspecced.defs { 4 + model SkeletonSearchPost { 5 + @required uri: atUri; 6 + } 7 + 8 + model SkeletonSearchActor { 9 + @required did: did; 10 + } 11 + 12 + model SkeletonSearchStarterPack { 13 + @required uri: atUri; 14 + } 15 + 16 + model TrendingTopic { 17 + @required topic: string; 18 + displayName?: string; 19 + description?: string; 20 + @required link: string; 21 + } 22 + 23 + model SkeletonTrend { 24 + @required topic: string; 25 + @required displayName: string; 26 + @required link: string; 27 + @required startedAt: datetime; 28 + @required postCount: integer; 29 + status?: "hot" | string; 30 + category?: string; 31 + @required dids: did[]; 32 + } 33 + 34 + model TrendView { 35 + @required topic: string; 36 + @required displayName: string; 37 + @required link: string; 38 + @required startedAt: datetime; 39 + @required postCount: integer; 40 + status?: "hot" | string; 41 + category?: string; 42 + @required actors: app.bsky.actor.defs.ProfileViewBasic[]; 43 + } 44 + 45 + model ThreadItemPost { 46 + @required post: app.bsky.feed.defs.PostView; 47 + 48 + @doc("This post has more parents that were not present in the response. This is just a boolean, without the number of parents.") 49 + @required 50 + moreParents: boolean; 51 + 52 + @doc("This post has more replies that were not present in the response. This is a numeric value, which is best-effort and might not be accurate.") 53 + @required 54 + moreReplies: integer; 55 + 56 + @doc("This post is part of a contiguous thread by the OP from the thread root. Many different OP threads can happen in the same thread.") 57 + @required 58 + opThread: boolean; 59 + 60 + @doc("The threadgate created by the author indicates this post as a reply to be hidden for everyone consuming the thread.") 61 + @required 62 + hiddenByThreadgate: boolean; 63 + 64 + @doc("This is by an account muted by the viewer requesting it.") 65 + @required 66 + mutedByViewer: boolean; 67 + } 68 + 69 + model ThreadItemNoUnauthenticated {} 70 + 71 + model ThreadItemNotFound {} 72 + 73 + model ThreadItemBlocked { 74 + @required author: app.bsky.feed.defs.BlockedAuthor; 75 + } 76 + 77 + @doc("The computed state of the age assurance process, returned to the user in question on certain authenticated requests.") 78 + model AgeAssuranceState { 79 + @doc("The timestamp when this state was last updated.") 80 + lastInitiatedAt?: datetime; 81 + 82 + @doc("The status of the age assurance process.") 83 + @required 84 + status: "unknown" | "pending" | "assured" | "blocked" | string; 85 + } 86 + 87 + @doc("Object used to store age assurance data in stash.") 88 + model AgeAssuranceEvent { 89 + @doc("The date and time of this write operation.") 90 + @required 91 + createdAt: datetime; 92 + 93 + @doc("The status of the age assurance process.") 94 + @required 95 + status: "unknown" | "pending" | "assured" | string; 96 + 97 + @doc("The unique identifier for this instance of the age assurance flow, in UUID format.") 98 + @required 99 + attemptId: string; 100 + 101 + @doc("The email used for AA.") 102 + email?: string; 103 + 104 + @doc("The IP address used when initiating the AA flow.") 105 + initIp?: string; 106 + 107 + @doc("The user agent used when initiating the AA flow.") 108 + initUa?: string; 109 + 110 + @doc("The IP address used when completing the AA flow.") 111 + completeIp?: string; 112 + 113 + @doc("The user agent used when completing the AA flow.") 114 + completeUa?: string; 115 + } 116 + }
+7
packages/emitter/test/scenarios/atproto/input/app/bsky/unspecced/getAgeAssuranceState.tsp
··· 1 + import "@tlex/emitter"; 2 + 3 + namespace app.bsky.unspecced.getAgeAssuranceState { 4 + @doc("Returns the current state of the age assurance process for an account. This is used to check if the user has completed age assurance or if further action is required.") 5 + @query 6 + op main(): app.bsky.unspecced.defs.AgeAssuranceState; 7 + }
+15
packages/emitter/test/scenarios/atproto/input/app/bsky/unspecced/getConfig.tsp
··· 1 + import "@tlex/emitter"; 2 + 3 + namespace app.bsky.unspecced.getConfig { 4 + @doc("Get miscellaneous runtime configuration.") 5 + @query 6 + op main(): { 7 + checkEmailConfirmed?: boolean; 8 + liveNow?: LiveNowConfig[]; 9 + }; 10 + 11 + model LiveNowConfig { 12 + @required did: did; 13 + @required domains: string[]; 14 + } 15 + }
+13
packages/emitter/test/scenarios/atproto/input/app/bsky/unspecced/getOnboardingSuggestedStarterPacks.tsp
··· 1 + import "@tlex/emitter"; 2 + 3 + namespace app.bsky.unspecced.getOnboardingSuggestedStarterPacks { 4 + @doc("Get a list of suggested starterpacks for onboarding") 5 + @query 6 + op main( 7 + @minValue(1) 8 + @maxValue(25) 9 + limit?: int32 = 10 10 + ): { 11 + @required starterPacks: app.bsky.graph.defs.StarterPackView[]; 12 + }; 13 + }
+16
packages/emitter/test/scenarios/atproto/input/app/bsky/unspecced/getOnboardingSuggestedStarterPacksSkeleton.tsp
··· 1 + import "@tlex/emitter"; 2 + 3 + namespace app.bsky.unspecced.getOnboardingSuggestedStarterPacksSkeleton { 4 + @doc("Get a skeleton of suggested starterpacks for onboarding. Intended to be called and hydrated by app.bsky.unspecced.getOnboardingSuggestedStarterPacks") 5 + @query 6 + op main( 7 + @doc("DID of the account making the request (not included for public/unauthenticated queries).") 8 + viewer?: did, 9 + 10 + @minValue(1) 11 + @maxValue(25) 12 + limit?: int32 = 10 13 + ): { 14 + @required starterPacks: atUri[]; 15 + }; 16 + }
+17
packages/emitter/test/scenarios/atproto/input/app/bsky/unspecced/getPopularFeedGenerators.tsp
··· 1 + import "@tlex/emitter"; 2 + 3 + namespace app.bsky.unspecced.getPopularFeedGenerators { 4 + @doc("An unspecced view of globally popular feed generators.") 5 + @query 6 + op main( 7 + @minValue(1) 8 + @maxValue(100) 9 + limit?: int32 = 50, 10 + 11 + cursor?: string, 12 + query?: string 13 + ): { 14 + cursor?: string; 15 + @required feeds: app.bsky.feed.defs.GeneratorView[]; 16 + }; 17 + }
+28
packages/emitter/test/scenarios/atproto/input/app/bsky/unspecced/getPostThreadOtherV2.tsp
··· 1 + import "@tlex/emitter"; 2 + 3 + namespace app.bsky.unspecced.getPostThreadOtherV2 { 4 + @doc("(NOTE: this endpoint is under development and WILL change without notice. Don't use it until it is moved out of `unspecced` or your application WILL break) Get additional posts under a thread e.g. replies hidden by threadgate. Based on an anchor post at any depth of the tree, returns top-level replies below that anchor. It does not include ancestors nor the anchor itself. This should be called after exhausting `app.bsky.unspecced.getPostThreadV2`. Does not require auth, but additional metadata and filtering will be applied for authed requests.") 5 + @query 6 + op main( 7 + @doc("Reference (AT-URI) to post record. This is the anchor post.") 8 + @required 9 + anchor: atUri, 10 + 11 + @doc("Whether to prioritize posts from followed users. It only has effect when the user is authenticated.") 12 + prioritizeFollowedUsers?: boolean = false 13 + ): { 14 + @doc("A flat list of other thread items. The depth of each item is indicated by the depth property inside the item.") 15 + @required 16 + thread: ThreadItem[]; 17 + }; 18 + 19 + model ThreadItem { 20 + @required uri: atUri; 21 + 22 + @doc("The nesting level of this item in the thread. Depth 0 means the anchor item. Items above have negative depths, items below have positive depths.") 23 + @required 24 + depth: integer; 25 + 26 + @required value: (app.bsky.unspecced.defs.ThreadItemPost | unknown); 27 + } 28 + }
+57
packages/emitter/test/scenarios/atproto/input/app/bsky/unspecced/getPostThreadV2.tsp
··· 1 + import "@tlex/emitter"; 2 + 3 + namespace app.bsky.unspecced.getPostThreadV2 { 4 + @doc("(NOTE: this endpoint is under development and WILL change without notice. Don't use it until it is moved out of `unspecced` or your application WILL break) Get posts in a thread. It is based in an anchor post at any depth of the tree, and returns posts above it (recursively resolving the parent, without further branching to their replies) and below it (recursive replies, with branching to their replies). Does not require auth, but additional metadata and filtering will be applied for authed requests.") 5 + @query 6 + op main( 7 + @doc("Reference (AT-URI) to post record. This is the anchor post, and the thread will be built around it. It can be any post in the tree, not necessarily a root post.") 8 + @required 9 + anchor: atUri, 10 + 11 + @doc("Whether to include parents above the anchor.") 12 + above?: boolean = true, 13 + 14 + @doc("How many levels of replies to include below the anchor.") 15 + @minValue(0) 16 + @maxValue(20) 17 + below?: int32 = 6, 18 + 19 + @doc("Maximum of replies to include at each level of the thread, except for the direct replies to the anchor, which are (NOTE: currently, during unspecced phase) all returned (NOTE: later they might be paginated).") 20 + @minValue(0) 21 + @maxValue(100) 22 + branchingFactor?: int32 = 10, 23 + 24 + @doc("Whether to prioritize posts from followed users. It only has effect when the user is authenticated.") 25 + prioritizeFollowedUsers?: boolean = false, 26 + 27 + @doc("Sorting for the thread replies.") 28 + sort?: "newest" | "oldest" | "top" | string = "oldest" 29 + ): { 30 + @doc("A flat list of thread items. The depth of each item is indicated by the depth property inside the item.") 31 + @required 32 + thread: ThreadItem[]; 33 + 34 + threadgate?: app.bsky.feed.defs.ThreadgateView; 35 + 36 + @doc("Whether this thread has additional replies. If true, a call can be made to the `getPostThreadOtherV2` endpoint to retrieve them.") 37 + @required 38 + hasOtherReplies: boolean; 39 + }; 40 + 41 + model ThreadItem { 42 + @required uri: atUri; 43 + 44 + @doc("The nesting level of this item in the thread. Depth 0 means the anchor item. Items above have negative depths, items below have positive depths.") 45 + @required 46 + depth: integer; 47 + 48 + @required 49 + value: ( 50 + app.bsky.unspecced.defs.ThreadItemPost | 51 + app.bsky.unspecced.defs.ThreadItemNoUnauthenticated | 52 + app.bsky.unspecced.defs.ThreadItemNotFound | 53 + app.bsky.unspecced.defs.ThreadItemBlocked | 54 + unknown 55 + ); 56 + } 57 + }
+13
packages/emitter/test/scenarios/atproto/input/app/bsky/unspecced/getSuggestedFeeds.tsp
··· 1 + import "@tlex/emitter"; 2 + 3 + namespace app.bsky.unspecced.getSuggestedFeeds { 4 + @doc("Get a list of suggested feeds") 5 + @query 6 + op main( 7 + @minValue(1) 8 + @maxValue(25) 9 + limit?: int32 = 10 10 + ): { 11 + @required feeds: app.bsky.feed.defs.GeneratorView[]; 12 + }; 13 + }
+16
packages/emitter/test/scenarios/atproto/input/app/bsky/unspecced/getSuggestedFeedsSkeleton.tsp
··· 1 + import "@tlex/emitter"; 2 + 3 + namespace app.bsky.unspecced.getSuggestedFeedsSkeleton { 4 + @doc("Get a skeleton of suggested feeds. Intended to be called and hydrated by app.bsky.unspecced.getSuggestedFeeds") 5 + @query 6 + op main( 7 + @doc("DID of the account making the request (not included for public/unauthenticated queries).") 8 + viewer?: did, 9 + 10 + @minValue(1) 11 + @maxValue(25) 12 + limit?: int32 = 10 13 + ): { 14 + @required feeds: atUri[]; 15 + }; 16 + }
+13
packages/emitter/test/scenarios/atproto/input/app/bsky/unspecced/getSuggestedStarterPacks.tsp
··· 1 + import "@tlex/emitter"; 2 + 3 + namespace app.bsky.unspecced.getSuggestedStarterPacks { 4 + @doc("Get a list of suggested starterpacks") 5 + @query 6 + op main( 7 + @minValue(1) 8 + @maxValue(25) 9 + limit?: int32 = 10 10 + ): { 11 + @required starterPacks: app.bsky.graph.defs.StarterPackView[]; 12 + }; 13 + }
+16
packages/emitter/test/scenarios/atproto/input/app/bsky/unspecced/getSuggestedStarterPacksSkeleton.tsp
··· 1 + import "@tlex/emitter"; 2 + 3 + namespace app.bsky.unspecced.getSuggestedStarterPacksSkeleton { 4 + @doc("Get a skeleton of suggested starterpacks. Intended to be called and hydrated by app.bsky.unspecced.getSuggestedStarterpacks") 5 + @query 6 + op main( 7 + @doc("DID of the account making the request (not included for public/unauthenticated queries).") 8 + viewer?: did, 9 + 10 + @minValue(1) 11 + @maxValue(25) 12 + limit?: int32 = 10 13 + ): { 14 + @required starterPacks: atUri[]; 15 + }; 16 + }
+16
packages/emitter/test/scenarios/atproto/input/app/bsky/unspecced/getSuggestedUsers.tsp
··· 1 + import "@tlex/emitter"; 2 + 3 + namespace app.bsky.unspecced.getSuggestedUsers { 4 + @doc("Get a list of suggested users") 5 + @query 6 + op main( 7 + @doc("Category of users to get suggestions for.") 8 + category?: string, 9 + 10 + @minValue(1) 11 + @maxValue(50) 12 + limit?: int32 = 25 13 + ): { 14 + @required actors: app.bsky.actor.defs.ProfileView[]; 15 + }; 16 + }
+19
packages/emitter/test/scenarios/atproto/input/app/bsky/unspecced/getSuggestedUsersSkeleton.tsp
··· 1 + import "@tlex/emitter"; 2 + 3 + namespace app.bsky.unspecced.getSuggestedUsersSkeleton { 4 + @doc("Get a skeleton of suggested users. Intended to be called and hydrated by app.bsky.unspecced.getSuggestedUsers") 5 + @query 6 + op main( 7 + @doc("DID of the account making the request (not included for public/unauthenticated queries).") 8 + viewer?: did, 9 + 10 + @doc("Category of users to get suggestions for.") 11 + category?: string, 12 + 13 + @minValue(1) 14 + @maxValue(50) 15 + limit?: int32 = 25 16 + ): { 17 + @required dids: did[]; 18 + }; 19 + }
+28
packages/emitter/test/scenarios/atproto/input/app/bsky/unspecced/getSuggestionsSkeleton.tsp
··· 1 + import "@tlex/emitter"; 2 + 3 + namespace app.bsky.unspecced.getSuggestionsSkeleton { 4 + @doc("Get a skeleton of suggested actors. Intended to be called and then hydrated through app.bsky.actor.getSuggestions") 5 + @query 6 + op main( 7 + @doc("DID of the account making the request (not included for public/unauthenticated queries). Used to boost followed accounts in ranking.") 8 + viewer?: did, 9 + 10 + @minValue(1) 11 + @maxValue(100) 12 + limit?: int32 = 50, 13 + 14 + cursor?: string, 15 + 16 + @doc("DID of the account to get suggestions relative to. If not provided, suggestions will be based on the viewer.") 17 + relativeToDid?: did 18 + ): { 19 + cursor?: string; 20 + @required actors: app.bsky.unspecced.defs.SkeletonSearchActor[]; 21 + 22 + @doc("DID of the account these suggestions are relative to. If this is returned undefined, suggestions are based on the viewer.") 23 + relativeToDid?: did; 24 + 25 + @doc("Snowflake for this recommendation, use when submitting recommendation events.") 26 + recId?: integer; 27 + }; 28 + }
+15
packages/emitter/test/scenarios/atproto/input/app/bsky/unspecced/getTaggedSuggestions.tsp
··· 1 + import "@tlex/emitter"; 2 + 3 + namespace app.bsky.unspecced.getTaggedSuggestions { 4 + @doc("Get a list of suggestions (feeds and users) tagged with categories") 5 + @query 6 + op main(): { 7 + @required suggestions: Suggestion[]; 8 + }; 9 + 10 + model Suggestion { 11 + @required tag: string; 12 + @required subjectType: "actor" | "feed" | string; 13 + @required subject: uri; 14 + } 15 + }
+17
packages/emitter/test/scenarios/atproto/input/app/bsky/unspecced/getTrendingTopics.tsp
··· 1 + import "@tlex/emitter"; 2 + 3 + namespace app.bsky.unspecced.getTrendingTopics { 4 + @doc("Get a list of trending topics") 5 + @query 6 + op main( 7 + @doc("DID of the account making the request (not included for public/unauthenticated queries). Used to boost followed accounts in ranking.") 8 + viewer?: did, 9 + 10 + @minValue(1) 11 + @maxValue(25) 12 + limit?: int32 = 10 13 + ): { 14 + @required topics: app.bsky.unspecced.defs.TrendingTopic[]; 15 + @required suggested: app.bsky.unspecced.defs.TrendingTopic[]; 16 + }; 17 + }
+13
packages/emitter/test/scenarios/atproto/input/app/bsky/unspecced/getTrends.tsp
··· 1 + import "@tlex/emitter"; 2 + 3 + namespace app.bsky.unspecced.getTrends { 4 + @doc("Get the current trends on the network") 5 + @query 6 + op main( 7 + @minValue(1) 8 + @maxValue(25) 9 + limit?: int32 = 10 10 + ): { 11 + @required trends: app.bsky.unspecced.defs.TrendView[]; 12 + }; 13 + }
+16
packages/emitter/test/scenarios/atproto/input/app/bsky/unspecced/getTrendsSkeleton.tsp
··· 1 + import "@tlex/emitter"; 2 + 3 + namespace app.bsky.unspecced.getTrendsSkeleton { 4 + @doc("Get the skeleton of trends on the network. Intended to be called and then hydrated through app.bsky.unspecced.getTrends") 5 + @query 6 + op main( 7 + @doc("DID of the account making the request (not included for public/unauthenticated queries).") 8 + viewer?: did, 9 + 10 + @minValue(1) 11 + @maxValue(25) 12 + limit?: int32 = 10 13 + ): { 14 + @required trends: app.bsky.unspecced.defs.SkeletonTrend[]; 15 + }; 16 + }
+24
packages/emitter/test/scenarios/atproto/input/app/bsky/unspecced/initAgeAssurance.tsp
··· 1 + import "@tlex/emitter"; 2 + 3 + namespace app.bsky.unspecced.initAgeAssurance { 4 + model InvalidEmail {} 5 + model DidTooLong {} 6 + model InvalidInitiation {} 7 + 8 + @doc("Initiate age assurance for an account. This is a one-time action that will start the process of verifying the user's age.") 9 + @procedure 10 + @errors(InvalidEmail, DidTooLong, InvalidInitiation) 11 + op main(input: { 12 + @doc("The user's email address to receive assurance instructions.") 13 + @required 14 + email: string; 15 + 16 + @doc("The user's preferred language for communication during the assurance process.") 17 + @required 18 + language: string; 19 + 20 + @doc("An ISO 3166-1 alpha-2 code of the user's location.") 21 + @required 22 + countryCode: string; 23 + }): app.bsky.unspecced.defs.AgeAssuranceState; 24 + }
-1
packages/emitter/test/scenarios/atproto/output/app/bsky/unspecced/getConfig.json
··· 9 9 "encoding": "application/json", 10 10 "schema": { 11 11 "type": "object", 12 - "required": [], 13 12 "properties": { 14 13 "checkEmailConfirmed": { "type": "boolean" }, 15 14 "liveNow": {