[#218] pkg/client: Add raw flag for object.Get
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
parent
e11b1728be
commit
582cdd4ba3
1 changed files with 11 additions and 0 deletions
|
@ -32,6 +32,8 @@ type DeleteObjectParams struct {
|
||||||
type GetObjectParams struct {
|
type GetObjectParams struct {
|
||||||
addr *object.Address
|
addr *object.Address
|
||||||
|
|
||||||
|
raw bool
|
||||||
|
|
||||||
w io.Writer
|
w io.Writer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -346,6 +348,14 @@ func (p *GetObjectParams) WithPayloadWriter(w io.Writer) *GetObjectParams {
|
||||||
return p
|
return p
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *GetObjectParams) WithRawFlag(v bool) *GetObjectParams {
|
||||||
|
if p != nil {
|
||||||
|
p.raw = v
|
||||||
|
}
|
||||||
|
|
||||||
|
return p
|
||||||
|
}
|
||||||
|
|
||||||
func (c *Client) GetObject(ctx context.Context, p *GetObjectParams, opts ...CallOption) (*object.Object, error) {
|
func (c *Client) GetObject(ctx context.Context, p *GetObjectParams, opts ...CallOption) (*object.Object, error) {
|
||||||
// check remote node version
|
// check remote node version
|
||||||
switch c.remoteNode.Version.Major() {
|
switch c.remoteNode.Version.Major() {
|
||||||
|
@ -391,6 +401,7 @@ func (c *Client) getObjectV2(ctx context.Context, p *GetObjectParams, opts ...Ca
|
||||||
|
|
||||||
// fill body fields
|
// fill body fields
|
||||||
body.SetAddress(p.addr.ToV2())
|
body.SetAddress(p.addr.ToV2())
|
||||||
|
body.SetRaw(p.raw)
|
||||||
|
|
||||||
// sign the request
|
// sign the request
|
||||||
if err := signature.SignServiceMessage(c.key, req); err != nil {
|
if err := signature.SignServiceMessage(c.key, req); err != nil {
|
||||||
|
|
Loading…
Reference in a new issue