# UserCalls

`interface` in `plugin-oauth` · v0.1.0

<https://seedcord.org/docs/packages/plugin-oauth/0.1.0/interfaces/user-calls>

Discord calls made as one user.

Each typed method needs one scope. With that scope in the client's `scopes`, it resolves to the result.
With it in `extraScopes`, it resolves to `undefined` for a user who hasn't granted it yet. With it in
neither, the call doesn't compile.

`get`, `post`, `put`, `patch`, and `delete` reach every other route and don't check scopes.

```ts
interface UserCalls<
    TScopes extends OAuthScope = never,
    TExtra extends OAuthScope = never
> extends UserRest
```

## Methods

### connections

```ts
connections(
    args: ScopedArgs<TScopes | TExtra, "connections">
): ScopedResult<TScopes, "connections", RESTGetAPICurrentUserConnectionsResult>
```

The accounts that the user connected on Discord, like GitHub. Needs the `connections` scope.

### guildMember

```ts
guildMember(
    args: ScopedArgs<
        TScopes | TExtra,
        "guilds.members.read",
        [guildId: string]
    >
): ScopedResult<TScopes, "guilds.members.read", RESTGetCurrentUserGuildMemberResult>
```

The user's member object in one server. Needs the `guilds.members.read` scope.

### guilds

```ts
guilds(
    args: ScopedArgs<
        TScopes | TExtra,
        "guilds",
        [query?: RESTGetAPICurrentUserGuildsQuery]
    >
): ScopedResult<TScopes, "guilds", RESTGetAPICurrentUserGuildsResult>
```

The servers that the user is in. Needs the `guilds` scope.

### joinGuild

```ts
joinGuild(
    args: ScopedArgs<
        TScopes | TExtra,
        "guilds.join",
        [guildId: string, options?: GuildJoinOptions]
    >
): ScopedResult<TScopes, "guilds.join", GuildJoin>
```

Adds the user to a server that the bot is in. Needs the `guilds.join` scope, and the bot needs the
Create Invite permission there.

### roleConnection

```ts
roleConnection(
    args: ScopedArgs<TScopes | TExtra, "role_connections.write">
): ScopedResult<TScopes, "role_connections.write", RESTGetAPICurrentUserApplicationRoleConnectionResult>
```

What the application has stored for the user's Linked Roles. Needs the `role_connections.write` scope.

### setRoleConnection

```ts
setRoleConnection(
    args: ScopedArgs<
        TScopes | TExtra,
        "role_connections.write",
        [connection: RESTPutAPICurrentUserApplicationRoleConnectionJSONBody]
    >
): ScopedResult<TScopes, "role_connections.write", RESTPutAPICurrentUserApplicationRoleConnectionResult>
```

Replaces what the application has stored for the user's Linked Roles. Needs the
`role_connections.write` scope. Discord doesn't check the values against the metadata types that
you registered.

### user

```ts
user(): Promise<RESTGetAPICurrentUserResult>
```

The user's own account.
