diff --git a/docs/developer-tools/embedded-app-sdk.mdx b/docs/developer-tools/embedded-app-sdk.mdx index 164b01b8be..c127d99903 100644 --- a/docs/developer-tools/embedded-app-sdk.mdx +++ b/docs/developer-tools/embedded-app-sdk.mdx @@ -167,6 +167,7 @@ Developers can use these commands to interact with the Discord client. The follo | [getEntitlements](/docs/developer-tools/embedded-app-sdk#getentitlements) | Returns a list of entitlements for the current user | | [getInstanceConnectedParticipants](/docs/developer-tools/embedded-app-sdk#getinstanceconnectedparticipants) | Returns all participants connected to the instance | | [getPlatformBehaviors](/docs/developer-tools/embedded-app-sdk#getplatformbehaviors) | Returns information about supported platform behaviors | +| [getRelationships](/docs/developer-tools/embedded-app-sdk#getrelationships) | Returns the current user's relationships | | [getSkus](/docs/developer-tools/embedded-app-sdk#getskus) | Returns a list of your app's SKUs | | [initiateImageUpload](/docs/developer-tools/embedded-app-sdk#initiateimageupload) | Presents the file upload flow in the Discord client | | [openExternalLink](/docs/developer-tools/embedded-app-sdk#openexternallink) | Allows for opening an external link from within the Discord client | @@ -455,6 +456,39 @@ await discordSdk.commands.getPlatformBehaviors(); --- + +### getRelationships() + +Returns the current user's relationships. + + +#### Supported Platforms +| Web | iOS | Android | +|-----|-----|---------| +| ✅ | ✅ | ✅ | + +#### Required Scopes + +- relationships.read + +:::info +Requires Discord approval +::: + +#### Signature + + +getRelationships(): Promise\<[GetRelationshipsResponse](/docs/developer-tools/embedded-app-sdk#getrelationshipsresponse)\> + + +#### Usage + +```js +await discordSdk.commands.getRelationships(); +``` + +--- + ### getSkus() Returns a list of SKU objects. SKUs without prices are automatically filtered out. @@ -795,6 +829,7 @@ Developers may use the following events alongside the `subscribe()` SDK method t | [CURRENT_GUILD_MEMBER_UPDATE](/docs/developer-tools/embedded-app-sdk#currentguildmemberupdate) | Received when the current guild member object changes | | [THERMAL_STATE_UPDATE](/docs/developer-tools/embedded-app-sdk#thermalstateupdate) | Received when Android or iOS thermal states are surfaced to the Discord app | | [ACTIVITY_INSTANCE_PARTICIPANTS_UPDATE](/docs/developer-tools/embedded-app-sdk#activityinstanceparticipantsupdate) | Received when the number of instance participants changes | +| [RELATIONSHIP_UPDATE](/docs/developer-tools/embedded-app-sdk#relationshipupdate) | Received when a relationship of the current user is updated | | [ENTITLEMENT_CREATE](/docs/developer-tools/embedded-app-sdk#entitlementcreate) | Received when an entitlement is created for a SKU | @@ -1054,6 +1089,41 @@ No scopes required --- +### RELATIONSHIP_UPDATE + +Received when a relationship of the current user is updated. + +#### Required Scopes + +- relationships.read + +:::info +Requires Discord approval +::: + +#### Sample Event Payload +```javascript +{ + "type": 1, + "user": { + "id": "7173771622812225536", + "username": "beef_supreme", + "discriminator": "0", + "global_name": "Dis Cord", + "avatar": "abcdefg", + "avatar_decoration_data": { + "asset": "abcdefg", + "sku_id": "123456789" + }, + "bot": false, + "flags": 1, + "premium_type": 2 + } +} +``` + +--- + ### ENTITLEMENT_CREATE :::preview @@ -1302,6 +1372,12 @@ Coming soon! Not available during Developer Preview |-------------------------|---------| | iosKeyboardResizesView? | boolean | +#### GetRelationshipsResponse + +| Property | Type | +|---------------|-----------------------------------------------------------------------| +| relationships | [Relationship](/docs/developer-tools/embedded-app-sdk#relationship)[] | + #### GetSkusResponse | Property | Type | @@ -1438,6 +1514,13 @@ Coming soon! Not available during Developer Preview | me | boolean | | emoji | [Emoji](/docs/developer-tools/embedded-app-sdk#emoji) | +#### Relationship + +| Property | Type | +|----------|---------------------------------------------------------------------| +| type | [number](/docs/developer-tools/embedded-app-sdk#relationship-types) | +| user | [User](/docs/developer-tools/embedded-app-sdk#user) | + #### Secrets | Property | Type | @@ -1690,3 +1773,15 @@ Coming soon! Not available during Developer Preview | CONSUMABLE | 3 | | BUNDLE | 4 | | SUBSCRIPTION | 5 | + +#### Relationship Types + +| Value | Name | Description | +|-------|------------------|--------------------------------------------------------------------------------------------------| +| 0 | None | The user has no relationship with the other user. | +| 1 | Friend | The user is friends with the other user. | +| 2 | Blocked | The current user has blocked the target user. | +| 3 | Pending Incoming | The current user has received a friend request from the target user, but it is not yet accepted. | +| 4 | Pending Outgoing | The current user has sent a friend request to the target user, but it is not yet accepted. | +| 5 | Implicit | The Implicit type is documented for visibility, but should be unused in the SDK. | +| 6 | Suggestion | The Suggestion type is documented for visibility, but should be unused in the SDK. |