Skip to content

Commit 15b73ce

Browse files
committed
Update schema
1 parent 5b104f9 commit 15b73ce

4 files changed

Lines changed: 159 additions & 2 deletions

File tree

packages/dashboard-client/resources.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1332,6 +1332,39 @@
13321332
"name": "list",
13331333
"rawName": "rawList"
13341334
},
1335+
{
1336+
"returnsItem": false,
1337+
"requestBodyRequiresItem": false,
1338+
"offersNestedItemsOptionInQueryParams": false,
1339+
"rel": "update",
1340+
"urlTemplate": "/oauth_applications/${oauthApplicationId}",
1341+
"method": "PUT",
1342+
"comment": "Update site access settings for an authorized application",
1343+
"urlPlaceholders": [
1344+
{
1345+
"variableName": "oauthApplicationId",
1346+
"isEntityId": true,
1347+
"relType": "OauthApplicationData"
1348+
}
1349+
],
1350+
"entityIdPlaceholder": {
1351+
"variableName": "oauthApplicationId",
1352+
"isEntityId": true,
1353+
"relType": "OauthApplicationData"
1354+
},
1355+
"requestBodyType": "OauthApplicationUpdateSchema",
1356+
"optionalRequestBody": false,
1357+
"requestStructure": {
1358+
"type": "oauth_application",
1359+
"idRequired": true,
1360+
"attributes": ["site_access_mode"],
1361+
"relationships": ["granted_sites"]
1362+
},
1363+
"queryParamsRequired": false,
1364+
"responseType": "OauthApplicationUpdateTargetSchema",
1365+
"name": "update",
1366+
"rawName": "rawUpdate"
1367+
},
13351368
{
13361369
"returnsItem": false,
13371370
"requestBodyRequiresItem": false,

packages/dashboard-client/src/generated/ApiTypes.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3663,7 +3663,13 @@ export type OauthApplication = {
36633663
* Date of token creation
36643664
*/
36653665
created_at: string;
3666+
/**
3667+
* Whether the application can access all projects or only selected ones
3668+
*/
3669+
site_access_mode: 'all' | 'selected';
3670+
granted_sites: SiteData[];
36663671
};
3672+
export type OauthApplicationUpdateTargetSchema = OauthApplication;
36673673
/**
36683674
* JSON API data
36693675
*
@@ -3689,6 +3695,32 @@ export type OauthApplicationAttributes = {
36893695
* Date of token creation
36903696
*/
36913697
created_at: string;
3698+
/**
3699+
* Whether the application can access all projects or only selected ones
3700+
*/
3701+
site_access_mode: 'all' | 'selected';
3702+
};
3703+
/**
3704+
* JSON API relationships
3705+
*
3706+
* This interface was referenced by `OauthApplication`'s JSON-Schema
3707+
* via the `definition` "relationships".
3708+
*/
3709+
export type OauthApplicationRelationships = {
3710+
granted_sites: SiteData[];
3711+
};
3712+
/**
3713+
* This interface was referenced by `OauthApplication`'s JSON-Schema
3714+
* via the `update.schema` link.
3715+
*/
3716+
export type OauthApplicationUpdateSchema = {
3717+
id?: OauthApplicationIdentity;
3718+
type?: OauthApplicationType;
3719+
/**
3720+
* Whether the application can access all projects or only selected ones
3721+
*/
3722+
site_access_mode: 'all' | 'selected';
3723+
granted_sites?: SiteData[];
36923724
};
36933725
/**
36943726
* Private entity to handle payments with Stripe

packages/dashboard-client/src/generated/RawApiTypes.ts

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3532,6 +3532,7 @@ export type OauthApplication = {
35323532
type: OauthApplicationType;
35333533
id: OauthApplicationIdentity;
35343534
attributes: OauthApplicationAttributes;
3535+
relationships: OauthApplicationRelationships;
35353536
};
35363537
/**
35373538
* JSON API attributes
@@ -3548,6 +3549,24 @@ export type OauthApplicationAttributes = {
35483549
* Date of token creation
35493550
*/
35503551
created_at: string;
3552+
/**
3553+
* Whether the application can access all projects or only selected ones
3554+
*/
3555+
site_access_mode: 'all' | 'selected';
3556+
};
3557+
/**
3558+
* JSON API relationships
3559+
*
3560+
* This interface was referenced by `OauthApplication`'s JSON-Schema
3561+
* via the `definition` "relationships".
3562+
*/
3563+
export type OauthApplicationRelationships = {
3564+
/**
3565+
* Projects the application has been granted access to (only relevant when site_access_mode is 'selected')
3566+
*/
3567+
granted_sites: {
3568+
data: SiteData[];
3569+
};
35513570
};
35523571
/**
35533572
* JSON API data
@@ -3565,10 +3584,38 @@ export type OauthApplicationData = {
35653584
*/
35663585
export type OauthApplicationInstancesTargetSchema = {
35673586
data: OauthApplication[];
3568-
meta: {
3569-
[k: string]: unknown;
3587+
};
3588+
/**
3589+
* This interface was referenced by `OauthApplication`'s JSON-Schema
3590+
* via the `update.schema` link.
3591+
*/
3592+
export type OauthApplicationUpdateSchema = {
3593+
data: {
3594+
id: OauthApplicationIdentity;
3595+
type: OauthApplicationType;
3596+
attributes: {
3597+
/**
3598+
* Whether the application can access all projects or only selected ones
3599+
*/
3600+
site_access_mode: 'all' | 'selected';
3601+
};
3602+
relationships?: {
3603+
/**
3604+
* Projects to grant access to (required when site_access_mode is 'selected')
3605+
*/
3606+
granted_sites?: {
3607+
data: SiteData[];
3608+
};
3609+
};
35703610
};
35713611
};
3612+
/**
3613+
* This interface was referenced by `OauthApplication`'s JSON-Schema
3614+
* via the `update.targetSchema` link.
3615+
*/
3616+
export type OauthApplicationUpdateTargetSchema = {
3617+
data: OauthApplication;
3618+
};
35723619
/**
35733620
* Private entity to handle payments with Stripe
35743621
*

packages/dashboard-client/src/generated/resources/OauthApplication.ts

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,51 @@ export default class OauthApplication extends BaseResource {
3535
);
3636
}
3737

38+
/**
39+
* Update site access settings for an authorized application
40+
*
41+
* @throws {ApiError}
42+
* @throws {TimeoutError}
43+
*/
44+
update(
45+
oauthApplicationId: string | ApiTypes.OauthApplicationData,
46+
body: ApiTypes.OauthApplicationUpdateSchema,
47+
) {
48+
return this.rawUpdate(
49+
Utils.toId(oauthApplicationId),
50+
Utils.serializeRequestBody<RawApiTypes.OauthApplicationUpdateSchema>(
51+
body,
52+
{
53+
id: Utils.toId(oauthApplicationId),
54+
type: 'oauth_application',
55+
attributes: ['site_access_mode'],
56+
relationships: ['granted_sites'],
57+
},
58+
),
59+
).then((body) =>
60+
Utils.deserializeResponseBody<ApiTypes.OauthApplicationUpdateTargetSchema>(
61+
body,
62+
),
63+
);
64+
}
65+
66+
/**
67+
* Update site access settings for an authorized application
68+
*
69+
* @throws {ApiError}
70+
* @throws {TimeoutError}
71+
*/
72+
rawUpdate(
73+
oauthApplicationId: string,
74+
body: RawApiTypes.OauthApplicationUpdateSchema,
75+
): Promise<RawApiTypes.OauthApplicationUpdateTargetSchema> {
76+
return this.client.request<RawApiTypes.OauthApplicationUpdateTargetSchema>({
77+
method: 'PUT',
78+
url: `/oauth_applications/${oauthApplicationId}`,
79+
body,
80+
});
81+
}
82+
3883
/**
3984
* Delete an authorized application
4085
*

0 commit comments

Comments
 (0)