Skip to content

Commit

Permalink
Some functions with request id
Browse files Browse the repository at this point in the history
  • Loading branch information
jadeydi committed Sep 15, 2021
1 parent 502fe50 commit 7ad1d2a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
15 changes: 11 additions & 4 deletions asset.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ type Asset struct {
DepositEntries []DepositEntry `json:"deposit_entries"`
}

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

func AssetShow(ctx context.Context, assetId string, accessToken string) (*Asset, error) {
body, err := Request(ctx, "GET", "/assets/"+assetId, nil, accessToken)
func AssetList(ctx context.Context, accessToken string) ([]*Asset, error) {
return AssetListWithRequestID(ctx, accessToken, UuidNewV4().String())
}

func AssetShowWithRequestID(ctx context.Context, assetId string, accessToken, requestID string) (*Asset, error) {
body, err := RequestWithId(ctx, "GET", "/assets/"+assetId, nil, accessToken, requestID)
if err != nil {
return nil, err
}
Expand All @@ -72,6 +76,9 @@ func AssetShow(ctx context.Context, assetId string, accessToken string) (*Asset,
}
return &resp.Data, nil
}
func AssetShow(ctx context.Context, assetId string, accessToken string) (*Asset, error) {
return AssetShowWithRequestID(ctx, assetId, accessToken, UuidNewV4().String())
}

func AssetSearch(ctx context.Context, name string) ([]*Asset, error) {
body, err := Request(ctx, "GET", "/network/assets/search/"+name, nil, "")
Expand Down
8 changes: 6 additions & 2 deletions user.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ func UpdatePin(ctx context.Context, oldEncryptedPin, encryptedPin, uid, sid, ses
return nil
}

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

func UserMe(ctx context.Context, accessToken string) (*User, error) {
return UserMeWithRequestID(ctx, accessToken, UuidNewV4().String())
}

func UpdateUserMe(ctx context.Context, uid, sid, privateKey, fullName, avatarBase64 string) (*User, error) {
data, err := json.Marshal(map[string]interface{}{
"full_name": fullName,
Expand Down

0 comments on commit 7ad1d2a

Please sign in to comment.