Class ProjectServiceAccountsClient
java.lang.Object
io.github.stefanbratanov.jvm.openai.ProjectServiceAccountsClient
Manage service accounts within a project. A service account is a bot user that is not associated
with a user. If a user leaves an organization, their keys and membership in projects will no
longer work. Service accounts do not have this limitation. However, service accounts can also be
deleted from a project.
Based on Project Service Accounts
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final record
static final record
static final record
-
Method Summary
Modifier and TypeMethodDescriptioncreateProjectServiceAccount
(String projectId, CreateProjectServiceAccountRequest request) Creates a new service account in the project.deleteProjectServiceAccount
(String projectId, String serviceAccountId) Deletes a service account from the project.Returns a list of service accounts in the project.retrieveProjectServiceAccount
(String projectId, String serviceAccountId) Retrieves a service account in the project.
-
Method Details
-
listProjectServiceAccounts
public ProjectServiceAccountsClient.PaginatedProjectServiceAccounts listProjectServiceAccounts(String projectId, Optional<String> after, Optional<Integer> limit) Returns a list of service accounts in the project.- Parameters:
projectId
- The ID of the project.after
- A cursor for use in pagination. after is an object ID that defines your place in the list.limit
- A limit on the number of objects to be returned.- Throws:
OpenAIException
- in case of API errors
-
createProjectServiceAccount
public ProjectServiceAccountsClient.ProjectServiceAccountCreateResponse createProjectServiceAccount(String projectId, CreateProjectServiceAccountRequest request) Creates a new service account in the project. This also returns an unredacted API key for the service account.- Parameters:
projectId
- The ID of the project.- Throws:
OpenAIException
- in case of API errors
-
retrieveProjectServiceAccount
public ProjectServiceAccount retrieveProjectServiceAccount(String projectId, String serviceAccountId) Retrieves a service account in the project.- Parameters:
projectId
- The ID of the project.serviceAccountId
- The ID of the service account.- Throws:
OpenAIException
- in case of API errors
-
deleteProjectServiceAccount
Deletes a service account from the project.- Parameters:
projectId
- The ID of the project.serviceAccountId
- The ID of the service account.- Throws:
OpenAIException
- in case of API errors
-