Skip to content

Commit 21892fe

Browse files
authored
Update hubspot client (#230)
* add make cmds * fix * update tickets and users
1 parent 431cd45 commit 21892fe

19 files changed

+1778
-669
lines changed

hubspot-contacts/hubspot-contacts.rs.patch.json

Lines changed: 22 additions & 14 deletions
Large diffs are not rendered by default.

hubspot-contacts/src/basic.rs

Lines changed: 67 additions & 16 deletions
Large diffs are not rendered by default.

hubspot-contacts/src/batch.rs

Lines changed: 40 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ impl Batch {
1212
Self { client }
1313
}
1414

15-
#[doc = "Read a batch of contacts by internal ID, or unique property values\n\n**Parameters:**\n\n- `archived: Option<bool>`: Whether to return only results that have been archived.\n\n```rust,no_run\nasync fn example_batch_post_crm_v_3_objects_contacts_read_read() -> anyhow::Result<()> {\n let client = hubspot_contacts::Client::new_from_env();\n let result: hubspot_contacts::types::BatchResponseSimplePublicObject = client\n .batch()\n .post_crm_v_3_objects_contacts_read_read(\n Some(true),\n &hubspot_contacts::types::BatchReadInputSimplePublicObjectId {\n properties_with_history: vec![\"some-string\".to_string()],\n id_property: Some(\"some-string\".to_string()),\n inputs: vec![hubspot_contacts::types::SimplePublicObjectId {\n id: \"some-string\".to_string(),\n }],\n properties: vec![\"some-string\".to_string()],\n },\n )\n .await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n```"]
15+
#[doc = "Retrieve a batch of contacts\n\nRetrieve a batch of contacts by ID (`contactId`) or unique property value (`idProperty`). \n\n**Parameters:**\n\n- `archived: Option<bool>`: Whether to return only results that have been archived.\n\n```rust,no_run\nasync fn example_batch_post_crm_v_3_objects_contacts_read_read() -> anyhow::Result<()> {\n let client = hubspot_contacts::Client::new_from_env();\n let result: hubspot_contacts::types::BatchResponseSimplePublicObject = client\n .batch()\n .post_crm_v_3_objects_contacts_read_read(\n Some(true),\n &hubspot_contacts::types::BatchReadInputSimplePublicObjectId {\n properties_with_history: vec![\"some-string\".to_string()],\n id_property: Some(\"some-string\".to_string()),\n inputs: vec![hubspot_contacts::types::SimplePublicObjectId {\n id: \"some-string\".to_string(),\n }],\n properties: vec![\"some-string\".to_string()],\n },\n )\n .await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n```"]
1616
#[tracing::instrument]
1717
pub async fn post_crm_v_3_objects_contacts_read_read<'a>(
1818
&'a self,
@@ -53,14 +53,7 @@ impl Batch {
5353
}
5454
}
5555

56-
#[doc = "Archive a batch of contacts by ID\n\n```rust,no_run\nasync fn \
57-
example_batch_post_crm_v_3_objects_contacts_archive_archive() -> anyhow::Result<()> \
58-
{\n let client = hubspot_contacts::Client::new_from_env();\n client\n \
59-
.batch()\n .post_crm_v_3_objects_contacts_archive_archive(\n \
60-
&hubspot_contacts::types::BatchInputSimplePublicObjectId {\n inputs: \
61-
vec![hubspot_contacts::types::SimplePublicObjectId {\n id: \
62-
\"some-string\".to_string(),\n }],\n },\n )\n \
63-
.await?;\n Ok(())\n}\n```"]
56+
#[doc = "Archive a batch of contacts\n\nArchive a batch of contacts by ID. Archived contacts can be restored within 90 days of deletion. Learn more about the [data impacted by contact deletions](https://knowledge.hubspot.com/privacy-and-consent/understand-restorable-and-permanent-contact-deletions) and how to [restore archived records](https://knowledge.hubspot.com/records/restore-deleted-records).\n\n```rust,no_run\nasync fn example_batch_post_crm_v_3_objects_contacts_archive_archive() -> anyhow::Result<()> {\n let client = hubspot_contacts::Client::new_from_env();\n client\n .batch()\n .post_crm_v_3_objects_contacts_archive_archive(\n &hubspot_contacts::types::BatchInputSimplePublicObjectId {\n inputs: vec![hubspot_contacts::types::SimplePublicObjectId {\n id: \"some-string\".to_string(),\n }],\n },\n )\n .await?;\n Ok(())\n}\n```"]
6457
#[tracing::instrument]
6558
pub async fn post_crm_v_3_objects_contacts_archive_archive<'a>(
6659
&'a self,
@@ -88,11 +81,11 @@ impl Batch {
8881
}
8982
}
9083

91-
#[doc = "Create a batch of contacts\n\n```rust,no_run\nasync fn example_batch_post_crm_v_3_objects_contacts_create_create() -> anyhow::Result<()> {\n let client = hubspot_contacts::Client::new_from_env();\n let result: hubspot_contacts::types::BatchResponseSimplePublicObject = client\n .batch()\n .post_crm_v_3_objects_contacts_create_create(\n &hubspot_contacts::types::BatchInputSimplePublicObjectInputForCreate {\n inputs: vec![hubspot_contacts::types::SimplePublicObjectInputForCreate {\n associations: vec![hubspot_contacts::types::PublicAssociationsForObject {\n types: vec![hubspot_contacts::types::AssociationSpec {\n association_category: hubspot_contacts::types::AssociationCategory::UserDefined,\n association_type_id: 4 as i32,\n }],\n to: hubspot_contacts::types::PublicObjectId {\n id: \"some-string\".to_string(),\n },\n }],\n properties: std::collections::HashMap::from([(\n \"some-key\".to_string(),\n \"some-string\".to_string(),\n )]),\n }],\n },\n )\n .await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n```"]
84+
#[doc = "Create a batch of contacts\n\nCreate a batch of contacts. The `inputs` array can contain a `properties` object to define property values for each record, along with an `associations` array to define [associations](https://developers.hubspot.com/docs/guides/api/crm/associations/associations-v4) with other CRM records.\n\n```rust,no_run\nasync fn example_batch_post_crm_v_3_objects_contacts_create_create() -> anyhow::Result<()> {\n let client = hubspot_contacts::Client::new_from_env();\n let result: hubspot_contacts::types::BatchResponseSimplePublicObject = client\n .batch()\n .post_crm_v_3_objects_contacts_create_create(\n &hubspot_contacts::types::BatchInputSimplePublicObjectBatchInputForCreate {\n inputs: vec![hubspot_contacts::types::SimplePublicObjectBatchInputForCreate {\n associations: Some(vec![hubspot_contacts::types::PublicAssociationsForObject {\n types: vec![hubspot_contacts::types::AssociationSpec {\n association_category: hubspot_contacts::types::AssociationCategory::UserDefined,\n association_type_id: 4 as i32,\n }],\n to: hubspot_contacts::types::PublicObjectId {\n id: \"some-string\".to_string(),\n },\n }]),\n object_write_trace_id: Some(\"some-string\".to_string()),\n properties: std::collections::HashMap::from([(\n \"some-key\".to_string(),\n \"some-string\".to_string(),\n )]),\n }],\n },\n )\n .await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n```"]
9285
#[tracing::instrument]
9386
pub async fn post_crm_v_3_objects_contacts_create_create<'a>(
9487
&'a self,
95-
body: &crate::types::BatchInputSimplePublicObjectInputForCreate,
88+
body: &crate::types::BatchInputSimplePublicObjectBatchInputForCreate,
9689
) -> Result<crate::types::BatchResponseSimplePublicObject, crate::types::error::Error> {
9790
let mut req = self.client.client.request(
9891
http::Method::POST,
@@ -122,7 +115,7 @@ impl Batch {
122115
}
123116
}
124117

125-
#[doc = "Update a batch of contacts\n\n```rust,no_run\nasync fn example_batch_post_crm_v_3_objects_contacts_update_update() -> anyhow::Result<()> {\n let client = hubspot_contacts::Client::new_from_env();\n let result: hubspot_contacts::types::BatchResponseSimplePublicObject = client\n .batch()\n .post_crm_v_3_objects_contacts_update_update(\n &hubspot_contacts::types::BatchInputSimplePublicObjectBatchInput {\n inputs: vec![hubspot_contacts::types::SimplePublicObjectBatchInput {\n id_property: Some(\"some-string\".to_string()),\n id: \"some-string\".to_string(),\n properties: std::collections::HashMap::from([(\n \"some-key\".to_string(),\n \"some-string\".to_string(),\n )]),\n }],\n },\n )\n .await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n```"]
118+
#[doc = "Update a batch of contacts\n\nUpdate a batch of contacts by ID (`contactId`) or unique property value (`idProperty`). Provided property values will be overwritten. Read-only and non-existent properties will result in an error. Properties values can be cleared by passing an empty string.\n\n```rust,no_run\nasync fn example_batch_post_crm_v_3_objects_contacts_update_update() -> anyhow::Result<()> {\n let client = hubspot_contacts::Client::new_from_env();\n let result: hubspot_contacts::types::BatchResponseSimplePublicObject = client\n .batch()\n .post_crm_v_3_objects_contacts_update_update(\n &hubspot_contacts::types::BatchInputSimplePublicObjectBatchInput {\n inputs: vec![hubspot_contacts::types::SimplePublicObjectBatchInput {\n id_property: Some(\"some-string\".to_string()),\n object_write_trace_id: Some(\"some-string\".to_string()),\n id: \"some-string\".to_string(),\n properties: std::collections::HashMap::from([(\n \"some-key\".to_string(),\n \"some-string\".to_string(),\n )]),\n }],\n },\n )\n .await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n```"]
126119
#[tracing::instrument]
127120
pub async fn post_crm_v_3_objects_contacts_update_update<'a>(
128121
&'a self,
@@ -155,4 +148,39 @@ impl Batch {
155148
})
156149
}
157150
}
151+
152+
#[doc = "Create or update a batch of contacts\n\nUpsert a batch of contacts. The `inputs` array can contain a `properties` object to define property values for each record.\n\n```rust,no_run\nasync fn example_batch_post_crm_v_3_objects_contacts_upsert_upsert() -> anyhow::Result<()> {\n let client = hubspot_contacts::Client::new_from_env();\n let result: hubspot_contacts::types::BatchResponseSimplePublicUpsertObject = client\n .batch()\n .post_crm_v_3_objects_contacts_upsert_upsert(\n &hubspot_contacts::types::BatchInputSimplePublicObjectBatchInputUpsert {\n inputs: vec![hubspot_contacts::types::SimplePublicObjectBatchInputUpsert {\n id_property: Some(\"some-string\".to_string()),\n object_write_trace_id: Some(\"some-string\".to_string()),\n id: \"some-string\".to_string(),\n properties: std::collections::HashMap::from([(\n \"some-key\".to_string(),\n \"some-string\".to_string(),\n )]),\n }],\n },\n )\n .await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n```"]
153+
#[tracing::instrument]
154+
pub async fn post_crm_v_3_objects_contacts_upsert_upsert<'a>(
155+
&'a self,
156+
body: &crate::types::BatchInputSimplePublicObjectBatchInputUpsert,
157+
) -> Result<crate::types::BatchResponseSimplePublicUpsertObject, crate::types::error::Error>
158+
{
159+
let mut req = self.client.client.request(
160+
http::Method::POST,
161+
format!(
162+
"{}/{}",
163+
self.client.base_url, "crm/v3/objects/contacts/batch/upsert"
164+
),
165+
);
166+
req = req.bearer_auth(&self.client.token);
167+
req = req.json(body);
168+
let resp = req.send().await?;
169+
let status = resp.status();
170+
if status.is_success() {
171+
let text = resp.text().await.unwrap_or_default();
172+
serde_json::from_str(&text).map_err(|err| {
173+
crate::types::error::Error::from_serde_error(
174+
format_serde_error::SerdeError::new(text.to_string(), err),
175+
status,
176+
)
177+
})
178+
} else {
179+
let text = resp.text().await.unwrap_or_default();
180+
Err(crate::types::error::Error::Server {
181+
body: text.to_string(),
182+
status,
183+
})
184+
}
185+
}
158186
}

hubspot-contacts/src/gdpr.rs

Lines changed: 0 additions & 42 deletions
This file was deleted.

hubspot-contacts/src/lib.rs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,8 @@
6161
pub mod basic;
6262
#[cfg(feature = "requests")]
6363
pub mod batch;
64-
#[cfg(feature = "requests")]
65-
pub mod gdpr;
6664
mod methods;
6765
#[cfg(feature = "requests")]
68-
pub mod public_object;
69-
#[cfg(feature = "requests")]
7066
pub mod search;
7167
#[cfg(test)]
7268
mod tests;
@@ -321,16 +317,6 @@ impl Client {
321317
basic::Basic::new(self.clone())
322318
}
323319

324-
/// Return a reference to an interface that provides access to Public_Object operations.
325-
pub fn public_object(&self) -> public_object::PublicObject {
326-
public_object::PublicObject::new(self.clone())
327-
}
328-
329-
/// Return a reference to an interface that provides access to GDPR operations.
330-
pub fn gdpr(&self) -> gdpr::Gdpr {
331-
gdpr::Gdpr::new(self.clone())
332-
}
333-
334320
/// Return a reference to an interface that provides access to Search operations.
335321
pub fn search(&self) -> search::Search {
336322
search::Search::new(self.clone())

hubspot-contacts/src/public_object.rs

Lines changed: 0 additions & 56 deletions
This file was deleted.

0 commit comments

Comments
 (0)