Skip to content

Commit

Permalink
Merge pull request #9 from jolicode/fix/add-people-query-parameter
Browse files Browse the repository at this point in the history
Fix/add people query parameter
  • Loading branch information
xavierlacot authored Aug 19, 2020
2 parents cba667e + 44a15f0 commit 8a2eb67
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 5 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changes between versions

## 4.0.0 (2020-08-19)

* fixed the `/assignments` "`state`" query parameter description
* added the "`state`" query parameter on the `/people` endpoint

## 3.0.0 (2020-08-06)

* Upgrade to Jane 6.0
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ dump($clients);
dump($assignments);
```

In the above example, the `$client` variable is an instance of the [Client](./generated/Client.php) class, which you can browse through to learn more about the API features.

Want more example or documentation? See the [documentation](doc/index.md).

## Troubleshoot
Expand Down
12 changes: 11 additions & 1 deletion Resources/forecast-openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ paths:
type: string
format: date
- name: state
description: Only return assignments before this date
description: Pass "active" to only return assignments for currently active users
required: false
in: query
schema:
Expand Down Expand Up @@ -314,6 +314,16 @@ paths:
security:
- BearerAuth: []
AccountAuth: []
parameters:
- name: state
description: Pass "active" to only return active users. Any other value also returns archived users.
required: false
in: query
schema:
type: string
enum:
- active
- archived
responses:
"200":
description: People list
Expand Down
13 changes: 10 additions & 3 deletions generated/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function getAssignment(int $id, string $fetch = self::FETCH_OBJECT)
* @var int $repeated_assignment_set Only return assignments for this repeated assignment set
* @var string $start_date Only return assignments after this date
* @var string $end_date Only return assignments before this date
* @var string $state Only return assignments before this date
* @var string $state Pass "active" to only return assignments for currently active users
* }
*
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
Expand Down Expand Up @@ -133,13 +133,20 @@ public function getPerson(int $id, string $fetch = self::FETCH_OBJECT)
}

/**
* Returns a list of people.
*
* @param array $queryParameters {
*
* @var string $state Pass "active" to only return active users. Any other value also returns archived users.
* }
*
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
*
* @return \JoliCode\Forecast\Api\Model\People|\JoliCode\Forecast\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null
*/
public function listPeople(string $fetch = self::FETCH_OBJECT)
public function listPeople(array $queryParameters = [], string $fetch = self::FETCH_OBJECT)
{
return $this->executePsr7Endpoint(new \JoliCode\Forecast\Api\Endpoint\ListPeople(), $fetch);
return $this->executePsr7Endpoint(new \JoliCode\Forecast\Api\Endpoint\ListPeople($queryParameters), $fetch);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion generated/Endpoint/ListAssignments.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class ListAssignments extends \Jane\OpenApiRuntime\Client\BaseEndpoint implement
* @var int $repeated_assignment_set Only return assignments for this repeated assignment set
* @var string $start_date Only return assignments after this date
* @var string $end_date Only return assignments before this date
* @var string $state Only return assignments before this date
* @var string $state Pass "active" to only return assignments for currently active users
* }
*/
public function __construct(array $queryParameters = [])
Expand Down
24 changes: 24 additions & 0 deletions generated/Endpoint/ListPeople.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,19 @@ class ListPeople extends \Jane\OpenApiRuntime\Client\BaseEndpoint implements \Ja
{
use \Jane\OpenApiRuntime\Client\Psr7EndpointTrait;

/**
* Returns a list of people.
*
* @param array $queryParameters {
*
* @var string $state Pass "active" to only return active users. Any other value also returns archived users.
* }
*/
public function __construct(array $queryParameters = [])
{
$this->queryParameters = $queryParameters;
}

public function getMethod(): string
{
return 'GET';
Expand All @@ -40,6 +53,17 @@ public function getAuthenticationScopes(): array
return ['BearerAuth', 'AccountAuth'];
}

protected function getQueryOptionsResolver(): \Symfony\Component\OptionsResolver\OptionsResolver
{
$optionsResolver = parent::getQueryOptionsResolver();
$optionsResolver->setDefined(['state']);
$optionsResolver->setRequired([]);
$optionsResolver->setDefaults([]);
$optionsResolver->setAllowedTypes('state', ['string']);

return $optionsResolver;
}

/**
* {@inheritdoc}
*
Expand Down

0 comments on commit 8a2eb67

Please sign in to comment.