[#180] sdk/client: Implement methods that attach tokens to Client

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2020-10-27 15:55:19 +03:00 committed by Alex Vanin
parent 805ad54f41
commit b2ba0eef07
3 changed files with 23 additions and 0 deletions

View file

@ -110,3 +110,19 @@ func v2SessionClientFromOptions(opts *clientOptions) (cli *v2session.Client, err
return cli, nil
}
// AttachSessionToken attaches session token to client.
//
// Provided token is attached to all requests without WithSession option.
// Use WithSession(nil) option in order to send request without session token.
func (c *Client) AttachSessionToken(token *token.SessionToken) {
c.sessionToken = token
}
// AttachBearerToken attaches bearer token to client.
//
// Provided bearer is attached to all requests without WithBearer option.
// Use WithBearer(nil) option in order to send request without bearer token.
func (c *Client) AttachBearerToken(token *token.BearerToken) {
c.bearerToken = token
}