aurigma/php-asset-storage-client

PHP API 客户端,用于客户 Canvas 网上印刷系统的资产存储服务。

2.0.0 2024-06-14 05:21 UTC

This package is auto-updated.

Last update: 2024-09-14 05:49:18 UTC


README

======================================================

此模块是资产存储服务的 PHP API 客户端,该服务是 Customer's Canvas 网上印刷系统的一部分。假设您熟悉其服务并了解如何使用其 API。有关 Customer's Canvas 和其服务的更多信息,请参阅文档中的入门部分

先决条件

要使用此软件包,您需要满足以下要求

  • 您必须在 Customer's Canvas 上有一个账户。

有关其他平台,请参阅 Customer's Canvas 文档中的后端服务文章。

安装

composer require aurigma/php-asset-storage-client

要求

PHP 7.2 及以上。

Composer

要通过 Composer 安装绑定,请在 composer.json 中添加以下内容

{
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/aurigma/php-asset-storage-client.git"
    }
  ],
  "require": {
    "aurigma/php-asset-storage-client": "*@dev"
  }
}

然后运行 composer install

入门

请遵循 安装过程

通过 文档 中的说明,通过您的后端接收访问令牌并将其传递给您的应用程序。

然后运行以下操作

<?php
require_once(__DIR__ . '/vendor/autoload.php');



// Configure API key authorization: apiKey
$config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKey('X-API-Key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-API-Key', 'Bearer');

// Configure OAuth2 access token for authorization: oauth2
$config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new OpenAPI\Client\Api\ArtifactsApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$tenant_id = 56; // int | Tenant identifier
$file = "/path/to/file.txt"; // \SplFileObject | Entity file content
$description = 'description_example'; // string | Artifact description
$group = 'group_example'; // string | Artifact group
$alias = 'alias_example'; // string | Artifact alias (special name within group)
$type = new \OpenAPI\Client\Model\ArtifactType(); // \OpenAPI\Client\Model\ArtifactType
$format = 'format_example'; // string | Artifact file format

try {
    $result = $apiInstance->artifactsCreate($tenant_id, $file, $description, $group, $alias, $type, $format);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ArtifactsApi->artifactsCreate: ', $e->getMessage(), PHP_EOL;
}
?>

测试

要运行测试,请使用

composer install
vendor/bin/phpunit

作者

Aurigma Inc info@aurigma.com (https://customerscanvas.com)

API 端点

所有 URI 都是相对于 https://dm-assetstorage.azurewebsites.net/

模型