You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

113 lines
3.3 KiB

2 years ago
  1. # OpenAPIClient-php
  2. The Seaweedfs Master Server API allows you to store blobs
  3. ## Installation & Usage
  4. ### Requirements
  5. PHP 7.4 and later.
  6. Should also work with PHP 8.0.
  7. ### Composer
  8. To install the bindings via [Composer](https://getcomposer.org/), add the following to `composer.json`:
  9. ```json
  10. {
  11. "repositories": [
  12. {
  13. "type": "vcs",
  14. "url": "https://github.com/GIT_USER_ID/GIT_REPO_ID.git"
  15. }
  16. ],
  17. "require": {
  18. "GIT_USER_ID/GIT_REPO_ID": "*@dev"
  19. }
  20. }
  21. ```
  22. Then run `composer install`
  23. ### Manual Installation
  24. Download the files and include `autoload.php`:
  25. ```php
  26. <?php
  27. require_once('/path/to/OpenAPIClient-php/vendor/autoload.php');
  28. ```
  29. ## Getting Started
  30. Please follow the [installation procedure](#installation--usage) and then run the following:
  31. ```php
  32. <?php
  33. require_once(__DIR__ . '/vendor/autoload.php');
  34. $apiInstance = new OpenAPI\Client\Api\DefaultApi(
  35. // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
  36. // This is optional, `GuzzleHttp\Client` will be used as default.
  37. new GuzzleHttp\Client()
  38. );
  39. $count = NULL; // mixed | how many file ids to assign. Use <fid>_1, <fid>_2 for the assigned additional file ids. e.g. 3,01637037d6_1, 3,01637037d6_2
  40. $collection = NULL; // mixed | required collection name
  41. $data_center = NULL; // mixed | preferred data center
  42. $rack = NULL; // mixed | preferred rack
  43. $data_node = NULL; // mixed | preferred volume server, e.g. 127.0.0.1:8080
  44. $disk = NULL; // mixed | If you have disks labelled, this must be supplied to specify the disk type to allocate on.
  45. $replication = NULL; // mixed | replica placement strategy
  46. $ttl = NULL; // mixed | file expiration time limit, example: 3m for 3 minutes. units: m-minute, h-hour, d-day, w-week, M-month, y-year
  47. $preallocate = NULL; // mixed | If no matching volumes, pre-allocate this number of bytes on disk for new volumes.
  48. $memory_map_max_size_mb = NULL; // mixed | Only implemented for windows. Use memory mapped files with specified size for new volumes.
  49. $writable_volume_count = NULL; // mixed | If no matching volumes, create specified number of new volumes.
  50. try {
  51. $result = $apiInstance->dirAssign($count, $collection, $data_center, $rack, $data_node, $disk, $replication, $ttl, $preallocate, $memory_map_max_size_mb, $writable_volume_count);
  52. print_r($result);
  53. } catch (Exception $e) {
  54. echo 'Exception when calling DefaultApi->dirAssign: ', $e->getMessage(), PHP_EOL;
  55. }
  56. ```
  57. ## API Endpoints
  58. All URIs are relative to *https://127.0.0.1:9333*
  59. Class | Method | HTTP request | Description
  60. ------------ | ------------- | ------------- | -------------
  61. *DefaultApi* | [**dirAssign**](docs/Api/DefaultApi.md#dirassign) | **GET** /dir/assign | Assign a file key
  62. *DefaultApi* | [**dirLookup**](docs/Api/DefaultApi.md#dirlookup) | **GET** /dir/lookup | Lookup volume
  63. ## Models
  64. - [FileKey](docs/Model/FileKey.md)
  65. - [Location](docs/Model/Location.md)
  66. ## Authorization
  67. All endpoints do not require authorization.
  68. ## Tests
  69. To run the tests, use:
  70. ```bash
  71. composer install
  72. vendor/bin/phpunit
  73. ```
  74. ## Author
  75. ## About this package
  76. This PHP package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
  77. - API version: `3.43.0`
  78. - Build package: `org.openapitools.codegen.languages.PhpClientCodegen`