Skip to content

Commit

Permalink
feat: ability to create a closed deal by specifying the close dates &…
Browse files Browse the repository at this point in the history
… convert some date fields from string to DateTime
  • Loading branch information
DavidRouyer committed Oct 9, 2018
1 parent 96cb780 commit f6ad38d
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 21 deletions.
18 changes: 15 additions & 3 deletions src/Pipedrive.net/Models/Request/DealUpdate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,24 @@ public class DealUpdate : IEntityWithCustomFields
[JsonProperty("lost_reason")]
public string LostReason { get; set; }

[JsonProperty("add_time")]
public DateTime AddTime { get; set; }

[JsonProperty("visible_to")]
public Visibility VisibleTo { get; set; }

[JsonProperty("add_time")]
public DateTime? AddTime { get; set; }

[JsonProperty("close_time")]
public DateTime? CloseTime { get; set; }

[JsonProperty("lost_time")]
public DateTime? LostTime { get; set; }

[JsonProperty("first_won_time")]
public DateTime? FirstWonTime { get; set; }

[JsonProperty("won_time")]
public DateTime? WonTime { get; set; }

[JsonIgnore]
public IDictionary<string, ICustomField> CustomFields { get; set; }
}
Expand Down
15 changes: 14 additions & 1 deletion src/Pipedrive.net/Models/Request/NewDeal.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System;
using System.Collections.Generic;

namespace Pipedrive
Expand Down Expand Up @@ -41,7 +42,19 @@ public class NewDeal : IEntityWithCustomFields
public Visibility VisibleTo { get; set; }

[JsonProperty("add_time")]
public string AddTime { get; set; }
public DateTime? AddTime { get; set; }

[JsonProperty("close_time")]
public DateTime? CloseTime { get; set; }

[JsonProperty("lost_time")]
public DateTime? LostTime { get; set; }

[JsonProperty("first_won_time")]
public DateTime? FirstWonTime { get; set; }

[JsonProperty("won_time")]
public DateTime? WonTime { get; set; }

[JsonIgnore]
public IDictionary<string, ICustomField> CustomFields { get; set; } = new Dictionary<string, ICustomField>();
Expand Down
3 changes: 2 additions & 1 deletion src/Pipedrive.net/Models/Request/NewOrganization.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;

namespace Pipedrive
Expand All @@ -15,7 +16,7 @@ public class NewOrganization : IEntityWithCustomFields
public Visibility VisibleTo { get; set; }

[JsonProperty("add_time")]
public string AddTime { get; set; }
public DateTime? AddTime { get; set; }

[JsonIgnore]
public IDictionary<string, ICustomField> CustomFields { get; set; } = new Dictionary<string, ICustomField>();
Expand Down
3 changes: 2 additions & 1 deletion src/Pipedrive.net/Models/Request/NewPerson.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;

namespace Pipedrive
Expand All @@ -24,7 +25,7 @@ public class NewPerson : IEntityWithCustomFields
public Visibility VisibleTo { get; set; }

[JsonProperty("add_time")]
public string AddTime { get; set; }
public DateTime? AddTime { get; set; }

[JsonIgnore]
public IDictionary<string, ICustomField> CustomFields { get; set; } = new Dictionary<string, ICustomField>();
Expand Down
18 changes: 11 additions & 7 deletions src/Pipedrive.net/Models/Response/Deal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,19 +78,19 @@ public class Deal : IEntityWithCustomFields
public Visibility VisibleTo { get; set; }

[JsonProperty("close_time")]
public string CloseTime { get; set; }
public DateTime? CloseTime { get; set; }

[JsonProperty("pipeline_id")]
public long PipelineId { get; set; }

[JsonProperty("won_time")]
public string WonTime { get; set; }
public DateTime? WonTime { get; set; }

[JsonProperty("first_won_time")]
public string FirstWonTime { get; set; }
public DateTime? FirstWonTime { get; set; }

[JsonProperty("lost_time")]
public string LostTime { get; set; }
public DateTime? LostTime { get; set; }

[JsonProperty("products_count")]
public int ProductsCount { get; set; }
Expand Down Expand Up @@ -126,10 +126,10 @@ public class Deal : IEntityWithCustomFields
public DateTime? ExpectedCloseDate { get; set; }

[JsonProperty("last_incoming_mail_time")]
public string LastIncomingMailTime { get; set; }
public DateTime? LastIncomingMailTime { get; set; }

[JsonProperty("last_outgoing_mail_time")]
public string LastOutgoingMailTime { get; set; }
public DateTime? LastOutgoingMailTime { get; set; }

[JsonProperty("stage_order_nr")]
public int StageOrderNr { get; set; }
Expand Down Expand Up @@ -193,8 +193,12 @@ public DealUpdate ToUpdate()
Status = Status,
Probability = Probability,
LostReason = LostReason,
AddTime = AddTime,
VisibleTo = VisibleTo,
AddTime = AddTime,
CloseTime = CloseTime,
LostTime = LostTime,
FirstWonTime = FirstWonTime,
WonTime = WonTime,
CustomFields = CustomFields
};
}
Expand Down
4 changes: 2 additions & 2 deletions src/Pipedrive.net/Models/Response/Person.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,10 @@ public class Person : IEntityWithCustomFields
public string TimelineLastActivityTimeByOwner { get; set; }

[JsonProperty("last_incoming_mail_time")]
public string LastIncomingMailTime { get; set; }
public DateTime? LastIncomingMailTime { get; set; }

[JsonProperty("last_outgoing_mail_time")]
public string LastOutgoingMailTime { get; set; }
public DateTime? LastOutgoingMailTime { get; set; }

[JsonProperty("org_name")]
public string OrgName { get; set; }
Expand Down
12 changes: 6 additions & 6 deletions src/Pipedrive.net/Models/Response/WebhookDeal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,19 +77,19 @@ public class WebhookDeal : IEntityWithCustomFields
public Visibility VisibleTo { get; set; }

[JsonProperty("close_time")]
public string CloseTime { get; set; }
public DateTime? CloseTime { get; set; }

[JsonProperty("pipeline_id")]
public long PipelineId { get; set; }

[JsonProperty("won_time")]
public string WonTime { get; set; }
public DateTime? WonTime { get; set; }

[JsonProperty("first_won_time")]
public string FirstWonTime { get; set; }
public DateTime? FirstWonTime { get; set; }

[JsonProperty("lost_time")]
public string LostTime { get; set; }
public DateTime? LostTime { get; set; }

[JsonProperty("products_count")]
public int ProductsCount { get; set; }
Expand Down Expand Up @@ -125,10 +125,10 @@ public class WebhookDeal : IEntityWithCustomFields
public DateTime? ExpectedCloseDate { get; set; }

[JsonProperty("last_incoming_mail_time")]
public string LastIncomingMailTime { get; set; }
public DateTime? LastIncomingMailTime { get; set; }

[JsonProperty("last_outgoing_mail_time")]
public string LastOutgoingMailTime { get; set; }
public DateTime? LastOutgoingMailTime { get; set; }

[JsonProperty("stage_order_nr")]
public int StageOrderNr { get; set; }
Expand Down

0 comments on commit f6ad38d

Please sign in to comment.