Skip to content

Commit

Permalink
New field for referred by and example
Browse files Browse the repository at this point in the history
  • Loading branch information
mrz1836 committed Jan 19, 2020
1 parent a7885a7 commit 0de20c3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions definitions.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ type User struct {
PayoutAddress string `json:"payout_address,omitempty"`
Phone string `json:"phone,omitempty"`
PhoneVerified bool `json:"phone_verified,omitempty"`
ReferredByUserID uint64 `json:"referred_by_user_id,omitempty"`
Status string `json:"status,omitempty"`
}

Expand Down
14 changes: 14 additions & 0 deletions examples/examples.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,20 @@ func main() {
log.Printf("user %d updated - first_name: %s", user.ID, user.FirstName)
}

//
// Example: Create a user (referred by another user
//
refUser := &tonicpow.User{
Email: fmt.Sprintf("Tes_ti-ng+%[email protected]", rand.Intn(100000)),
Password: testPassword,
ReferredByUserID: user.ID,
}
if refUser, err = TonicPowAPI.CreateUser(refUser); err != nil {
log.Fatalf("create user failed error %s - api error: %s data: %s", err.Error(), TonicPowAPI.LastRequest.Error.Message, TonicPowAPI.LastRequest.Error.Data)
} else {
log.Printf("user %d created and referred by user %d", refUser.ID, refUser.ReferredByUserID)
}

//
// Example: Get new updated balance for user
//
Expand Down

0 comments on commit 0de20c3

Please sign in to comment.