Skip to content

Commit

Permalink
Added support for users getSessions & getRefreshTokens endpoint in ma…
Browse files Browse the repository at this point in the history
…nagement api client (#1021)

Co-authored-by: gyaneshgouraw-okta <[email protected]>
  • Loading branch information
gyaneshgouraw-okta and gyaneshgouraw-okta authored Jul 15, 2024
1 parent 17bac36 commit 777a4fa
Show file tree
Hide file tree
Showing 3 changed files with 614 additions and 0 deletions.
142 changes: 142 additions & 0 deletions src/management/__generated/managers/users-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import type {
GetLogs200Response,
GetOrganizationMemberRoles200Response,
GetPermissions200Response,
GetRefreshTokensForUser200Response,
GetSessionsForUser200Response,
GetUserOrganizations200Response,
GetUsers200Response,
GetUsers200ResponseOneOfInner,
Expand Down Expand Up @@ -40,6 +42,8 @@ import type {
DeleteAuthenticatorsRequest,
DeleteMultifactorByProviderRequest,
DeletePermissionsOperationRequest,
DeleteRefreshTokensForUserRequest,
DeleteSessionsForUserRequest,
DeleteUserIdentityByUserIdRequest,
DeleteUserRolesOperationRequest,
DeleteUsersByIdRequest,
Expand All @@ -48,6 +52,8 @@ import type {
GetEnrollmentsRequest,
GetLogsByUserRequest,
GetPermissionsRequest,
GetRefreshTokensForUserRequest,
GetSessionsForUserRequest,
GetUserOrganizationsRequest,
GetUserRolesRequest,
GetUsersRequest,
Expand Down Expand Up @@ -205,6 +211,58 @@ export class UsersManager extends BaseAPI {
return runtime.VoidApiResponse.fromResponse(response);
}

/**
* Delete all refresh tokens for a user.
* Delete refresh tokens for a user
*
* @throws {RequiredError}
*/
async deleteRefreshTokens(
requestParameters: DeleteRefreshTokensForUserRequest,
initOverrides?: InitOverride
): Promise<ApiResponse<void>> {
runtime.validateRequiredRequestParams(requestParameters, ['user_id']);

const response = await this.request(
{
path: `/users/{user_id}/refresh-tokens`.replace(
'{user_id}',
encodeURIComponent(String(requestParameters.user_id))
),
method: 'DELETE',
},
initOverrides
);

return runtime.VoidApiResponse.fromResponse(response);
}

/**
* Delete all sessions for a user.
* Delete sessions for user
*
* @throws {RequiredError}
*/
async deleteSessions(
requestParameters: DeleteSessionsForUserRequest,
initOverrides?: InitOverride
): Promise<ApiResponse<void>> {
runtime.validateRequiredRequestParams(requestParameters, ['user_id']);

const response = await this.request(
{
path: `/users/{user_id}/sessions`.replace(
'{user_id}',
encodeURIComponent(String(requestParameters.user_id))
),
method: 'DELETE',
},
initOverrides
);

return runtime.VoidApiResponse.fromResponse(response);
}

/**
* Unlink an identity from the target user making it a separate user account again.
* Unlink a User Identity
Expand Down Expand Up @@ -493,6 +551,90 @@ export class UsersManager extends BaseAPI {
return runtime.JSONApiResponse.fromResponse(response);
}

/**
* Retrieve details for a user's refresh tokens.
* Get refresh tokens for a user
*
* @throws {RequiredError}
*/
async getRefreshTokens(
requestParameters: GetRefreshTokensForUserRequest,
initOverrides?: InitOverride
): Promise<ApiResponse<GetRefreshTokensForUser200Response>> {
runtime.validateRequiredRequestParams(requestParameters, ['user_id']);

const queryParameters = runtime.applyQueryParams(requestParameters, [
{
key: 'include_totals',
config: {},
},
{
key: 'from',
config: {},
},
{
key: 'take',
config: {},
},
]);

const response = await this.request(
{
path: `/users/{user_id}/refresh-tokens`.replace(
'{user_id}',
encodeURIComponent(String(requestParameters.user_id))
),
method: 'GET',
query: queryParameters,
},
initOverrides
);

return runtime.JSONApiResponse.fromResponse(response);
}

/**
* Retrieve details for a user's sessions.
* Get sessions for user
*
* @throws {RequiredError}
*/
async getSessions(
requestParameters: GetSessionsForUserRequest,
initOverrides?: InitOverride
): Promise<ApiResponse<GetSessionsForUser200Response>> {
runtime.validateRequiredRequestParams(requestParameters, ['user_id']);

const queryParameters = runtime.applyQueryParams(requestParameters, [
{
key: 'include_totals',
config: {},
},
{
key: 'from',
config: {},
},
{
key: 'take',
config: {},
},
]);

const response = await this.request(
{
path: `/users/{user_id}/sessions`.replace(
'{user_id}',
encodeURIComponent(String(requestParameters.user_id))
),
method: 'GET',
query: queryParameters,
},
initOverrides
);

return runtime.JSONApiResponse.fromResponse(response);
}

/**
* This endpoint will retrieve all organizations that the specified user is a member of.
*
Expand Down
Loading

0 comments on commit 777a4fa

Please sign in to comment.