Skip to content

Commit 14ebd33

Browse files
committed
feat(oauth): enhance AuthorizeOptions with permissions examples
- Add comprehensive JSDoc examples for scope parameter - Document usage with ScopePresets and PermissionBuilder - Include preset examples (EMAIL_AND_PROFILE, POSTING_APP) - Include custom scope building example - Preserve legacy scope examples - Build and lint successful
1 parent 8bada43 commit 14ebd33

File tree

1 file changed

+37
-3
lines changed
  • packages/sdk-core/src/core

1 file changed

+37
-3
lines changed

packages/sdk-core/src/core/SDK.ts

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,47 @@ export interface AuthorizeOptions {
1717
* OAuth scope string to request specific permissions.
1818
* Overrides the default scope configured in {@link ATProtoSDKConfig.oauth.scope}.
1919
*
20-
* @example
20+
* Can use the permission system for type-safe scope building.
21+
*
22+
* @example Using presets
23+
* ```typescript
24+
* import { ScopePresets } from '@hypercerts-org/sdk-core';
25+
*
26+
* // Request email and profile access
27+
* await sdk.authorize("user.bsky.social", {
28+
* scope: ScopePresets.EMAIL_AND_PROFILE
29+
* });
30+
*
31+
* // Request full posting capabilities
32+
* await sdk.authorize("user.bsky.social", {
33+
* scope: ScopePresets.POSTING_APP
34+
* });
35+
* ```
36+
*
37+
* @example Building custom scopes
38+
* ```typescript
39+
* import { PermissionBuilder, buildScope } from '@hypercerts-org/sdk-core';
40+
*
41+
* const scope = buildScope(
42+
* new PermissionBuilder()
43+
* .accountEmail('read')
44+
* .repoWrite('app.bsky.feed.post')
45+
* .blob(['image/*'])
46+
* .build()
47+
* );
48+
*
49+
* await sdk.authorize("user.bsky.social", { scope });
50+
* ```
51+
*
52+
* @example Legacy scopes
2153
* ```typescript
2254
* // Request read-only access
2355
* await sdk.authorize("user.bsky.social", { scope: "atproto" });
2456
*
25-
* // Request full access (default typically includes transition:generic)
26-
* await sdk.authorize("user.bsky.social", { scope: "atproto transition:generic" });
57+
* // Request full access (legacy)
58+
* await sdk.authorize("user.bsky.social", {
59+
* scope: "atproto transition:generic"
60+
* });
2761
* ```
2862
*/
2963
scope?: string;

0 commit comments

Comments
 (0)