|
14 | 14 | *
|
15 | 15 | * 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.
|
16 | 16 | *
|
17 |
| - * OpenAPI spec version: 1.0.6 |
| 17 | + * OpenAPI spec version: 1.0.7 |
18 | 18 | *
|
19 | 19 | * Generated by: https://github.com/swagger-api/swagger-codegen.git
|
20 | 20 | * Swagger Codegen version: 3.0.24
|
@@ -539,6 +539,220 @@ protected function pushNotificationsRequest()
|
539 | 539 | );
|
540 | 540 | }
|
541 | 541 |
|
| 542 | + /** |
| 543 | + * Operation releaseNotifications |
| 544 | + * |
| 545 | + * |
| 546 | + * @throws \DocPlanner\Client\ApiException on non-2xx response |
| 547 | + * @throws \InvalidArgumentException |
| 548 | + * @return void |
| 549 | + */ |
| 550 | + public function releaseNotifications() |
| 551 | + { |
| 552 | + $this->releaseNotificationsWithHttpInfo(); |
| 553 | + } |
| 554 | + |
| 555 | + /** |
| 556 | + * Operation releaseNotificationsWithHttpInfo |
| 557 | + * |
| 558 | + * |
| 559 | + * @throws \DocPlanner\Client\ApiException on non-2xx response |
| 560 | + * @throws \InvalidArgumentException |
| 561 | + * @return array of null, HTTP status code, HTTP response headers (array of strings) |
| 562 | + */ |
| 563 | + public function releaseNotificationsWithHttpInfo() |
| 564 | + { |
| 565 | + $returnType = ''; |
| 566 | + $request = $this->releaseNotificationsRequest(); |
| 567 | + |
| 568 | + try { |
| 569 | + $options = $this->createHttpClientOption(); |
| 570 | + try { |
| 571 | + $response = $this->client->send($request, $options); |
| 572 | + } catch (RequestException $e) { |
| 573 | + throw new ApiException( |
| 574 | + "[{$e->getCode()}] {$e->getMessage()}", |
| 575 | + $e->getCode(), |
| 576 | + $e->getResponse() ? $e->getResponse()->getHeaders() : null, |
| 577 | + $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null |
| 578 | + ); |
| 579 | + } |
| 580 | + |
| 581 | + $statusCode = $response->getStatusCode(); |
| 582 | + |
| 583 | + if ($statusCode < 200 || $statusCode > 299) { |
| 584 | + throw new ApiException( |
| 585 | + sprintf( |
| 586 | + '[%d] Error connecting to the API (%s)', |
| 587 | + $statusCode, |
| 588 | + $request->getUri() |
| 589 | + ), |
| 590 | + $statusCode, |
| 591 | + $response->getHeaders(), |
| 592 | + $response->getBody() |
| 593 | + ); |
| 594 | + } |
| 595 | + |
| 596 | + return [null, $statusCode, $response->getHeaders()]; |
| 597 | + |
| 598 | + } catch (ApiException $e) { |
| 599 | + switch ($e->getCode()) { |
| 600 | + case 403: |
| 601 | + $data = ObjectSerializer::deserialize( |
| 602 | + $e->getResponseBody(), |
| 603 | + '\DocPlanner\Client\Model\Error', |
| 604 | + $e->getResponseHeaders() |
| 605 | + ); |
| 606 | + $e->setResponseObject($data); |
| 607 | + break; |
| 608 | + } |
| 609 | + throw $e; |
| 610 | + } |
| 611 | + } |
| 612 | + |
| 613 | + /** |
| 614 | + * Operation releaseNotificationsAsync |
| 615 | + * |
| 616 | + * |
| 617 | + * |
| 618 | + * |
| 619 | + * @throws \InvalidArgumentException |
| 620 | + * @return \GuzzleHttp\Promise\PromiseInterface |
| 621 | + */ |
| 622 | + public function releaseNotificationsAsync() |
| 623 | + { |
| 624 | + return $this->releaseNotificationsAsyncWithHttpInfo() |
| 625 | + ->then( |
| 626 | + function ($response) { |
| 627 | + return $response[0]; |
| 628 | + } |
| 629 | + ); |
| 630 | + } |
| 631 | + |
| 632 | + /** |
| 633 | + * Operation releaseNotificationsAsyncWithHttpInfo |
| 634 | + * |
| 635 | + * |
| 636 | + * |
| 637 | + * |
| 638 | + * @throws \InvalidArgumentException |
| 639 | + * @return \GuzzleHttp\Promise\PromiseInterface |
| 640 | + */ |
| 641 | + public function releaseNotificationsAsyncWithHttpInfo() |
| 642 | + { |
| 643 | + $returnType = ''; |
| 644 | + $request = $this->releaseNotificationsRequest(); |
| 645 | + |
| 646 | + return $this->client |
| 647 | + ->sendAsync($request, $this->createHttpClientOption()) |
| 648 | + ->then( |
| 649 | + function ($response) use ($returnType) { |
| 650 | + return [null, $response->getStatusCode(), $response->getHeaders()]; |
| 651 | + }, |
| 652 | + function ($exception) { |
| 653 | + $response = $exception->getResponse(); |
| 654 | + $statusCode = $response->getStatusCode(); |
| 655 | + throw new ApiException( |
| 656 | + sprintf( |
| 657 | + '[%d] Error connecting to the API (%s)', |
| 658 | + $statusCode, |
| 659 | + $exception->getRequest()->getUri() |
| 660 | + ), |
| 661 | + $statusCode, |
| 662 | + $response->getHeaders(), |
| 663 | + $response->getBody() |
| 664 | + ); |
| 665 | + } |
| 666 | + ); |
| 667 | + } |
| 668 | + |
| 669 | + /** |
| 670 | + * Create request for operation 'releaseNotifications' |
| 671 | + * |
| 672 | + * |
| 673 | + * @throws \InvalidArgumentException |
| 674 | + * @return \GuzzleHttp\Psr7\Request |
| 675 | + */ |
| 676 | + protected function releaseNotificationsRequest() |
| 677 | + { |
| 678 | + |
| 679 | + $resourcePath = '/notifications/release'; |
| 680 | + $formParams = []; |
| 681 | + $queryParams = []; |
| 682 | + $headerParams = []; |
| 683 | + $httpBody = ''; |
| 684 | + $multipart = false; |
| 685 | + |
| 686 | + |
| 687 | + |
| 688 | + // body params |
| 689 | + $_tempBody = null; |
| 690 | + |
| 691 | + if ($multipart) { |
| 692 | + $headers = $this->headerSelector->selectHeadersForMultipart( |
| 693 | + ['application/vnd.error+docplanner+json'] |
| 694 | + ); |
| 695 | + } else { |
| 696 | + $headers = $this->headerSelector->selectHeaders( |
| 697 | + ['application/vnd.error+docplanner+json'], |
| 698 | + [] |
| 699 | + ); |
| 700 | + } |
| 701 | + |
| 702 | + // for model (json/xml) |
| 703 | + if (isset($_tempBody)) { |
| 704 | + // $_tempBody is the method argument, if present |
| 705 | + $httpBody = $_tempBody; |
| 706 | + // \stdClass has no __toString(), so we should encode it manually |
| 707 | + if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { |
| 708 | + $httpBody = \GuzzleHttp\json_encode($httpBody); |
| 709 | + } |
| 710 | + } elseif (count($formParams) > 0) { |
| 711 | + if ($multipart) { |
| 712 | + $multipartContents = []; |
| 713 | + foreach ($formParams as $formParamName => $formParamValue) { |
| 714 | + $multipartContents[] = [ |
| 715 | + 'name' => $formParamName, |
| 716 | + 'contents' => $formParamValue |
| 717 | + ]; |
| 718 | + } |
| 719 | + // for HTTP post (form) |
| 720 | + $httpBody = new MultipartStream($multipartContents); |
| 721 | + |
| 722 | + } elseif ($headers['Content-Type'] === 'application/json') { |
| 723 | + $httpBody = \GuzzleHttp\json_encode($formParams); |
| 724 | + |
| 725 | + } else { |
| 726 | + // for HTTP post (form) |
| 727 | + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); |
| 728 | + } |
| 729 | + } |
| 730 | + |
| 731 | + // this endpoint requires OAuth (access token) |
| 732 | + if ($this->config->getAccessToken() !== null) { |
| 733 | + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); |
| 734 | + } |
| 735 | + |
| 736 | + $defaultHeaders = []; |
| 737 | + if ($this->config->getUserAgent()) { |
| 738 | + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); |
| 739 | + } |
| 740 | + |
| 741 | + $headers = array_merge( |
| 742 | + $defaultHeaders, |
| 743 | + $headerParams, |
| 744 | + $headers |
| 745 | + ); |
| 746 | + |
| 747 | + $query = \GuzzleHttp\Psr7\build_query($queryParams); |
| 748 | + return new Request( |
| 749 | + 'POST', |
| 750 | + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), |
| 751 | + $headers, |
| 752 | + $httpBody |
| 753 | + ); |
| 754 | + } |
| 755 | + |
542 | 756 | /**
|
543 | 757 | * Create http client option
|
544 | 758 | *
|
|
0 commit comments