Skip to content

Commit d36ecde

Browse files
feat: Add Full User Profile
1 parent f07f57d commit d36ecde

File tree

4 files changed

+39
-0
lines changed

4 files changed

+39
-0
lines changed

connect.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ const (
9494
URIUserSessionInvalidate string = "/session/token"
9595
URIUserSessionRenew string = "/session/refresh_token"
9696
URIUserProfile string = "/user/profile"
97+
URIFullUserProfile string = "/user/profile/full"
9798
URIUserMargins string = "/user/margins"
9899
URIUserMarginsSegment string = "/user/margins/%s" // "/user/margins/{segment}"
99100

connect_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ var MockResponders = [][]string{
114114

115115
// GET endpoints
116116
{http.MethodGet, URIUserProfile, "profile.json"},
117+
{http.MethodGet, URIFullUserProfile, "full_profile.json"},
117118
{http.MethodGet, URIUserMargins, "margins.json"},
118119
{http.MethodGet, URIUserMarginsSegment, "margins_equity.json"},
119120
{http.MethodGet, URIGetOrders, "orders.json"},

user.go

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,28 @@ type UserProfile struct {
5454
Exchanges []string `json:"exchanges"`
5555
}
5656

57+
type FullUserProfile struct {
58+
UserID string `json:"user_id"`
59+
UserName string `json:"user_name"`
60+
AvatarURL string `json:"avatar_url"`
61+
UserType string `json:"user_type"`
62+
Email string `json:"email"`
63+
Phone string `json:"phone"`
64+
Broker string `json:"broker"`
65+
TwoFAType string `json:"twofa_type"`
66+
Banks []Bank `json:"bank_accounts"`
67+
DPIDs []string `json:"dp_ids"`
68+
Products []string `json:"products"`
69+
OrderTypes []string `json:"order_types"`
70+
Exchanges []string `json:"exchanges"`
71+
Pan string `json:"pan"`
72+
UserShortName string `json:"user_shortname"`
73+
Tags []string `json:"tags"`
74+
PasswordTimestamp string `json:"password_timestamp"`
75+
TwoFATimestamp string `json:"twofa_timestamp"`
76+
Meta UserMeta `json:"meta"`
77+
}
78+
5779
// Margins represents the user margins for a segment.
5880
type Margins struct {
5981
Category string `json:"-"`
@@ -178,6 +200,13 @@ func (c *Client) GetUserProfile() (UserProfile, error) {
178200
return userProfile, err
179201
}
180202

203+
// GetFullUserProfile gets full user profile.
204+
func (c *Client) GetFullUserProfile() (FullUserProfile, error) {
205+
var fUserProfile FullUserProfile
206+
err := c.doEnvelope(http.MethodGet, URIFullUserProfile, nil, nil, &fUserProfile)
207+
return fUserProfile, err
208+
}
209+
181210
// GetUserMargins gets all user margins.
182211
func (c *Client) GetUserMargins() (AllMargins, error) {
183212
var allUserMargins AllMargins

user_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ func (ts *TestSuite) TestGetUserProfile(t *testing.T) {
1212
}
1313
}
1414

15+
func (ts *TestSuite) TestGetFullUserProfile(t *testing.T) {
16+
t.Parallel()
17+
fullProfile, err := ts.KiteConnect.GetFullUserProfile()
18+
if err != nil || fullProfile.Email == "" || fullProfile.UserID == "" {
19+
t.Errorf("Error while reading full user profile. Error: %v", err)
20+
}
21+
}
22+
1523
func (ts *TestSuite) TestGetUserMargins(t *testing.T) {
1624
t.Parallel()
1725
margins, err := ts.KiteConnect.GetUserMargins()

0 commit comments

Comments
 (0)