/php-client

A client library for the https://nft.storage/ service.

Primary LanguagePHP

NFTStorage

This client was generated via the OpenAPI schema and is experimental, unsupported, and may not work at all!

No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

Installation & Usage

Requirements

PHP 7.2 and later.

Composer

To install the bindings via Composer, add the following to composer.json:

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

Then run composer install

Manual Installation

Download the files and include autoload.php:

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

Getting Started

Please follow the installation procedure and then run the following:

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



// Configure Bearer (JWT) authorization: bearerAuth
$config = NFTStorage\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new NFTStorage\Api\NFTStorageAPI(
    // 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
);
$before = 2020-07-27T17:32:28Z; // \DateTime | Return results created before provided timestamp
$limit = 10; // int | Max records to return

try {
    $result = $apiInstance->callList($before, $limit);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling NFTStorageAPI->callList: ', $e->getMessage(), PHP_EOL;
}

API Endpoints

All URIs are relative to https://api.nft.storage

Class Method HTTP request Description
NFTStorageAPI callList GET / List all stored files
NFTStorageAPI delete DELETE /{cid} Stop storing the content with the passed CID
NFTStorageAPI status GET /{cid} Get information for the stored file CID
NFTStorageAPI store POST /upload Store a file

Models

Authorization

bearerAuth

  • Type: Bearer authentication (JWT)

Tests

To run the tests, use:

composer install
vendor/bin/phpunit

Author

About this package

This PHP package is automatically generated by the OpenAPI Generator project:

  • API version: 1.0
  • Build package: org.openapitools.codegen.languages.PhpClientCodegen