Skip to content

Commit 7ad1d2a

Browse files
committed
Some functions with request id
1 parent 502fe50 commit 7ad1d2a

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

asset.go

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ type Asset struct {
2525
DepositEntries []DepositEntry `json:"deposit_entries"`
2626
}
2727

28-
func AssetList(ctx context.Context, accessToken string) ([]*Asset, error) {
29-
body, err := Request(ctx, "GET", "/assets", nil, accessToken)
28+
func AssetListWithRequestID(ctx context.Context, accessToken, requestID string) ([]*Asset, error) {
29+
body, err := RequestWithId(ctx, "GET", "/assets", nil, accessToken, requestID)
3030
if err != nil {
3131
return nil, err
3232
}
@@ -49,8 +49,12 @@ func AssetList(ctx context.Context, accessToken string) ([]*Asset, error) {
4949
return resp.Data, nil
5050
}
5151

52-
func AssetShow(ctx context.Context, assetId string, accessToken string) (*Asset, error) {
53-
body, err := Request(ctx, "GET", "/assets/"+assetId, nil, accessToken)
52+
func AssetList(ctx context.Context, accessToken string) ([]*Asset, error) {
53+
return AssetListWithRequestID(ctx, accessToken, UuidNewV4().String())
54+
}
55+
56+
func AssetShowWithRequestID(ctx context.Context, assetId string, accessToken, requestID string) (*Asset, error) {
57+
body, err := RequestWithId(ctx, "GET", "/assets/"+assetId, nil, accessToken, requestID)
5458
if err != nil {
5559
return nil, err
5660
}
@@ -72,6 +76,9 @@ func AssetShow(ctx context.Context, assetId string, accessToken string) (*Asset,
7276
}
7377
return &resp.Data, nil
7478
}
79+
func AssetShow(ctx context.Context, assetId string, accessToken string) (*Asset, error) {
80+
return AssetShowWithRequestID(ctx, assetId, accessToken, UuidNewV4().String())
81+
}
7582

7683
func AssetSearch(ctx context.Context, name string) ([]*Asset, error) {
7784
body, err := Request(ctx, "GET", "/network/assets/search/"+name, nil, "")

user.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ func UpdatePin(ctx context.Context, oldEncryptedPin, encryptedPin, uid, sid, ses
129129
return nil
130130
}
131131

132-
func UserMe(ctx context.Context, accessToken string) (*User, error) {
133-
body, err := Request(ctx, "GET", "/me", nil, accessToken)
132+
func UserMeWithRequestID(ctx context.Context, accessToken, requestID string) (*User, error) {
133+
body, err := RequestWithId(ctx, "GET", "/me", nil, accessToken, requestID)
134134
if err != nil {
135135
return nil, ServerError(ctx, err)
136136
}
@@ -148,6 +148,10 @@ func UserMe(ctx context.Context, accessToken string) (*User, error) {
148148
return resp.Data, nil
149149
}
150150

151+
func UserMe(ctx context.Context, accessToken string) (*User, error) {
152+
return UserMeWithRequestID(ctx, accessToken, UuidNewV4().String())
153+
}
154+
151155
func UpdateUserMe(ctx context.Context, uid, sid, privateKey, fullName, avatarBase64 string) (*User, error) {
152156
data, err := json.Marshal(map[string]interface{}{
153157
"full_name": fullName,

0 commit comments

Comments
 (0)