Skip to content

Commit

Permalink
Merge pull request #11 from jolicode/feature/jane-5
Browse files Browse the repository at this point in the history
Feature/jane 5
  • Loading branch information
xavierlacot authored Feb 21, 2020
2 parents 08bb697 + 5610a2a commit fc9d47f
Show file tree
Hide file tree
Showing 397 changed files with 16,749 additions and 12,832 deletions.
548 changes: 548 additions & 0 deletions Resources/harvest-openapi.yaml

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
},
"require": {
"php": ">= 7.1",
"jane-php/open-api-runtime": "^4.5",
"psr/http-client-implementation": "*",
"jane-php/open-api-runtime": "^5.3",
"php-http/client-implementation": "*",
"php-http/client-common": "^1.7 || ^2.0"
},
"require-dev": {
"jane-php/open-api": "^4.5",
"symfony/http-client": "^4.3",
"jane-php/open-api-2": "^5.3",
"symfony/http-client": "^5.0",
"nyholm/psr7": "^1.2",
"friendsofphp/php-cs-fixer": "^2.13"
"friendsofphp/php-cs-fixer": "^2.16"
}
}
27 changes: 27 additions & 0 deletions generated/Authentication/AccountAuthAuthentication.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace JoliCode\Harvest\Api\Authentication;

class AccountAuthAuthentication implements \Jane\OpenApiRuntime\Client\Authentication
{
private $apiKey;
public function __construct(string $apiKey)
{
$this->{'apiKey'} = $apiKey;
}
public function getPlugin() : \Http\Client\Common\Plugin
{
return new \Http\Client\Common\Plugin\AuthenticationPlugin(new class($this->{'apiKey'}) implements \Http\Message\Authentication
{
private $apiKey;
public function __construct(string $apiKey)
{
$this->{'apiKey'} = $apiKey;
}
public function authenticate(\Psr\Http\Message\RequestInterface $request)
{
return $request->withHeader('Harvest-Account-Id', $this->{'apiKey'});
}
});
}
}
27 changes: 27 additions & 0 deletions generated/Authentication/BearerAuthAuthentication.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace JoliCode\Harvest\Api\Authentication;

class BearerAuthAuthentication implements \Jane\OpenApiRuntime\Client\Authentication
{
private $apiKey;
public function __construct(string $apiKey)
{
$this->{'apiKey'} = $apiKey;
}
public function getPlugin() : \Http\Client\Common\Plugin
{
return new \Http\Client\Common\Plugin\AuthenticationPlugin(new class($this->{'apiKey'}) implements \Http\Message\Authentication
{
private $apiKey;
public function __construct(string $apiKey)
{
$this->{'apiKey'} = $apiKey;
}
public function authenticate(\Psr\Http\Message\RequestInterface $request)
{
return $request->withHeader('Authorization', $this->{'apiKey'});
}
});
}
}
1,487 changes: 710 additions & 777 deletions generated/Client.php

Large diffs are not rendered by default.

42 changes: 42 additions & 0 deletions generated/Endpoint/ClientsReport.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

namespace JoliCode\Harvest\Api\Endpoint;

class ClientsReport extends \Jane\OpenApiRuntime\Client\BaseEndpoint implements \Jane\OpenApiRuntime\Client\Psr7Endpoint
{
/**
*
*
* @param \JoliCode\Harvest\Api\Model\ReportsTimeClientsGetBody $payload json payload
*/
public function __construct(\JoliCode\Harvest\Api\Model\ReportsTimeClientsGetBody $payload)
{
$this->body = $payload;
}
use \Jane\OpenApiRuntime\Client\Psr7EndpointTrait;
public function getMethod() : string
{
return 'GET';
}
public function getUri() : string
{
return '/reports/time/clients';
}
public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, $streamFactory = null) : array
{
return $this->getSerializedBody($serializer);
}
/**
* {@inheritdoc}
*
*
* @return null|\JoliCode\Harvest\Api\Model\Error
*/
protected function transformResponseBody(string $body, int $status, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType)
{
if (200 === $status) {
return null;
}
return $serializer->deserialize($body, 'JoliCode\\Harvest\\Api\\Model\\Error', 'json');
}
}
43 changes: 14 additions & 29 deletions generated/Endpoint/CreateBillableRate.php
Original file line number Diff line number Diff line change
@@ -1,65 +1,50 @@
<?php

declare(strict_types=1);

/*
* This file has been auto generated by Jane,
*
* Do no edit it directly.
*/

namespace JoliCode\Harvest\Api\Endpoint;

class CreateBillableRate extends \Jane\OpenApiRuntime\Client\BaseEndpoint implements \Jane\OpenApiRuntime\Client\Psr7Endpoint
{
protected $userId;

/**
* Creates a new billable rate object. Returns a billable rate object and a 201 Created response code if the call succeeded.
* Creates a new billable rate object. Returns a billable rate object and a 201 Created response code if the call succeeded.
Creating a billable rate with no start_date will replace a user’s existing rate(s).
Creating a billable rate with a start_date that is before a user’s existing rate(s) will replace those billable rates with the new one.
*
* @param string $userId
* @param \JoliCode\Harvest\Api\Model\UsersUserIdBillableRatesPostBody $payload json payload
*/
*
* @param string $userId
* @param \JoliCode\Harvest\Api\Model\UsersUserIdBillableRatesPostBody $payload json payload
*/
public function __construct(string $userId, \JoliCode\Harvest\Api\Model\UsersUserIdBillableRatesPostBody $payload)
{
$this->userId = $userId;
$this->body = $payload;
}

use \Jane\OpenApiRuntime\Client\Psr7EndpointTrait;

public function getMethod(): string
public function getMethod() : string
{
return 'POST';
}

public function getUri(): string
public function getUri() : string
{
return str_replace(['{userId}'], [$this->userId], '/users/{userId}/billable_rates');
return str_replace(array('{userId}'), array($this->userId), '/users/{userId}/billable_rates');
}

public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, $streamFactory = null): array
public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, $streamFactory = null) : array
{
return $this->getSerializedBody($serializer);
}

/**
* {@inheritdoc}
*
*
* @return \JoliCode\Harvest\Api\Model\BillableRate|\JoliCode\Harvest\Api\Model\Error|null
* @return null|\JoliCode\Harvest\Api\Model\BillableRate|\JoliCode\Harvest\Api\Model\Error
*/
protected function transformResponseBody(string $body, int $status, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType)
{
if (201 === $status) {
return $serializer->deserialize($body, 'JoliCode\\Harvest\\Api\\Model\\BillableRate', 'json');
}

return $serializer->deserialize($body, 'JoliCode\\Harvest\\Api\\Model\\Error', 'json');
}
}
}
24 changes: 5 additions & 19 deletions generated/Endpoint/CreateClient.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
<?php

declare(strict_types=1);

/*
* This file has been auto generated by Jane,
*
* Do no edit it directly.
*/

namespace JoliCode\Harvest\Api\Endpoint;

class CreateClient extends \Jane\OpenApiRuntime\Client\BaseEndpoint implements \Jane\OpenApiRuntime\Client\Psr7Endpoint
Expand All @@ -21,36 +13,30 @@ public function __construct(\JoliCode\Harvest\Api\Model\ClientsPostBody $payload
{
$this->body = $payload;
}

use \Jane\OpenApiRuntime\Client\Psr7EndpointTrait;

public function getMethod(): string
public function getMethod() : string
{
return 'POST';
}

public function getUri(): string
public function getUri() : string
{
return '/clients';
}

public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, $streamFactory = null): array
public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, $streamFactory = null) : array
{
return $this->getSerializedBody($serializer);
}

/**
* {@inheritdoc}
*
*
* @return \JoliCode\Harvest\Api\Model\Client|\JoliCode\Harvest\Api\Model\Error|null
* @return null|\JoliCode\Harvest\Api\Model\Client|\JoliCode\Harvest\Api\Model\Error
*/
protected function transformResponseBody(string $body, int $status, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType)
{
if (201 === $status) {
return $serializer->deserialize($body, 'JoliCode\\Harvest\\Api\\Model\\Client', 'json');
}

return $serializer->deserialize($body, 'JoliCode\\Harvest\\Api\\Model\\Error', 'json');
}
}
}
24 changes: 5 additions & 19 deletions generated/Endpoint/CreateContact.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
<?php

declare(strict_types=1);

/*
* This file has been auto generated by Jane,
*
* Do no edit it directly.
*/

namespace JoliCode\Harvest\Api\Endpoint;

class CreateContact extends \Jane\OpenApiRuntime\Client\BaseEndpoint implements \Jane\OpenApiRuntime\Client\Psr7Endpoint
Expand All @@ -21,36 +13,30 @@ public function __construct(\JoliCode\Harvest\Api\Model\ContactsPostBody $payloa
{
$this->body = $payload;
}

use \Jane\OpenApiRuntime\Client\Psr7EndpointTrait;

public function getMethod(): string
public function getMethod() : string
{
return 'POST';
}

public function getUri(): string
public function getUri() : string
{
return '/contacts';
}

public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, $streamFactory = null): array
public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, $streamFactory = null) : array
{
return $this->getSerializedBody($serializer);
}

/**
* {@inheritdoc}
*
*
* @return \JoliCode\Harvest\Api\Model\Contact|\JoliCode\Harvest\Api\Model\Error|null
* @return null|\JoliCode\Harvest\Api\Model\Contact|\JoliCode\Harvest\Api\Model\Error
*/
protected function transformResponseBody(string $body, int $status, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType)
{
if (201 === $status) {
return $serializer->deserialize($body, 'JoliCode\\Harvest\\Api\\Model\\Contact', 'json');
}

return $serializer->deserialize($body, 'JoliCode\\Harvest\\Api\\Model\\Error', 'json');
}
}
}
43 changes: 14 additions & 29 deletions generated/Endpoint/CreateCostRate.php
Original file line number Diff line number Diff line change
@@ -1,65 +1,50 @@
<?php

declare(strict_types=1);

/*
* This file has been auto generated by Jane,
*
* Do no edit it directly.
*/

namespace JoliCode\Harvest\Api\Endpoint;

class CreateCostRate extends \Jane\OpenApiRuntime\Client\BaseEndpoint implements \Jane\OpenApiRuntime\Client\Psr7Endpoint
{
protected $userId;

/**
* Creates a new cost rate object. Returns a cost rate object and a 201 Created response code if the call succeeded.
* Creates a new cost rate object. Returns a cost rate object and a 201 Created response code if the call succeeded.
Creating a cost rate with no start_date will replace a user’s existing rate(s).
Creating a cost rate with a start_date that is before a user’s existing rate(s) will replace those cost rates with the new one.
*
* @param string $userId
* @param \JoliCode\Harvest\Api\Model\UsersUserIdCostRatesPostBody $payload json payload
*/
*
* @param string $userId
* @param \JoliCode\Harvest\Api\Model\UsersUserIdCostRatesPostBody $payload json payload
*/
public function __construct(string $userId, \JoliCode\Harvest\Api\Model\UsersUserIdCostRatesPostBody $payload)
{
$this->userId = $userId;
$this->body = $payload;
}

use \Jane\OpenApiRuntime\Client\Psr7EndpointTrait;

public function getMethod(): string
public function getMethod() : string
{
return 'POST';
}

public function getUri(): string
public function getUri() : string
{
return str_replace(['{userId}'], [$this->userId], '/users/{userId}/cost_rates');
return str_replace(array('{userId}'), array($this->userId), '/users/{userId}/cost_rates');
}

public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, $streamFactory = null): array
public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, $streamFactory = null) : array
{
return $this->getSerializedBody($serializer);
}

/**
* {@inheritdoc}
*
*
* @return \JoliCode\Harvest\Api\Model\CostRate|\JoliCode\Harvest\Api\Model\Error|null
* @return null|\JoliCode\Harvest\Api\Model\CostRate|\JoliCode\Harvest\Api\Model\Error
*/
protected function transformResponseBody(string $body, int $status, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType)
{
if (201 === $status) {
return $serializer->deserialize($body, 'JoliCode\\Harvest\\Api\\Model\\CostRate', 'json');
}

return $serializer->deserialize($body, 'JoliCode\\Harvest\\Api\\Model\\Error', 'json');
}
}
}
Loading

0 comments on commit fc9d47f

Please sign in to comment.