Skip to content

Commit

Permalink
Release 24.7 (#72)
Browse files Browse the repository at this point in the history
* Insert example from index.php

* Bump version to 24.7
  • Loading branch information
Denis-Averin authored Jul 26, 2024
1 parent 8398e8b commit 9bd7d15
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 4 deletions.
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ update:
composer update
composer validate

.PHONY: insert-example
insert-example:
./scripts/insert-example.bash

.PHONY: after-gen
after-gen: format
after-gen: format insert-example
./scripts/add-deprecation-warnings.bash
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[![Supported PHP Versions](https://img.shields.io/packagist/dependency-v/aspose/barcode-cloud-php/php)](https://packagist.org/packages/aspose/barcode-cloud-php)

- API version: 3.0
- Package version: 24.6.0
- Package version: 24.7.0
- Supported PHP versions: ">=7.4 || >=8.0"

## Demo applications
Expand Down Expand Up @@ -47,14 +47,23 @@ require __DIR__ . '/vendor/autoload.php';
### Sample usage

```php
<?php

declare(strict_types=1);

require __DIR__ . '/vendor/autoload.php';

use Aspose\BarCode\Configuration;
use Aspose\BarCode\BarcodeApi;
use Aspose\BarCode\Requests\GetBarcodeGenerateRequest;
use Aspose\BarCode\Model\{EncodeBarcodeType, CodeLocation};

$config = new Configuration();
$config->setClientId('Client Id from https://dashboard.aspose.cloud/applications');
$config->setClientId('ClientId from https://dashboard.aspose.cloud/applications');
$config->setClientSecret('Client Secret from https://dashboard.aspose.cloud/applications');
if (getenv("TEST_CONFIGURATION_ACCESS_TOKEN")) {
$config->setAccessToken(getenv("TEST_CONFIGURATION_ACCESS_TOKEN"));
}

$request = new GetBarcodeGenerateRequest(EncodeBarcodeType::QR, 'PHP SDK Test');
$request->format = 'png';
Expand All @@ -68,6 +77,7 @@ $size = $response->getSize();
header("Content-Type: $type");
header("Content-Length: $size");
echo $response->fread($size);

```

## Licensing
Expand Down Expand Up @@ -194,3 +204,4 @@ Class | Method | HTTP request | Description
- [TextAlignment](docs/Model/TextAlignment.md)
- [FileVersion](docs/Model/FileVersion.md)


8 changes: 8 additions & 0 deletions scripts/insert-example.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
set -euo pipefail

cd "$( dirname "${BASH_SOURCE[0]}" )/.."

python "./scripts/insert-example.py" "README.template" > "README.md"

rm "README.template"
34 changes: 34 additions & 0 deletions scripts/insert-example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import argparse
import os
import re
import typing

REPLACE_RE = re.compile(r'^%insert (?P<file_name>[^%]+)%$', re.MULTILINE)


def read_text(filename: str) -> str:
with open(filename, "rt") as rf:
text = rf.read()
return text


def main(template: typing.TextIO) -> None:
content: str = template.read()

def sub_match(match):
file_name = match.group('file_name')
return read_text(file_name)

text = REPLACE_RE.sub(sub_match, content)
print(text)


def parse_args() -> typing.Dict[str, typing.Any]:
parser = argparse.ArgumentParser()
parser.add_argument("template", type=argparse.FileType("rt"), help="README.template")
kwargs = vars(parser.parse_args())
return kwargs


if __name__ == "__main__":
main(**parse_args())
2 changes: 1 addition & 1 deletion src/Aspose/BarCode/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Configuration implements JsonSerializable
*
* @var string
*/
protected $clientVersion = '24.6.0';
protected $clientVersion = '24.7.0';

/**
* ClientId for API
Expand Down

0 comments on commit 9bd7d15

Please sign in to comment.