Skip to main content

ghl_models/v3/
opportunities.rs

1//! `opportunities` data models for GoHighLevel API V3 (26 types).
2//!
3//! Generated from HighLevel's official OpenAPI spec for the
4//! **Opportunities** module. Every endpoint that uses these types, with its
5//! parameters, required scopes and enum values, is documented in the
6//! [`opportunities` API reference](https://github.com/Shahroz/ghl-rs/blob/main/docs/api/opportunities.md).
7//!
8//! Enable with `features = ["opportunities"]`.
9// @generated by xtask/generate_models.py — do not edit by hand.
10// Source: https://github.com/GoHighLevel/highlevel-api-docs
11// Doc comments are HighLevel's own field descriptions, reflowed verbatim, so
12// they aren't held to rustdoc's markdown conventions.
13#![allow(
14    missing_docs,
15    clippy::doc_lazy_continuation,
16    clippy::doc_overindented_list_items
17)]
18
19use serde::{Deserialize, Serialize};
20
21/// `AdditionalDetailsDTO` from the GoHighLevel OpenAPI spec.
22#[derive(Debug, Clone, Default, Serialize, Deserialize)]
23pub struct AdditionalDetailsDTO {
24    /// Include notes in the response
25    /// Required by the API.
26    pub notes: bool,
27    /// Include tasks in the response
28    /// Required by the API.
29    pub tasks: bool,
30    /// Include calendar events in the response
31    /// Required by the API.
32    #[serde(rename = "calendarEvents")]
33    pub calendar_events: bool,
34    /// Include unread conversations count in the response
35    /// Required by the API.
36    #[serde(rename = "unReadConversations")]
37    pub un_read_conversations: bool,
38}
39
40/// `CreateAddFollowersSuccessfulResponseDto` from the GoHighLevel OpenAPI spec.
41#[derive(Debug, Clone, Default, Serialize, Deserialize)]
42pub struct CreateAddFollowersSuccessfulResponseDto {
43    /// Current list of all follower user IDs after the operation
44    #[serde(default, skip_serializing_if = "Vec::is_empty")]
45    pub followers: Vec<String>,
46    /// User IDs that were successfully added as followers
47    #[serde(
48        rename = "followersAdded",
49        default,
50        skip_serializing_if = "Vec::is_empty"
51    )]
52    pub followers_added: Vec<String>,
53}
54
55/// `CreateDtoV3` from the GoHighLevel OpenAPI spec.
56#[derive(Debug, Clone, Default, Serialize, Deserialize)]
57pub struct CreateDtoV3 {
58    /// pipeline Id
59    /// Required by the API.
60    #[serde(rename = "pipelineId")]
61    pub pipeline_id: String,
62    /// Identifier of the location (sub-account)
63    /// Required by the API.
64    #[serde(rename = "locationId")]
65    pub location_id: String,
66    /// Name of the opportunity
67    /// Required by the API.
68    pub name: String,
69    /// Identifier of the pipeline stage
70    #[serde(
71        rename = "pipelineStageId",
72        default,
73        skip_serializing_if = "Option::is_none"
74    )]
75    pub pipeline_stage_id: Option<String>,
76    /// Current status of the opportunity
77    /// Allowed values: `open`, `won`, `lost`, `abandoned`, `all`.
78    /// Required by the API.
79    pub status: String,
80    /// Identifier of the contact linked to the opportunity
81    /// Required by the API.
82    #[serde(rename = "contactId")]
83    pub contact_id: String,
84    /// Monetary value of the opportunity
85    #[serde(
86        rename = "monetaryValue",
87        default,
88        skip_serializing_if = "Option::is_none"
89    )]
90    pub monetary_value: Option<f64>,
91    /// Expected close date. Supported formats: YYYY/MM/DD, MM/DD/YYYY, YYYY-MM-DD, MM-DD-YYYY,
92    /// YYYY.MM.DD, MM.DD.YYYY, or ISO 8601
93    #[serde(
94        rename = "forecastExpectedCloseDate",
95        default,
96        skip_serializing_if = "Option::is_none"
97    )]
98    pub forecast_expected_close_date: Option<String>,
99    /// Forecast probability
100    #[serde(
101        rename = "forecastProbability",
102        default,
103        skip_serializing_if = "Option::is_none"
104    )]
105    pub forecast_probability: Option<f64>,
106    /// Identifier of the user the opportunity is assigned to
107    #[serde(
108        rename = "assignedTo",
109        default,
110        skip_serializing_if = "Option::is_none"
111    )]
112    pub assigned_to: Option<String>,
113    /// Add custom fields to opportunities.
114    /// Multiple possible shapes in the spec; raw JSON.
115    #[serde(
116        rename = "customFields",
117        default,
118        skip_serializing_if = "Vec::is_empty"
119    )]
120    pub custom_fields: Vec<serde_json::Value>,
121}
122
123/// `CustomFieldResponseSchema` from the GoHighLevel OpenAPI spec.
124#[derive(Debug, Clone, Default, Serialize, Deserialize)]
125pub struct CustomFieldResponseSchema {
126    /// Unique identifier of the custom field
127    /// Required by the API.
128    pub id: String,
129    /// The value of the custom field
130    /// Multiple possible shapes in the spec; raw JSON.
131    /// Required by the API.
132    #[serde(rename = "fieldValue")]
133    pub field_value: serde_json::Value,
134}
135
136/// `DeleteFollowersSuccessfulResponseDto` from the GoHighLevel OpenAPI spec.
137#[derive(Debug, Clone, Default, Serialize, Deserialize)]
138pub struct DeleteFollowersSuccessfulResponseDto {
139    /// Current list of all follower user IDs after the operation
140    #[serde(default, skip_serializing_if = "Vec::is_empty")]
141    pub followers: Vec<String>,
142    /// User IDs that were successfully removed as followers
143    #[serde(
144        rename = "followersRemoved",
145        default,
146        skip_serializing_if = "Vec::is_empty"
147    )]
148    pub followers_removed: Vec<String>,
149}
150
151/// `DeleteUpdateOpportunitySuccessfulResponseDto` from the GoHighLevel OpenAPI spec.
152#[derive(Debug, Clone, Default, Serialize, Deserialize)]
153pub struct DeleteUpdateOpportunitySuccessfulResponseDto {
154    /// Indicates whether the operation was successful. Deprecated — use `success` instead.
155    #[serde(default, skip_serializing_if = "Option::is_none")]
156    pub succeded: Option<bool>,
157    /// Indicates whether the operation was successful
158    #[serde(default, skip_serializing_if = "Option::is_none")]
159    pub success: Option<bool>,
160}
161
162/// `FollowersDTO` from the GoHighLevel OpenAPI spec.
163#[derive(Debug, Clone, Default, Serialize, Deserialize)]
164pub struct FollowersDTO {
165    /// Array of user IDs to add or remove as followers (max 10)
166    /// Required by the API.
167    #[serde(default, skip_serializing_if = "Vec::is_empty")]
168    pub followers: Vec<String>,
169}
170
171/// `GetPipelinesSuccessfulResponseDto` from the GoHighLevel OpenAPI spec.
172#[derive(Debug, Clone, Default, Serialize, Deserialize)]
173pub struct GetPipelinesSuccessfulResponseDto {
174    /// List of pipelines for the location
175    #[serde(default, skip_serializing_if = "Vec::is_empty")]
176    pub pipelines: Vec<PipelinesResponseSchema>,
177}
178
179/// `GetPostOpportunitySuccessfulResponseDto` from the GoHighLevel OpenAPI spec.
180#[derive(Debug, Clone, Default, Serialize, Deserialize)]
181pub struct GetPostOpportunitySuccessfulResponseDto {
182    /// The created or retrieved opportunity object
183    #[serde(default, skip_serializing_if = "Option::is_none")]
184    pub opportunity: Option<SearchOpportunitiesResponseSchema>,
185}
186
187/// `LostReasonResponseSchema` from the GoHighLevel OpenAPI spec.
188#[derive(Debug, Clone, Default, Serialize, Deserialize)]
189pub struct LostReasonResponseSchema {
190    /// lost reason id
191    #[serde(default, skip_serializing_if = "Option::is_none")]
192    pub id: Option<String>,
193    /// lost reason name
194    #[serde(default, skip_serializing_if = "Option::is_none")]
195    pub name: Option<String>,
196    /// location id
197    #[serde(
198        rename = "locationId",
199        default,
200        skip_serializing_if = "Option::is_none"
201    )]
202    pub location_id: Option<String>,
203    /// updated at
204    /// Format: date-time (ISO-8601 string).
205    #[serde(rename = "updatedAt", default, skip_serializing_if = "Option::is_none")]
206    pub updated_at: Option<String>,
207    /// created at
208    /// Format: date-time (ISO-8601 string).
209    #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")]
210    pub created_at: Option<String>,
211}
212
213/// `LostReasonsResponseSchema` from the GoHighLevel OpenAPI spec.
214#[derive(Debug, Clone, Default, Serialize, Deserialize)]
215pub struct LostReasonsResponseSchema {
216    /// List of lost reasons for the location
217    #[serde(rename = "lostReasons", default, skip_serializing_if = "Vec::is_empty")]
218    pub lost_reasons: Vec<LostReasonResponseSchema>,
219    /// Total number of lost reasons matching the query
220    #[serde(default, skip_serializing_if = "Option::is_none")]
221    pub total: Option<f64>,
222}
223
224/// `OpportunitySearchBodyDTO` from the GoHighLevel OpenAPI spec.
225#[derive(Debug, Clone, Default, Serialize, Deserialize)]
226pub struct OpportunitySearchBodyDTO {
227    /// Location Id
228    /// Required by the API.
229    #[serde(rename = "locationId")]
230    pub location_id: String,
231    /// Full-text search query string (max 75 characters)
232    /// Required by the API.
233    pub query: String,
234    /// Maximum number of results to return per page
235    /// Required by the API.
236    pub limit: f64,
237    /// Page number (0-indexed)
238    /// Required by the API.
239    pub page: f64,
240    /// Search-after cursor values for deep pagination
241    /// Required by the API.
242    #[serde(rename = "searchAfter", default, skip_serializing_if = "Vec::is_empty")]
243    pub search_after: Vec<String>,
244    /// Flags to include additional related entities in the response
245    /// Required by the API.
246    #[serde(rename = "additionalDetails")]
247    pub additional_details: AdditionalDetailsDTO,
248}
249
250/// `PipelinesResponseSchema` from the GoHighLevel OpenAPI spec.
251#[derive(Debug, Clone, Default, Serialize, Deserialize)]
252pub struct PipelinesResponseSchema {
253    /// Unique identifier of the pipeline
254    #[serde(default, skip_serializing_if = "Option::is_none")]
255    pub id: Option<String>,
256    /// Name of the pipeline
257    #[serde(default, skip_serializing_if = "Option::is_none")]
258    pub name: Option<String>,
259    /// Stages belonging to this pipeline
260    #[serde(default, skip_serializing_if = "Vec::is_empty")]
261    pub stages: Vec<Vec<serde_json::Value>>,
262    /// Whether the pipeline is shown in the funnel view
263    #[serde(
264        rename = "showInFunnel",
265        default,
266        skip_serializing_if = "Option::is_none"
267    )]
268    pub show_in_funnel: Option<bool>,
269    /// Whether the pipeline is shown in the pie chart view
270    #[serde(
271        rename = "showInPieChart",
272        default,
273        skip_serializing_if = "Option::is_none"
274    )]
275    pub show_in_pie_chart: Option<bool>,
276    /// Identifier of the location (sub-account) this pipeline belongs to
277    #[serde(
278        rename = "locationId",
279        default,
280        skip_serializing_if = "Option::is_none"
281    )]
282    pub location_id: Option<String>,
283    /// Whether stage-level win probability is enabled for this pipeline
284    #[serde(
285        rename = "useOpportunityProbability",
286        default,
287        skip_serializing_if = "Option::is_none"
288    )]
289    pub use_opportunity_probability: Option<bool>,
290    /// How pipeline/stage colors are rendered
291    /// Allowed values: `dot`, `bg-tint`, `none`.
292    #[serde(
293        rename = "colorRenderMode",
294        default,
295        skip_serializing_if = "Option::is_none"
296    )]
297    pub color_render_mode: Option<String>,
298}
299
300/// `PostSearchSuccessfulResponseDto` from the GoHighLevel OpenAPI spec.
301#[derive(Debug, Clone, Default, Serialize, Deserialize)]
302pub struct PostSearchSuccessfulResponseDto {
303    /// List of opportunities matching the search criteria
304    #[serde(default, skip_serializing_if = "Vec::is_empty")]
305    pub opportunities: Vec<SearchOpportunitiesResponseSchema>,
306    /// Total number of opportunities matching the query
307    /// Required by the API.
308    pub total: f64,
309    /// Per-stage totals when pipeline filter is present
310    #[serde(
311        rename = "stageAggregations",
312        default,
313        skip_serializing_if = "Vec::is_empty"
314    )]
315    pub stage_aggregations: Vec<StageAggregationResponseDto>,
316    /// Aggregation results keyed by aggregation name
317    #[serde(default, skip_serializing_if = "Option::is_none")]
318    pub aggregations: Option<serde_json::Value>,
319}
320
321/// `SearchMetaResponseSchema` from the GoHighLevel OpenAPI spec.
322#[derive(Debug, Clone, Default, Serialize, Deserialize)]
323pub struct SearchMetaResponseSchema {
324    /// Total number of opportunities matching the query
325    #[serde(default, skip_serializing_if = "Option::is_none")]
326    pub total: Option<f64>,
327    /// URL to retrieve the next page of results
328    #[serde(
329        rename = "nextPageUrl",
330        default,
331        skip_serializing_if = "Option::is_none"
332    )]
333    pub next_page_url: Option<String>,
334    /// Cursor id to use for pagination (startAfterId param)
335    #[serde(
336        rename = "startAfterId",
337        default,
338        skip_serializing_if = "Option::is_none"
339    )]
340    pub start_after_id: Option<String>,
341    /// Cursor timestamp to use for pagination (startAfter param)
342    #[serde(
343        rename = "startAfter",
344        default,
345        skip_serializing_if = "Option::is_none"
346    )]
347    pub start_after: Option<f64>,
348    /// Current page number
349    #[serde(
350        rename = "currentPage",
351        default,
352        skip_serializing_if = "Option::is_none"
353    )]
354    pub current_page: Option<f64>,
355    /// Next page number
356    #[serde(rename = "nextPage", default, skip_serializing_if = "Option::is_none")]
357    pub next_page: Option<f64>,
358    /// Previous page number
359    #[serde(rename = "prevPage", default, skip_serializing_if = "Option::is_none")]
360    pub prev_page: Option<f64>,
361}
362
363/// `SearchOpportunitiesContactResponseSchema` from the GoHighLevel OpenAPI spec.
364#[derive(Debug, Clone, Default, Serialize, Deserialize)]
365pub struct SearchOpportunitiesContactResponseSchema {
366    /// Unique identifier of the contact
367    #[serde(default, skip_serializing_if = "Option::is_none")]
368    pub id: Option<String>,
369    /// Full name of the contact
370    #[serde(default, skip_serializing_if = "Option::is_none")]
371    pub name: Option<String>,
372    /// Company name associated with the contact
373    #[serde(
374        rename = "companyName",
375        default,
376        skip_serializing_if = "Option::is_none"
377    )]
378    pub company_name: Option<String>,
379    /// Email address of the contact
380    #[serde(default, skip_serializing_if = "Option::is_none")]
381    pub email: Option<String>,
382    /// Phone number of the contact
383    #[serde(default, skip_serializing_if = "Option::is_none")]
384    pub phone: Option<String>,
385    /// Tags associated with the contact
386    #[serde(default, skip_serializing_if = "Vec::is_empty")]
387    pub tags: Vec<String>,
388}
389
390/// `SearchOpportunitiesResponseSchema` from the GoHighLevel OpenAPI spec.
391#[derive(Debug, Clone, Default, Serialize, Deserialize)]
392pub struct SearchOpportunitiesResponseSchema {
393    /// Unique identifier of the opportunity
394    #[serde(default, skip_serializing_if = "Option::is_none")]
395    pub id: Option<String>,
396    /// Name of the opportunity
397    #[serde(default, skip_serializing_if = "Option::is_none")]
398    pub name: Option<String>,
399    /// Monetary value of the opportunity
400    #[serde(
401        rename = "monetaryValue",
402        default,
403        skip_serializing_if = "Option::is_none"
404    )]
405    pub monetary_value: Option<f64>,
406    /// Identifier of the pipeline the opportunity belongs to
407    #[serde(
408        rename = "pipelineId",
409        default,
410        skip_serializing_if = "Option::is_none"
411    )]
412    pub pipeline_id: Option<String>,
413    /// Identifier of the pipeline stage the opportunity is in
414    #[serde(
415        rename = "pipelineStageId",
416        default,
417        skip_serializing_if = "Option::is_none"
418    )]
419    pub pipeline_stage_id: Option<String>,
420    /// Identifier of the user the opportunity is assigned to
421    #[serde(
422        rename = "assignedTo",
423        default,
424        skip_serializing_if = "Option::is_none"
425    )]
426    pub assigned_to: Option<String>,
427    /// Current status of the opportunity
428    #[serde(default, skip_serializing_if = "Option::is_none")]
429    pub status: Option<String>,
430    /// Source of the opportunity
431    #[serde(default, skip_serializing_if = "Option::is_none")]
432    pub source: Option<String>,
433    /// ISO 8601 timestamp of the last status change
434    #[serde(
435        rename = "lastStatusChangeAt",
436        default,
437        skip_serializing_if = "Option::is_none"
438    )]
439    pub last_status_change_at: Option<String>,
440    /// ISO 8601 timestamp of the last stage change
441    #[serde(
442        rename = "lastStageChangeAt",
443        default,
444        skip_serializing_if = "Option::is_none"
445    )]
446    pub last_stage_change_at: Option<String>,
447    /// ISO 8601 timestamp of the last action on the opportunity
448    #[serde(
449        rename = "lastActionDate",
450        default,
451        skip_serializing_if = "Option::is_none"
452    )]
453    pub last_action_date: Option<String>,
454    /// Index version of the opportunity record
455    #[serde(
456        rename = "indexVersion",
457        default,
458        skip_serializing_if = "Option::is_none"
459    )]
460    pub index_version: Option<String>,
461    /// ISO 8601 timestamp when the opportunity was created
462    #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")]
463    pub created_at: Option<String>,
464    /// ISO 8601 timestamp when the opportunity was last updated
465    #[serde(rename = "updatedAt", default, skip_serializing_if = "Option::is_none")]
466    pub updated_at: Option<String>,
467    /// Expected close date for the forecast (YYYY-MM-DD)
468    #[serde(
469        rename = "forecastExpectedCloseDate",
470        default,
471        skip_serializing_if = "Option::is_none"
472    )]
473    pub forecast_expected_close_date: Option<String>,
474    /// Original forecast close date before any slippage (YYYY-MM-DD)
475    #[serde(
476        rename = "forecastOriginalCloseDate",
477        default,
478        skip_serializing_if = "Option::is_none"
479    )]
480    pub forecast_original_close_date: Option<String>,
481    /// Number of times the close date has slipped
482    #[serde(
483        rename = "forecastSlippageCount",
484        default,
485        skip_serializing_if = "Option::is_none"
486    )]
487    pub forecast_slippage_count: Option<f64>,
488    /// Total days the close date has slipped
489    #[serde(
490        rename = "forecastDaysSlipped",
491        default,
492        skip_serializing_if = "Option::is_none"
493    )]
494    pub forecast_days_slipped: Option<f64>,
495    /// ISO 8601 timestamp of the last close-date slip
496    #[serde(
497        rename = "forecastLastSlippedAt",
498        default,
499        skip_serializing_if = "Option::is_none"
500    )]
501    pub forecast_last_slipped_at: Option<String>,
502    /// Forecast win probability percentage (0–100)
503    #[serde(
504        rename = "forecastProbability",
505        default,
506        skip_serializing_if = "Option::is_none"
507    )]
508    pub forecast_probability: Option<f64>,
509    /// Effective win probability after stage and forecast adjustments (0–100)
510    #[serde(
511        rename = "effectiveProbability",
512        default,
513        skip_serializing_if = "Option::is_none"
514    )]
515    pub effective_probability: Option<f64>,
516    /// Identifier of the contact linked to the opportunity
517    #[serde(rename = "contactId", default, skip_serializing_if = "Option::is_none")]
518    pub contact_id: Option<String>,
519    /// Identifier of the location (sub-account) the opportunity belongs to
520    #[serde(
521        rename = "locationId",
522        default,
523        skip_serializing_if = "Option::is_none"
524    )]
525    pub location_id: Option<String>,
526    /// Contact details associated with the opportunity
527    #[serde(default, skip_serializing_if = "Option::is_none")]
528    pub contact: Option<SearchOpportunitiesContactResponseSchema>,
529    /// Notes attached to the opportunity
530    #[serde(default, skip_serializing_if = "Vec::is_empty")]
531    pub notes: Vec<Vec<serde_json::Value>>,
532    /// Tasks attached to the opportunity
533    #[serde(default, skip_serializing_if = "Vec::is_empty")]
534    pub tasks: Vec<Vec<serde_json::Value>>,
535    /// Calendar events attached to the opportunity
536    #[serde(
537        rename = "calendarEvents",
538        default,
539        skip_serializing_if = "Vec::is_empty"
540    )]
541    pub calendar_events: Vec<Vec<serde_json::Value>>,
542    /// Identifier of the lost reason if the opportunity was marked lost
543    #[serde(
544        rename = "lostReasonId",
545        default,
546        skip_serializing_if = "Option::is_none"
547    )]
548    pub lost_reason_id: Option<String>,
549    /// Custom fields associated with the opportunity
550    #[serde(
551        rename = "customFields",
552        default,
553        skip_serializing_if = "Vec::is_empty"
554    )]
555    pub custom_fields: Vec<CustomFieldResponseSchema>,
556    /// User IDs following this opportunity
557    #[serde(default, skip_serializing_if = "Vec::is_empty")]
558    pub followers: Vec<Vec<serde_json::Value>>,
559    /// External object identifier for integrations
560    #[serde(
561        rename = "externalObjectId",
562        default,
563        skip_serializing_if = "Option::is_none"
564    )]
565    pub external_object_id: Option<String>,
566}
567
568/// `SearchSuccessfulResponseDto` from the GoHighLevel OpenAPI spec.
569#[derive(Debug, Clone, Default, Serialize, Deserialize)]
570pub struct SearchSuccessfulResponseDto {
571    /// List of opportunities matching the search criteria
572    #[serde(default, skip_serializing_if = "Vec::is_empty")]
573    pub opportunities: Vec<SearchOpportunitiesResponseSchema>,
574    /// Pagination metadata for the result set
575    #[serde(default, skip_serializing_if = "Option::is_none")]
576    pub meta: Option<SearchMetaResponseSchema>,
577    /// Aggregation results keyed by aggregation name
578    #[serde(default, skip_serializing_if = "Option::is_none")]
579    pub aggregations: Option<serde_json::Value>,
580}
581
582/// `StageAggregationResponseDto` from the GoHighLevel OpenAPI spec.
583#[derive(Debug, Clone, Default, Serialize, Deserialize)]
584pub struct StageAggregationResponseDto {
585    /// Identifier of the pipeline stage being aggregated
586    /// Required by the API.
587    #[serde(rename = "pipelineStageId")]
588    pub pipeline_stage_id: String,
589    /// Total number of opportunities in this stage
590    /// Required by the API.
591    #[serde(rename = "totalCount")]
592    pub total_count: f64,
593    /// Total monetary value of all opportunities in this stage
594    /// Required by the API.
595    #[serde(rename = "totalValue")]
596    pub total_value: f64,
597    /// Probability-weighted total value of opportunities in this stage
598    /// Required by the API.
599    #[serde(rename = "weightedValue")]
600    pub weighted_value: f64,
601    /// Total value of open opportunities in this stage
602    /// Required by the API.
603    #[serde(rename = "openValue")]
604    pub open_value: f64,
605    /// Probability-weighted value of open opportunities in this stage
606    /// Required by the API.
607    #[serde(rename = "openWeightedValue")]
608    pub open_weighted_value: f64,
609    /// Total value of won opportunities in this stage
610    /// Required by the API.
611    #[serde(rename = "wonValue")]
612    pub won_value: f64,
613}
614
615/// `UpdateOpportunityDtoV3` from the GoHighLevel OpenAPI spec.
616#[derive(Debug, Clone, Default, Serialize, Deserialize)]
617pub struct UpdateOpportunityDtoV3 {
618    /// pipeline Id
619    #[serde(
620        rename = "pipelineId",
621        default,
622        skip_serializing_if = "Option::is_none"
623    )]
624    pub pipeline_id: Option<String>,
625    /// Name of the opportunity
626    #[serde(default, skip_serializing_if = "Option::is_none")]
627    pub name: Option<String>,
628    /// Identifier of the pipeline stage
629    #[serde(
630        rename = "pipelineStageId",
631        default,
632        skip_serializing_if = "Option::is_none"
633    )]
634    pub pipeline_stage_id: Option<String>,
635    /// Current status of the opportunity
636    /// Allowed values: `open`, `won`, `lost`, `abandoned`, `all`.
637    #[serde(default, skip_serializing_if = "Option::is_none")]
638    pub status: Option<String>,
639    /// Monetary value of the opportunity
640    #[serde(
641        rename = "monetaryValue",
642        default,
643        skip_serializing_if = "Option::is_none"
644    )]
645    pub monetary_value: Option<f64>,
646    /// Expected close date. Supported formats: YYYY/MM/DD, MM/DD/YYYY, YYYY-MM-DD, MM-DD-YYYY,
647    /// YYYY.MM.DD, MM.DD.YYYY, or ISO 8601
648    #[serde(
649        rename = "forecastExpectedCloseDate",
650        default,
651        skip_serializing_if = "Option::is_none"
652    )]
653    pub forecast_expected_close_date: Option<String>,
654    /// Forecast probability
655    #[serde(
656        rename = "forecastProbability",
657        default,
658        skip_serializing_if = "Option::is_none"
659    )]
660    pub forecast_probability: Option<f64>,
661    /// Identifier of the user the opportunity is assigned to
662    #[serde(
663        rename = "assignedTo",
664        default,
665        skip_serializing_if = "Option::is_none"
666    )]
667    pub assigned_to: Option<String>,
668    /// Update custom fields to opportunities.
669    /// Multiple possible shapes in the spec; raw JSON.
670    #[serde(
671        rename = "customFields",
672        default,
673        skip_serializing_if = "Vec::is_empty"
674    )]
675    pub custom_fields: Vec<serde_json::Value>,
676}
677
678/// `UpdateStatusDto` from the GoHighLevel OpenAPI spec.
679#[derive(Debug, Clone, Default, Serialize, Deserialize)]
680pub struct UpdateStatusDto {
681    /// New status for the opportunity
682    /// Allowed values: `open`, `won`, `lost`, `abandoned`, `all`.
683    /// Required by the API.
684    pub status: String,
685    /// lost reason Id
686    #[serde(
687        rename = "lostReasonId",
688        default,
689        skip_serializing_if = "Option::is_none"
690    )]
691    pub lost_reason_id: Option<String>,
692}
693
694/// `UpsertOpportunityDto` from the GoHighLevel OpenAPI spec.
695#[derive(Debug, Clone, Default, Serialize, Deserialize)]
696pub struct UpsertOpportunityDto {
697    /// opportunityId
698    #[serde(default, skip_serializing_if = "Option::is_none")]
699    pub id: Option<String>,
700    /// pipeline Id
701    /// Required by the API.
702    #[serde(rename = "pipelineId")]
703    pub pipeline_id: String,
704    /// locationId
705    /// Required by the API.
706    #[serde(rename = "locationId")]
707    pub location_id: String,
708    /// contactId
709    /// Required by the API.
710    #[serde(default, skip_serializing_if = "Vec::is_empty")]
711    pub followers: Vec<String>,
712    /// isRemoveAllFollowers
713    /// Required by the API.
714    #[serde(rename = "isRemoveAllFollowers")]
715    pub is_remove_all_followers: bool,
716    /// followers action type
717    /// Allowed values: `add`, `remove`.
718    /// Required by the API.
719    #[serde(rename = "followersActionType")]
720    pub followers_action_type: String,
721    /// name
722    #[serde(default, skip_serializing_if = "Option::is_none")]
723    pub name: Option<String>,
724    /// Current status of the opportunity
725    /// Allowed values: `open`, `won`, `lost`, `abandoned`, `all`.
726    #[serde(default, skip_serializing_if = "Option::is_none")]
727    pub status: Option<String>,
728    /// Identifier of the pipeline stage
729    #[serde(
730        rename = "pipelineStageId",
731        default,
732        skip_serializing_if = "Option::is_none"
733    )]
734    pub pipeline_stage_id: Option<String>,
735    /// Monetary value of the opportunity
736    #[serde(
737        rename = "monetaryValue",
738        default,
739        skip_serializing_if = "Option::is_none"
740    )]
741    pub monetary_value: Option<serde_json::Value>,
742    /// Expected close date. Supported formats: YYYY/MM/DD, MM/DD/YYYY, YYYY-MM-DD, MM-DD-YYYY,
743    /// YYYY.MM.DD, MM.DD.YYYY, or ISO 8601
744    #[serde(
745        rename = "forecastExpectedCloseDate",
746        default,
747        skip_serializing_if = "Option::is_none"
748    )]
749    pub forecast_expected_close_date: Option<String>,
750    /// Forecast probability
751    #[serde(
752        rename = "forecastProbability",
753        default,
754        skip_serializing_if = "Option::is_none"
755    )]
756    pub forecast_probability: Option<f64>,
757    /// Identifier of the user the opportunity is assigned to
758    #[serde(
759        rename = "assignedTo",
760        default,
761        skip_serializing_if = "Option::is_none"
762    )]
763    pub assigned_to: Option<String>,
764    /// lost reason Id
765    #[serde(
766        rename = "lostReasonId",
767        default,
768        skip_serializing_if = "Option::is_none"
769    )]
770    pub lost_reason_id: Option<String>,
771}
772
773/// `UpsertOpportunitySuccessfulResponseDto` from the GoHighLevel OpenAPI spec.
774#[derive(Debug, Clone, Default, Serialize, Deserialize)]
775pub struct UpsertOpportunitySuccessfulResponseDto {
776    /// Updated / New Opportunity
777    /// Required by the API.
778    pub opportunity: serde_json::Value,
779    /// Indicates whether the opportunity was newly created (true) or updated (false)
780    /// Required by the API.
781    pub new: bool,
782}
783
784/// `customFieldsInputArraySchemaV3` from the GoHighLevel OpenAPI spec.
785#[derive(Debug, Clone, Default, Serialize, Deserialize)]
786pub struct CustomFieldsInputArraySchemaV3 {
787    /// Pass either `id` or `key` of custom field
788    /// Required by the API.
789    pub id: String,
790    /// Pass either `id` or `key` of custom field
791    #[serde(default, skip_serializing_if = "Option::is_none")]
792    pub key: Option<String>,
793    /// Value of the custom field
794    #[serde(rename = "fieldValue", default, skip_serializing_if = "Vec::is_empty")]
795    pub field_value: Vec<String>,
796}
797
798/// `customFieldsInputObjectSchemaV3` from the GoHighLevel OpenAPI spec.
799#[derive(Debug, Clone, Default, Serialize, Deserialize)]
800pub struct CustomFieldsInputObjectSchemaV3 {
801    /// Pass either `id` or `key` of custom field
802    /// Required by the API.
803    pub id: String,
804    /// Pass either `id` or `key` of custom field
805    #[serde(default, skip_serializing_if = "Option::is_none")]
806    pub key: Option<String>,
807    /// Value of the custom field
808    #[serde(
809        rename = "fieldValue",
810        default,
811        skip_serializing_if = "Option::is_none"
812    )]
813    pub field_value: Option<serde_json::Value>,
814}
815
816/// `customFieldsInputStringSchemaV3` from the GoHighLevel OpenAPI spec.
817#[derive(Debug, Clone, Default, Serialize, Deserialize)]
818pub struct CustomFieldsInputStringSchemaV3 {
819    /// Pass either `id` or `key` of custom field
820    #[serde(default, skip_serializing_if = "Option::is_none")]
821    pub id: Option<String>,
822    /// Pass either `id` or `key` of custom field
823    #[serde(default, skip_serializing_if = "Option::is_none")]
824    pub key: Option<String>,
825    /// Value of the custom field
826    #[serde(
827        rename = "fieldValue",
828        default,
829        skip_serializing_if = "Option::is_none"
830    )]
831    pub field_value: Option<String>,
832}