diff --git a/src/generated/.openapi-generator/FILES b/src/generated/.openapi-generator/FILES index f7ad2fd..137c88c 100644 --- a/src/generated/.openapi-generator/FILES +++ b/src/generated/.openapi-generator/FILES @@ -10,7 +10,8 @@ models/AppInfo.ts models/AppResponse.ts models/AppleUserSocialConnection.ts models/AuthMethods.ts -models/CreateTransactionRequest.ts +models/CreateTransactionAuthenticateRequest.ts +models/CreateTransactionRegisterRequest.ts models/CreateTransactionResponse.ts models/ElementCustomization.ts models/FontFamily.ts diff --git a/src/generated/apis/TransactionsApi.ts b/src/generated/apis/TransactionsApi.ts index 75caaa4..0ece2ae 100644 --- a/src/generated/apis/TransactionsApi.ts +++ b/src/generated/apis/TransactionsApi.ts @@ -15,7 +15,8 @@ import * as runtime from '../runtime'; import type { - CreateTransactionRequest, + CreateTransactionAuthenticateRequest, + CreateTransactionRegisterRequest, CreateTransactionResponse, Model400Error, Model401Error, @@ -25,8 +26,10 @@ import type { Model500Error, } from '../models/index'; import { - CreateTransactionRequestFromJSON, - CreateTransactionRequestToJSON, + CreateTransactionAuthenticateRequestFromJSON, + CreateTransactionAuthenticateRequestToJSON, + CreateTransactionRegisterRequestFromJSON, + CreateTransactionRegisterRequestToJSON, CreateTransactionResponseFromJSON, CreateTransactionResponseToJSON, Model400ErrorFromJSON, @@ -43,9 +46,14 @@ import { Model500ErrorToJSON, } from '../models/index'; -export interface CreateTransactionOperationRequest { +export interface CreateAuthenticateTransactionRequest { appId: string; - createTransactionRequest: CreateTransactionRequest; + createTransactionAuthenticateRequest: CreateTransactionAuthenticateRequest; +} + +export interface CreateRegisterTransactionRequest { + appId: string; + createTransactionRegisterRequest: CreateTransactionRegisterRequest; } /** @@ -54,15 +62,60 @@ export interface CreateTransactionOperationRequest { export class TransactionsApi extends runtime.BaseAPI { /** - * Create a transaction to start a user\'s registration or authentication process + * Create a transaction to start a user\'s authentication process + */ + async createAuthenticateTransactionRaw(requestParameters: CreateAuthenticateTransactionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters.appId === null || requestParameters.appId === undefined) { + throw new runtime.RequiredError('appId','Required parameter requestParameters.appId was null or undefined when calling createAuthenticateTransaction.'); + } + + if (requestParameters.createTransactionAuthenticateRequest === null || requestParameters.createTransactionAuthenticateRequest === undefined) { + throw new runtime.RequiredError('createTransactionAuthenticateRequest','Required parameter requestParameters.createTransactionAuthenticateRequest was null or undefined when calling createAuthenticateTransaction.'); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + headerParameters['Content-Type'] = 'application/json'; + + if (this.configuration && this.configuration.accessToken) { + const token = this.configuration.accessToken; + const tokenString = await token("bearerAuth", []); + + if (tokenString) { + headerParameters["Authorization"] = `Bearer ${tokenString}`; + } + } + const response = await this.request({ + path: `/apps/{app_id}/transactions/authenticate`.replace(`{${"app_id"}}`, encodeURIComponent(String(requestParameters.appId))), + method: 'POST', + headers: headerParameters, + query: queryParameters, + body: CreateTransactionAuthenticateRequestToJSON(requestParameters.createTransactionAuthenticateRequest), + }, initOverrides); + + return new runtime.JSONApiResponse(response, (jsonValue) => CreateTransactionResponseFromJSON(jsonValue)); + } + + /** + * Create a transaction to start a user\'s authentication process + */ + async createAuthenticateTransaction(requestParameters: CreateAuthenticateTransactionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.createAuthenticateTransactionRaw(requestParameters, initOverrides); + return await response.value(); + } + + /** + * Create a transaction to start a user\'s registration process */ - async createTransactionRaw(requestParameters: CreateTransactionOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async createRegisterTransactionRaw(requestParameters: CreateRegisterTransactionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters.appId === null || requestParameters.appId === undefined) { - throw new runtime.RequiredError('appId','Required parameter requestParameters.appId was null or undefined when calling createTransaction.'); + throw new runtime.RequiredError('appId','Required parameter requestParameters.appId was null or undefined when calling createRegisterTransaction.'); } - if (requestParameters.createTransactionRequest === null || requestParameters.createTransactionRequest === undefined) { - throw new runtime.RequiredError('createTransactionRequest','Required parameter requestParameters.createTransactionRequest was null or undefined when calling createTransaction.'); + if (requestParameters.createTransactionRegisterRequest === null || requestParameters.createTransactionRegisterRequest === undefined) { + throw new runtime.RequiredError('createTransactionRegisterRequest','Required parameter requestParameters.createTransactionRegisterRequest was null or undefined when calling createRegisterTransaction.'); } const queryParameters: any = {}; @@ -80,21 +133,21 @@ export class TransactionsApi extends runtime.BaseAPI { } } const response = await this.request({ - path: `/apps/{app_id}/transactions`.replace(`{${"app_id"}}`, encodeURIComponent(String(requestParameters.appId))), + path: `/apps/{app_id}/transactions/register`.replace(`{${"app_id"}}`, encodeURIComponent(String(requestParameters.appId))), method: 'POST', headers: headerParameters, query: queryParameters, - body: CreateTransactionRequestToJSON(requestParameters.createTransactionRequest), + body: CreateTransactionRegisterRequestToJSON(requestParameters.createTransactionRegisterRequest), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => CreateTransactionResponseFromJSON(jsonValue)); } /** - * Create a transaction to start a user\'s registration or authentication process + * Create a transaction to start a user\'s registration process */ - async createTransaction(requestParameters: CreateTransactionOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.createTransactionRaw(requestParameters, initOverrides); + async createRegisterTransaction(requestParameters: CreateRegisterTransactionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.createRegisterTransactionRaw(requestParameters, initOverrides); return await response.value(); } diff --git a/src/generated/models/CreateTransactionAuthenticateRequest.ts b/src/generated/models/CreateTransactionAuthenticateRequest.ts new file mode 100644 index 0000000..7f6649a --- /dev/null +++ b/src/generated/models/CreateTransactionAuthenticateRequest.ts @@ -0,0 +1,66 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Passage Management API + * Passage\'s management API to manage your Passage apps and users. + * + * The version of the OpenAPI document: 1 + * Contact: support@passage.id + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +/** + * + * @export + * @interface CreateTransactionAuthenticateRequest + */ +export interface CreateTransactionAuthenticateRequest { + /** + * the user's unique identifier that will be associated with this transaction + * @type {string} + * @memberof CreateTransactionAuthenticateRequest + */ + externalId: string; +} + +/** + * Check if a given object implements the CreateTransactionAuthenticateRequest interface. + */ +export function instanceOfCreateTransactionAuthenticateRequest(value: object): boolean { + let isInstance = true; + isInstance = isInstance && "externalId" in value; + + return isInstance; +} + +export function CreateTransactionAuthenticateRequestFromJSON(json: any): CreateTransactionAuthenticateRequest { + return CreateTransactionAuthenticateRequestFromJSONTyped(json, false); +} + +export function CreateTransactionAuthenticateRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): CreateTransactionAuthenticateRequest { + if ((json === undefined) || (json === null)) { + return json; + } + return { + + 'externalId': json['external_id'], + }; +} + +export function CreateTransactionAuthenticateRequestToJSON(value?: CreateTransactionAuthenticateRequest | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + + 'external_id': value.externalId, + }; +} + diff --git a/src/generated/models/CreateTransactionRequest.ts b/src/generated/models/CreateTransactionRegisterRequest.ts similarity index 63% rename from src/generated/models/CreateTransactionRequest.ts rename to src/generated/models/CreateTransactionRegisterRequest.ts index 947cce2..86da3a8 100644 --- a/src/generated/models/CreateTransactionRequest.ts +++ b/src/generated/models/CreateTransactionRegisterRequest.ts @@ -16,27 +16,27 @@ import { exists, mapValues } from '../runtime'; /** * * @export - * @interface CreateTransactionRequest + * @interface CreateTransactionRegisterRequest */ -export interface CreateTransactionRequest { +export interface CreateTransactionRegisterRequest { /** * the user's unique identifier that will be associated with this transaction * @type {string} - * @memberof CreateTransactionRequest + * @memberof CreateTransactionRegisterRequest */ externalId: string; /** * the immutable display name of the passkey that the user will see * @type {string} - * @memberof CreateTransactionRequest + * @memberof CreateTransactionRegisterRequest */ passkeyDisplayName: string; } /** - * Check if a given object implements the CreateTransactionRequest interface. + * Check if a given object implements the CreateTransactionRegisterRequest interface. */ -export function instanceOfCreateTransactionRequest(value: object): boolean { +export function instanceOfCreateTransactionRegisterRequest(value: object): boolean { let isInstance = true; isInstance = isInstance && "externalId" in value; isInstance = isInstance && "passkeyDisplayName" in value; @@ -44,11 +44,11 @@ export function instanceOfCreateTransactionRequest(value: object): boolean { return isInstance; } -export function CreateTransactionRequestFromJSON(json: any): CreateTransactionRequest { - return CreateTransactionRequestFromJSONTyped(json, false); +export function CreateTransactionRegisterRequestFromJSON(json: any): CreateTransactionRegisterRequest { + return CreateTransactionRegisterRequestFromJSONTyped(json, false); } -export function CreateTransactionRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): CreateTransactionRequest { +export function CreateTransactionRegisterRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): CreateTransactionRegisterRequest { if ((json === undefined) || (json === null)) { return json; } @@ -59,7 +59,7 @@ export function CreateTransactionRequestFromJSONTyped(json: any, ignoreDiscrimin }; } -export function CreateTransactionRequestToJSON(value?: CreateTransactionRequest | null): any { +export function CreateTransactionRegisterRequestToJSON(value?: CreateTransactionRegisterRequest | null): any { if (value === undefined) { return undefined; } diff --git a/src/generated/models/ListPaginatedUsersItem.ts b/src/generated/models/ListPaginatedUsersItem.ts index 340897b..892b54c 100644 --- a/src/generated/models/ListPaginatedUsersItem.ts +++ b/src/generated/models/ListPaginatedUsersItem.ts @@ -44,6 +44,12 @@ export interface ListPaginatedUsersItem { * @memberof ListPaginatedUsersItem */ emailVerified: boolean; + /** + * The external ID of the user. Only set if the user was created in a Flex app. + * @type {string} + * @memberof ListPaginatedUsersItem + */ + externalId: string; /** * * @type {string} @@ -102,6 +108,7 @@ export function instanceOfListPaginatedUsersItem(value: object): boolean { isInstance = isInstance && "createdAt" in value; isInstance = isInstance && "email" in value; isInstance = isInstance && "emailVerified" in value; + isInstance = isInstance && "externalId" in value; isInstance = isInstance && "id" in value; isInstance = isInstance && "lastLoginAt" in value; isInstance = isInstance && "loginCount" in value; @@ -127,6 +134,7 @@ export function ListPaginatedUsersItemFromJSONTyped(json: any, ignoreDiscriminat 'createdAt': (new Date(json['created_at'])), 'email': json['email'], 'emailVerified': json['email_verified'], + 'externalId': json['external_id'], 'id': json['id'], 'lastLoginAt': (new Date(json['last_login_at'])), 'loginCount': json['login_count'], @@ -150,6 +158,7 @@ export function ListPaginatedUsersItemToJSON(value?: ListPaginatedUsersItem | nu 'created_at': (value.createdAt.toISOString()), 'email': value.email, 'email_verified': value.emailVerified, + 'external_id': value.externalId, 'id': value.id, 'last_login_at': (value.lastLoginAt.toISOString()), 'login_count': value.loginCount, diff --git a/src/generated/models/UserInfo.ts b/src/generated/models/UserInfo.ts index 2efab00..f9637d3 100644 --- a/src/generated/models/UserInfo.ts +++ b/src/generated/models/UserInfo.ts @@ -68,6 +68,12 @@ export interface UserInfo { * @memberof UserInfo */ emailVerified: boolean; + /** + * The external ID of the user. Only set if the user was created in a Flex app. + * @type {string} + * @memberof UserInfo + */ + externalId: string; /** * * @type {string} @@ -156,6 +162,7 @@ export function instanceOfUserInfo(value: object): boolean { isInstance = isInstance && "createdAt" in value; isInstance = isInstance && "email" in value; isInstance = isInstance && "emailVerified" in value; + isInstance = isInstance && "externalId" in value; isInstance = isInstance && "id" in value; isInstance = isInstance && "lastLoginAt" in value; isInstance = isInstance && "loginCount" in value; @@ -186,6 +193,7 @@ export function UserInfoFromJSONTyped(json: any, ignoreDiscriminator: boolean): 'createdAt': (new Date(json['created_at'])), 'email': json['email'], 'emailVerified': json['email_verified'], + 'externalId': json['external_id'], 'id': json['id'], 'lastLoginAt': (new Date(json['last_login_at'])), 'loginCount': json['login_count'], @@ -214,6 +222,7 @@ export function UserInfoToJSON(value?: UserInfo | null): any { 'created_at': (value.createdAt.toISOString()), 'email': value.email, 'email_verified': value.emailVerified, + 'external_id': value.externalId, 'id': value.id, 'last_login_at': (value.lastLoginAt.toISOString()), 'login_count': value.loginCount, diff --git a/src/generated/models/index.ts b/src/generated/models/index.ts index 6b325ec..8f064fa 100644 --- a/src/generated/models/index.ts +++ b/src/generated/models/index.ts @@ -4,7 +4,8 @@ export * from './AppInfo'; export * from './AppResponse'; export * from './AppleUserSocialConnection'; export * from './AuthMethods'; -export * from './CreateTransactionRequest'; +export * from './CreateTransactionAuthenticateRequest'; +export * from './CreateTransactionRegisterRequest'; export * from './CreateTransactionResponse'; export * from './ElementCustomization'; export * from './FontFamily';