Lightweight coding agent that runs in your terminal
Rust
backend-client: add get_config_requirements_file (#10001)
gt-oaiddc704d4c632
diff --git a/codex-rs/backend-client/src/client.rs b/codex-rs/backend-client/src/client.rsindex ea3585956b..ec5fd3f61b 100644--- a/codex-rs/backend-client/src/client.rs+++ b/codex-rs/backend-client/src/client.rs@@ -1,4 +1,5 @@use crate::types::CodeTaskDetailsResponse;+use crate::types::ConfigFileResponse;use crate::types::CreditStatusDetails;use crate::types::PaginatedListTaskListItem;use crate::types::RateLimitStatusPayload;@@ -244,6 +245,20 @@ impl Client {self.decode_json::<TurnAttemptsSiblingTurnsResponse>(&url, &ct, &body)}+ /// Fetch the managed requirements file from codex-backend.+ ///+ /// `GET /api/codex/config/requirements` (Codex API style) or+ /// `GET /wham/config/requirements` (ChatGPT backend-api style).+ pub async fn get_config_requirements_file(&self) -> Result<ConfigFileResponse> {+ let url = match self.path_style {+ PathStyle::CodexApi => format!("{}/api/codex/config/requirements", self.base_url),+ PathStyle::ChatGptApi => format!("{}/wham/config/requirements", self.base_url),+ };+ let req = self.http.get(&url).headers(self.headers());+ let (body, ct) = self.exec_request(req, "GET", &url).await?;+ self.decode_json::<ConfigFileResponse>(&url, &ct, &body)+ }+/// Create a new task (user turn) by POSTing to the appropriate backend path/// based on `path_style`. Returns the created task id.pub async fn create_task(&self, request_body: serde_json::Value) -> Result<String> {diff --git a/codex-rs/backend-client/src/lib.rs b/codex-rs/backend-client/src/lib.rsindex 29fe9f3c6b..de827e9a97 100644--- a/codex-rs/backend-client/src/lib.rs+++ b/codex-rs/backend-client/src/lib.rs@@ -4,6 +4,7 @@ pub mod types;pub use client::Client;pub use types::CodeTaskDetailsResponse;pub use types::CodeTaskDetailsResponseExt;+pub use types::ConfigFileResponse;pub use types::PaginatedListTaskListItem;pub use types::TaskListItem;pub use types::TurnAttemptsSiblingTurnsResponse;diff --git a/codex-rs/backend-client/src/types.rs b/codex-rs/backend-client/src/types.rsindex afeb231a18..9deeab7903 100644--- a/codex-rs/backend-client/src/types.rs+++ b/codex-rs/backend-client/src/types.rs@@ -1,3 +1,4 @@+pub use codex_backend_openapi_models::models::ConfigFileResponse;pub use codex_backend_openapi_models::models::CreditStatusDetails;pub use codex_backend_openapi_models::models::PaginatedListTaskListItem;pub use codex_backend_openapi_models::models::PlanType;diff --git a/codex-rs/codex-backend-openapi-models/src/models/config_file_response.rs b/codex-rs/codex-backend-openapi-models/src/models/config_file_response.rsnew file mode 100644index 0000000000..2e22cb58fe--- /dev/null+++ b/codex-rs/codex-backend-openapi-models/src/models/config_file_response.rs@@ -0,0 +1,40 @@+/*+ * codex-backend+ *+ * codex-backend+ *+ * The version of the OpenAPI document: 0.0.1+ *+ * Generated by: https://openapi-generator.tech+ */++use serde::Deserialize;+use serde::Serialize;++#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]+pub struct ConfigFileResponse {+ #[serde(rename = "contents", skip_serializing_if = "Option::is_none")]+ pub contents: Option<String>,+ #[serde(rename = "sha256", skip_serializing_if = "Option::is_none")]+ pub sha256: Option<String>,+ #[serde(rename = "updated_at", skip_serializing_if = "Option::is_none")]+ pub updated_at: Option<String>,+ #[serde(rename = "updated_by_user_id", skip_serializing_if = "Option::is_none")]+ pub updated_by_user_id: Option<String>,+}++impl ConfigFileResponse {+ pub fn new(+ contents: Option<String>,+ sha256: Option<String>,+ updated_at: Option<String>,+ updated_by_user_id: Option<String>,+ ) -> ConfigFileResponse {+ ConfigFileResponse {+ contents,+ sha256,+ updated_at,+ updated_by_user_id,+ }+ }+}diff --git a/codex-rs/codex-backend-openapi-models/src/models/mod.rs b/codex-rs/codex-backend-openapi-models/src/models/mod.rsindex d767154925..7072dede5e 100644--- a/codex-rs/codex-backend-openapi-models/src/models/mod.rs+++ b/codex-rs/codex-backend-openapi-models/src/models/mod.rs@@ -3,6 +3,10 @@// Currently export only the types referenced by the workspace// The process for this will change+// Config+pub mod config_file_response;+pub use self::config_file_response::ConfigFileResponse;+// Cloud Taskspub mod code_task_details_response;pub use self::code_task_details_response::CodeTaskDetailsResponse;