Skip to content

Commit e041f56

Browse files
committed
wip
1 parent f3d7df0 commit e041f56

File tree

4 files changed

+228
-294
lines changed

4 files changed

+228
-294
lines changed

.openapi-generator-ignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
/.travis.yml
44
/git_push.sh
55
/composer.json
6+
/README.md
67
/test/
78
/tests/
89
/phpunit.xml.dist

README.md

Lines changed: 15 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,30 @@
1-
# OpenAPIClient-php
1+
# Billingo PHP SDK
22

3-
This is a Billingo API v3 documentation. Our API based on REST software architectural style. API has resource-oriented URLs, accepts JSON-encoded request bodies and returns JSON-encoded responses. To use this API you have to generate a new API key on our [site](https://app.billingo.hu/api-key). After that, you can test your API key on this page.
3+
## Requirements
44

5-
For more information, please visit [https://www.billingo.hu/kapcsolat](https://www.billingo.hu/kapcsolat).
5+
- PHP 8.1 and later.
6+
- Curl, JSON, Multibyte String extensions
67

7-
## Installation & Usage
8+
## Installation
89

9-
### Requirements
10-
11-
PHP 8.1 and later.
12-
13-
### Composer
14-
15-
To install the bindings via [Composer](https://getcomposer.org/), add the following to `composer.json`:
16-
17-
```json
18-
{
19-
"repositories": [
20-
{
21-
"type": "vcs",
22-
"url": "https://github.com/GIT_USER_ID/GIT_REPO_ID.git"
23-
}
24-
],
25-
"require": {
26-
"GIT_USER_ID/GIT_REPO_ID": "*@dev"
27-
}
28-
}
29-
```
30-
31-
Then run `composer install`
32-
33-
### Manual Installation
34-
35-
Download the files and include `autoload.php`:
36-
37-
```php
38-
<?php
39-
require_once('/path/to/OpenAPIClient-php/vendor/autoload.php');
10+
```sh
11+
composer require conedevelopment/billingo-php
4012
```
4113

42-
## Getting Started
43-
44-
Please follow the [installation procedure](#installation--usage) and then run the following:
14+
## Usage
4515

4616
```php
47-
<?php
48-
require_once(__DIR__ . '/vendor/autoload.php');
49-
50-
51-
52-
// Configure API key authorization: api_key
53-
$config = Cone\Billingo\Configuration::getDefaultConfiguration()->setApiKey('X-API-KEY', 'YOUR_API_KEY');
54-
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
55-
// $config = Cone\Billingo\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-API-KEY', 'Bearer');
56-
17+
use Cone\Billingo\Client;
5718

58-
$apiInstance = new Cone\Billingo\Api\BankAccountApi(
59-
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
60-
// This is optional, `GuzzleHttp\Client` will be used as default.
61-
new GuzzleHttp\Client(),
62-
$config
63-
);
64-
$bankAccount = new \Cone\Billingo\Model\BankAccount(); // \Cone\Billingo\Model\BankAccount | BankAccount object that you would like to store.
19+
$client = new Client('ApiKey');
6520

6621
try {
67-
$result = $apiInstance->createBankAccount($bankAccount);
68-
print_r($result);
69-
} catch (Exception $e) {
70-
echo 'Exception when calling BankAccountApi->createBankAccount: ', $e->getMessage(), PHP_EOL;
71-
}
22+
$response = $client->documents()->listDocument();
7223

24+
// Handle response
25+
} catch (Throwable $exception) {
26+
// Handle exception, report to Sentry, etc...
27+
}
7328
```
7429

7530
## API Endpoints
@@ -224,33 +179,3 @@ Class | Method | HTTP request | Description
224179
- [ValidationError](docs/Model/ValidationError.md)
225180
- [ValidationErrorResponse](docs/Model/ValidationErrorResponse.md)
226181
- [Vat](docs/Model/Vat.md)
227-
228-
## Authorization
229-
230-
### api_key
231-
232-
- **Type**: API key
233-
- **API key parameter name**: X-API-KEY
234-
- **Location**: HTTP header
235-
236-
237-
## Tests
238-
239-
To run the tests, use:
240-
241-
```bash
242-
composer install
243-
vendor/bin/phpunit
244-
```
245-
246-
## Author
247-
248-
249-
250-
## About this package
251-
252-
This PHP package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
253-
254-
- API version: `3.0.14`
255-
- Generator version: `7.17.0`
256-
- Build package: `org.openapitools.codegen.languages.PhpNextgenClientCodegen`

src/Billingo.php

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

33
namespace Cone\Billingo;
44

5-
use Cone\Billingo\Api\BankAccountApi;
6-
use Cone\Billingo\Api\CurrencyApi;
7-
use Cone\Billingo\Api\DocumentApi;
8-
use Cone\Billingo\Api\DocumentExportApi;
9-
use Cone\Billingo\Api\OrganizationApi;
10-
use Cone\Billingo\Api\PartnerApi;
11-
use Cone\Billingo\Api\ProductApi;
12-
use Cone\Billingo\Api\SpendingApi;
13-
use Cone\Billingo\Api\UtilApi;
14-
15-
class Billingo
5+
class Billingo extends Client
166
{
17-
/**
18-
* The API key.
19-
*/
20-
protected string $apiKey;
21-
22-
/**
23-
* The bank account service instance.
24-
*/
25-
protected ?BankAccountApi $bankAccounts = null;
26-
27-
/**
28-
* The currencies service instance.
29-
*/
30-
protected ?CurrencyApi $currencies = null;
31-
32-
/**
33-
* The document service instance.
34-
*/
35-
protected ?DocumentApi $documents = null;
36-
37-
/**
38-
* The document export service instance.
39-
*/
40-
protected ?DocumentExportApi $documentExports = null;
41-
42-
/**
43-
* The organization service instance.
44-
*/
45-
protected ?OrganizationApi $organizations = null;
46-
47-
/**
48-
* The partner service instance.
49-
*/
50-
protected ?PartnerApi $partners = null;
51-
52-
/**
53-
* The product service instance.
54-
*/
55-
protected ?ProductApi $products = null;
56-
57-
/**
58-
* The spending service instance.
59-
*/
60-
protected ?SpendingApi $spendings = null;
61-
62-
/**
63-
* The util service instance.
64-
*/
65-
protected ?UtilApi $utils = null;
66-
67-
/**
68-
* Create a new Billingo client.
69-
*/
70-
public function __construct(string $apiKey)
71-
{
72-
$this->apiKey = $apiKey;
73-
74-
$this->config()->setApiKey('X-API-KEY', $apiKey);
75-
}
76-
77-
/**
78-
* Get the configuration instance.
79-
*/
80-
public function config(): Configuration
81-
{
82-
return Configuration::getDefaultConfiguration();
83-
}
84-
85-
/**
86-
* Get the bank account service.
87-
*/
88-
public function bankAccounts(): BankAccountApi
89-
{
90-
if (is_null($this->bankAccounts)) {
91-
$this->bankAccounts = new BankAccountApi(
92-
config: $this->config()
93-
);
94-
}
95-
96-
return $this->bankAccounts;
97-
}
98-
99-
/**
100-
* Get the currency service.
101-
*/
102-
public function currencies(): CurrencyApi
103-
{
104-
if (is_null($this->currencies)) {
105-
$this->currencies = new CurrencyApi(
106-
config: $this->config()
107-
);
108-
}
109-
110-
return $this->currencies;
111-
}
112-
113-
/**
114-
* Get the document service.
115-
*/
116-
public function documents(): DocumentApi
117-
{
118-
if (is_null($this->documents)) {
119-
$this->documents = new DocumentApi(
120-
config: $this->config()
121-
);
122-
}
123-
124-
return $this->documents;
125-
}
126-
127-
/**
128-
* Get the document export service.
129-
*/
130-
public function documentExports(): DocumentExportApi
131-
{
132-
if (is_null($this->documentExports)) {
133-
$this->documentExports = new DocumentExportApi(
134-
config: $this->config()
135-
);
136-
}
137-
138-
return $this->documentExports;
139-
}
140-
141-
/**
142-
* Get the organization service.
143-
*/
144-
public function organizations(): OrganizationApi
145-
{
146-
if (is_null($this->organizations)) {
147-
$this->organizations = new OrganizationApi(
148-
config: $this->config()
149-
);
150-
}
151-
152-
return $this->organizations;
153-
}
154-
155-
/**
156-
* Get the partner service.
157-
*/
158-
public function partners(): PartnerApi
159-
{
160-
if (is_null($this->partners)) {
161-
$this->partners = new PartnerApi(
162-
config: $this->config()
163-
);
164-
}
165-
166-
return $this->partners;
167-
}
168-
169-
/**
170-
* Get the product service.
171-
*/
172-
public function products(): ProductApi
173-
{
174-
if (is_null($this->products)) {
175-
$this->products = new ProductApi(
176-
config: $this->config()
177-
);
178-
}
179-
180-
return $this->products;
181-
}
182-
183-
/**
184-
* Get the spening service.
185-
*/
186-
public function spendings(): SpendingApi
187-
{
188-
if (is_null($this->spendings)) {
189-
$this->spendings = new SpendingApi(
190-
config: $this->config()
191-
);
192-
}
193-
194-
return $this->spendings;
195-
}
196-
197-
/**
198-
* Get the util service.
199-
*/
200-
public function utils(): UtilApi
201-
{
202-
if (is_null($this->utils)) {
203-
$this->utils = new UtilApi(
204-
config: $this->config()
205-
);
206-
}
207-
208-
return $this->utils;
209-
}
7+
//
2108
}

0 commit comments

Comments
 (0)