Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: get deal #27

Merged
merged 1 commit into from
Feb 27, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion deals.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ type DealCreateResponse struct {
Deal DealCreateResponseDeal `json:"deal"`
}

type GetDealOpts struct {
CompanyID int32 `url:"company_id,omitempty"`
}

// DealCreateResponseDeal struct for DealCreateResponseDeal
type DealCreateResponseDeal struct {
// 取引ID
Expand Down Expand Up @@ -177,7 +181,13 @@ func (c *Client) GetDeal(
ctx context.Context, oauth2Token *oauth2.Token, companyID int32, dealID int32,
) (*DealCreateResponse, *oauth2.Token, error) {
var result DealCreateResponse
oauth2Token, err := c.call(ctx, path.Join(APIPathDeals, strconv.Itoa(int(companyID)), strconv.Itoa(int(dealID))), http.MethodGet, oauth2Token, nil, nil, &result)
var dealOpt GetDealOpts
dealOpt.CompanyID = companyID
v, err := query.Values(dealOpt)
if err != nil {
return nil, oauth2Token, err
}
oauth2Token, err = c.call(ctx, path.Join(APIPathDeals, strconv.Itoa(int(dealID))), http.MethodGet, oauth2Token, v, nil, &result)
if err != nil {
return nil, oauth2Token, err
}
Expand Down