Skip to main content

ghl_sdk/services/
contacts.rs

1// @generated by xtask/generate_services.py — do not edit by hand.
2//! `contacts` — typed methods for all 32 API v2 operations
3//! in this module.
4//!
5//! These methods live on the same [`ContactsService`](crate::contacts::ContactsService) you get from [`Ghl::contacts`](crate::Ghl::contacts), alongside the hand-written helpers.
6//!
7//! Request and response types come from [`ghl_models::v2::contacts`](https://docs.rs/ghl-models/latest/ghl_models/v2/contacts/); every endpoint is also documented in the
8//! [`contacts` API reference](https://github.com/Shahroz/ghl-rs/blob/main/docs/api/contacts.md).
9//!
10//! Enable with `features = ["contacts"]`.
11
12#![allow(clippy::too_many_arguments)]
13
14use crate::error::Result;
15use ghl_models::v2::contacts as models;
16
17use crate::contacts::ContactsService;
18
19/// Query parameters for [`ContactsService::get_contacts`].
20#[derive(Debug, Clone, Default)]
21pub struct GetContactsParams {
22    /// Location Id
23    /// Required by the API.
24    pub location_id: String,
25    /// Start After Id
26    pub start_after_id: Option<String>,
27    /// Start Afte
28    pub start_after: Option<f64>,
29    /// Contact Query
30    pub query: Option<String>,
31    /// Limit Per Page records count. will allow maximum up to 100 and default will be 20
32    pub limit: Option<f64>,
33}
34
35impl GetContactsParams {
36    /// Start from the parameters the API requires.
37    pub fn new(location_id: impl Into<String>) -> Self {
38        Self {
39            location_id: location_id.into(),
40            ..Default::default()
41        }
42    }
43
44    /// Start After Id
45    pub fn start_after_id(mut self, v: impl Into<String>) -> Self {
46        self.start_after_id = Some(v.into());
47        self
48    }
49
50    /// Start Afte
51    pub fn start_after(mut self, v: f64) -> Self {
52        self.start_after = Some(v);
53        self
54    }
55
56    /// Contact Query
57    pub fn query(mut self, v: impl Into<String>) -> Self {
58        self.query = Some(v.into());
59        self
60    }
61
62    /// Limit Per Page records count. will allow maximum up to 100 and default will be 20
63    pub fn limit(mut self, v: f64) -> Self {
64        self.limit = Some(v);
65        self
66    }
67
68    fn to_query(&self) -> Vec<(String, String)> {
69        let mut q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
70        if let Some(v) = &self.start_after_id {
71            q.push(("startAfterId".into(), v.to_string()));
72        }
73        if let Some(v) = &self.start_after {
74            q.push(("startAfter".into(), v.to_string()));
75        }
76        if let Some(v) = &self.query {
77            q.push(("query".into(), v.to_string()));
78        }
79        if let Some(v) = &self.limit {
80            q.push(("limit".into(), v.to_string()));
81        }
82        q
83    }
84}
85
86/// Query parameters for [`ContactsService::get_contacts_by_business_id`].
87#[derive(Debug, Clone, Default)]
88pub struct GetContactsByBusinessIdParams {
89    /// `limit` query parameter.
90    pub limit: Option<String>,
91    /// `locationId` query parameter.
92    /// Required by the API.
93    pub location_id: String,
94    /// `skip` query parameter.
95    pub skip: Option<String>,
96    /// `query` query parameter.
97    pub query: Option<String>,
98}
99
100impl GetContactsByBusinessIdParams {
101    /// Start from the parameters the API requires.
102    pub fn new(location_id: impl Into<String>) -> Self {
103        Self {
104            location_id: location_id.into(),
105            ..Default::default()
106        }
107    }
108
109    /// Set the `limit` query parameter.
110    pub fn limit(mut self, v: impl Into<String>) -> Self {
111        self.limit = Some(v.into());
112        self
113    }
114
115    /// Set the `skip` query parameter.
116    pub fn skip(mut self, v: impl Into<String>) -> Self {
117        self.skip = Some(v.into());
118        self
119    }
120
121    /// Set the `query` query parameter.
122    pub fn query(mut self, v: impl Into<String>) -> Self {
123        self.query = Some(v.into());
124        self
125    }
126
127    fn to_query(&self) -> Vec<(String, String)> {
128        let mut q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
129        if let Some(v) = &self.limit {
130            q.push(("limit".into(), v.to_string()));
131        }
132        if let Some(v) = &self.skip {
133            q.push(("skip".into(), v.to_string()));
134        }
135        if let Some(v) = &self.query {
136            q.push(("query".into(), v.to_string()));
137        }
138        q
139    }
140}
141
142/// Query parameters for [`ContactsService::get_duplicate_contact`].
143#[derive(Debug, Clone, Default)]
144pub struct GetDuplicateContactParams {
145    /// Location Id
146    /// Required by the API.
147    pub location_id: String,
148    /// Phone Number - Pass in URL Encoded form. i.e +1423164516 will become `%2B1423164516`
149    pub number: Option<String>,
150    /// Email - Pass in URL Encoded form. i.e test+abc@gmail.com will become
151    /// `test%2Babc%40gmail.com`
152    pub email: Option<String>,
153}
154
155impl GetDuplicateContactParams {
156    /// Start from the parameters the API requires.
157    pub fn new(location_id: impl Into<String>) -> Self {
158        Self {
159            location_id: location_id.into(),
160            ..Default::default()
161        }
162    }
163
164    /// Phone Number - Pass in URL Encoded form. i.e +1423164516 will become `%2B1423164516`
165    pub fn number(mut self, v: impl Into<String>) -> Self {
166        self.number = Some(v.into());
167        self
168    }
169
170    /// Email - Pass in URL Encoded form. i.e test+abc@gmail.com will become
171    /// `test%2Babc%40gmail.com`
172    pub fn email(mut self, v: impl Into<String>) -> Self {
173        self.email = Some(v.into());
174        self
175    }
176
177    fn to_query(&self) -> Vec<(String, String)> {
178        let mut q: Vec<(String, String)> = vec![("locationId".into(), self.location_id.clone())];
179        if let Some(v) = &self.number {
180            q.push(("number".into(), v.to_string()));
181        }
182        if let Some(v) = &self.email {
183            q.push(("email".into(), v.to_string()));
184        }
185        q
186    }
187}
188
189impl ContactsService {
190    /// Get Contacts
191    ///
192    /// Get Contacts **Note:** This API endpoint is deprecated. Please use the [Search
193    /// Contacts](https://marketplace.gohighlevel.com/docs/ghl/contacts/search-contacts-advanced)
194    /// endpoint instead.
195    ///
196    /// `GET /contacts/`
197    ///
198    /// Requires scope: `contacts.readonly`.
199    pub async fn get_contacts(
200        &self,
201        params: &GetContactsParams,
202    ) -> Result<models::ContactsSearchSuccessfulResponseDto> {
203        let query = params.to_query();
204        self.client
205            .send_versioned(
206                reqwest::Method::GET,
207                "/contacts/",
208                &query,
209                None::<&()>,
210                Some("2021-07-28"),
211            )
212            .await
213    }
214
215    /// Create Contact
216    ///
217    /// Please find the list of acceptable values for the `country` field here
218    ///
219    /// `POST /contacts/`
220    ///
221    /// Requires scope: `contacts.write`.
222    pub async fn create_contact(
223        &self,
224        body: &models::CreateContactDto,
225    ) -> Result<models::CreateContactsSuccessfulResponseDto> {
226        let query = Vec::new();
227        self.client
228            .send_versioned(
229                reqwest::Method::POST,
230                "/contacts/",
231                &query,
232                Some(body),
233                Some("2021-07-28"),
234            )
235            .await
236    }
237
238    /// Add/Remove Contacts From Business
239    ///
240    /// Add/Remove Contacts From Business . Passing a `null` businessId will remove the
241    /// businessId from the contacts
242    ///
243    /// `POST /contacts/bulk/business`
244    pub async fn add_remove_contacts_from_business(
245        &self,
246        body: &models::ContactsBusinessUpdate,
247    ) -> Result<models::ContactsBulkUpateResponse> {
248        let query = Vec::new();
249        self.client
250            .send_versioned(
251                reqwest::Method::POST,
252                "/contacts/bulk/business",
253                &query,
254                Some(body),
255                Some("2021-07-28"),
256            )
257            .await
258    }
259
260    /// Update Contacts Tags
261    ///
262    /// Allows you to update tags to multiple contacts at once, you can add or remove tags
263    /// from the contacts
264    ///
265    /// `POST /contacts/bulk/tags/update/{type}`
266    pub async fn update_contacts_tags(
267        &self,
268        type_: &str,
269        body: &models::UpdateTagsDTO,
270    ) -> Result<models::UpdateTagsResponseDTO> {
271        let path = format!(
272            "/contacts/bulk/tags/update/{}",
273            crate::services::encode(type_)
274        );
275        let query = Vec::new();
276        self.client
277            .send_versioned(
278                reqwest::Method::POST,
279                &path,
280                &query,
281                Some(body),
282                Some("2021-07-28"),
283            )
284            .await
285    }
286
287    /// Get Contacts By BusinessId
288    ///
289    /// `GET /contacts/business/{businessId}`
290    ///
291    /// Requires scope: `contacts.readonly`.
292    pub async fn get_contacts_by_business_id(
293        &self,
294        business_id: &str,
295        params: &GetContactsByBusinessIdParams,
296    ) -> Result<models::ContactsSearchSuccessfulResponseDto> {
297        let path = format!(
298            "/contacts/business/{}",
299            crate::services::encode(business_id)
300        );
301        let query = params.to_query();
302        self.client
303            .send_versioned(
304                reqwest::Method::GET,
305                &path,
306                &query,
307                None::<&()>,
308                Some("2021-07-28"),
309            )
310            .await
311    }
312
313    /// Search Contacts
314    ///
315    /// Search contacts based on combinations of advanced filters. Documentation Link -
316    /// <https://doc.clickup.com/8631005/d/h/87cpx-158396/6e629989abe7fad>
317    ///
318    /// `POST /contacts/search`
319    ///
320    /// Requires scope: `contacts.readonly`.
321    pub async fn search_contacts(
322        &self,
323        body: &models::SearchBodyV2DTO,
324    ) -> Result<serde_json::Value> {
325        let query = Vec::new();
326        self.client
327            .send_versioned(
328                reqwest::Method::POST,
329                "/contacts/search",
330                &query,
331                Some(body),
332                Some("2021-07-28"),
333            )
334            .await
335    }
336
337    /// Get Duplicate Contact
338    ///
339    /// Get Duplicate Contact. If `Allow Duplicate Contact` is disabled under Settings, the
340    /// global unique identifier will be used for searching the contact. If the setting is
341    /// enabled, first priority for search is `email` and the second priority will be
342    /// `phone`.
343    ///
344    /// `GET /contacts/search/duplicate`
345    ///
346    /// Requires scope: `contacts.readonly`.
347    pub async fn get_duplicate_contact(
348        &self,
349        params: &GetDuplicateContactParams,
350    ) -> Result<serde_json::Value> {
351        let query = params.to_query();
352        self.client
353            .send_versioned(
354                reqwest::Method::GET,
355                "/contacts/search/duplicate",
356                &query,
357                None::<&()>,
358                Some("2021-07-28"),
359            )
360            .await
361    }
362
363    /// Upsert Contact
364    ///
365    /// Please find the list of acceptable values for the `country` field here The Upsert
366    /// API will adhere to the configuration defined under the “Allow Duplicate Contact”
367    /// setting at the Location level. If the setting is configured to check both Email and
368    /// Phone, the API will attempt to identify an existing contact based on the priority
369    /// sequence specified in the setting, and will create or update the contact
370    /// accordingly. If two separate contacts already exist—one with the same email and
371    /// another w
372    ///
373    /// `POST /contacts/upsert`
374    ///
375    /// Requires scope: `contacts.write`.
376    pub async fn upsert_contact(
377        &self,
378        body: &models::UpsertContactDto,
379    ) -> Result<models::UpsertContactsSuccessfulResponseDto> {
380        let query = Vec::new();
381        self.client
382            .send_versioned(
383                reqwest::Method::POST,
384                "/contacts/upsert",
385                &query,
386                Some(body),
387                Some("2021-07-28"),
388            )
389            .await
390    }
391
392    /// Delete Contact
393    ///
394    /// `DELETE /contacts/{contactId}`
395    ///
396    /// Requires scope: `contacts.write`.
397    pub async fn delete_contact(
398        &self,
399        contact_id: &str,
400    ) -> Result<models::DeleteContactsSuccessfulResponseDto> {
401        let path = format!("/contacts/{}", crate::services::encode(contact_id));
402        let query = Vec::new();
403        self.client
404            .send_versioned(
405                reqwest::Method::DELETE,
406                &path,
407                &query,
408                None::<&()>,
409                Some("2021-07-28"),
410            )
411            .await
412    }
413
414    /// Get Contact
415    ///
416    /// `GET /contacts/{contactId}`
417    ///
418    /// Requires scope: `contacts.readonly`.
419    pub async fn get_contact(
420        &self,
421        contact_id: &str,
422    ) -> Result<models::ContactsByIdSuccessfulResponseDto> {
423        let path = format!("/contacts/{}", crate::services::encode(contact_id));
424        let query = Vec::new();
425        self.client
426            .send_versioned(
427                reqwest::Method::GET,
428                &path,
429                &query,
430                None::<&()>,
431                Some("2021-07-28"),
432            )
433            .await
434    }
435
436    /// Update Contact
437    ///
438    /// Please find the list of acceptable values for the `country` field here
439    ///
440    /// `PUT /contacts/{contactId}`
441    ///
442    /// Requires scope: `contacts.write`.
443    pub async fn update_contact(
444        &self,
445        contact_id: &str,
446        body: &models::UpdateContactDto,
447    ) -> Result<models::UpdateContactsSuccessfulResponseDto> {
448        let path = format!("/contacts/{}", crate::services::encode(contact_id));
449        let query = Vec::new();
450        self.client
451            .send_versioned(
452                reqwest::Method::PUT,
453                &path,
454                &query,
455                Some(body),
456                Some("2021-07-28"),
457            )
458            .await
459    }
460
461    /// Get Appointments for Contact
462    ///
463    /// `GET /contacts/{contactId}/appointments`
464    ///
465    /// Requires scope: `contacts.readonly`.
466    pub async fn get_appointments_for_contact(
467        &self,
468        contact_id: &str,
469    ) -> Result<models::GetEventsSuccessfulResponseDto> {
470        let path = format!(
471            "/contacts/{}/appointments",
472            crate::services::encode(contact_id)
473        );
474        let query = Vec::new();
475        self.client
476            .send_versioned(
477                reqwest::Method::GET,
478                &path,
479                &query,
480                None::<&()>,
481                Some("2021-07-28"),
482            )
483            .await
484    }
485
486    /// Remove Contact From Every Campaign
487    ///
488    /// `DELETE /contacts/{contactId}/campaigns/removeAll`
489    ///
490    /// Requires scope: `contacts.write`.
491    pub async fn remove_contact_from_every_campaign(
492        &self,
493        contact_id: &str,
494    ) -> Result<models::CreateDeleteCantactsCampaignsSuccessfulResponseDto> {
495        let path = format!(
496            "/contacts/{}/campaigns/removeAll",
497            crate::services::encode(contact_id)
498        );
499        let query = Vec::new();
500        self.client
501            .send_versioned(
502                reqwest::Method::DELETE,
503                &path,
504                &query,
505                None::<&()>,
506                Some("2021-07-28"),
507            )
508            .await
509    }
510
511    /// Remove Contact From Campaign
512    ///
513    /// `DELETE /contacts/{contactId}/campaigns/{campaignId}`
514    ///
515    /// Requires scope: `contacts.write`.
516    pub async fn remove_contact_from_campaign(
517        &self,
518        contact_id: &str,
519        campaign_id: &str,
520    ) -> Result<models::CreateDeleteCantactsCampaignsSuccessfulResponseDto> {
521        let path = format!(
522            "/contacts/{}/campaigns/{}",
523            crate::services::encode(contact_id),
524            crate::services::encode(campaign_id)
525        );
526        let query = Vec::new();
527        self.client
528            .send_versioned(
529                reqwest::Method::DELETE,
530                &path,
531                &query,
532                None::<&()>,
533                Some("2021-07-28"),
534            )
535            .await
536    }
537
538    /// Add Contact to Campaign
539    ///
540    /// Add contact to Campaign
541    ///
542    /// `POST /contacts/{contactId}/campaigns/{campaignId}`
543    ///
544    /// Requires scope: `contacts.write`.
545    pub async fn add_contact_to_campaign(
546        &self,
547        contact_id: &str,
548        campaign_id: &str,
549        body: &models::AddContactToCampaignDto,
550    ) -> Result<models::CreateDeleteCantactsCampaignsSuccessfulResponseDto> {
551        let path = format!(
552            "/contacts/{}/campaigns/{}",
553            crate::services::encode(contact_id),
554            crate::services::encode(campaign_id)
555        );
556        let query = Vec::new();
557        self.client
558            .send_versioned(
559                reqwest::Method::POST,
560                &path,
561                &query,
562                Some(body),
563                Some("2021-07-28"),
564            )
565            .await
566    }
567
568    /// Remove Followers
569    ///
570    /// `DELETE /contacts/{contactId}/followers`
571    ///
572    /// Requires scope: `contacts.write`.
573    pub async fn remove_followers(
574        &self,
575        contact_id: &str,
576        body: &models::FollowersDTO,
577    ) -> Result<models::DeleteFollowersSuccessfulResponseDto> {
578        let path = format!(
579            "/contacts/{}/followers",
580            crate::services::encode(contact_id)
581        );
582        let query = Vec::new();
583        self.client
584            .send_versioned(
585                reqwest::Method::DELETE,
586                &path,
587                &query,
588                Some(body),
589                Some("2021-07-28"),
590            )
591            .await
592    }
593
594    /// Add Followers
595    ///
596    /// `POST /contacts/{contactId}/followers`
597    ///
598    /// Requires scope: `contacts.write`.
599    pub async fn add_followers(
600        &self,
601        contact_id: &str,
602        body: &models::FollowersDTO,
603    ) -> Result<models::CreateAddFollowersSuccessfulResponseDto> {
604        let path = format!(
605            "/contacts/{}/followers",
606            crate::services::encode(contact_id)
607        );
608        let query = Vec::new();
609        self.client
610            .send_versioned(
611                reqwest::Method::POST,
612                &path,
613                &query,
614                Some(body),
615                Some("2021-07-28"),
616            )
617            .await
618    }
619
620    /// Get All Notes
621    ///
622    /// `GET /contacts/{contactId}/notes`
623    ///
624    /// Requires scope: `contacts.readonly`.
625    pub async fn get_all_notes(
626        &self,
627        contact_id: &str,
628    ) -> Result<models::GetNotesListSuccessfulResponseDto> {
629        let path = format!("/contacts/{}/notes", crate::services::encode(contact_id));
630        let query = Vec::new();
631        self.client
632            .send_versioned(
633                reqwest::Method::GET,
634                &path,
635                &query,
636                None::<&()>,
637                Some("2021-07-28"),
638            )
639            .await
640    }
641
642    /// Create Note
643    ///
644    /// `POST /contacts/{contactId}/notes`
645    ///
646    /// Requires scope: `contacts.write`.
647    pub async fn create_note(
648        &self,
649        contact_id: &str,
650        body: &models::NotesDTO,
651    ) -> Result<models::GetCreateUpdateNoteSuccessfulResponseDto> {
652        let path = format!("/contacts/{}/notes", crate::services::encode(contact_id));
653        let query = Vec::new();
654        self.client
655            .send_versioned(
656                reqwest::Method::POST,
657                &path,
658                &query,
659                Some(body),
660                Some("2021-07-28"),
661            )
662            .await
663    }
664
665    /// Delete Note
666    ///
667    /// `DELETE /contacts/{contactId}/notes/{id}`
668    ///
669    /// Requires scope: `contacts.write`.
670    pub async fn delete_note(
671        &self,
672        contact_id: &str,
673        id: &str,
674    ) -> Result<models::DeleteNoteSuccessfulResponseDto> {
675        let path = format!(
676            "/contacts/{}/notes/{}",
677            crate::services::encode(contact_id),
678            crate::services::encode(id)
679        );
680        let query = Vec::new();
681        self.client
682            .send_versioned(
683                reqwest::Method::DELETE,
684                &path,
685                &query,
686                None::<&()>,
687                Some("2021-07-28"),
688            )
689            .await
690    }
691
692    /// Get Note
693    ///
694    /// `GET /contacts/{contactId}/notes/{id}`
695    ///
696    /// Requires scope: `contacts.readonly`.
697    pub async fn get_note(
698        &self,
699        contact_id: &str,
700        id: &str,
701    ) -> Result<models::GetCreateUpdateNoteSuccessfulResponseDto> {
702        let path = format!(
703            "/contacts/{}/notes/{}",
704            crate::services::encode(contact_id),
705            crate::services::encode(id)
706        );
707        let query = Vec::new();
708        self.client
709            .send_versioned(
710                reqwest::Method::GET,
711                &path,
712                &query,
713                None::<&()>,
714                Some("2021-07-28"),
715            )
716            .await
717    }
718
719    /// Update Note
720    ///
721    /// `PUT /contacts/{contactId}/notes/{id}`
722    ///
723    /// Requires scope: `contacts.write`.
724    pub async fn update_note(
725        &self,
726        contact_id: &str,
727        id: &str,
728        body: &models::UpdateNoteDTO,
729    ) -> Result<models::GetCreateUpdateNoteSuccessfulResponseDto> {
730        let path = format!(
731            "/contacts/{}/notes/{}",
732            crate::services::encode(contact_id),
733            crate::services::encode(id)
734        );
735        let query = Vec::new();
736        self.client
737            .send_versioned(
738                reqwest::Method::PUT,
739                &path,
740                &query,
741                Some(body),
742                Some("2021-07-28"),
743            )
744            .await
745    }
746
747    /// Remove Tags
748    ///
749    /// `DELETE /contacts/{contactId}/tags`
750    ///
751    /// Requires scope: `contacts.write`.
752    pub async fn remove_tags(
753        &self,
754        contact_id: &str,
755        body: &models::TagsDTO,
756    ) -> Result<models::CreateDeleteTagSuccessfulResponseDto> {
757        let path = format!("/contacts/{}/tags", crate::services::encode(contact_id));
758        let query = Vec::new();
759        self.client
760            .send_versioned(
761                reqwest::Method::DELETE,
762                &path,
763                &query,
764                Some(body),
765                Some("2021-07-28"),
766            )
767            .await
768    }
769
770    /// Add Tags
771    ///
772    /// `POST /contacts/{contactId}/tags`
773    ///
774    /// Requires scope: `contacts.write`.
775    pub async fn add_tags(
776        &self,
777        contact_id: &str,
778        body: &models::TagsDTO,
779    ) -> Result<models::CreateAddTagSuccessfulResponseDto> {
780        let path = format!("/contacts/{}/tags", crate::services::encode(contact_id));
781        let query = Vec::new();
782        self.client
783            .send_versioned(
784                reqwest::Method::POST,
785                &path,
786                &query,
787                Some(body),
788                Some("2021-07-28"),
789            )
790            .await
791    }
792
793    /// Get all Tasks
794    ///
795    /// `GET /contacts/{contactId}/tasks`
796    ///
797    /// Requires scope: `contacts.readonly`.
798    pub async fn get_all_tasks(
799        &self,
800        contact_id: &str,
801    ) -> Result<models::TasksListSuccessfulResponseDto> {
802        let path = format!("/contacts/{}/tasks", crate::services::encode(contact_id));
803        let query = Vec::new();
804        self.client
805            .send_versioned(
806                reqwest::Method::GET,
807                &path,
808                &query,
809                None::<&()>,
810                Some("2021-07-28"),
811            )
812            .await
813    }
814
815    /// Create Task
816    ///
817    /// `POST /contacts/{contactId}/tasks`
818    ///
819    /// Requires scope: `contacts.write`.
820    pub async fn create_task(
821        &self,
822        contact_id: &str,
823        body: &models::CreateTaskParams,
824    ) -> Result<models::TaskByIsSuccessfulResponseDto> {
825        let path = format!("/contacts/{}/tasks", crate::services::encode(contact_id));
826        let query = Vec::new();
827        self.client
828            .send_versioned(
829                reqwest::Method::POST,
830                &path,
831                &query,
832                Some(body),
833                Some("2021-07-28"),
834            )
835            .await
836    }
837
838    /// Delete Task
839    ///
840    /// `DELETE /contacts/{contactId}/tasks/{taskId}`
841    ///
842    /// Requires scope: `contacts.write`.
843    pub async fn delete_task(
844        &self,
845        contact_id: &str,
846        task_id: &str,
847    ) -> Result<models::DeleteTaskSuccessfulResponseDto> {
848        let path = format!(
849            "/contacts/{}/tasks/{}",
850            crate::services::encode(contact_id),
851            crate::services::encode(task_id)
852        );
853        let query = Vec::new();
854        self.client
855            .send_versioned(
856                reqwest::Method::DELETE,
857                &path,
858                &query,
859                None::<&()>,
860                Some("2021-07-28"),
861            )
862            .await
863    }
864
865    /// Get Task
866    ///
867    /// `GET /contacts/{contactId}/tasks/{taskId}`
868    ///
869    /// Requires scope: `contacts.readonly`.
870    pub async fn get_task(
871        &self,
872        contact_id: &str,
873        task_id: &str,
874    ) -> Result<models::TaskByIsSuccessfulResponseDto> {
875        let path = format!(
876            "/contacts/{}/tasks/{}",
877            crate::services::encode(contact_id),
878            crate::services::encode(task_id)
879        );
880        let query = Vec::new();
881        self.client
882            .send_versioned(
883                reqwest::Method::GET,
884                &path,
885                &query,
886                None::<&()>,
887                Some("2021-07-28"),
888            )
889            .await
890    }
891
892    /// Update Task
893    ///
894    /// `PUT /contacts/{contactId}/tasks/{taskId}`
895    ///
896    /// Requires scope: `contacts.write`.
897    pub async fn update_task(
898        &self,
899        contact_id: &str,
900        task_id: &str,
901        body: &models::UpdateTaskBody,
902    ) -> Result<models::TaskByIsSuccessfulResponseDto> {
903        let path = format!(
904            "/contacts/{}/tasks/{}",
905            crate::services::encode(contact_id),
906            crate::services::encode(task_id)
907        );
908        let query = Vec::new();
909        self.client
910            .send_versioned(
911                reqwest::Method::PUT,
912                &path,
913                &query,
914                Some(body),
915                Some("2021-07-28"),
916            )
917            .await
918    }
919
920    /// Update Task Completed
921    ///
922    /// `PUT /contacts/{contactId}/tasks/{taskId}/completed`
923    ///
924    /// Requires scope: `contacts.write`.
925    pub async fn update_task_completed(
926        &self,
927        contact_id: &str,
928        task_id: &str,
929        body: &models::UpdateTaskStatusParams,
930    ) -> Result<models::TaskByIsSuccessfulResponseDto> {
931        let path = format!(
932            "/contacts/{}/tasks/{}/completed",
933            crate::services::encode(contact_id),
934            crate::services::encode(task_id)
935        );
936        let query = Vec::new();
937        self.client
938            .send_versioned(
939                reqwest::Method::PUT,
940                &path,
941                &query,
942                Some(body),
943                Some("2021-07-28"),
944            )
945            .await
946    }
947
948    /// Delete Contact from Workflow
949    ///
950    /// `DELETE /contacts/{contactId}/workflow/{workflowId}`
951    ///
952    /// Requires scope: `contacts.write`.
953    pub async fn delete_contact_from_workflow(
954        &self,
955        contact_id: &str,
956        workflow_id: &str,
957        body: &models::CreateWorkflowDto,
958    ) -> Result<models::ContactsWorkflowSuccessfulResponseDto> {
959        let path = format!(
960            "/contacts/{}/workflow/{}",
961            crate::services::encode(contact_id),
962            crate::services::encode(workflow_id)
963        );
964        let query = Vec::new();
965        self.client
966            .send_versioned(
967                reqwest::Method::DELETE,
968                &path,
969                &query,
970                Some(body),
971                Some("2021-07-28"),
972            )
973            .await
974    }
975
976    /// Add Contact to Workflow
977    ///
978    /// `POST /contacts/{contactId}/workflow/{workflowId}`
979    ///
980    /// Requires scope: `contacts.write`.
981    pub async fn add_contact_to_workflow(
982        &self,
983        contact_id: &str,
984        workflow_id: &str,
985        body: &models::CreateWorkflowDto,
986    ) -> Result<models::ContactsWorkflowSuccessfulResponseDto> {
987        let path = format!(
988            "/contacts/{}/workflow/{}",
989            crate::services::encode(contact_id),
990            crate::services::encode(workflow_id)
991        );
992        let query = Vec::new();
993        self.client
994            .send_versioned(
995                reqwest::Method::POST,
996                &path,
997                &query,
998                Some(body),
999                Some("2021-07-28"),
1000            )
1001            .await
1002    }
1003}