Skip to content

Commit 1bc8c97

Browse files
committed
Release v1.0.17
* Introduced **Pull Multiple Notifications** endpoint
1 parent f761026 commit 1bc8c97

File tree

91 files changed

+878
-109
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+878
-109
lines changed

docs/Api/APINotificationCallbacksApi.md

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,70 @@ All URIs are relative to *https://www.{domain}/api/v3/integration*
44

55
Method | HTTP request | Description
66
------------- | ------------- | -------------
7+
[**pullMultipleNotification**](APINotificationCallbacksApi.md#pullmultiplenotification) | **GET** /notifications/multiple |
78
[**pullNotification**](APINotificationCallbacksApi.md#pullnotification) | **GET** /notifications |
89
[**pushNotifications**](APINotificationCallbacksApi.md#pushnotifications) | **POST** /{client-endpoint-url} |
910
[**releaseNotifications**](APINotificationCallbacksApi.md#releasenotifications) | **POST** /notifications/release |
1011

12+
# **pullMultipleNotification**
13+
> \DocPlanner\Client\Model\PullMultipleNotificationsResponse pullMultipleNotification($limit)
14+
15+
16+
17+
Pulling Notifications - You can pull multiple notifications via this endpoint. This page will respond to you with the earliest notifications you haven’t been pulled yet in the quantity limited by `limit` parameter. First In First Out (FIFO) principle applied here. This endpoint will respond with the collection of notifications and amount of remaining notifications. Important: Notifications that are not pulled in 72 hours are marked as expired and deleted from the system.
18+
19+
### Example
20+
```php
21+
<?php
22+
require_once(__DIR__ . '/vendor/autoload.php');
23+
24+
// Configure OAuth2 access token for authorization: OAuth 2.0
25+
$config = DocPlanner\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
26+
27+
$apiInstance = new DocPlanner\Client\Api\APINotificationCallbacksApi(
28+
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
29+
// This is optional, `GuzzleHttp\Client` will be used as default.
30+
new GuzzleHttp\Client(),
31+
$config
32+
);
33+
$limit = 56; // int | Maximum number of notifications pulled. Can take value from 1 to 100. If not provided the default value of 1 is applied.
34+
35+
try {
36+
$result = $apiInstance->pullMultipleNotification($limit);
37+
print_r($result);
38+
} catch (Exception $e) {
39+
echo 'Exception when calling APINotificationCallbacksApi->pullMultipleNotification: ', $e->getMessage(), PHP_EOL;
40+
}
41+
?>
42+
```
43+
44+
### Parameters
45+
46+
Name | Type | Description | Notes
47+
------------- | ------------- | ------------- | -------------
48+
**limit** | **int**| Maximum number of notifications pulled. Can take value from 1 to 100. If not provided the default value of 1 is applied. | [optional]
49+
50+
### Return type
51+
52+
[**\DocPlanner\Client\Model\PullMultipleNotificationsResponse**](../Model/PullMultipleNotificationsResponse.md)
53+
54+
### Authorization
55+
56+
[OAuth 2.0](../../README.md#OAuth 2.0)
57+
58+
### HTTP request headers
59+
60+
- **Content-Type**: Not defined
61+
- **Accept**: application/vnd.docplanner+json; charset=UTF-8, application/vnd.error+docplanner+json
62+
63+
[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md)
64+
1165
# **pullNotification**
1266
> \DocPlanner\Client\Model\Notification pullNotification()
1367
1468

1569

16-
Pulling Notifications - You can pull notifications via this endpoint. This page will respond to you with the earliest notification you haven’t been pulled yet. First In First Out (FIFO) principle applied here. This endpoint will respond with one notification per request until there aren’t any notifications left in the notification stack. Important: Notifications that are not pulled in 72 hours are marked as expired and deleted from the system.
70+
Pulling Notifications - You can pull notifications via this endpoint. This page will respond to you with the earliest notification you haven’t been pulled yet. First In First Out (FIFO) principle applied here. This endpoint will respond with one notification per request until there aren’t any notifications left in the notification queue. Important: Notifications that are not pulled in 72 hours are marked as expired and deleted from the system.
1771

1872
### Example
1973
```php

docs/Model/AddAddressServiceRequest.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Name | Type | Description | Notes
77
**is_price_from** | **bool** | If the specified price is the minimum price of the service | [optional]
88
**price** | **int** | Minimum price | [optional]
99
**description** | **string** | | [optional]
10+
**is_visible** | **bool** | | [optional]
1011

1112
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)
1213

docs/Model/AddressService.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Name | Type | Description | Notes
1111
**service_id** | **string** | | [optional]
1212
**description** | **string** | | [optional]
1313
**duration** | **int** | | [optional]
14+
**is_visible** | **bool** | | [optional]
1415

1516
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)
1617

docs/Model/AddressServiceNotification.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Name | Type | Description | Notes
77
**name** | **string** | | [optional]
88
**price** | **int** | | [optional]
99
**is_price_from** | **bool** | | [optional]
10+
**is_visible** | **bool** | | [optional]
1011

1112
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)
1213

docs/Model/CancelBookingRequest.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
## Properties
44
Name | Type | Description | Notes
55
------------ | ------------- | ------------- | -------------
6-
**send_notifications** | **bool** | | [optional]
6+
**reason** | **string** | Reason why visit was canceled | [optional]
7+
**send_notifications** | **bool** | Whether patient should get notification on canceling the visit | [optional] [default to true]
78

89
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)
910

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# PullMultipleNotificationsResponse
2+
3+
## Properties
4+
Name | Type | Description | Notes
5+
------------ | ------------- | ------------- | -------------
6+
**notifications** | [**\DocPlanner\Client\Model\Notification[]**](Notification.md) | | [optional]
7+
**remaining** | **int** | | [optional]
8+
9+
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)
10+

lib/Api/APINotificationCallbacksApi.php

Lines changed: 261 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*
1515
* Welcome to Docplanner Integrations [REST](https://en.wikipedia.org/wiki/Representational_state_transfer) API! This API gives You the ability to build Your own application and integrate it with Docplanner services.
1616
*
17-
* OpenAPI spec version: 1.0.13
17+
* OpenAPI spec version: 1.0.17
1818
*
1919
* Generated by: https://github.com/swagger-api/swagger-codegen.git
2020
* Swagger Codegen version: 3.0.24
@@ -86,6 +86,266 @@ public function getConfig()
8686
return $this->config;
8787
}
8888

89+
/**
90+
* Operation pullMultipleNotification
91+
*
92+
* @param int $limit Maximum number of notifications pulled. Can take value from 1 to 100. If not provided the default value of 1 is applied. (optional)
93+
*
94+
* @throws \DocPlanner\Client\ApiException on non-2xx response
95+
* @throws \InvalidArgumentException
96+
* @return \DocPlanner\Client\Model\PullMultipleNotificationsResponse
97+
*/
98+
public function pullMultipleNotification($limit = null)
99+
{
100+
list($response) = $this->pullMultipleNotificationWithHttpInfo($limit);
101+
return $response;
102+
}
103+
104+
/**
105+
* Operation pullMultipleNotificationWithHttpInfo
106+
*
107+
* @param int $limit Maximum number of notifications pulled. Can take value from 1 to 100. If not provided the default value of 1 is applied. (optional)
108+
*
109+
* @throws \DocPlanner\Client\ApiException on non-2xx response
110+
* @throws \InvalidArgumentException
111+
* @return array of \DocPlanner\Client\Model\PullMultipleNotificationsResponse, HTTP status code, HTTP response headers (array of strings)
112+
*/
113+
public function pullMultipleNotificationWithHttpInfo($limit = null)
114+
{
115+
$returnType = '\DocPlanner\Client\Model\PullMultipleNotificationsResponse';
116+
$request = $this->pullMultipleNotificationRequest($limit);
117+
118+
try {
119+
$options = $this->createHttpClientOption();
120+
try {
121+
$response = $this->client->send($request, $options);
122+
} catch (RequestException $e) {
123+
throw new ApiException(
124+
"[{$e->getCode()}] {$e->getMessage()}",
125+
$e->getCode(),
126+
$e->getResponse() ? $e->getResponse()->getHeaders() : null,
127+
$e->getResponse() ? $e->getResponse()->getBody()->getContents() : null
128+
);
129+
}
130+
131+
$statusCode = $response->getStatusCode();
132+
133+
if ($statusCode < 200 || $statusCode > 299) {
134+
throw new ApiException(
135+
sprintf(
136+
'[%d] Error connecting to the API (%s)',
137+
$statusCode,
138+
$request->getUri()
139+
),
140+
$statusCode,
141+
$response->getHeaders(),
142+
$response->getBody()
143+
);
144+
}
145+
146+
$responseBody = $response->getBody();
147+
if ($returnType === '\SplFileObject') {
148+
$content = $responseBody; //stream goes to serializer
149+
} else {
150+
$content = $responseBody->getContents();
151+
if (!in_array($returnType, ['string','integer','bool'])) {
152+
$content = json_decode($content);
153+
}
154+
}
155+
156+
return [
157+
ObjectSerializer::deserialize($content, $returnType, []),
158+
$response->getStatusCode(),
159+
$response->getHeaders()
160+
];
161+
162+
} catch (ApiException $e) {
163+
switch ($e->getCode()) {
164+
case 200:
165+
$data = ObjectSerializer::deserialize(
166+
$e->getResponseBody(),
167+
'\DocPlanner\Client\Model\PullMultipleNotificationsResponse',
168+
$e->getResponseHeaders()
169+
);
170+
$e->setResponseObject($data);
171+
break;
172+
case 404:
173+
$data = ObjectSerializer::deserialize(
174+
$e->getResponseBody(),
175+
'\DocPlanner\Client\Model\Error',
176+
$e->getResponseHeaders()
177+
);
178+
$e->setResponseObject($data);
179+
break;
180+
}
181+
throw $e;
182+
}
183+
}
184+
185+
/**
186+
* Operation pullMultipleNotificationAsync
187+
*
188+
*
189+
*
190+
* @param int $limit Maximum number of notifications pulled. Can take value from 1 to 100. If not provided the default value of 1 is applied. (optional)
191+
*
192+
* @throws \InvalidArgumentException
193+
* @return \GuzzleHttp\Promise\PromiseInterface
194+
*/
195+
public function pullMultipleNotificationAsync($limit = null)
196+
{
197+
return $this->pullMultipleNotificationAsyncWithHttpInfo($limit)
198+
->then(
199+
function ($response) {
200+
return $response[0];
201+
}
202+
);
203+
}
204+
205+
/**
206+
* Operation pullMultipleNotificationAsyncWithHttpInfo
207+
*
208+
*
209+
*
210+
* @param int $limit Maximum number of notifications pulled. Can take value from 1 to 100. If not provided the default value of 1 is applied. (optional)
211+
*
212+
* @throws \InvalidArgumentException
213+
* @return \GuzzleHttp\Promise\PromiseInterface
214+
*/
215+
public function pullMultipleNotificationAsyncWithHttpInfo($limit = null)
216+
{
217+
$returnType = '\DocPlanner\Client\Model\PullMultipleNotificationsResponse';
218+
$request = $this->pullMultipleNotificationRequest($limit);
219+
220+
return $this->client
221+
->sendAsync($request, $this->createHttpClientOption())
222+
->then(
223+
function ($response) use ($returnType) {
224+
$responseBody = $response->getBody();
225+
if ($returnType === '\SplFileObject') {
226+
$content = $responseBody; //stream goes to serializer
227+
} else {
228+
$content = $responseBody->getContents();
229+
if ($returnType !== 'string') {
230+
$content = json_decode($content);
231+
}
232+
}
233+
234+
return [
235+
ObjectSerializer::deserialize($content, $returnType, []),
236+
$response->getStatusCode(),
237+
$response->getHeaders()
238+
];
239+
},
240+
function ($exception) {
241+
$response = $exception->getResponse();
242+
$statusCode = $response->getStatusCode();
243+
throw new ApiException(
244+
sprintf(
245+
'[%d] Error connecting to the API (%s)',
246+
$statusCode,
247+
$exception->getRequest()->getUri()
248+
),
249+
$statusCode,
250+
$response->getHeaders(),
251+
$response->getBody()
252+
);
253+
}
254+
);
255+
}
256+
257+
/**
258+
* Create request for operation 'pullMultipleNotification'
259+
*
260+
* @param int $limit Maximum number of notifications pulled. Can take value from 1 to 100. If not provided the default value of 1 is applied. (optional)
261+
*
262+
* @throws \InvalidArgumentException
263+
* @return \GuzzleHttp\Psr7\Request
264+
*/
265+
protected function pullMultipleNotificationRequest($limit = null)
266+
{
267+
268+
$resourcePath = '/notifications/multiple';
269+
$formParams = [];
270+
$queryParams = [];
271+
$headerParams = [];
272+
$httpBody = '';
273+
$multipart = false;
274+
275+
// query params
276+
if ($limit !== null) {
277+
$queryParams['limit'] = ObjectSerializer::toQueryValue($limit, null);
278+
}
279+
280+
281+
// body params
282+
$_tempBody = null;
283+
284+
if ($multipart) {
285+
$headers = $this->headerSelector->selectHeadersForMultipart(
286+
['application/vnd.docplanner+json; charset=UTF-8', 'application/vnd.error+docplanner+json']
287+
);
288+
} else {
289+
$headers = $this->headerSelector->selectHeaders(
290+
['application/vnd.docplanner+json; charset=UTF-8', 'application/vnd.error+docplanner+json'],
291+
[]
292+
);
293+
}
294+
295+
// for model (json/xml)
296+
if (isset($_tempBody)) {
297+
// $_tempBody is the method argument, if present
298+
$httpBody = $_tempBody;
299+
// \stdClass has no __toString(), so we should encode it manually
300+
if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') {
301+
$httpBody = \GuzzleHttp\json_encode($httpBody);
302+
}
303+
} elseif (count($formParams) > 0) {
304+
if ($multipart) {
305+
$multipartContents = [];
306+
foreach ($formParams as $formParamName => $formParamValue) {
307+
$multipartContents[] = [
308+
'name' => $formParamName,
309+
'contents' => $formParamValue
310+
];
311+
}
312+
// for HTTP post (form)
313+
$httpBody = new MultipartStream($multipartContents);
314+
315+
} elseif ($headers['Content-Type'] === 'application/json') {
316+
$httpBody = \GuzzleHttp\json_encode($formParams);
317+
318+
} else {
319+
// for HTTP post (form)
320+
$httpBody = \GuzzleHttp\Psr7\build_query($formParams);
321+
}
322+
}
323+
324+
// this endpoint requires OAuth (access token)
325+
if ($this->config->getAccessToken() !== null) {
326+
$headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
327+
}
328+
329+
$defaultHeaders = [];
330+
if ($this->config->getUserAgent()) {
331+
$defaultHeaders['User-Agent'] = $this->config->getUserAgent();
332+
}
333+
334+
$headers = array_merge(
335+
$defaultHeaders,
336+
$headerParams,
337+
$headers
338+
);
339+
340+
$query = \GuzzleHttp\Psr7\build_query($queryParams);
341+
return new Request(
342+
'GET',
343+
$this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
344+
$headers,
345+
$httpBody
346+
);
347+
}
348+
89349
/**
90350
* Operation pullNotification
91351
*

0 commit comments

Comments
 (0)