[#164] client: Refactor and document package functionality

Get rid of `Option` pattern. Define `Init`, `Dial` and `Close` methods
for the corresponding stages of use.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2022-03-07 14:39:49 +03:00 committed by Alex Vanin
parent df5c69eea5
commit 22dad0573d
18 changed files with 316 additions and 265 deletions

View file

@ -71,7 +71,7 @@ func (c *Client) SessionCreate(ctx context.Context, prm PrmSessionCreate) (*ResS
panic(panicMsgMissingContext)
}
ownerID := owner.NewIDFromPublicKey(&c.opts.key.PublicKey)
ownerID := owner.NewIDFromPublicKey(&c.prm.key.PublicKey)
// form request body
reqBody := new(v2session.CreateRequestBody)
@ -95,7 +95,7 @@ func (c *Client) SessionCreate(ctx context.Context, prm PrmSessionCreate) (*ResS
cc.req = &req
cc.statusRes = &res
cc.call = func() (responseV2, error) {
return rpcapi.CreateSession(c.Raw(), &req, client.WithContext(ctx))
return rpcapi.CreateSession(&c.c, &req, client.WithContext(ctx))
}
cc.result = func(r responseV2) {
resp := r.(*v2session.CreateResponse)