Skip to content

Commit

Permalink
new Yousign API v3
Browse files Browse the repository at this point in the history
  • Loading branch information
qdequippe committed May 13, 2024
1 parent b729809 commit 8ad9073
Show file tree
Hide file tree
Showing 885 changed files with 63,228 additions and 26,957 deletions.
15 changes: 15 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/.gitattributes export-ignore
/.github export-ignore
/.gitignore export-ignore
/.jane-openapi-*.php export-ignore
/CHANGELOG.md export-ignore
/CONTRIBUTING.md export-ignore
/doc export-ignore
/Makefile export-ignore
/phpunit.xml.dist export-ignore
/resources export-ignore
/tests export-ignore
/VERSIONING.md export-ignore
/.php-cs-fixer.php export-ignore
/rector.php export-ignore
/openapi-specs export-ignore
20 changes: 20 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: 2

updates:
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
labels:
- "github-actions"
- "dependencies"

# Maintain dependencies for Composer
- package-ecosystem: "composer"
directory: "/"
schedule:
interval: "monthly"
labels:
- "php"
- "dependencies"
19 changes: 19 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: CI

on:
push:
branches: [ main ]
pull_request:

jobs:
check-cs:
name: Coding Style
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: PHP-CS-Fixer
uses: docker://oskarstark/php-cs-fixer-ga
with:
args: --config=.php-cs-fixer.php --diff --dry-run
29 changes: 29 additions & 0 deletions .github/workflows/diff-spec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Diff spec

on:
workflow_dispatch:
schedule:
- cron: '0 0 * * MON'

jobs:
check-spec:
name: Check SDK is in sync with spec
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install dependencies
run: composer update --no-interaction

- name: Regenerate SDK library
run: rm -rf generated && vendor/bin/jane-openapi generate --config-file=.jane-openapi.php

- name: Rector
run: vendor/bin/rector

- name: Code style
run: ./vendor/bin/php-cs-fixer fix

- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
10 changes: 0 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
# Dependencies
/vendor

# Composer
composer.lock
composer.phar

# CS
.php_cs.cache
.php-cs-fixer.cache

# tests
phpunit.xml
ci_generated
.phpunit.result.cache
6 changes: 2 additions & 4 deletions .jane-openapi.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
<?php

$directory = __DIR__ . '/generated/';

return [
'openapi-file' => 'https://swagger.yousign.com/swagger.json',
'openapi-file' => 'https://developers.yousign.com/openapi/60c6f824bd87e600229f054b',
'namespace' => 'Qdequippe\Yousign\Api',
'directory' => $directory,
'directory' => __DIR__ . '/generated/',
'reference' => true,
'strict' => false,
'clean-generated' => true,
Expand Down
16 changes: 8 additions & 8 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<?php

$finder = PhpCsFixer\Finder::create()->in(__DIR__);
$config = new PhpCsFixer\Config();
declare(strict_types=1);

return $config
$finder = PhpCsFixer\Finder::create()
->in(__DIR__)
;

return (new PhpCsFixer\Config())
->setRiskyAllowed(true)
->setRules([
'@PhpCsFixer' => true,
'@Symfony' => true,
'@Symfony:risky' => true,
'@PHP71Migration' => true,
'@PHP71Migration:risky' => true,
'strict_param' => true,
'array_syntax' => ['syntax' => 'short'],
])
->setRiskyAllowed(true)
->setFinder($finder)
;
4 changes: 2 additions & 2 deletions LICENSE → LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2021 Quentin Dequippe
Copyright (c) 2022 Quentin Dequippe

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
SOFTWARE.
21 changes: 21 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
rector: ## Run rector (dry run)
./vendor/bin/rector process --dry-run --verbose

rectify: ## Run rector
./vendor/bin/rector process

cs: ## Fix code style (PHP CS Fixer)
./vendor/bin/php-cs-fixer fix

cs_check: ## Check code style
./vendor/bin/php-cs-fixer check

jane: ## Generate SDK
./vendor/bin/jane-openapi generate --config-file=.jane-openapi.php

.PHONY: help

help: ## Display this help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'

.DEFAULT_GOAL := help
37 changes: 35 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,35 @@
# yousign-php-api
PHP Yousign Client
# PHP client for Yousign API

This SDK is generated automatically with [JanePHP](https://github.com/janephp/janephp)
from the [Yousign API](https://developers.yousign.com/).

It also provides a **full object-oriented interface** for all the endpoints,
requests and responses of the Yousign API.

## Installation

This library is built atop of [PSR-7](https://www.php-fig.org/psr/psr-7/) and
[PSR-18](https://www.php-fig.org/psr/psr-18/). So you will need to install some
implementations for those standard interfaces.

If no PSR-18 client or PSR-7 message factory is available yet in your project
or you don't know or don't care which one to use, just install some default:

```bash
composer require symfony/http-client nyholm/psr7
```

You can now install the Yousign client:

```bash
composer require qdequippe/yousign-php-api
```

## Quick start

To create a client:

```php
$client = \Qdequippe\Yousign\Api\Client::create();
$client->getSignatureRequests();
```
31 changes: 15 additions & 16 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,22 @@
}
},
"require": {
"php": ">= 7.2",
"jane-php/open-api-runtime": "~7.4.0",
"psr/http-client-implementation": "*",
"php-http/client-common": "^1.9 || ^2.0",
"php-http/discovery": "^1.7",
"php-http/multipart-stream-builder": "^1.1"
"php": ">= 8.1",
"jane-php/open-api-runtime": "^7.6"
},
"require-dev": {
"jane-php/open-api-2": "~7.4.0",
"symfony/http-client": "^4.3.3 || ^5.1 || ^6.0",
"nyholm/psr7": "^1.2",
"friendsofphp/php-cs-fixer": "^3.0",
"symfony/phpunit-bridge": "^6.0",
"opis/json-schema": "^2.0",
"symfony/console": "^6.0",
"symfony/contracts": "^3.0",
"symfony/process": "^6.0",
"symfony/string": "^6.0"
"jane-php/open-api-3": "^7.6",
"friendsofphp/php-cs-fixer": "^3.56",
"rector/rector": "^1.0"
},
"config": {
"allow-plugins": {
"php-http/discovery": true
}
},
"extra": {
"symfony": {
"allow-contrib": "true"
}
}
}
27 changes: 0 additions & 27 deletions generated/Authentication/ApiKeyAuthentication.php

This file was deleted.

28 changes: 28 additions & 0 deletions generated/Authentication/BearerAuthAuthentication.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

namespace Qdequippe\Yousign\Api\Authentication;

use Jane\Component\OpenApiRuntime\Client\AuthenticationPlugin;
use Psr\Http\Message\RequestInterface;

class BearerAuthAuthentication implements AuthenticationPlugin
{
private $token;

public function __construct(string $token)
{
$this->{'token'} = $token;
}

public function authentication(RequestInterface $request): RequestInterface
{
$header = sprintf('Bearer %s', $this->{'token'});

return $request->withHeader('Authorization', $header);
}

public function getScope(): string
{
return 'bearerAuth';
}
}
Loading

0 comments on commit 8ad9073

Please sign in to comment.