Skip to content

Commit 8973e90

Browse files
committed
upgrade to jane 5
1 parent 08bb697 commit 8973e90

File tree

364 files changed

+12972
-12830
lines changed

Some content is hidden

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

364 files changed

+12972
-12830
lines changed

composer.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@
1818
},
1919
"require": {
2020
"php": ">= 7.1",
21-
"jane-php/open-api-runtime": "^4.5",
22-
"psr/http-client-implementation": "*",
21+
"jane-php/open-api-runtime": "^5.3",
22+
"php-http/client-implementation": "*",
2323
"php-http/client-common": "^1.7 || ^2.0"
2424
},
2525
"require-dev": {
26-
"jane-php/open-api": "^4.5",
27-
"symfony/http-client": "^4.3",
26+
"jane-php/open-api-2": "^5.3",
27+
"symfony/http-client": "^5.0",
2828
"nyholm/psr7": "^1.2",
29-
"friendsofphp/php-cs-fixer": "^2.13"
29+
"friendsofphp/php-cs-fixer": "^2.16"
3030
}
3131
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
namespace JoliCode\Harvest\Api\Authentication;
4+
5+
class AccountAuthAuthentication implements \Jane\OpenApiRuntime\Client\Authentication
6+
{
7+
private $apiKey;
8+
public function __construct(string $apiKey)
9+
{
10+
$this->{'apiKey'} = $apiKey;
11+
}
12+
public function getPlugin() : \Http\Client\Common\Plugin
13+
{
14+
return new \Http\Client\Common\Plugin\AuthenticationPlugin(new class($this->{'apiKey'}) implements \Http\Message\Authentication
15+
{
16+
private $apiKey;
17+
public function __construct(string $apiKey)
18+
{
19+
$this->{'apiKey'} = $apiKey;
20+
}
21+
public function authenticate(\Psr\Http\Message\RequestInterface $request)
22+
{
23+
return $request->withHeader('Harvest-Account-Id', $this->{'apiKey'});
24+
}
25+
});
26+
}
27+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
namespace JoliCode\Harvest\Api\Authentication;
4+
5+
class BearerAuthAuthentication implements \Jane\OpenApiRuntime\Client\Authentication
6+
{
7+
private $apiKey;
8+
public function __construct(string $apiKey)
9+
{
10+
$this->{'apiKey'} = $apiKey;
11+
}
12+
public function getPlugin() : \Http\Client\Common\Plugin
13+
{
14+
return new \Http\Client\Common\Plugin\AuthenticationPlugin(new class($this->{'apiKey'}) implements \Http\Message\Authentication
15+
{
16+
private $apiKey;
17+
public function __construct(string $apiKey)
18+
{
19+
$this->{'apiKey'} = $apiKey;
20+
}
21+
public function authenticate(\Psr\Http\Message\RequestInterface $request)
22+
{
23+
return $request->withHeader('Authorization', $this->{'apiKey'});
24+
}
25+
});
26+
}
27+
}

generated/Client.php

Lines changed: 623 additions & 777 deletions
Large diffs are not rendered by default.
Lines changed: 14 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,50 @@
11
<?php
22

3-
declare(strict_types=1);
4-
5-
/*
6-
* This file has been auto generated by Jane,
7-
*
8-
* Do no edit it directly.
9-
*/
10-
113
namespace JoliCode\Harvest\Api\Endpoint;
124

135
class CreateBillableRate extends \Jane\OpenApiRuntime\Client\BaseEndpoint implements \Jane\OpenApiRuntime\Client\Psr7Endpoint
146
{
157
protected $userId;
16-
178
/**
18-
* Creates a new billable rate object. Returns a billable rate object and a 201 Created response code if the call succeeded.
19-
20-
9+
* Creates a new billable rate object. Returns a billable rate object and a 201 Created response code if the call succeeded.
10+
11+
2112
Creating a billable rate with no start_date will replace a user’s existing rate(s).
2213
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.
23-
24-
*
25-
* @param string $userId
26-
* @param \JoliCode\Harvest\Api\Model\UsersUserIdBillableRatesPostBody $payload json payload
27-
*/
14+
15+
*
16+
* @param string $userId
17+
* @param \JoliCode\Harvest\Api\Model\UsersUserIdBillableRatesPostBody $payload json payload
18+
*/
2819
public function __construct(string $userId, \JoliCode\Harvest\Api\Model\UsersUserIdBillableRatesPostBody $payload)
2920
{
3021
$this->userId = $userId;
3122
$this->body = $payload;
3223
}
33-
3424
use \Jane\OpenApiRuntime\Client\Psr7EndpointTrait;
35-
36-
public function getMethod(): string
25+
public function getMethod() : string
3726
{
3827
return 'POST';
3928
}
40-
41-
public function getUri(): string
29+
public function getUri() : string
4230
{
43-
return str_replace(['{userId}'], [$this->userId], '/users/{userId}/billable_rates');
31+
return str_replace(array('{userId}'), array($this->userId), '/users/{userId}/billable_rates');
4432
}
45-
46-
public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, $streamFactory = null): array
33+
public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, $streamFactory = null) : array
4734
{
4835
return $this->getSerializedBody($serializer);
4936
}
50-
5137
/**
5238
* {@inheritdoc}
5339
*
5440
*
55-
* @return \JoliCode\Harvest\Api\Model\BillableRate|\JoliCode\Harvest\Api\Model\Error|null
41+
* @return null|\JoliCode\Harvest\Api\Model\BillableRate|\JoliCode\Harvest\Api\Model\Error
5642
*/
5743
protected function transformResponseBody(string $body, int $status, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType)
5844
{
5945
if (201 === $status) {
6046
return $serializer->deserialize($body, 'JoliCode\\Harvest\\Api\\Model\\BillableRate', 'json');
6147
}
62-
6348
return $serializer->deserialize($body, 'JoliCode\\Harvest\\Api\\Model\\Error', 'json');
6449
}
65-
}
50+
}

generated/Endpoint/CreateClient.php

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
11
<?php
22

3-
declare(strict_types=1);
4-
5-
/*
6-
* This file has been auto generated by Jane,
7-
*
8-
* Do no edit it directly.
9-
*/
10-
113
namespace JoliCode\Harvest\Api\Endpoint;
124

135
class CreateClient extends \Jane\OpenApiRuntime\Client\BaseEndpoint implements \Jane\OpenApiRuntime\Client\Psr7Endpoint
@@ -21,36 +13,30 @@ public function __construct(\JoliCode\Harvest\Api\Model\ClientsPostBody $payload
2113
{
2214
$this->body = $payload;
2315
}
24-
2516
use \Jane\OpenApiRuntime\Client\Psr7EndpointTrait;
26-
27-
public function getMethod(): string
17+
public function getMethod() : string
2818
{
2919
return 'POST';
3020
}
31-
32-
public function getUri(): string
21+
public function getUri() : string
3322
{
3423
return '/clients';
3524
}
36-
37-
public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, $streamFactory = null): array
25+
public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, $streamFactory = null) : array
3826
{
3927
return $this->getSerializedBody($serializer);
4028
}
41-
4229
/**
4330
* {@inheritdoc}
4431
*
4532
*
46-
* @return \JoliCode\Harvest\Api\Model\Client|\JoliCode\Harvest\Api\Model\Error|null
33+
* @return null|\JoliCode\Harvest\Api\Model\Client|\JoliCode\Harvest\Api\Model\Error
4734
*/
4835
protected function transformResponseBody(string $body, int $status, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType)
4936
{
5037
if (201 === $status) {
5138
return $serializer->deserialize($body, 'JoliCode\\Harvest\\Api\\Model\\Client', 'json');
5239
}
53-
5440
return $serializer->deserialize($body, 'JoliCode\\Harvest\\Api\\Model\\Error', 'json');
5541
}
56-
}
42+
}

generated/Endpoint/CreateContact.php

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
11
<?php
22

3-
declare(strict_types=1);
4-
5-
/*
6-
* This file has been auto generated by Jane,
7-
*
8-
* Do no edit it directly.
9-
*/
10-
113
namespace JoliCode\Harvest\Api\Endpoint;
124

135
class CreateContact extends \Jane\OpenApiRuntime\Client\BaseEndpoint implements \Jane\OpenApiRuntime\Client\Psr7Endpoint
@@ -21,36 +13,30 @@ public function __construct(\JoliCode\Harvest\Api\Model\ContactsPostBody $payloa
2113
{
2214
$this->body = $payload;
2315
}
24-
2516
use \Jane\OpenApiRuntime\Client\Psr7EndpointTrait;
26-
27-
public function getMethod(): string
17+
public function getMethod() : string
2818
{
2919
return 'POST';
3020
}
31-
32-
public function getUri(): string
21+
public function getUri() : string
3322
{
3423
return '/contacts';
3524
}
36-
37-
public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, $streamFactory = null): array
25+
public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, $streamFactory = null) : array
3826
{
3927
return $this->getSerializedBody($serializer);
4028
}
41-
4229
/**
4330
* {@inheritdoc}
4431
*
4532
*
46-
* @return \JoliCode\Harvest\Api\Model\Contact|\JoliCode\Harvest\Api\Model\Error|null
33+
* @return null|\JoliCode\Harvest\Api\Model\Contact|\JoliCode\Harvest\Api\Model\Error
4734
*/
4835
protected function transformResponseBody(string $body, int $status, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType)
4936
{
5037
if (201 === $status) {
5138
return $serializer->deserialize($body, 'JoliCode\\Harvest\\Api\\Model\\Contact', 'json');
5239
}
53-
5440
return $serializer->deserialize($body, 'JoliCode\\Harvest\\Api\\Model\\Error', 'json');
5541
}
56-
}
42+
}

generated/Endpoint/CreateCostRate.php

Lines changed: 14 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,50 @@
11
<?php
22

3-
declare(strict_types=1);
4-
5-
/*
6-
* This file has been auto generated by Jane,
7-
*
8-
* Do no edit it directly.
9-
*/
10-
113
namespace JoliCode\Harvest\Api\Endpoint;
124

135
class CreateCostRate extends \Jane\OpenApiRuntime\Client\BaseEndpoint implements \Jane\OpenApiRuntime\Client\Psr7Endpoint
146
{
157
protected $userId;
16-
178
/**
18-
* Creates a new cost rate object. Returns a cost rate object and a 201 Created response code if the call succeeded.
19-
20-
9+
* Creates a new cost rate object. Returns a cost rate object and a 201 Created response code if the call succeeded.
10+
11+
2112
Creating a cost rate with no start_date will replace a user’s existing rate(s).
2213
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.
23-
24-
*
25-
* @param string $userId
26-
* @param \JoliCode\Harvest\Api\Model\UsersUserIdCostRatesPostBody $payload json payload
27-
*/
14+
15+
*
16+
* @param string $userId
17+
* @param \JoliCode\Harvest\Api\Model\UsersUserIdCostRatesPostBody $payload json payload
18+
*/
2819
public function __construct(string $userId, \JoliCode\Harvest\Api\Model\UsersUserIdCostRatesPostBody $payload)
2920
{
3021
$this->userId = $userId;
3122
$this->body = $payload;
3223
}
33-
3424
use \Jane\OpenApiRuntime\Client\Psr7EndpointTrait;
35-
36-
public function getMethod(): string
25+
public function getMethod() : string
3726
{
3827
return 'POST';
3928
}
40-
41-
public function getUri(): string
29+
public function getUri() : string
4230
{
43-
return str_replace(['{userId}'], [$this->userId], '/users/{userId}/cost_rates');
31+
return str_replace(array('{userId}'), array($this->userId), '/users/{userId}/cost_rates');
4432
}
45-
46-
public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, $streamFactory = null): array
33+
public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, $streamFactory = null) : array
4734
{
4835
return $this->getSerializedBody($serializer);
4936
}
50-
5137
/**
5238
* {@inheritdoc}
5339
*
5440
*
55-
* @return \JoliCode\Harvest\Api\Model\CostRate|\JoliCode\Harvest\Api\Model\Error|null
41+
* @return null|\JoliCode\Harvest\Api\Model\CostRate|\JoliCode\Harvest\Api\Model\Error
5642
*/
5743
protected function transformResponseBody(string $body, int $status, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType)
5844
{
5945
if (201 === $status) {
6046
return $serializer->deserialize($body, 'JoliCode\\Harvest\\Api\\Model\\CostRate', 'json');
6147
}
62-
6348
return $serializer->deserialize($body, 'JoliCode\\Harvest\\Api\\Model\\Error', 'json');
6449
}
65-
}
50+
}

0 commit comments

Comments
 (0)