@@ -24,6 +24,7 @@ import { GlobalOrgData } from "../models/GlobalOrgData";
2424import { GlobalOrgsResponse } from "../models/GlobalOrgsResponse" ;
2525import { JSONAPIErrorResponse } from "../models/JSONAPIErrorResponse" ;
2626import { ManagedOrgsResponse } from "../models/ManagedOrgsResponse" ;
27+ import { MaxSessionDurationUpdateRequest } from "../models/MaxSessionDurationUpdateRequest" ;
2728import { OrgConfigGetResponse } from "../models/OrgConfigGetResponse" ;
2829import { OrgConfigListResponse } from "../models/OrgConfigListResponse" ;
2930import { OrgConfigWriteRequest } from "../models/OrgConfigWriteRequest" ;
@@ -239,6 +240,51 @@ export class OrganizationsApiRequestFactory extends BaseAPIRequestFactory {
239240 return requestContext ;
240241 }
241242
243+ public async updateLoginOrgConfigsMaxSessionDuration (
244+ body : MaxSessionDurationUpdateRequest ,
245+ _options ?: Configuration
246+ ) : Promise < RequestContext > {
247+ const _config = _options || this . configuration ;
248+
249+ // verify required parameter 'body' is not null or undefined
250+ if ( body === null || body === undefined ) {
251+ throw new RequiredError (
252+ "body" ,
253+ "updateLoginOrgConfigsMaxSessionDuration"
254+ ) ;
255+ }
256+
257+ // Path Params
258+ const localVarPath = "/api/v2/login/org_configs/max_session_duration" ;
259+
260+ // Make Request Context
261+ const requestContext = _config
262+ . getServer ( "v2.OrganizationsApi.updateLoginOrgConfigsMaxSessionDuration" )
263+ . makeRequestContext ( localVarPath , HttpMethod . PUT ) ;
264+ requestContext . setHeaderParam ( "Accept" , "*/*" ) ;
265+ requestContext . setHttpConfig ( _config . httpConfig ) ;
266+
267+ // Body Params
268+ const contentType = ObjectSerializer . getPreferredMediaType ( [
269+ "application/json" ,
270+ ] ) ;
271+ requestContext . setHeaderParam ( "Content-Type" , contentType ) ;
272+ const serializedBody = ObjectSerializer . stringify (
273+ ObjectSerializer . serialize ( body , "MaxSessionDurationUpdateRequest" , "" ) ,
274+ contentType
275+ ) ;
276+ requestContext . setBody ( serializedBody ) ;
277+
278+ // Apply auth methods
279+ applySecurityAuthentication ( _config , requestContext , [
280+ "apiKeyAuth" ,
281+ "appKeyAuth" ,
282+ "AuthZ" ,
283+ ] ) ;
284+
285+ return requestContext ;
286+ }
287+
242288 public async updateOrgConfig (
243289 orgConfigName : string ,
244290 body : OrgConfigWriteRequest ,
@@ -795,6 +841,60 @@ export class OrganizationsApiResponseProcessor {
795841 ) ;
796842 }
797843
844+ /**
845+ * Unwraps the actual response sent by the server from the response context and deserializes the response content
846+ * to the expected objects
847+ *
848+ * @params response Response returned by the server for a request to updateLoginOrgConfigsMaxSessionDuration
849+ * @throws ApiException if the response code was not in [200, 299]
850+ */
851+ public async updateLoginOrgConfigsMaxSessionDuration (
852+ response : ResponseContext
853+ ) : Promise < void > {
854+ const contentType = ObjectSerializer . normalizeMediaType (
855+ response . headers [ "content-type" ]
856+ ) ;
857+ if ( response . httpStatusCode === 204 ) {
858+ return ;
859+ }
860+ if (
861+ response . httpStatusCode === 400 ||
862+ response . httpStatusCode === 401 ||
863+ response . httpStatusCode === 403 ||
864+ response . httpStatusCode === 429
865+ ) {
866+ const bodyText = ObjectSerializer . parse (
867+ await response . body . text ( ) ,
868+ contentType
869+ ) ;
870+ let body : APIErrorResponse ;
871+ try {
872+ body = ObjectSerializer . deserialize (
873+ bodyText ,
874+ "APIErrorResponse"
875+ ) as APIErrorResponse ;
876+ } catch ( error ) {
877+ logger . debug ( `Got error deserializing error: ${ error } ` ) ;
878+ throw new ApiException < APIErrorResponse > (
879+ response . httpStatusCode ,
880+ bodyText
881+ ) ;
882+ }
883+ throw new ApiException < APIErrorResponse > ( response . httpStatusCode , body ) ;
884+ }
885+
886+ // Work around for missing responses in specification, e.g. for petstore.yaml
887+ if ( response . httpStatusCode >= 200 && response . httpStatusCode <= 299 ) {
888+ return ;
889+ }
890+
891+ const body = ( await response . body . text ( ) ) || "" ;
892+ throw new ApiException < string > (
893+ response . httpStatusCode ,
894+ 'Unknown API Status Code!\nBody: "' + body + '"'
895+ ) ;
896+ }
897+
798898 /**
799899 * Unwraps the actual response sent by the server from the response context and deserializes the response content
800900 * to the expected objects
@@ -1094,6 +1194,13 @@ export interface OrganizationsApiListOrgsRequest {
10941194 filterName ?: string ;
10951195}
10961196
1197+ export interface OrganizationsApiUpdateLoginOrgConfigsMaxSessionDurationRequest {
1198+ /**
1199+ * @type MaxSessionDurationUpdateRequest
1200+ */
1201+ body : MaxSessionDurationUpdateRequest ;
1202+ }
1203+
10971204export interface OrganizationsApiUpdateOrgConfigRequest {
10981205 /**
10991206 * The name of an Org Config.
@@ -1325,6 +1432,31 @@ export class OrganizationsApi {
13251432 } ) ;
13261433 }
13271434
1435+ /**
1436+ * Update the maximum session duration for the current organization.
1437+ * The duration is specified in seconds.
1438+ * @param param The request object
1439+ */
1440+ public updateLoginOrgConfigsMaxSessionDuration (
1441+ param : OrganizationsApiUpdateLoginOrgConfigsMaxSessionDurationRequest ,
1442+ options ?: Configuration
1443+ ) : Promise < void > {
1444+ const requestContextPromise =
1445+ this . requestFactory . updateLoginOrgConfigsMaxSessionDuration (
1446+ param . body ,
1447+ options
1448+ ) ;
1449+ return requestContextPromise . then ( ( requestContext ) => {
1450+ return this . configuration . httpApi
1451+ . send ( requestContext )
1452+ . then ( ( responseContext ) => {
1453+ return this . responseProcessor . updateLoginOrgConfigsMaxSessionDuration (
1454+ responseContext
1455+ ) ;
1456+ } ) ;
1457+ } ) ;
1458+ }
1459+
13281460 /**
13291461 * Update the value of a specific Org Config.
13301462 * @param param The request object
0 commit comments