From f3db3fdb6312ec2e3ce9b09e2a2074a4027c1ec8 Mon Sep 17 00:00:00 2001 From: Vladimir Kolchin Date: Fri, 20 Jan 2023 08:31:25 +0100 Subject: [PATCH] add update-scopes method --- lib/RetailCrm/Methods/V5/Module.php | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/lib/RetailCrm/Methods/V5/Module.php b/lib/RetailCrm/Methods/V5/Module.php index 5322d08..421e02d 100644 --- a/lib/RetailCrm/Methods/V5/Module.php +++ b/lib/RetailCrm/Methods/V5/Module.php @@ -73,4 +73,32 @@ trait Module ['integrationModule' => json_encode($configuration)] ); } + + /** + * Update scopes + * + * @param string $code + * @param array $requires + * + * @throws \RetailCrm\Exception\InvalidJsonException + * @throws \RetailCrm\Exception\CurlException + * @throws \InvalidArgumentException + * + * @return \RetailCrm\Response\ApiResponse + */ + public function integrationModulesUpdateScopes($code, array $requires) + { + if (!count($requires) || empty($requires['scopes'])) { + throw new \InvalidArgumentException( + 'Parameter `requires` must contains a data & configuration `scopes` must be set' + ); + } + + /* @noinspection PhpUndefinedMethodInspection */ + return $this->client->makeRequest( + sprintf('/integration-modules/%s/update-scopes', $code), + "POST", + ['requires' => json_encode($requires)] + ); + } }