alblez / bimdata-php-api-client

BIMData API 是一个工具,用于与存储在 BIMData 服务器上的模型进行交互。通过 API,您可以管理项目、云,上传 IFC 文件并通过端点进行管理。

dev-main 2021-10-25 03:34 UTC

This package is auto-updated.

Last update: 2024-09-25 09:51:53 UTC


README

BIMData API 是一个工具,用于与存储在 BIMData 的服务器上的模型进行交互。通过 API,您可以管理您的项目、云,上传您的 IFC 文件并通过端点进行管理。

安装与使用

要求

PHP 7.4 或 PHP 8.0。

Composer

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

{
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/GIT_USER_ID/GIT_REPO_ID.git"
    }
  ],
  "require": {
    "GIT_USER_ID/GIT_REPO_ID": "*@dev"
  }
}

然后运行 composer install

手动安装

下载文件并包含 autoload.php

<?php
require_once('/path/to/OpenAPIClient-php/vendor/autoload.php');

入门指南

请按照 安装说明 操作,然后运行以下命令

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



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

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

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


$apiInstance = new OpenAPI\Client\Api\BcfApi(
    // 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
);
$projects_pk = 'projects_pk_example'; // string
$topics_guid = 'topics_guid_example'; // string
$data = new \OpenAPI\Client\Model\Comment(); // \OpenAPI\Client\Model\Comment

try {
    $result = $apiInstance->createComment($projects_pk, $topics_guid, $data);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling BcfApi->createComment: ', $e->getMessage(), PHP_EOL;
}

API 端点

所有 URI 都相对于 https://api.bimdata.io

模型

授权

Bearer

  • 类型: API 密钥
  • API 密钥参数名称: 授权
  • 位置: HTTP 标头

bimdata_connect

  • 类型: OAuth
  • 流程: implicit
  • 授权 URL: https://iam.bimdata.io/auth/realms/bimdata/protocol/openid-connect/auth
  • 作用域: N/A

client_credentials

  • 类型: OAuth
  • 流程: application
  • 授权 URL: https://iam.bimdata.io/auth/realms/bimdata/protocol/openid-connect/token
  • 作用域: N/A

测试

要运行测试,请使用

composer install
vendor/bin/phpunit

作者

support@bimdata.io

关于本包

本 PHP 包是由 OpenAPI Generator 项目自动生成的

  • API 版本: v1
  • 构建包: org.openapitools.codegen.languages.PhpClientCodegen