From 94f00178795d7cd0d52560fccf2ff433d6eefb35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Voron?= Date: Tue, 9 Jul 2024 15:13:33 +0200 Subject: [PATCH] clients/sdk: update OpenAPI client --- clients/packages/sdk/openapi/source.json | 479 ++++++++++++++++-- clients/packages/sdk/openapi/updated.json | 469 +++++++++++++++-- .../packages/sdk/src/client/apis/Oauth2Api.ts | 191 +++++-- .../packages/sdk/src/client/models/index.ts | 198 ++++++++ 4 files changed, 1225 insertions(+), 112 deletions(-) diff --git a/clients/packages/sdk/openapi/source.json b/clients/packages/sdk/openapi/source.json index 03311ba4bf..b367ae898d 100644 --- a/clients/packages/sdk/openapi/source.json +++ b/clients/packages/sdk/openapi/source.json @@ -6952,8 +6952,8 @@ "security": [ { "OpenIdConnect": [ - "organizations:read", - "organizations:write" + "organizations:write", + "organizations:read" ] }, { @@ -7031,8 +7031,8 @@ "security": [ { "OpenIdConnect": [ - "organizations:read", - "organizations:write" + "organizations:write", + "organizations:read" ] }, { @@ -7112,8 +7112,8 @@ "security": [ { "OpenIdConnect": [ - "organizations:read", - "organizations:write" + "organizations:write", + "organizations:read" ] }, { @@ -7196,8 +7196,8 @@ "security": [ { "OpenIdConnect": [ - "organizations:read", - "organizations:write" + "organizations:write", + "organizations:read" ] }, { @@ -7327,8 +7327,8 @@ "security": [ { "OpenIdConnect": [ - "organizations:read", - "organizations:write" + "organizations:write", + "organizations:read" ] }, { @@ -7365,9 +7365,9 @@ }, "description": "Filter by the type of purchase the customer made.", "default": [ + "order", "donation", - "subscription", - "order" + "subscription" ], "title": "Customer Types" }, @@ -10704,8 +10704,7 @@ "get": { "tags": [ "oauth2", - "documented", - "featured" + "documented" ], "summary": "List Clients", "description": "List OAuth2 clients.", @@ -10777,8 +10776,7 @@ "post": { "tags": [ "oauth2", - "documented", - "featured" + "documented" ], "summary": "Create Client", "description": "Create an OAuth2 client.", @@ -10830,8 +10828,7 @@ "get": { "tags": [ "oauth2", - "documented", - "featured" + "documented" ], "summary": "Get Client", "description": "Get an OAuth2 client by Client ID.", @@ -10883,8 +10880,7 @@ "put": { "tags": [ "oauth2", - "documented", - "featured" + "documented" ], "summary": "Update Client", "description": "Update an OAuth2 client.", @@ -10946,8 +10942,7 @@ "delete": { "tags": [ "oauth2", - "documented", - "featured" + "documented" ], "summary": "Delete Client", "description": "Delete an OAuth2 client.", @@ -11001,8 +10996,7 @@ "get": { "tags": [ "oauth2", - "documented", - "featured" + "documented" ], "summary": "Authorize", "operationId": "oauth2:authorize", @@ -11051,8 +11045,7 @@ "post": { "tags": [ "oauth2", - "documented", - "featured" + "documented" ], "summary": "Consent", "operationId": "oauth2:consent", @@ -11108,16 +11101,116 @@ ], "summary": "Request Token", "description": "Request an access token using a valid grant.", - "operationId": "oauth2:oauth2:request_token", + "operationId": "oauth2:request_token", + "requestBody": { + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "oneOf": [ + { + "$ref": "#/paths/~1v1~1oauth2~1token/post/x-components/AuthorizationCodeTokenRequest" + }, + { + "$ref": "#/paths/~1v1~1oauth2~1token/post/x-components/RefreshTokenRequest" + } + ], + "discriminator": { + "propertyName": "grant_type", + "mapping": { + "authorization_code": "#/paths/~1v1~1oauth2~1token/post/x-components/AuthorizationCodeTokenRequest", + "refresh_token": "#/paths/~1v1~1oauth2~1token/post/x-components/RefreshTokenRequest" + } + } + } + } + }, + "required": true + }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { - "schema": {} + "schema": { + "$ref": "#/components/schemas/TokenResponse" + } } } } + }, + "x-components": { + "AuthorizationCodeTokenRequest": { + "properties": { + "grant_type": { + "const": "authorization_code", + "enum": [ + "authorization_code" + ], + "title": "Grant Type", + "type": "string" + }, + "client_id": { + "title": "Client Id", + "type": "string" + }, + "client_secret": { + "title": "Client Secret", + "type": "string" + }, + "code": { + "title": "Code", + "type": "string" + }, + "redirect_uri": { + "format": "uri", + "maxLength": 2083, + "minLength": 1, + "title": "Redirect Uri", + "type": "string" + } + }, + "required": [ + "grant_type", + "client_id", + "client_secret", + "code", + "redirect_uri" + ], + "title": "AuthorizationCodeTokenRequest", + "type": "object" + }, + "RefreshTokenRequest": { + "properties": { + "grant_type": { + "const": "refresh_token", + "enum": [ + "refresh_token" + ], + "title": "Grant Type", + "type": "string" + }, + "client_id": { + "title": "Client Id", + "type": "string" + }, + "client_secret": { + "title": "Client Secret", + "type": "string" + }, + "refresh_token": { + "title": "Refresh Token", + "type": "string" + } + }, + "required": [ + "grant_type", + "client_id", + "client_secret", + "refresh_token" + ], + "title": "RefreshTokenRequest", + "type": "object" + } } } }, @@ -11130,13 +11223,60 @@ ], "summary": "Revoke Token", "description": "Revoke an access token or a refresh token.", - "operationId": "oauth2:oauth2:revoke_token", + "operationId": "oauth2:revoke_token", + "requestBody": { + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "properties": { + "token": { + "type": "string", + "title": "Token" + }, + "token_type_hint": { + "anyOf": [ + { + "type": "string", + "enum": [ + "access_token", + "refresh_token" + ] + }, + { + "type": "null" + } + ], + "title": "Token Type Hint" + }, + "client_id": { + "type": "string", + "title": "Client Id" + }, + "client_secret": { + "type": "string", + "title": "Client Secret" + } + }, + "type": "object", + "required": [ + "token", + "client_id", + "client_secret" + ], + "title": "RevokeTokenRequest" + } + } + }, + "required": true + }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { - "schema": {} + "schema": { + "$ref": "#/components/schemas/RevokeTokenResponse" + } } } } @@ -11152,13 +11292,60 @@ ], "summary": "Introspect Token", "description": "Get information about an access token.", - "operationId": "oauth2:oauth2:introspect_token", + "operationId": "oauth2:introspect_token", + "requestBody": { + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "properties": { + "token": { + "type": "string", + "title": "Token" + }, + "token_type_hint": { + "anyOf": [ + { + "type": "string", + "enum": [ + "access_token", + "refresh_token" + ] + }, + { + "type": "null" + } + ], + "title": "Token Type Hint" + }, + "client_id": { + "type": "string", + "title": "Client Id" + }, + "client_secret": { + "type": "string", + "title": "Client Secret" + } + }, + "type": "object", + "required": [ + "token", + "client_id", + "client_secret" + ], + "title": "IntrospectTokenRequest" + } + } + }, + "required": true + }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { - "schema": {} + "schema": { + "$ref": "#/components/schemas/IntrospectTokenResponse" + } } } } @@ -11174,13 +11361,23 @@ ], "summary": "Get User Info", "description": "Get information about the authenticated user.", - "operationId": "oauth2:oauth2:userinfo", + "operationId": "oauth2:userinfo", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { - "schema": {} + "schema": { + "anyOf": [ + { + "$ref": "#/components/schemas/UserInfoUser" + }, + { + "$ref": "#/components/schemas/UserInfoOrganization" + } + ], + "title": "Response Oauth2:Userinfo" + } } } } @@ -11199,13 +11396,23 @@ ], "summary": "Get User Info", "description": "Get information about the authenticated user.", - "operationId": "oauth2:oauth2:userinfo", + "operationId": "oauth2:userinfo", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { - "schema": {} + "schema": { + "anyOf": [ + { + "$ref": "#/components/schemas/UserInfoUser" + }, + { + "$ref": "#/components/schemas/UserInfoOrganization" + } + ], + "title": "Response Oauth2:Userinfo" + } } } } @@ -12498,8 +12705,8 @@ "security": [ { "OpenIdConnect": [ - "products:write", - "products:read" + "products:read", + "products:write" ] }, { @@ -12749,8 +12956,8 @@ "security": [ { "OpenIdConnect": [ - "products:write", - "products:read" + "products:read", + "products:write" ] }, { @@ -20348,6 +20555,67 @@ ], "title": "Interval" }, + "IntrospectTokenResponse": { + "properties": { + "active": { + "type": "boolean", + "title": "Active" + }, + "client_id": { + "type": "string", + "title": "Client Id" + }, + "token_type": { + "type": "string", + "enum": [ + "access_token", + "refresh_token" + ], + "title": "Token Type" + }, + "scope": { + "type": "string", + "title": "Scope" + }, + "sub_type": { + "$ref": "#/components/schemas/SubType" + }, + "sub": { + "type": "string", + "title": "Sub" + }, + "aud": { + "type": "string", + "title": "Aud" + }, + "iss": { + "type": "string", + "title": "Iss" + }, + "exp": { + "type": "integer", + "title": "Exp" + }, + "iat": { + "type": "integer", + "title": "Iat" + } + }, + "type": "object", + "required": [ + "active", + "client_id", + "token_type", + "scope", + "sub_type", + "sub", + "aud", + "iss", + "exp", + "iat" + ], + "title": "IntrospectTokenResponse" + }, "Issue-Input": { "properties": { "id": { @@ -27349,6 +27617,11 @@ ], "title": "ResourceNotFound" }, + "RevokeTokenResponse": { + "properties": {}, + "type": "object", + "title": "RevokeTokenResponse" + }, "Reward": { "properties": { "pledge": { @@ -27800,6 +28073,14 @@ ], "title": "Status" }, + "SubType": { + "type": "string", + "enum": [ + "user", + "organization" + ], + "title": "SubType" + }, "Subscription-Input": { "properties": { "created_at": { @@ -28310,6 +28591,54 @@ ], "title": "TeamAdminMemberPledgedNotificationPayload" }, + "TokenResponse": { + "properties": { + "access_token": { + "type": "string", + "title": "Access Token" + }, + "token_type": { + "type": "string", + "enum": [ + "Bearer" + ], + "const": "Bearer", + "title": "Token Type" + }, + "expires_in": { + "type": "integer", + "title": "Expires In" + }, + "refresh_token": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Refresh Token" + }, + "scope": { + "type": "string", + "title": "Scope" + }, + "id_token": { + "type": "string", + "title": "Id Token" + } + }, + "type": "object", + "required": [ + "access_token", + "token_type", + "expires_in", + "scope", + "id_token" + ], + "title": "TokenResponse" + }, "TrackPageView": { "properties": { "location_href": { @@ -29867,6 +30196,76 @@ ], "title": "UserFreeSubscriptionCreate" }, + "UserInfoOrganization": { + "properties": { + "sub": { + "type": "string", + "title": "Sub" + }, + "name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Name" + } + }, + "type": "object", + "required": [ + "sub" + ], + "title": "UserInfoOrganization" + }, + "UserInfoUser": { + "properties": { + "sub": { + "type": "string", + "title": "Sub" + }, + "name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Name" + }, + "email": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Email" + }, + "email_verified": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "title": "Email Verified" + } + }, + "type": "object", + "required": [ + "sub" + ], + "title": "UserInfoUser" + }, "UserOrder": { "properties": { "created_at": { diff --git a/clients/packages/sdk/openapi/updated.json b/clients/packages/sdk/openapi/updated.json index f922153ca0..6fdfc1d14c 100644 --- a/clients/packages/sdk/openapi/updated.json +++ b/clients/packages/sdk/openapi/updated.json @@ -6952,8 +6952,8 @@ "security": [ { "OpenIdConnect": [ - "organizations:read", - "organizations:write" + "organizations:write", + "organizations:read" ] }, { @@ -7031,8 +7031,8 @@ "security": [ { "OpenIdConnect": [ - "organizations:read", - "organizations:write" + "organizations:write", + "organizations:read" ] }, { @@ -7112,8 +7112,8 @@ "security": [ { "OpenIdConnect": [ - "organizations:read", - "organizations:write" + "organizations:write", + "organizations:read" ] }, { @@ -7196,8 +7196,8 @@ "security": [ { "OpenIdConnect": [ - "organizations:read", - "organizations:write" + "organizations:write", + "organizations:read" ] }, { @@ -7327,8 +7327,8 @@ "security": [ { "OpenIdConnect": [ - "organizations:read", - "organizations:write" + "organizations:write", + "organizations:read" ] }, { @@ -7365,9 +7365,9 @@ }, "description": "Filter by the type of purchase the customer made.", "default": [ + "order", "donation", - "subscription", - "order" + "subscription" ], "title": "Customer Types" }, @@ -10704,8 +10704,7 @@ "get": { "tags": [ "oauth2", - "documented", - "featured" + "documented" ], "summary": "List Clients", "description": "List OAuth2 clients.", @@ -10777,8 +10776,7 @@ "post": { "tags": [ "oauth2", - "documented", - "featured" + "documented" ], "summary": "Create Client", "description": "Create an OAuth2 client.", @@ -10830,8 +10828,7 @@ "get": { "tags": [ "oauth2", - "documented", - "featured" + "documented" ], "summary": "Get Client", "description": "Get an OAuth2 client by Client ID.", @@ -10883,8 +10880,7 @@ "put": { "tags": [ "oauth2", - "documented", - "featured" + "documented" ], "summary": "Update Client", "description": "Update an OAuth2 client.", @@ -10946,8 +10942,7 @@ "delete": { "tags": [ "oauth2", - "documented", - "featured" + "documented" ], "summary": "Delete Client", "description": "Delete an OAuth2 client.", @@ -11001,8 +10996,7 @@ "get": { "tags": [ "oauth2", - "documented", - "featured" + "documented" ], "summary": "Authorize", "operationId": "authorize", @@ -11051,8 +11045,7 @@ "post": { "tags": [ "oauth2", - "documented", - "featured" + "documented" ], "summary": "Consent", "operationId": "consent", @@ -11109,15 +11102,115 @@ "summary": "Request Token", "description": "Request an access token using a valid grant.", "operationId": "request_token", + "requestBody": { + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "oneOf": [ + { + "$ref": "#/paths/~1v1~1oauth2~1token/post/x-components/AuthorizationCodeTokenRequest" + }, + { + "$ref": "#/paths/~1v1~1oauth2~1token/post/x-components/RefreshTokenRequest" + } + ], + "discriminator": { + "propertyName": "grant_type", + "mapping": { + "authorization_code": "#/paths/~1v1~1oauth2~1token/post/x-components/AuthorizationCodeTokenRequest", + "refresh_token": "#/paths/~1v1~1oauth2~1token/post/x-components/RefreshTokenRequest" + } + } + } + } + }, + "required": true + }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { - "schema": {} + "schema": { + "$ref": "#/components/schemas/TokenResponse" + } } } } + }, + "x-components": { + "AuthorizationCodeTokenRequest": { + "properties": { + "grant_type": { + "const": "authorization_code", + "enum": [ + "authorization_code" + ], + "title": "Grant Type", + "type": "string" + }, + "client_id": { + "title": "Client Id", + "type": "string" + }, + "client_secret": { + "title": "Client Secret", + "type": "string" + }, + "code": { + "title": "Code", + "type": "string" + }, + "redirect_uri": { + "format": "uri", + "maxLength": 2083, + "minLength": 1, + "title": "Redirect Uri", + "type": "string" + } + }, + "required": [ + "grant_type", + "client_id", + "client_secret", + "code", + "redirect_uri" + ], + "title": "AuthorizationCodeTokenRequest", + "type": "object" + }, + "RefreshTokenRequest": { + "properties": { + "grant_type": { + "const": "refresh_token", + "enum": [ + "refresh_token" + ], + "title": "Grant Type", + "type": "string" + }, + "client_id": { + "title": "Client Id", + "type": "string" + }, + "client_secret": { + "title": "Client Secret", + "type": "string" + }, + "refresh_token": { + "title": "Refresh Token", + "type": "string" + } + }, + "required": [ + "grant_type", + "client_id", + "client_secret", + "refresh_token" + ], + "title": "RefreshTokenRequest", + "type": "object" + } } } }, @@ -11131,12 +11224,59 @@ "summary": "Revoke Token", "description": "Revoke an access token or a refresh token.", "operationId": "revoke_token", + "requestBody": { + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "properties": { + "token": { + "type": "string", + "title": "Token" + }, + "token_type_hint": { + "anyOf": [ + { + "type": "string", + "enum": [ + "access_token", + "refresh_token" + ] + }, + { + "type": "null" + } + ], + "title": "Token Type Hint" + }, + "client_id": { + "type": "string", + "title": "Client Id" + }, + "client_secret": { + "type": "string", + "title": "Client Secret" + } + }, + "type": "object", + "required": [ + "token", + "client_id", + "client_secret" + ], + "title": "RevokeTokenRequest" + } + } + }, + "required": true + }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { - "schema": {} + "schema": { + "$ref": "#/components/schemas/RevokeTokenResponse" + } } } } @@ -11153,12 +11293,59 @@ "summary": "Introspect Token", "description": "Get information about an access token.", "operationId": "introspect_token", + "requestBody": { + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "properties": { + "token": { + "type": "string", + "title": "Token" + }, + "token_type_hint": { + "anyOf": [ + { + "type": "string", + "enum": [ + "access_token", + "refresh_token" + ] + }, + { + "type": "null" + } + ], + "title": "Token Type Hint" + }, + "client_id": { + "type": "string", + "title": "Client Id" + }, + "client_secret": { + "type": "string", + "title": "Client Secret" + } + }, + "type": "object", + "required": [ + "token", + "client_id", + "client_secret" + ], + "title": "IntrospectTokenRequest" + } + } + }, + "required": true + }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { - "schema": {} + "schema": { + "$ref": "#/components/schemas/IntrospectTokenResponse" + } } } } @@ -11180,7 +11367,17 @@ "description": "Successful Response", "content": { "application/json": { - "schema": {} + "schema": { + "anyOf": [ + { + "$ref": "#/components/schemas/UserInfoUser" + }, + { + "$ref": "#/components/schemas/UserInfoOrganization" + } + ], + "title": "Response Oauth2:Userinfo" + } } } } @@ -11205,7 +11402,17 @@ "description": "Successful Response", "content": { "application/json": { - "schema": {} + "schema": { + "anyOf": [ + { + "$ref": "#/components/schemas/UserInfoUser" + }, + { + "$ref": "#/components/schemas/UserInfoOrganization" + } + ], + "title": "Response Oauth2:Userinfo" + } } } } @@ -12498,8 +12705,8 @@ "security": [ { "OpenIdConnect": [ - "products:write", - "products:read" + "products:read", + "products:write" ] }, { @@ -12749,8 +12956,8 @@ "security": [ { "OpenIdConnect": [ - "products:write", - "products:read" + "products:read", + "products:write" ] }, { @@ -19646,6 +19853,67 @@ ], "title": "Interval" }, + "IntrospectTokenResponse": { + "properties": { + "active": { + "type": "boolean", + "title": "Active" + }, + "client_id": { + "type": "string", + "title": "Client Id" + }, + "token_type": { + "type": "string", + "enum": [ + "access_token", + "refresh_token" + ], + "title": "Token Type" + }, + "scope": { + "type": "string", + "title": "Scope" + }, + "sub_type": { + "$ref": "#/components/schemas/SubType" + }, + "sub": { + "type": "string", + "title": "Sub" + }, + "aud": { + "type": "string", + "title": "Aud" + }, + "iss": { + "type": "string", + "title": "Iss" + }, + "exp": { + "type": "integer", + "title": "Exp" + }, + "iat": { + "type": "integer", + "title": "Iat" + } + }, + "type": "object", + "required": [ + "active", + "client_id", + "token_type", + "scope", + "sub_type", + "sub", + "aud", + "iss", + "exp", + "iat" + ], + "title": "IntrospectTokenResponse" + }, "IssueFunding": { "properties": { "issue": { @@ -25235,6 +25503,11 @@ ], "title": "ResourceNotFound" }, + "RevokeTokenResponse": { + "properties": {}, + "type": "object", + "title": "RevokeTokenResponse" + }, "Reward": { "properties": { "pledge": { @@ -25686,6 +25959,14 @@ ], "title": "Status" }, + "SubType": { + "type": "string", + "enum": [ + "user", + "organization" + ], + "title": "SubType" + }, "SubscriptionCreateEmail": { "properties": { "email": { @@ -25912,6 +26193,54 @@ ], "title": "TeamAdminMemberPledgedNotificationPayload" }, + "TokenResponse": { + "properties": { + "access_token": { + "type": "string", + "title": "Access Token" + }, + "token_type": { + "type": "string", + "enum": [ + "Bearer" + ], + "const": "Bearer", + "title": "Token Type" + }, + "expires_in": { + "type": "integer", + "title": "Expires In" + }, + "refresh_token": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Refresh Token" + }, + "scope": { + "type": "string", + "title": "Scope" + }, + "id_token": { + "type": "string", + "title": "Id Token" + } + }, + "type": "object", + "required": [ + "access_token", + "token_type", + "expires_in", + "scope", + "id_token" + ], + "title": "TokenResponse" + }, "TrackPageView": { "properties": { "location_href": { @@ -27469,6 +27798,76 @@ ], "title": "UserFreeSubscriptionCreate" }, + "UserInfoOrganization": { + "properties": { + "sub": { + "type": "string", + "title": "Sub" + }, + "name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Name" + } + }, + "type": "object", + "required": [ + "sub" + ], + "title": "UserInfoOrganization" + }, + "UserInfoUser": { + "properties": { + "sub": { + "type": "string", + "title": "Sub" + }, + "name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Name" + }, + "email": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Email" + }, + "email_verified": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "title": "Email Verified" + } + }, + "type": "object", + "required": [ + "sub" + ], + "title": "UserInfoUser" + }, "UserOrder": { "properties": { "created_at": { diff --git a/clients/packages/sdk/src/client/apis/Oauth2Api.ts b/clients/packages/sdk/src/client/apis/Oauth2Api.ts index 0a73627a10..df856b538c 100644 --- a/clients/packages/sdk/src/client/apis/Oauth2Api.ts +++ b/clients/packages/sdk/src/client/apis/Oauth2Api.ts @@ -16,10 +16,13 @@ import * as runtime from '../runtime'; import type { HTTPValidationError, + IntrospectTokenResponse, ListResourceOAuth2Client, OAuth2ClientConfiguration, OAuth2ClientConfigurationUpdate, ResponseOauth2Authorize, + ResponseOauth2Userinfo, + TokenResponse, } from '../models/index'; export interface Oauth2ApiConsentRequest { @@ -38,11 +41,25 @@ export interface Oauth2ApiGetClientRequest { clientId: string; } +export interface Oauth2ApiIntrospectTokenRequest { + token: string; + clientId: string; + clientSecret: string; + tokenTypeHint?: IntrospectTokenTokenTypeHintEnum; +} + export interface Oauth2ApiListClientsRequest { page?: number; limit?: number; } +export interface Oauth2ApiRevokeTokenRequest { + token: string; + clientId: string; + clientSecret: string; + tokenTypeHint?: RevokeTokenTokenTypeHintEnum; +} + export interface Oauth2ApiUpdateClientRequest { clientId: string; body: OAuth2ClientConfigurationUpdate; @@ -299,31 +316,79 @@ export class Oauth2Api extends runtime.BaseAPI { * Get information about an access token. * Introspect Token */ - async introspectTokenRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async introspectTokenRaw(requestParameters: Oauth2ApiIntrospectTokenRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters['token'] == null) { + throw new runtime.RequiredError( + 'token', + 'Required parameter "token" was null or undefined when calling introspectToken().' + ); + } + + if (requestParameters['clientId'] == null) { + throw new runtime.RequiredError( + 'clientId', + 'Required parameter "clientId" was null or undefined when calling introspectToken().' + ); + } + + if (requestParameters['clientSecret'] == null) { + throw new runtime.RequiredError( + 'clientSecret', + 'Required parameter "clientSecret" was null or undefined when calling introspectToken().' + ); + } + const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; + const consumes: runtime.Consume[] = [ + { contentType: 'application/x-www-form-urlencoded' }, + ]; + // @ts-ignore: canConsumeForm may be unused + const canConsumeForm = runtime.canConsumeForm(consumes); + + let formParams: { append(param: string, value: any): any }; + let useForm = false; + if (useForm) { + formParams = new FormData(); + } else { + formParams = new URLSearchParams(); + } + + if (requestParameters['token'] != null) { + formParams.append('token', requestParameters['token'] as any); + } + + if (requestParameters['tokenTypeHint'] != null) { + formParams.append('token_type_hint', requestParameters['tokenTypeHint'] as any); + } + + if (requestParameters['clientId'] != null) { + formParams.append('client_id', requestParameters['clientId'] as any); + } + + if (requestParameters['clientSecret'] != null) { + formParams.append('client_secret', requestParameters['clientSecret'] as any); + } + const response = await this.request({ path: `/v1/oauth2/introspect`, method: 'POST', headers: headerParameters, query: queryParameters, + body: formParams, }, initOverrides); - if (this.isJsonMime(response.headers.get('content-type'))) { - return new runtime.JSONApiResponse(response); - } else { - return new runtime.TextApiResponse(response) as any; - } + return new runtime.JSONApiResponse(response); } /** * Get information about an access token. * Introspect Token */ - async introspectToken(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.introspectTokenRaw(initOverrides); + async introspectToken(requestParameters: Oauth2ApiIntrospectTokenRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.introspectTokenRaw(requestParameters, initOverrides); return await response.value(); } @@ -375,7 +440,7 @@ export class Oauth2Api extends runtime.BaseAPI { * Request an access token using a valid grant. * Request Token */ - async requestTokenRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async requestTokenRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; @@ -387,18 +452,14 @@ export class Oauth2Api extends runtime.BaseAPI { query: queryParameters, }, initOverrides); - if (this.isJsonMime(response.headers.get('content-type'))) { - return new runtime.JSONApiResponse(response); - } else { - return new runtime.TextApiResponse(response) as any; - } + return new runtime.JSONApiResponse(response); } /** * Request an access token using a valid grant. * Request Token */ - async requestToken(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + async requestToken(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.requestTokenRaw(initOverrides); return await response.value(); } @@ -407,31 +468,79 @@ export class Oauth2Api extends runtime.BaseAPI { * Revoke an access token or a refresh token. * Revoke Token */ - async revokeTokenRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async revokeTokenRaw(requestParameters: Oauth2ApiRevokeTokenRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters['token'] == null) { + throw new runtime.RequiredError( + 'token', + 'Required parameter "token" was null or undefined when calling revokeToken().' + ); + } + + if (requestParameters['clientId'] == null) { + throw new runtime.RequiredError( + 'clientId', + 'Required parameter "clientId" was null or undefined when calling revokeToken().' + ); + } + + if (requestParameters['clientSecret'] == null) { + throw new runtime.RequiredError( + 'clientSecret', + 'Required parameter "clientSecret" was null or undefined when calling revokeToken().' + ); + } + const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; + const consumes: runtime.Consume[] = [ + { contentType: 'application/x-www-form-urlencoded' }, + ]; + // @ts-ignore: canConsumeForm may be unused + const canConsumeForm = runtime.canConsumeForm(consumes); + + let formParams: { append(param: string, value: any): any }; + let useForm = false; + if (useForm) { + formParams = new FormData(); + } else { + formParams = new URLSearchParams(); + } + + if (requestParameters['token'] != null) { + formParams.append('token', requestParameters['token'] as any); + } + + if (requestParameters['tokenTypeHint'] != null) { + formParams.append('token_type_hint', requestParameters['tokenTypeHint'] as any); + } + + if (requestParameters['clientId'] != null) { + formParams.append('client_id', requestParameters['clientId'] as any); + } + + if (requestParameters['clientSecret'] != null) { + formParams.append('client_secret', requestParameters['clientSecret'] as any); + } + const response = await this.request({ path: `/v1/oauth2/revoke`, method: 'POST', headers: headerParameters, query: queryParameters, + body: formParams, }, initOverrides); - if (this.isJsonMime(response.headers.get('content-type'))) { - return new runtime.JSONApiResponse(response); - } else { - return new runtime.TextApiResponse(response) as any; - } + return new runtime.JSONApiResponse(response); } /** * Revoke an access token or a refresh token. * Revoke Token */ - async revokeToken(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.revokeTokenRaw(initOverrides); + async revokeToken(requestParameters: Oauth2ApiRevokeTokenRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.revokeTokenRaw(requestParameters, initOverrides); return await response.value(); } @@ -496,7 +605,7 @@ export class Oauth2Api extends runtime.BaseAPI { * Get information about the authenticated user. * Get User Info */ - async userinfoRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async userinfoRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; @@ -508,18 +617,14 @@ export class Oauth2Api extends runtime.BaseAPI { query: queryParameters, }, initOverrides); - if (this.isJsonMime(response.headers.get('content-type'))) { - return new runtime.JSONApiResponse(response); - } else { - return new runtime.TextApiResponse(response) as any; - } + return new runtime.JSONApiResponse(response); } /** * Get information about the authenticated user. * Get User Info */ - async userinfo(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + async userinfo(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.userinfoRaw(initOverrides); return await response.value(); } @@ -528,7 +633,7 @@ export class Oauth2Api extends runtime.BaseAPI { * Get information about the authenticated user. * Get User Info */ - async userinfo_1Raw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async userinfo_1Raw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; @@ -540,18 +645,14 @@ export class Oauth2Api extends runtime.BaseAPI { query: queryParameters, }, initOverrides); - if (this.isJsonMime(response.headers.get('content-type'))) { - return new runtime.JSONApiResponse(response); - } else { - return new runtime.TextApiResponse(response) as any; - } + return new runtime.JSONApiResponse(response); } /** * Get information about the authenticated user. * Get User Info */ - async userinfo_1(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + async userinfo_1(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.userinfo_1Raw(initOverrides); return await response.value(); } @@ -566,3 +667,19 @@ export const ConsentActionEnum = { DENY: 'deny' } as const; export type ConsentActionEnum = typeof ConsentActionEnum[keyof typeof ConsentActionEnum]; +/** + * @export + */ +export const IntrospectTokenTokenTypeHintEnum = { + ACCESS_TOKEN: 'access_token', + REFRESH_TOKEN: 'refresh_token' +} as const; +export type IntrospectTokenTokenTypeHintEnum = typeof IntrospectTokenTokenTypeHintEnum[keyof typeof IntrospectTokenTokenTypeHintEnum]; +/** + * @export + */ +export const RevokeTokenTokenTypeHintEnum = { + ACCESS_TOKEN: 'access_token', + REFRESH_TOKEN: 'refresh_token' +} as const; +export type RevokeTokenTokenTypeHintEnum = typeof RevokeTokenTokenTypeHintEnum[keyof typeof RevokeTokenTokenTypeHintEnum]; diff --git a/clients/packages/sdk/src/client/models/index.ts b/clients/packages/sdk/src/client/models/index.ts index 90bf00a663..e0c7567bb9 100644 --- a/clients/packages/sdk/src/client/models/index.ts +++ b/clients/packages/sdk/src/client/models/index.ts @@ -5254,6 +5254,84 @@ export const Interval = { } as const; export type Interval = typeof Interval[keyof typeof Interval]; +/** + * + * @export + * @interface IntrospectTokenResponse + */ +export interface IntrospectTokenResponse { + /** + * + * @type {boolean} + * @memberof IntrospectTokenResponse + */ + active: boolean; + /** + * + * @type {string} + * @memberof IntrospectTokenResponse + */ + client_id: string; + /** + * + * @type {string} + * @memberof IntrospectTokenResponse + */ + token_type: IntrospectTokenResponseTokenTypeEnum; + /** + * + * @type {string} + * @memberof IntrospectTokenResponse + */ + scope: string; + /** + * + * @type {SubType} + * @memberof IntrospectTokenResponse + */ + sub_type: SubType; + /** + * + * @type {string} + * @memberof IntrospectTokenResponse + */ + sub: string; + /** + * + * @type {string} + * @memberof IntrospectTokenResponse + */ + aud: string; + /** + * + * @type {string} + * @memberof IntrospectTokenResponse + */ + iss: string; + /** + * + * @type {number} + * @memberof IntrospectTokenResponse + */ + exp: number; + /** + * + * @type {number} + * @memberof IntrospectTokenResponse + */ + iat: number; +} + + +/** + * @export + */ +export const IntrospectTokenResponseTokenTypeEnum = { + ACCESS_TOKEN: 'access_token', + REFRESH_TOKEN: 'refresh_token' +} as const; +export type IntrospectTokenResponseTokenTypeEnum = typeof IntrospectTokenResponseTokenTypeEnum[keyof typeof IntrospectTokenResponseTokenTypeEnum]; + /** * * @export @@ -10691,6 +10769,12 @@ export type ResponseFilesUploaded = { service: 'downloadable' } & DownloadableFi * @export */ export type ResponseOauth2Authorize = { sub_type: 'organization' } & AuthorizeResponseOrganization | { sub_type: 'user' } & AuthorizeResponseUser; +/** + * @type ResponseOauth2Userinfo + * @export + */ +export type ResponseOauth2Userinfo = UserInfoOrganization | UserInfoUser; + /** * @type ResponseUsersGetBenefit * @@ -11098,6 +11182,17 @@ export const Status = { } as const; export type Status = typeof Status[keyof typeof Status]; + +/** + * + * @export + */ +export const SubType = { + USER: 'user', + ORGANIZATION: 'organization' +} as const; +export type SubType = typeof SubType[keyof typeof SubType]; + /** * * @export @@ -11420,6 +11515,59 @@ export interface TeamAdminMemberPledgedNotificationPayload { */ pledge_id: string; } +/** + * + * @export + * @interface TokenResponse + */ +export interface TokenResponse { + /** + * + * @type {string} + * @memberof TokenResponse + */ + access_token: string; + /** + * + * @type {string} + * @memberof TokenResponse + */ + token_type: TokenResponseTokenTypeEnum; + /** + * + * @type {number} + * @memberof TokenResponse + */ + expires_in: number; + /** + * + * @type {string} + * @memberof TokenResponse + */ + refresh_token?: string; + /** + * + * @type {string} + * @memberof TokenResponse + */ + scope: string; + /** + * + * @type {string} + * @memberof TokenResponse + */ + id_token: string; +} + + +/** + * @export + */ +export const TokenResponseTokenTypeEnum = { + BEARER: 'Bearer' +} as const; +export type TokenResponseTokenTypeEnum = typeof TokenResponseTokenTypeEnum[keyof typeof TokenResponseTokenTypeEnum]; + /** * * @export @@ -12608,6 +12756,56 @@ export interface UserFreeSubscriptionCreate { */ customer_email?: string; } +/** + * + * @export + * @interface UserInfoOrganization + */ +export interface UserInfoOrganization { + /** + * + * @type {string} + * @memberof UserInfoOrganization + */ + sub: string; + /** + * + * @type {string} + * @memberof UserInfoOrganization + */ + name?: string; +} +/** + * + * @export + * @interface UserInfoUser + */ +export interface UserInfoUser { + /** + * + * @type {string} + * @memberof UserInfoUser + */ + sub: string; + /** + * + * @type {string} + * @memberof UserInfoUser + */ + name?: string; + /** + * + * @type {string} + * @memberof UserInfoUser + */ + email?: string; + /** + * + * @type {boolean} + * @memberof UserInfoUser + */ + email_verified?: boolean; +} /** * * @export