-
Notifications
You must be signed in to change notification settings - Fork 0
/
VenmoUser.cs
executable file
·123 lines (121 loc) · 3.48 KB
/
VenmoUser.cs
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
116
117
118
119
120
121
122
123
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
namespace VenmoWrapper
{
/// <summary>
/// A class containing all the data Venmo provides about a user,
/// including the current user. Check if balance, phone number, or email
/// are null to determine if this is the current user or not.
/// </summary>
[DataContract]
public class VenmoUser : IComparable
{
//TODO: Remove the first_name firstname, etc... duplication.
[DataMember]
public string username { get; set; }
[DataMember]
public string id { get; set; }
[DataMember]
public string first_name { get; set; }
[IgnoreDataMember]
public string firstname
{
get
{
return first_name;
}
set
{
first_name = value;
}
}
[DataMember]
public string last_name { get; set; }
[IgnoreDataMember]
public string lastname
{
get
{
return last_name;
}
set
{
last_name = value;
}
}
[DataMember]
public string display_name { get; set; }
[IgnoreDataMember]
public string name
{
get
{
return display_name;
}
set
{
display_name = value;
}
}
[DataMember]
public bool is_friend { get; set; }
[DataMember]
public int friends_count { get; set; }
[DataMember]
public string date_joined { get; set; }
[DataMember]
public string profile_picture_url { get; set; }
[IgnoreDataMember]
public string picture
{
get
{
return profile_picture_url;
}
set
{
profile_picture_url = value;
}
}
[DataMember]
public string about { get; set; }
[DataMember]
public double balance { get; set; }
[IgnoreDataMember]
public string formattedBalance
{
get
{
if (balance >= 0)
{
return balance.ToString("N2");
}
return "";
}
}
[DataMember]
public string phone { get; set; }
[DataMember]
public string email { get; set; }
/// <summary>
/// Standard CompareTo method. Compares on first name, then last name.
/// </summary>
/// <param name="obj">The VenmoUser to which to compare this user.</param>
/// <returns>1 if the provided user comes after this user, 0 if they are the same,
/// and -1 if this user comes after the provided user.</returns>
public int CompareTo(object obj)
{
VenmoUser user = obj as VenmoUser;
if (user == null)
{
throw new ArgumentException("Object is not of type VenmoUser");
}
int same = this.first_name.CompareTo(user.first_name);
return same == 0 ? this.last_name.CompareTo(user.last_name) : same;
}
}
}