@@ -87,6 +87,7 @@ export class ClientsClient {
8787 * is_global: true,
8888 * is_first_party: true,
8989 * app_type: "app_type",
90+ * external_client_id: "external_client_id",
9091 * q: "q"
9192 * })
9293 */
@@ -107,6 +108,7 @@ export class ClientsClient {
107108 is_global : isGlobal ,
108109 is_first_party : isFirstParty ,
109110 app_type : appType ,
111+ external_client_id : externalClientId ,
110112 q,
111113 } = request ;
112114 const _queryParams : Record < string , unknown > = {
@@ -118,6 +120,7 @@ export class ClientsClient {
118120 is_global : isGlobal ,
119121 is_first_party : isFirstParty ,
120122 app_type : appType ,
123+ external_client_id : externalClientId ,
121124 q,
122125 } ;
123126 const _authRequest : core . AuthRequest = await this . _options . authProvider . getAuthRequest ( ) ;
@@ -289,6 +292,181 @@ export class ClientsClient {
289292 return handleNonStatusCodeError ( _response . error , _response . rawResponse , "POST" , "/clients" ) ;
290293 }
291294
295+ /**
296+ *
297+ * Fetches and validates a Client ID Metadata Document without creating a client.
298+ * Returns the raw metadata and how it would be mapped to Auth0 client fields.
299+ * This endpoint is useful for testing metadata URIs before creating CIMD clients.
300+ *
301+ *
302+ * @param {Management.PreviewCimdMetadataRequestContent } request
303+ * @param {ClientsClient.RequestOptions } requestOptions - Request-specific configuration.
304+ *
305+ * @throws {@link Management.BadRequestError }
306+ * @throws {@link Management.UnauthorizedError }
307+ * @throws {@link Management.ForbiddenError }
308+ * @throws {@link Management.TooManyRequestsError }
309+ * @throws {@link Management.InternalServerError }
310+ *
311+ * @example
312+ * await client.clients.previewCimdMetadata({
313+ * external_client_id: "external_client_id"
314+ * })
315+ */
316+ public previewCimdMetadata (
317+ request : Management . PreviewCimdMetadataRequestContent ,
318+ requestOptions ?: ClientsClient . RequestOptions ,
319+ ) : core . HttpResponsePromise < Management . PreviewCimdMetadataResponseContent > {
320+ return core . HttpResponsePromise . fromPromise ( this . __previewCimdMetadata ( request , requestOptions ) ) ;
321+ }
322+
323+ private async __previewCimdMetadata (
324+ request : Management . PreviewCimdMetadataRequestContent ,
325+ requestOptions ?: ClientsClient . RequestOptions ,
326+ ) : Promise < core . WithRawResponse < Management . PreviewCimdMetadataResponseContent > > {
327+ const _authRequest : core . AuthRequest = await this . _options . authProvider . getAuthRequest ( ) ;
328+ let _headers : core . Fetcher . Args [ "headers" ] = mergeHeaders (
329+ _authRequest . headers ,
330+ this . _options ?. headers ,
331+ requestOptions ?. headers ,
332+ ) ;
333+ const _response = await ( this . _options . fetcher ?? core . fetcher ) ( {
334+ url : core . url . join (
335+ ( await core . Supplier . get ( this . _options . baseUrl ) ) ??
336+ ( await core . Supplier . get ( this . _options . environment ) ) ??
337+ environments . ManagementEnvironment . Default ,
338+ "clients/cimd/preview" ,
339+ ) ,
340+ method : "POST" ,
341+ headers : _headers ,
342+ contentType : "application/json" ,
343+ queryParameters : requestOptions ?. queryParams ,
344+ requestType : "json" ,
345+ body : request ,
346+ timeoutMs : ( requestOptions ?. timeoutInSeconds ?? this . _options ?. timeoutInSeconds ?? 60 ) * 1000 ,
347+ maxRetries : requestOptions ?. maxRetries ?? this . _options ?. maxRetries ,
348+ abortSignal : requestOptions ?. abortSignal ,
349+ fetchFn : this . _options ?. fetch ,
350+ logging : this . _options . logging ,
351+ } ) ;
352+ if ( _response . ok ) {
353+ return {
354+ data : _response . body as Management . PreviewCimdMetadataResponseContent ,
355+ rawResponse : _response . rawResponse ,
356+ } ;
357+ }
358+
359+ if ( _response . error . reason === "status-code" ) {
360+ switch ( _response . error . statusCode ) {
361+ case 400 :
362+ throw new Management . BadRequestError ( _response . error . body as unknown , _response . rawResponse ) ;
363+ case 401 :
364+ throw new Management . UnauthorizedError ( _response . error . body as unknown , _response . rawResponse ) ;
365+ case 403 :
366+ throw new Management . ForbiddenError ( _response . error . body as unknown , _response . rawResponse ) ;
367+ case 429 :
368+ throw new Management . TooManyRequestsError ( _response . error . body as unknown , _response . rawResponse ) ;
369+ case 500 :
370+ throw new Management . InternalServerError ( _response . error . body as unknown , _response . rawResponse ) ;
371+ default :
372+ throw new errors . ManagementError ( {
373+ statusCode : _response . error . statusCode ,
374+ body : _response . error . body ,
375+ rawResponse : _response . rawResponse ,
376+ } ) ;
377+ }
378+ }
379+
380+ return handleNonStatusCodeError ( _response . error , _response . rawResponse , "POST" , "/clients/cimd/preview" ) ;
381+ }
382+
383+ /**
384+ *
385+ * Idempotent registration for Client ID Metadata Document (CIMD) clients.
386+ * Uses external_client_id as the unique identifier for upsert operations.
387+ * **Create:** Returns 201 when a new client is created (requires \
388+ *
389+ * @param {Management.RegisterCimdClientRequestContent } request
390+ * @param {ClientsClient.RequestOptions } requestOptions - Request-specific configuration.
391+ *
392+ * @throws {@link Management.BadRequestError }
393+ * @throws {@link Management.UnauthorizedError }
394+ * @throws {@link Management.ForbiddenError }
395+ * @throws {@link Management.TooManyRequestsError }
396+ * @throws {@link Management.InternalServerError }
397+ *
398+ * @example
399+ * await client.clients.registerCimdClient({
400+ * external_client_id: "external_client_id"
401+ * })
402+ */
403+ public registerCimdClient (
404+ request : Management . RegisterCimdClientRequestContent ,
405+ requestOptions ?: ClientsClient . RequestOptions ,
406+ ) : core . HttpResponsePromise < Management . RegisterCimdClientResponseContent > {
407+ return core . HttpResponsePromise . fromPromise ( this . __registerCimdClient ( request , requestOptions ) ) ;
408+ }
409+
410+ private async __registerCimdClient (
411+ request : Management . RegisterCimdClientRequestContent ,
412+ requestOptions ?: ClientsClient . RequestOptions ,
413+ ) : Promise < core . WithRawResponse < Management . RegisterCimdClientResponseContent > > {
414+ const _authRequest : core . AuthRequest = await this . _options . authProvider . getAuthRequest ( ) ;
415+ let _headers : core . Fetcher . Args [ "headers" ] = mergeHeaders (
416+ _authRequest . headers ,
417+ this . _options ?. headers ,
418+ requestOptions ?. headers ,
419+ ) ;
420+ const _response = await ( this . _options . fetcher ?? core . fetcher ) ( {
421+ url : core . url . join (
422+ ( await core . Supplier . get ( this . _options . baseUrl ) ) ??
423+ ( await core . Supplier . get ( this . _options . environment ) ) ??
424+ environments . ManagementEnvironment . Default ,
425+ "clients/cimd/register" ,
426+ ) ,
427+ method : "POST" ,
428+ headers : _headers ,
429+ contentType : "application/json" ,
430+ queryParameters : requestOptions ?. queryParams ,
431+ requestType : "json" ,
432+ body : request ,
433+ timeoutMs : ( requestOptions ?. timeoutInSeconds ?? this . _options ?. timeoutInSeconds ?? 60 ) * 1000 ,
434+ maxRetries : requestOptions ?. maxRetries ?? this . _options ?. maxRetries ,
435+ abortSignal : requestOptions ?. abortSignal ,
436+ fetchFn : this . _options ?. fetch ,
437+ logging : this . _options . logging ,
438+ } ) ;
439+ if ( _response . ok ) {
440+ return {
441+ data : _response . body as Management . RegisterCimdClientResponseContent ,
442+ rawResponse : _response . rawResponse ,
443+ } ;
444+ }
445+
446+ if ( _response . error . reason === "status-code" ) {
447+ switch ( _response . error . statusCode ) {
448+ case 400 :
449+ throw new Management . BadRequestError ( _response . error . body as unknown , _response . rawResponse ) ;
450+ case 401 :
451+ throw new Management . UnauthorizedError ( _response . error . body as unknown , _response . rawResponse ) ;
452+ case 403 :
453+ throw new Management . ForbiddenError ( _response . error . body as unknown , _response . rawResponse ) ;
454+ case 429 :
455+ throw new Management . TooManyRequestsError ( _response . error . body as unknown , _response . rawResponse ) ;
456+ case 500 :
457+ throw new Management . InternalServerError ( _response . error . body as unknown , _response . rawResponse ) ;
458+ default :
459+ throw new errors . ManagementError ( {
460+ statusCode : _response . error . statusCode ,
461+ body : _response . error . body ,
462+ rawResponse : _response . rawResponse ,
463+ } ) ;
464+ }
465+ }
466+
467+ return handleNonStatusCodeError ( _response . error , _response . rawResponse , "POST" , "/clients/cimd/register" ) ;
468+ }
469+
292470 /**
293471 * Retrieve client details by ID. Clients are SSO connections or Applications linked with your Auth0 tenant. A list of fields to include or exclude may also be specified.
294472 * For more information, read <a href="https://www.auth0.com/docs/get-started/applications"> Applications in Auth0</a> and <a href="https://www.auth0.com/docs/authenticate/single-sign-on"> Single Sign-On</a>.
0 commit comments