diff --git a/examples/collaborateurs.php b/examples/collaborateurs.php new file mode 100644 index 0000000..b24a571 --- /dev/null +++ b/examples/collaborateurs.php @@ -0,0 +1,25 @@ +getCollaborateurs([ + 'query' => ['referenceIds' => [$referenceId]] + ]); + var_dump($collaborateurs) ; +} catch (ApidaeException $e) { + echo $e->getcode() ; + echo $e->getMessage() ; + die() ; +} catch (Exception $e) { + echo $e->getcode() ; + echo $e->getMessage() ; + die() ; +} diff --git a/src/Client.php b/src/Client.php index cf560e0..8e4aa8f 100755 --- a/src/Client.php +++ b/src/Client.php @@ -22,6 +22,7 @@ use ApidaePHP\Exception\ApidaeException; use GuzzleHttp\Command\CommandInterface; use GuzzleHttp\Command\Guzzle\Operation; +use ApidaePHP\Description\Collaborateurs; use GuzzleHttp\Client as GuzzleHttpClient; use GuzzleHttp\Command\Guzzle\Description; use ApidaePHP\Description\TouristicObjects; @@ -1410,14 +1411,14 @@ class Client extends GuzzleClient use Export; use ApidaeSso; - const NAME = 'apidae-php'; - const VERSION = '2.0.0'; + public const NAME = 'apidae-php'; + public const VERSION = '2.0.0'; - const META_SCOPE = 'api_metadonnees'; - const SSO_SCOPE = 'sso'; - const EDIT_SCOPE = 'api_ecriture'; + public const META_SCOPE = 'api_metadonnees'; + public const SSO_SCOPE = 'sso'; + public const EDIT_SCOPE = 'api_ecriture'; - const ENVIRONMENTS = [ + public const ENVIRONMENTS = [ 'prod' => [ 'baseUri' => 'https://api.apidae-tourisme.com/', 'ssoBaseUrl' => 'https://base.apidae-tourisme.com' @@ -1502,6 +1503,7 @@ public function __construct(array $config = []) $this->operations = array_merge( Agenda::$operations, + Collaborateurs::$operations, Edit::$operations, Exports::$operations, Member::$operations, @@ -1616,7 +1618,7 @@ public function __call($method, array $args): array|string return $match[1]; } } - + if (! is_array($result) && preg_match('#^Guzzle.*Result$#', get_class($result))) { return $result->toArray() ; } diff --git a/src/Description/Collaborateurs.php b/src/Description/Collaborateurs.php new file mode 100644 index 0000000..26f863f --- /dev/null +++ b/src/Description/Collaborateurs.php @@ -0,0 +1,36 @@ + $operations */ + public static array $operations = array( + 'postCollaborateurs' => [ + 'httpMethod' => 'POST', + 'uri' => '/api/v002/collaborateurs/', + 'documentationUrl' => 'https://dev.apidae-tourisme.com/documentation-technique/v2/api-decriture/v002-collaborateurs/', + 'responseModel' => 'getResponse', + 'parameters' => [ + 'query' => [ + 'type' => 'string', + 'location' => 'formParam', + 'required' => true + ], + ], + ], + 'getCollaborateurs' => [ + 'httpMethod' => 'GET', + 'uri' => '/api/v002/collaborateurs/', + 'documentationUrl' => 'https://dev.apidae-tourisme.com/documentation-technique/v2/api-de-diffusion/liste-des-services/v002-collaborateurs/', + 'responseModel' => 'getResponse', + 'parameters' => [ + 'query' => [ + 'type' => 'string', + 'location' => 'formParam', + 'required' => true + ], + ], + ] + ); +}