Skip to content

Commit e06eab1

Browse files
refactor(oauth): rename OpenapiOauthClient to OauthClient
1 parent ce8e1ab commit e06eab1

7 files changed

Lines changed: 18 additions & 18 deletions

File tree

CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ The `examples/` directory contains practical usage demonstrations:
7474

7575
### PSR-4 Autoloading
7676

77-
The project uses PSR-4 autoloading with `OpenApi\` namespace mapped to `src/` directory.
77+
The project uses PSR-4 autoloading with `Openapi\` namespace mapped to `src/` directory.
7878

7979
## Requirements
8080

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ composer require openapi/openapi-sdk
5656
### Token Generation
5757

5858
```php
59-
use OpenApi\OauthClient;
59+
use Openapi\OauthClient;
6060

6161
$oauthClient = new OauthClient('username', 'apikey', true); // true for test environment
6262

@@ -73,7 +73,7 @@ $token = $tokenData['token'];
7373
### Making API Calls
7474

7575
```php
76-
use OpenApi\Client;
76+
use Openapi\Client;
7777

7878
$client = new Client($token);
7979

examples/complete_workflow.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
require_once __DIR__ . '/../vendor/autoload.php';
44

5-
use Openapi\OpenapiOauthClient;
5+
use Openapi\OauthClient;
66
use Openapi\OpenapiClient;
77
use Openapi\OpenapiException;
88

@@ -11,7 +11,7 @@
1111

1212
// Step 1: Create OAuth client
1313
echo "Step 1: Creating OAuth client..." . PHP_EOL;
14-
$oauthClient = new OpenapiOauthClient('<your_username>', '<your_apikey>', true);
14+
$oauthClient = new OauthClient('<your_username>', '<your_apikey>', true);
1515
echo "✓ OAuth client created" . PHP_EOL . PHP_EOL;
1616

1717
// Step 2: Generate token

examples/token_generation.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
require_once __DIR__ . '/../vendor/autoload.php';
44

5-
use Openapi\OpenapiOauthClient;
5+
use Openapi\OauthClient;
66

77
try {
8-
$oauthClient = new OpenapiOauthClient('<your_username>', '<your_apikey>', true);
8+
$oauthClient = new OauthClient('<your_username>', '<your_apikey>', true);
99

1010
$scopes = [
1111
'GET:test.imprese.openapi.it/advance',
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Openapi;
44

5-
class OpenapiOauthClient
5+
class OauthClient
66
{
77
private string $url;
88
private string $username;

src/OpenapiException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class OpenapiException extends \Exception
1010
private ?int $httpCode = null;
1111

1212
/**
13-
* TODO: Utilize this method in OpenapiClient and OpenapiOauthClient to provide structured error context
13+
* TODO: Utilize this method in OpenapiClient and OauthClient to provide structured error context
1414
*/
1515
public function setServerResponse(mixed $response, mixed $headers = null, mixed $rawResponse = null, ?int $httpCode = null): void
1616
{
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
<?php
22

3-
use Openapi\OpenapiOauthClient;
3+
use Openapi\OauthClient;
44
use PHPUnit\Framework\TestCase;
55

6-
final class OpenapiOauthClientTest extends TestCase
6+
final class OauthClientTest extends TestCase
77
{
88
private string $username = 'test_username';
99
private string $apikey = 'test_apikey';
1010

1111
public function testOauthClientCreation(): void
1212
{
13-
$client = new OpenapiOauthClient($this->username, $this->apikey, true);
14-
$this->assertInstanceOf(OpenapiOauthClient::class, $client);
13+
$client = new OauthClient($this->username, $this->apikey, true);
14+
$this->assertInstanceOf(OauthClient::class, $client);
1515
}
1616

1717
public function testOauthClientCanBeCreatedFromEnvironmentVariables(): void
@@ -24,14 +24,14 @@ public function testOauthClientCanBeCreatedFromEnvironmentVariables(): void
2424
$this->assertNotSame('', $username, 'OPENAPI_USERNAME is empty');
2525
$this->assertNotSame('', $apikey, 'OPENAPI_SANDBOX_KEY is empty');
2626

27-
$client = new OpenapiOauthClient($username, $apikey, true);
28-
$this->assertInstanceOf(OpenapiOauthClient::class, $client);
27+
$client = new OauthClient($username, $apikey, true);
28+
$this->assertInstanceOf(OauthClient::class, $client);
2929
}
3030

3131
public function testOauthClientProductionMode(): void
3232
{
33-
$client = new OpenapiOauthClient($this->username, $this->apikey, false);
34-
$this->assertInstanceOf(OpenapiOauthClient::class, $client);
33+
$client = new OauthClient($this->username, $this->apikey, false);
34+
$this->assertInstanceOf(OauthClient::class, $client);
3535
}
3636

3737
public function testEnvironmentVariablesAreAvailable(): void
@@ -47,7 +47,7 @@ public function testCreateTokenWithScopes(): void
4747
{
4848
$this->markTestSkipped('Requires valid credentials for integration test');
4949

50-
$client = new OpenapiOauthClient($this->username, $this->apikey, true);
50+
$client = new OauthClient($this->username, $this->apikey, true);
5151
$scopes = [
5252
'GET:test.imprese.openapi.it/advance',
5353
'POST:test.postontarget.com/fields/country'

0 commit comments

Comments
 (0)