@@ -43,7 +43,7 @@ export class Connection {
4343 headers : {
4444 "X-Fern-Language" : "JavaScript" ,
4545 "X-Fern-SDK-Name" : "@revertdotdev/node" ,
46- "X-Fern-SDK-Version" : "0.0.796 " ,
46+ "X-Fern-SDK-Version" : "0.0.835 " ,
4747 "x-revert-api-token" : xRevertApiToken ,
4848 "x-api-version" : xApiVersion != null ? xApiVersion : undefined ,
4949 "x-revert-t-id" : xRevertTId ,
@@ -133,7 +133,7 @@ export class Connection {
133133 headers : {
134134 "X-Fern-Language" : "JavaScript" ,
135135 "X-Fern-SDK-Name" : "@revertdotdev/node" ,
136- "X-Fern-SDK-Version" : "0.0.796 " ,
136+ "X-Fern-SDK-Version" : "0.0.835 " ,
137137 "x-revert-api-token" : xRevertApiToken ,
138138 "x-api-version" : xApiVersion != null ? xApiVersion : undefined ,
139139 "x-revert-t-id" : xRevertTId ,
@@ -223,7 +223,7 @@ export class Connection {
223223 headers : {
224224 "X-Fern-Language" : "JavaScript" ,
225225 "X-Fern-SDK-Name" : "@revertdotdev/node" ,
226- "X-Fern-SDK-Version" : "0.0.796 " ,
226+ "X-Fern-SDK-Version" : "0.0.835 " ,
227227 "x-revert-api-token" : xRevertApiToken ,
228228 "x-api-version" : xApiVersion != null ? xApiVersion : undefined ,
229229 } ,
@@ -312,7 +312,7 @@ export class Connection {
312312 headers : {
313313 "X-Fern-Language" : "JavaScript" ,
314314 "X-Fern-SDK-Name" : "@revertdotdev/node" ,
315- "X-Fern-SDK-Version" : "0.0.796 " ,
315+ "X-Fern-SDK-Version" : "0.0.835 " ,
316316 "x-revert-api-token" : xRevertApiToken ,
317317 "x-api-version" : xApiVersion != null ? xApiVersion : undefined ,
318318 "x-revert-t-id" : xRevertTId ,
@@ -405,7 +405,7 @@ export class Connection {
405405 headers : {
406406 "X-Fern-Language" : "JavaScript" ,
407407 "X-Fern-SDK-Name" : "@revertdotdev/node" ,
408- "X-Fern-SDK-Version" : "0.0.796 " ,
408+ "X-Fern-SDK-Version" : "0.0.835 " ,
409409 "x-revert-api-token" : xRevertApiToken ,
410410 "x-api-version" : xApiVersion != null ? xApiVersion : undefined ,
411411 "x-revert-t-id" : xRevertTId ,
@@ -495,7 +495,7 @@ export class Connection {
495495 headers : {
496496 "X-Fern-Language" : "JavaScript" ,
497497 "X-Fern-SDK-Name" : "@revertdotdev/node" ,
498- "X-Fern-SDK-Version" : "0.0.796 " ,
498+ "X-Fern-SDK-Version" : "0.0.835 " ,
499499 "x-revert-api-token" : xRevertApiToken ,
500500 "x-api-version" : xApiVersion != null ? xApiVersion : undefined ,
501501 "x-revert-t-id" : xRevertTId ,
@@ -587,7 +587,7 @@ export class Connection {
587587 headers : {
588588 "X-Fern-Language" : "JavaScript" ,
589589 "X-Fern-SDK-Name" : "@revertdotdev/node" ,
590- "X-Fern-SDK-Version" : "0.0.796 " ,
590+ "X-Fern-SDK-Version" : "0.0.835 " ,
591591 "x-revert-api-token" : xRevertApiToken ,
592592 "x-api-version" : xApiVersion != null ? xApiVersion : undefined ,
593593 } ,
@@ -647,4 +647,97 @@ export class Connection {
647647 } ) ;
648648 }
649649 }
650+
651+ /**
652+ * Import multiple connections for a specific environment. Use this to bulk import connections as a one-time exercise.
653+ * @throws {@link Revert.common.UnAuthorizedError }
654+ * @throws {@link Revert.common.InternalServerError }
655+ * @throws {@link Revert.common.NotFoundError }
656+ */
657+ public async importConnections (
658+ request : Revert . ImportConnectionsRequest ,
659+ requestOptions ?: Connection . RequestOptions
660+ ) : Promise < Revert . ImportConnectionsResponse > {
661+ const { xRevertApiToken, xApiVersion, xRevertTId, body : _body } = request ;
662+ const _response = await core . fetcher ( {
663+ url : urlJoin (
664+ ( await core . Supplier . get ( this . _options . environment ) ) ?? environments . RevertEnvironment . Production ,
665+ "connection/import"
666+ ) ,
667+ method : "POST" ,
668+ headers : {
669+ "X-Fern-Language" : "JavaScript" ,
670+ "X-Fern-SDK-Name" : "@revertdotdev/node" ,
671+ "X-Fern-SDK-Version" : "0.0.835" ,
672+ "x-revert-api-token" : xRevertApiToken ,
673+ "x-api-version" : xApiVersion != null ? xApiVersion : undefined ,
674+ "x-revert-t-id" : xRevertTId ,
675+ } ,
676+ contentType : "application/json" ,
677+ body : await serializers . ImportConnectionsRequestBody . jsonOrThrow ( _body , {
678+ unrecognizedObjectKeys : "strip" ,
679+ } ) ,
680+ timeoutMs : requestOptions ?. timeoutInSeconds != null ? requestOptions . timeoutInSeconds * 1000 : undefined ,
681+ maxRetries : requestOptions ?. maxRetries ,
682+ } ) ;
683+ if ( _response . ok ) {
684+ return await serializers . ImportConnectionsResponse . parseOrThrow ( _response . body , {
685+ unrecognizedObjectKeys : "passthrough" ,
686+ allowUnrecognizedUnionMembers : true ,
687+ allowUnrecognizedEnumValues : true ,
688+ breadcrumbsPrefix : [ "response" ] ,
689+ } ) ;
690+ }
691+
692+ if ( _response . error . reason === "status-code" ) {
693+ switch ( _response . error . statusCode ) {
694+ case 401 :
695+ throw new Revert . common . UnAuthorizedError (
696+ await serializers . common . BaseError . parseOrThrow ( _response . error . body , {
697+ unrecognizedObjectKeys : "passthrough" ,
698+ allowUnrecognizedUnionMembers : true ,
699+ allowUnrecognizedEnumValues : true ,
700+ breadcrumbsPrefix : [ "response" ] ,
701+ } )
702+ ) ;
703+ case 500 :
704+ throw new Revert . common . InternalServerError (
705+ await serializers . common . BaseError . parseOrThrow ( _response . error . body , {
706+ unrecognizedObjectKeys : "passthrough" ,
707+ allowUnrecognizedUnionMembers : true ,
708+ allowUnrecognizedEnumValues : true ,
709+ breadcrumbsPrefix : [ "response" ] ,
710+ } )
711+ ) ;
712+ case 404 :
713+ throw new Revert . common . NotFoundError (
714+ await serializers . common . BaseError . parseOrThrow ( _response . error . body , {
715+ unrecognizedObjectKeys : "passthrough" ,
716+ allowUnrecognizedUnionMembers : true ,
717+ allowUnrecognizedEnumValues : true ,
718+ breadcrumbsPrefix : [ "response" ] ,
719+ } )
720+ ) ;
721+ default :
722+ throw new errors . RevertError ( {
723+ statusCode : _response . error . statusCode ,
724+ body : _response . error . body ,
725+ } ) ;
726+ }
727+ }
728+
729+ switch ( _response . error . reason ) {
730+ case "non-json" :
731+ throw new errors . RevertError ( {
732+ statusCode : _response . error . statusCode ,
733+ body : _response . error . rawBody ,
734+ } ) ;
735+ case "timeout" :
736+ throw new errors . RevertTimeoutError ( ) ;
737+ case "unknown" :
738+ throw new errors . RevertError ( {
739+ message : _response . error . errorMessage ,
740+ } ) ;
741+ }
742+ }
650743}
0 commit comments