Skip to content

Commit

Permalink
fix: remove models.PlainResponse from user and portfolio calls
Browse files Browse the repository at this point in the history
  • Loading branch information
vividvilla committed Jul 5, 2018
1 parent 98bf0a0 commit 5fdd573
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
4 changes: 1 addition & 3 deletions portfolio.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"net/url"

"github.com/google/go-querystring/query"
"github.com/zerodhatech/go-kite-connect/models"
)

// Holding is an individual holdings response.
Expand Down Expand Up @@ -111,14 +110,13 @@ func (c *Client) ConvertPosition(positionParams ConvertPositionParams) (bool, er
b bool
err error
params url.Values
out models.PlainResponse
)

if params, err = query.Values(positionParams); err != nil {
return false, NewError(InputError, fmt.Sprintf("Error decoding order params: %v", err), nil)
}

if err = c.doEnvelope(http.MethodPut, URIConvertPosition, params, nil, &out); err == nil {
if err = c.doEnvelope(http.MethodPut, URIConvertPosition, params, nil, nil); err == nil {
b = true
}

Expand Down
13 changes: 4 additions & 9 deletions user.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import (
"fmt"
"net/http"
"net/url"

"github.com/zerodhatech/go-kite-connect/models"
)

// UserSession represents the response after a successful authentication.
Expand Down Expand Up @@ -110,18 +108,15 @@ func (c *Client) GenerateSession(requestToken string, apiSecret string) (UserSes
return session, err
}

func (c *Client) invalidateToken(tokenKey string, tokenValue string) (bool, error) {
var (
b bool
out models.PlainResponse
)
func (c *Client) invalidateToken(tokenType string, token string) (bool, error) {
var b bool

// construct url values
params := url.Values{}
params.Add("api_key", c.apiKey)
params.Add(tokenKey, tokenValue)
params.Add(tokenType, token)

err := c.doEnvelope(http.MethodDelete, URIUserSessionInvalidate, params, nil, &out)
err := c.doEnvelope(http.MethodDelete, URIUserSessionInvalidate, params, nil, nil)
if err == nil {
b = true
}
Expand Down

0 comments on commit 5fdd573

Please sign in to comment.