pub struct ProjectsApi<'a>(/* private fields */);
Expand description
ProjectsApi
struct to interact with the projects endpoints of the API.
Implementations§
Source§impl<'a> ProjectsApi<'a>
impl<'a> ProjectsApi<'a>
Sourcepub async fn list_projects(
&self,
limit: Option<u8>,
after: Option<&str>,
include_archived: Option<bool>,
) -> OpenAIResult<Value>
pub async fn list_projects( &self, limit: Option<u8>, after: Option<&str>, include_archived: Option<bool>, ) -> OpenAIResult<Value>
List projects within an organization.
§Arguments
limit
- Optional limit on the number of objects to return (1-100, default 20).after
- Optional cursor for pagination.include_archived
- Optional flag to include archived projects.
§Returns
A Result containing the JSON response as serde_json::Value
on success, or an OpenAIError
on failure.
Sourcepub async fn create_project(
&self,
name: &str,
app_use_case: Option<&str>,
business_website: Option<&str>,
) -> OpenAIResult<Value>
pub async fn create_project( &self, name: &str, app_use_case: Option<&str>, business_website: Option<&str>, ) -> OpenAIResult<Value>
Create a new project in the organization.
§Arguments
name
- The friendly name of the project.app_use_case
- Optional description of the business, project, or use case.business_website
- Optional business URL or social media link.
§Returns
A Result containing the JSON response as serde_json::Value
on success, or an OpenAIError
on failure.
Sourcepub async fn retrieve_project(&self, project_id: &str) -> OpenAIResult<Value>
pub async fn retrieve_project(&self, project_id: &str) -> OpenAIResult<Value>
Retrieve information about a specific project.
§Arguments
project_id
- The ID of the project to retrieve.
§Returns
A Result containing the JSON response as serde_json::Value
on success, or an OpenAIError
on failure.
Sourcepub async fn modify_project(
&self,
project_id: &str,
name: &str,
app_use_case: Option<&str>,
business_website: Option<&str>,
) -> OpenAIResult<Value>
pub async fn modify_project( &self, project_id: &str, name: &str, app_use_case: Option<&str>, business_website: Option<&str>, ) -> OpenAIResult<Value>
Modify an existing project in the organization.
§Arguments
project_id
- The ID of the project to modify.name
- The updated name of the project.app_use_case
- Optional updated description of the business, project, or use case.business_website
- Optional updated business URL or social media link.
§Returns
A Result containing the JSON response as serde_json::Value
on success, or an OpenAIError
on failure.
Sourcepub async fn archive_project(&self, project_id: &str) -> OpenAIResult<Value>
pub async fn archive_project(&self, project_id: &str) -> OpenAIResult<Value>
Archive a project in the organization.
§Arguments
project_id
- The ID of the project to archive.
§Returns
A Result containing the JSON response as serde_json::Value
on success, or an OpenAIError
on failure.
Sourcepub async fn list_project_users(
&self,
project_id: &str,
limit: Option<u8>,
after: Option<&str>,
) -> OpenAIResult<Value>
pub async fn list_project_users( &self, project_id: &str, limit: Option<u8>, after: Option<&str>, ) -> OpenAIResult<Value>
List users in a project.
§Arguments
project_id
- The ID of the project.limit
- Optional limit on the number of objects to return (1-100, default 20).after
- Optional cursor for pagination.
§Returns
A Result containing the JSON response as serde_json::Value
on success, or an OpenAIError
on failure.
Sourcepub async fn create_project_user(
&self,
project_id: &str,
user_id: &str,
role: &str,
) -> OpenAIResult<Value>
pub async fn create_project_user( &self, project_id: &str, user_id: &str, role: &str, ) -> OpenAIResult<Value>
Add a user to a project.
§Arguments
project_id
- The ID of the project.user_id
- The ID of the user to add.role
- The role of the user (owner or member).
§Returns
A Result containing the JSON response as serde_json::Value
on success, or an OpenAIError
on failure.
Sourcepub async fn retrieve_project_user(
&self,
project_id: &str,
user_id: &str,
) -> OpenAIResult<Value>
pub async fn retrieve_project_user( &self, project_id: &str, user_id: &str, ) -> OpenAIResult<Value>
Retrieve information about a specific user in a project.
§Arguments
project_id
- The ID of the project.user_id
- The ID of the user.
§Returns
A Result containing the JSON response as serde_json::Value
on success, or an OpenAIError
on failure.
Sourcepub async fn modify_project_user(
&self,
project_id: &str,
user_id: &str,
role: &str,
) -> OpenAIResult<Value>
pub async fn modify_project_user( &self, project_id: &str, user_id: &str, role: &str, ) -> OpenAIResult<Value>
Modify a user’s role in a project.
§Arguments
project_id
- The ID of the project.user_id
- The ID of the user.role
- The new role of the user (owner or member).
§Returns
A Result containing the JSON response as serde_json::Value
on success, or an OpenAIError
on failure.
Sourcepub async fn delete_project_user(
&self,
project_id: &str,
user_id: &str,
) -> OpenAIResult<Value>
pub async fn delete_project_user( &self, project_id: &str, user_id: &str, ) -> OpenAIResult<Value>
Delete a user from a project.
§Arguments
project_id
- The ID of the project.user_id
- The ID of the user to delete.
§Returns
A Result containing the JSON response as serde_json::Value
on success, or an OpenAIError
on failure.