From 2f98cf2f2c84dd92b29779fa56bd8cbc587d6d7d Mon Sep 17 00:00:00 2001 From: Laurent Le Houerou Date: Wed, 27 Mar 2024 08:37:45 +0400 Subject: [PATCH] add QueryRaw to graphql client --- graphql/client.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/graphql/client.go b/graphql/client.go index dbb827e..3481732 100644 --- a/graphql/client.go +++ b/graphql/client.go @@ -80,6 +80,21 @@ func (c *Client) Query( return c.gql.Query(ctx, q, variables, options...) } +func (c *Client) QueryRaw( + ctx context.Context, + q interface{}, + variables interface{}, + options ...graphql.Option, +) ([]byte, error) { + err := c.rl.Wait(ctx) + if err != nil { + return nil, errors.Wrap(err, "waiting for rate limit") + } + c.lock.Lock() + defer c.lock.Unlock() + return c.gql.QueryRaw(ctx, q, variables, options...) +} + func (c *Client) Mutate( ctx context.Context, q interface{},