Skip to content

Commit f9a47ed

Browse files
author
Vitor
committed
refactor: make a type including all scopes
1 parent 05cc037 commit f9a47ed

File tree

12 files changed

+44
-100
lines changed

12 files changed

+44
-100
lines changed

deno/payloads/v10/application.ts

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,7 @@
22
* Types extracted from https://discord.com/developers/docs/resources/application
33
*/
44

5-
import type {
6-
OAuth2PublicUserScopes,
7-
OAuth2GuildScopes,
8-
OAuth2OtherScopes,
9-
OAuth2RestrictedUserScopes,
10-
OAuth2PrivateUserScopes,
11-
} from './oauth2.ts';
5+
import type { OAuth2Scopes } from './oauth2.ts';
126
import type { APITeam } from './teams.ts';
137
import type { APIUser } from './user.ts';
148
import type { Permissions, Snowflake } from '../../globals.ts';
@@ -114,13 +108,7 @@ export interface APIApplication {
114108
}
115109

116110
export interface APIApplicationInstallParams {
117-
scopes: (
118-
| OAuth2PublicUserScopes
119-
| OAuth2GuildScopes
120-
| OAuth2OtherScopes
121-
| OAuth2RestrictedUserScopes
122-
| OAuth2PrivateUserScopes
123-
)[];
111+
scopes: OAuth2Scopes[];
124112
permissions: Permissions;
125113
}
126114

deno/payloads/v10/oauth2.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,3 +175,10 @@ export enum OAuth2PrivateUserScopes {
175175
*/
176176
Voice = 'voice',
177177
}
178+
179+
export type OAuth2Scopes =
180+
| OAuth2PublicUserScopes
181+
| OAuth2GuildScopes
182+
| OAuth2OtherScopes
183+
| OAuth2RestrictedUserScopes
184+
| OAuth2PrivateUserScopes;

deno/payloads/v9/application.ts

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,7 @@
22
* Types extracted from https://discord.com/developers/docs/resources/application
33
*/
44

5-
import type {
6-
OAuth2PublicUserScopes,
7-
OAuth2GuildScopes,
8-
OAuth2OtherScopes,
9-
OAuth2RestrictedUserScopes,
10-
OAuth2PrivateUserScopes,
11-
} from './oauth2.ts';
5+
import type { OAuth2Scopes } from './oauth2.ts';
126
import type { APITeam } from './teams.ts';
137
import type { APIUser } from './user.ts';
148
import type { Permissions, Snowflake } from '../../globals.ts';
@@ -114,13 +108,7 @@ export interface APIApplication {
114108
}
115109

116110
export interface APIApplicationInstallParams {
117-
scopes: (
118-
| OAuth2PublicUserScopes
119-
| OAuth2GuildScopes
120-
| OAuth2OtherScopes
121-
| OAuth2RestrictedUserScopes
122-
| OAuth2PrivateUserScopes
123-
)[];
111+
scopes: OAuth2Scopes[];
124112
permissions: Permissions;
125113
}
126114

deno/payloads/v9/oauth2.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,3 +175,10 @@ export enum OAuth2PrivateUserScopes {
175175
*/
176176
Voice = 'voice',
177177
}
178+
179+
export type OAuth2Scopes =
180+
| OAuth2PublicUserScopes
181+
| OAuth2GuildScopes
182+
| OAuth2OtherScopes
183+
| OAuth2RestrictedUserScopes
184+
| OAuth2PrivateUserScopes;

deno/rest/v10/oauth2.ts

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,8 @@ import type {
44
APIGuild,
55
APIUser,
66
APIWebhook,
7-
OAuth2PublicUserScopes,
87
OAuth2GuildScopes,
9-
OAuth2OtherScopes,
10-
OAuth2RestrictedUserScopes,
11-
OAuth2PrivateUserScopes,
8+
OAuth2Scopes,
129
} from '../../payloads/v10/mod.ts';
1310

1411
/**
@@ -27,13 +24,7 @@ export interface RESTGetAPIOAuth2CurrentAuthorizationResult {
2724
/**
2825
* the scopes the user has authorized the application for
2926
*/
30-
scopes: (
31-
| OAuth2PublicUserScopes
32-
| OAuth2GuildScopes
33-
| OAuth2OtherScopes
34-
| OAuth2RestrictedUserScopes
35-
| OAuth2PrivateUserScopes
36-
)[];
27+
scopes: OAuth2Scopes[];
3728
/**
3829
* when the access token expires
3930
*/

deno/rest/v9/oauth2.ts

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,8 @@ import type {
44
APIGuild,
55
APIUser,
66
APIWebhook,
7-
OAuth2PublicUserScopes,
87
OAuth2GuildScopes,
9-
OAuth2OtherScopes,
10-
OAuth2RestrictedUserScopes,
11-
OAuth2PrivateUserScopes,
8+
OAuth2Scopes,
129
} from '../../payloads/v10/mod.ts';
1310

1411
/**
@@ -27,13 +24,7 @@ export interface RESTGetAPIOAuth2CurrentAuthorizationResult {
2724
/**
2825
* the scopes the user has authorized the application for
2926
*/
30-
scopes: (
31-
| OAuth2PublicUserScopes
32-
| OAuth2GuildScopes
33-
| OAuth2OtherScopes
34-
| OAuth2RestrictedUserScopes
35-
| OAuth2PrivateUserScopes
36-
)[];
27+
scopes: OAuth2Scopes[];
3728
/**
3829
* when the access token expires
3930
*/

payloads/v10/application.ts

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,7 @@
22
* Types extracted from https://discord.com/developers/docs/resources/application
33
*/
44

5-
import type {
6-
OAuth2PublicUserScopes,
7-
OAuth2GuildScopes,
8-
OAuth2OtherScopes,
9-
OAuth2RestrictedUserScopes,
10-
OAuth2PrivateUserScopes,
11-
} from './oauth2';
5+
import type { OAuth2Scopes } from './oauth2';
126
import type { APITeam } from './teams';
137
import type { APIUser } from './user';
148
import type { Permissions, Snowflake } from '../../globals';
@@ -114,13 +108,7 @@ export interface APIApplication {
114108
}
115109

116110
export interface APIApplicationInstallParams {
117-
scopes: (
118-
| OAuth2PublicUserScopes
119-
| OAuth2GuildScopes
120-
| OAuth2OtherScopes
121-
| OAuth2RestrictedUserScopes
122-
| OAuth2PrivateUserScopes
123-
)[];
111+
scopes: OAuth2Scopes[];
124112
permissions: Permissions;
125113
}
126114

payloads/v10/oauth2.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,3 +175,10 @@ export enum OAuth2PrivateUserScopes {
175175
*/
176176
Voice = 'voice',
177177
}
178+
179+
export type OAuth2Scopes =
180+
| OAuth2PublicUserScopes
181+
| OAuth2GuildScopes
182+
| OAuth2OtherScopes
183+
| OAuth2RestrictedUserScopes
184+
| OAuth2PrivateUserScopes;

payloads/v9/application.ts

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,7 @@
22
* Types extracted from https://discord.com/developers/docs/resources/application
33
*/
44

5-
import type {
6-
OAuth2PublicUserScopes,
7-
OAuth2GuildScopes,
8-
OAuth2OtherScopes,
9-
OAuth2RestrictedUserScopes,
10-
OAuth2PrivateUserScopes,
11-
} from './oauth2';
5+
import type { OAuth2Scopes } from './oauth2';
126
import type { APITeam } from './teams';
137
import type { APIUser } from './user';
148
import type { Permissions, Snowflake } from '../../globals';
@@ -114,13 +108,7 @@ export interface APIApplication {
114108
}
115109

116110
export interface APIApplicationInstallParams {
117-
scopes: (
118-
| OAuth2PublicUserScopes
119-
| OAuth2GuildScopes
120-
| OAuth2OtherScopes
121-
| OAuth2RestrictedUserScopes
122-
| OAuth2PrivateUserScopes
123-
)[];
111+
scopes: OAuth2Scopes[];
124112
permissions: Permissions;
125113
}
126114

payloads/v9/oauth2.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,3 +175,10 @@ export enum OAuth2PrivateUserScopes {
175175
*/
176176
Voice = 'voice',
177177
}
178+
179+
export type OAuth2Scopes =
180+
| OAuth2PublicUserScopes
181+
| OAuth2GuildScopes
182+
| OAuth2OtherScopes
183+
| OAuth2RestrictedUserScopes
184+
| OAuth2PrivateUserScopes;

rest/v10/oauth2.ts

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,8 @@ import type {
44
APIGuild,
55
APIUser,
66
APIWebhook,
7-
OAuth2PublicUserScopes,
87
OAuth2GuildScopes,
9-
OAuth2OtherScopes,
10-
OAuth2RestrictedUserScopes,
11-
OAuth2PrivateUserScopes,
8+
OAuth2Scopes,
129
} from '../../payloads/v10/index';
1310

1411
/**
@@ -27,13 +24,7 @@ export interface RESTGetAPIOAuth2CurrentAuthorizationResult {
2724
/**
2825
* the scopes the user has authorized the application for
2926
*/
30-
scopes: (
31-
| OAuth2PublicUserScopes
32-
| OAuth2GuildScopes
33-
| OAuth2OtherScopes
34-
| OAuth2RestrictedUserScopes
35-
| OAuth2PrivateUserScopes
36-
)[];
27+
scopes: OAuth2Scopes[];
3728
/**
3829
* when the access token expires
3930
*/

rest/v9/oauth2.ts

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,8 @@ import type {
44
APIGuild,
55
APIUser,
66
APIWebhook,
7-
OAuth2PublicUserScopes,
87
OAuth2GuildScopes,
9-
OAuth2OtherScopes,
10-
OAuth2RestrictedUserScopes,
11-
OAuth2PrivateUserScopes,
8+
OAuth2Scopes,
129
} from '../../payloads/v10/index';
1310

1411
/**
@@ -27,13 +24,7 @@ export interface RESTGetAPIOAuth2CurrentAuthorizationResult {
2724
/**
2825
* the scopes the user has authorized the application for
2926
*/
30-
scopes: (
31-
| OAuth2PublicUserScopes
32-
| OAuth2GuildScopes
33-
| OAuth2OtherScopes
34-
| OAuth2RestrictedUserScopes
35-
| OAuth2PrivateUserScopes
36-
)[];
27+
scopes: OAuth2Scopes[];
3728
/**
3829
* when the access token expires
3930
*/

0 commit comments

Comments
 (0)