-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathCartAddition.cs
More file actions
115 lines (108 loc) · 4.25 KB
/
CartAddition.cs
File metadata and controls
115 lines (108 loc) · 4.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/*
This file is auto-generated, do not edit
*/
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using Recombee.ApiClient.Util;
namespace Recombee.ApiClient.Bindings
{
/// <summary>CartAddition Binding</summary>
public class CartAddition: RecombeeBinding {
private readonly string userId;
/// <summary>User who added the item to the cart</summary>
[JsonProperty("userId")]
public string UserId
{
get {return userId;}
}
private readonly string itemId;
/// <summary>Item added to the cart</summary>
[JsonProperty("itemId")]
public string ItemId
{
get {return itemId;}
}
[JsonConverter(typeof(EpochJsonReader))]
private readonly DateTime? timestamp;
/// <summary>UTC timestamp of the cart addition as ISO8601-1 pattern or UTC epoch time. The default value is the current time.</summary>
[JsonConverter(typeof(EpochJsonReader))]
[JsonProperty("timeStamp")]
public DateTime? Timestamp
{
get {return timestamp;}
}
private readonly double? amount;
/// <summary>Amount (number) added to cart. The default is 1. For example if `user-x` adds two `item-y` during a single order (session...), the `amount` should equal to 2.</summary>
[JsonProperty("amount")]
public double? Amount
{
get {return amount;}
}
private readonly double? price;
/// <summary>Price of the added item. If `amount` is greater than 1, sum of prices of all the items should be given.</summary>
[JsonProperty("price")]
public double? Price
{
get {return price;}
}
private readonly string recommId;
/// <summary>If this cart addition is based on a recommendation request, `recommId` is the id of the clicked recommendation.</summary>
[JsonProperty("recommId")]
public string RecommId
{
get {return recommId;}
}
private readonly Dictionary<string, object> additionalData;
/// <summary>A dictionary of additional data for the interaction.</summary>
[JsonProperty("additionalData")]
public Dictionary<string, object> AdditionalData
{
get {return additionalData;}
}
public CartAddition (string userId, string itemId, DateTime? timestamp = null, double? amount = null, double? price = null, string recommId = null, Dictionary<string, object> additionalData = null)
{
this.userId = userId;
this.itemId = itemId;
this.timestamp = timestamp;
this.amount = amount;
this.price = price;
this.recommId = recommId;
this.additionalData = additionalData;
}
/// <summary>Determines whether the specified object is equal to the current object</summary>
/// <param name="obj">The object to compare with the current object</param>
/// <returns>true if the specified object is equal to the current object; otherwise, false</returns>
public override bool Equals(Object obj)
{
if (!(obj is CartAddition))
return false;
if (obj == this)
return true;
CartAddition that = (CartAddition) obj;
return new EqualsBuilder<CartAddition>(this, that)
.With(m => m.UserId)
.With(m => m.ItemId)
.With(m => m.Timestamp)
.With(m => m.Amount)
.With(m => m.Price)
.With(m => m.RecommId)
.With(m => m.AdditionalData)
.Equals();
}
/// <summary>Hash function</summary>
/// <returns>A hash code for the current object</returns>
public override int GetHashCode()
{
return new HashCodeBuilder<CartAddition>(this)
.With(m => m.UserId)
.With(m => m.ItemId)
.With(m => m.Timestamp)
.With(m => m.Amount)
.With(m => m.Price)
.With(m => m.RecommId)
.With(m => m.AdditionalData)
.HashCode;
}
}
}