Skip to content

Commit

Permalink
ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.402.14
Browse files Browse the repository at this point in the history
  • Loading branch information
speakeasybot authored and flemzord committed Sep 25, 2024
1 parent 736b20d commit ff6670b
Show file tree
Hide file tree
Showing 25 changed files with 360 additions and 219 deletions.
18 changes: 11 additions & 7 deletions .speakeasy/gen.lock
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
lockVersion: 2.0.0
id: 0b9e0548-6a63-426d-aa19-95795ea55543
management:
docChecksum: da9839425759ec1e92b6441bb2f3ca7c
docVersion: v2.1.0-beta.2
speakeasyVersion: 1.401.4
generationVersion: 2.421.3
releaseVersion: 3.0.0
configChecksum: 81f4388952106541a307980a7e810376
docChecksum: d5d12540f5ed5f4996d23aae4cd97c31
docVersion: v2.1.0-beta.3
speakeasyVersion: 1.402.14
generationVersion: 2.422.22
releaseVersion: 3.1.0
configChecksum: d3cf88a54a4c1b792558c3a7f38355fc
repoURL: https://github.com/formancehq/formance-sdk-php.git
repoSubDirectory: .
installationURL: https://github.com/formancehq/formance-sdk-php
published: true
features:
php:
core: 3.4.4
core: 3.4.5
deprecations: 2.81.1
errors: 0.1.2
getRequestBodies: 2.81.1
globalSecurity: 2.81.7
globalSecurityFlattening: 0.1.1
globalServerURLs: 2.82.1
ignores: 2.81.1
methodSecurity: 2.82.1
nameOverrides: 2.81.2
nullables: 1.0.0
responseFormat: 0.1.0
Expand Down Expand Up @@ -156,6 +157,7 @@ generatedFiles:
- docs/Models/Operations/GetTransferInitiationRequest.md
- docs/Models/Operations/GetTransferInitiationResponse.md
- docs/Models/Operations/GetVersionsResponse.md
- docs/Models/Operations/GetVersionsSecurity.md
- docs/Models/Operations/GetWalletRequest.md
- docs/Models/Operations/GetWalletResponse.md
- docs/Models/Operations/GetWalletSummaryRequest.md
Expand Down Expand Up @@ -953,6 +955,7 @@ generatedFiles:
- src/Models/Operations/GetTransferInitiationRequest.php
- src/Models/Operations/GetTransferInitiationResponse.php
- src/Models/Operations/GetVersionsResponse.php
- src/Models/Operations/GetVersionsSecurity.php
- src/Models/Operations/GetWalletRequest.php
- src/Models/Operations/GetWalletResponse.php
- src/Models/Operations/GetWalletSummaryRequest.php
Expand Down Expand Up @@ -1595,6 +1598,7 @@ generatedFiles:
- src/SDKWalletsV1.php
- src/SDKWebhooksV1.php
- src/Search.php
- src/ServerEnvironment.php
- src/Utils/DateHandler.php
- src/Utils/DateTimeHandler.php
- src/Utils/DefaultRequest.php
Expand Down
12 changes: 6 additions & 6 deletions .speakeasy/workflow.lock
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
speakeasyVersion: 1.401.4
speakeasyVersion: 1.402.14
sources:
my-source:
sourceNamespace: my-source
sourceRevisionDigest: sha256:9e799be414b09d9f8302cf039b1eb4e2b49dd0102424879bd9360c3a007c32c9
sourceBlobDigest: sha256:d381055f92cce103e8bd74a08b227de17950d63394bdf06c5d5e0709fb8d9fa8
sourceRevisionDigest: sha256:0f91ebfb9d754eff5dc742b23c76f28207ffd67e6aec3e5713c343ad6781f22c
sourceBlobDigest: sha256:289baef68db829be9ab3b7d551c2c8f06c9adf872c08c55eb3d4fb8cc570d555
tags:
- latest
- main
targets:
formance-sdk-php:
source: my-source
sourceNamespace: my-source
sourceRevisionDigest: sha256:9e799be414b09d9f8302cf039b1eb4e2b49dd0102424879bd9360c3a007c32c9
sourceBlobDigest: sha256:d381055f92cce103e8bd74a08b227de17950d63394bdf06c5d5e0709fb8d9fa8
sourceRevisionDigest: sha256:0f91ebfb9d754eff5dc742b23c76f28207ffd67e6aec3e5713c343ad6781f22c
sourceBlobDigest: sha256:289baef68db829be9ab3b7d551c2c8f06c9adf872c08c55eb3d4fb8cc570d555
workflow:
workflowVersion: 1.0.0
speakeasyVersion: latest
sources:
my-source:
inputs:
- location: https://github.com/formancehq/stack/releases/download/v2.1.0-beta.2/generate.json
- location: https://github.com/formancehq/stack/releases/download/v2.1.0-beta.3/generate.json
registry:
location: registry.speakeasyapi.dev/formance/formance/my-source
targets:
Expand Down
20 changes: 12 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,15 @@ declare(strict_types=1);
require 'vendor/autoload.php';

use formance\stack;
use formance\stack\Models\Shared;
use formance\stack\Models\Operations;

$security = new Shared\Security(
authorization: "<YOUR_AUTHORIZATION_HERE>",
);

$sdk = stack\SDK::builder()->setSecurity($security)->build();
$sdk = stack\SDK::builder()->build();

try {
$response = $sdk->getVersions();
$requestSecurity = new Operations\GetVersionsSecurity(
authorization: "<YOUR_AUTHORIZATION_HERE>",
);
$response = $sdk->getVersions($requestSecurity);

if ($response->getVersionsResponse !== null) {
// handle response
Expand Down Expand Up @@ -330,10 +329,15 @@ You can override the default server globally by passing a server index to the `s
| # | Server | Variables |
| - | ------ | --------- |
| 0 | `http://localhost` | None |
| 1 | `https://{stack}.sandbox.formance.cloud` | None |
| 1 | `https://{organization}.{environment}.formance.cloud` | `environment` (default is `sandbox`), `organization` (default is `orgID-stackID`) |



#### Variables

Some of the server options above contain variables. If you want to set the values of those variables, the following optional parameters are available when initializing the SDK client instance:
* `environment: stack\ServerEnvironment`
* `organization: string`

### Override Server URL Per-Client

Expand Down
12 changes: 11 additions & 1 deletion RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -248,4 +248,14 @@ Based on:
### Generated
- [php v3.0.0] .
### Releases
- [Composer v3.0.0] https://packagist.org/packages/formance/formance-sdk#v3.0.0 - .
- [Composer v3.0.0] https://packagist.org/packages/formance/formance-sdk#v3.0.0 - .

## 2024-09-25 11:50:18
### Changes
Based on:
- OpenAPI Doc
- Speakeasy CLI 1.402.14 (2.422.22) https://github.com/speakeasy-api/speakeasy
### Generated
- [php v3.1.0] .
### Releases
- [Composer v3.1.0] https://packagist.org/packages/formance/formance-sdk#v3.1.0 - .
13 changes: 6 additions & 7 deletions USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,15 @@ declare(strict_types=1);
require 'vendor/autoload.php';

use formance\stack;
use formance\stack\Models\Shared;
use formance\stack\Models\Operations;

$security = new Shared\Security(
authorization: "<YOUR_AUTHORIZATION_HERE>",
);

$sdk = stack\SDK::builder()->setSecurity($security)->build();
$sdk = stack\SDK::builder()->build();

try {
$response = $sdk->getVersions();
$requestSecurity = new Operations\GetVersionsSecurity(
authorization: "<YOUR_AUTHORIZATION_HERE>",
);
$response = $sdk->getVersions($requestSecurity);

if ($response->getVersionsResponse !== null) {
// handle response
Expand Down
9 changes: 9 additions & 0 deletions docs/Models/Operations/GetVersionsSecurity.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# GetVersionsSecurity


## Fields

| Field | Type | Required | Description |
| ------------------ | ------------------ | ------------------ | ------------------ |
| `authorization` | *?string* | :heavy_minus_sign: | N/A |
| `noAuthorization` | *?string* | :heavy_minus_sign: | N/A |
2 changes: 1 addition & 1 deletion docs/Models/Shared/Security.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@

| Field | Type | Required | Description |
| ------------------ | ------------------ | ------------------ | ------------------ |
| `authorization` | *string* | :heavy_check_mark: | N/A |
| `authorization` | *?string* | :heavy_minus_sign: | N/A |
19 changes: 12 additions & 7 deletions docs/sdks/sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,15 @@ declare(strict_types=1);
require 'vendor/autoload.php';

use formance\stack;
use formance\stack\Models\Shared;
use formance\stack\Models\Operations;

$security = new Shared\Security(
authorization: "<YOUR_AUTHORIZATION_HERE>",
);

$sdk = stack\SDK::builder()->setSecurity($security)->build();
$sdk = stack\SDK::builder()->build();

try {
$response = $sdk->getVersions();
$requestSecurity = new Operations\GetVersionsSecurity(
authorization: "<YOUR_AUTHORIZATION_HERE>",
);
$response = $sdk->getVersions($requestSecurity);

if ($response->getVersionsResponse !== null) {
// handle response
Expand All @@ -50,6 +49,12 @@ try {
}
```

### Parameters

| Parameter | Type | Required | Description |
| -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- |
| `security` | [Operations\GetVersionsSecurity](../../Models/Operations/GetVersionsSecurity.md) | :heavy_check_mark: | The security requirements to use for the request. |

### Response

**[?Operations\GetVersionsResponse](../../Models/Operations/GetVersionsResponse.md)**
Expand Down
2 changes: 1 addition & 1 deletion gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ generation:
comments: {}
telemetryEnabled: false
php:
version: 3.0.0
version: 3.1.0
clientServerStatusCodesAsErrors: true
flattenGlobalSecurity: true
imports:
Expand Down
37 changes: 37 additions & 0 deletions src/Models/Operations/GetVersionsSecurity.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

/**
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/

declare(strict_types=1);

namespace formance\stack\Models\Operations;

use formance\stack\Utils\SpeakeasyMetadata;
class GetVersionsSecurity
{
/**
*
* @var ?string $authorization
*/
#[SpeakeasyMetadata('security:scheme=true,type=oauth2,name=Authorization')]
public ?string $authorization = null;

/**
*
* @var ?string $noAuthorization
*/
#[SpeakeasyMetadata('security:scheme=true,type=oauth2,name=Authorization')]
public ?string $noAuthorization = null;

/**
* @param ?string $authorization
* @param ?string $noAuthorization
*/
public function __construct(?string $authorization = null, ?string $noAuthorization = null)
{
$this->authorization = $authorization;
$this->noAuthorization = $noAuthorization;
}
}
8 changes: 4 additions & 4 deletions src/Models/Shared/Security.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ class Security
{
/**
*
* @var string $authorization
* @var ?string $authorization
*/
#[SpeakeasyMetadata('security:scheme=true,type=oauth2,name=Authorization')]
public string $authorization;
public ?string $authorization = null;

/**
* @param string $authorization
* @param ?string $authorization
*/
public function __construct(string $authorization)
public function __construct(?string $authorization = null)
{
$this->authorization = $authorization;
}
Expand Down
12 changes: 7 additions & 5 deletions src/SDK.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ class SDK
public const SERVERS = [
/** local server */
'http://localhost',
/** sandbox server */
'https://{stack}.sandbox.formance.cloud',
/** A per-organization and per-environment API */
'https://{organization}.{environment}.formance.cloud',
];

public Auth $auth;
Expand Down Expand Up @@ -80,20 +80,22 @@ public function __construct(
/**
* Show stack version information
*
* @param Operations\GetVersionsSecurity $security
* @return Operations\GetVersionsResponse
* @throws \formance\stack\Models\Errors\SDKException
*/
public function getVersions(
Operations\GetVersionsSecurity $security,
): Operations\GetVersionsResponse {
$baseUrl = $this->sdkConfiguration->getServerUrl();
$baseUrl = Utils\Utils::templateUrl($this->sdkConfiguration->getServerUrl(), $this->sdkConfiguration->getServerDefaults());
$url = Utils\Utils::generateUrl($baseUrl, '/versions');
$options = ['http_errors' => false];
$options['headers']['Accept'] = 'application/json';
$options['headers']['user-agent'] = $this->sdkConfiguration->userAgent;
$httpRequest = new \GuzzleHttp\Psr7\Request('GET', $url);
$client = Utils\Utils::configureSecurityClient($this->sdkConfiguration->defaultClient, $security);


$httpResponse = $this->sdkConfiguration->securityClient->send($httpRequest, $options);
$httpResponse = $client->send($httpRequest, $options);
$contentType = $httpResponse->getHeader('Content-Type')[0] ?? '';

$statusCode = $httpResponse->getStatusCode();
Expand Down
36 changes: 36 additions & 0 deletions src/SDKBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,42 @@ public function setServerIndex(int $serverIdx): SDKBuilder
return $this;
}

/**
* setEnvironment is used to configure the environment variable for url substitution
*
* @param ServerEnvironment $environment
* @return SDKBuilder
*/
public function setEnvironment(ServerEnvironment $environment): SDKBuilder
{
foreach ($this->sdkConfig->serverDefaults as $idx => $serverDefaults) {
if (! array_key_exists('environment', $serverDefaults)) {
continue;
}
$this->sdkConfig->serverDefaults[$idx]['environment'] = $environment->value;
}

return $this;
}

/**
* setOrganization is used to configure the organization variable for url substitution
*
* @param string $organization
* @return SDKBuilder
*/
public function setOrganization(string $organization): SDKBuilder
{
foreach ($this->sdkConfig->serverDefaults as $idx => $serverDefaults) {
if (! array_key_exists('organization', $serverDefaults)) {
continue;
}
$this->sdkConfig->serverDefaults[$idx]['organization'] = $organization;
}

return $this;
}

/**
* build is used to build the SDK with any of the configured options.
*
Expand Down
Loading

0 comments on commit ff6670b

Please sign in to comment.