gn-office/directcloud-api

A minimal implementation of DirectCloud API

v1.6.4 2025-02-26 04:34 UTC

This package is auto-updated.

Last update: 2025-02-26 04:34:31 UTC


README

Latest Version on Packagist Total Downloads

This is a minimal PHP implementation of the DirectCloud API. It contains only the methods needed for our flysystem-directcloud adapter. We are open however to PRs that add extra methods to the client.

Installation

You can install the package via composer:

composer require gn-office/directcloud-api

Usage

The first thing you need to do is to get an authorization information at DirectCloud. You'll find more info at DirectCloud API Documentation.

use GNOffice\DirectCloud\Client;

$client = new Client([$service, $service_key, $code, $id, $password]);
// or
$client = new Client([$service, $service_key, $access_key]);
// or
$client = new Client($access_token);

//create a folder
$client->createFolder($node, $name);

//list a folder
$client->getList($node);

Endpoints

Look in the source code of GNOffice\DirectCloud\Client to discover the methods you can use.

If you do not find your favorite method, you can directly use the v1Request and v2Request functions.

public function v1Request(string $method, string $endpoint, string $requestOption = null, $parameters = [])

public function v2Request(string $method, string $endpoint, string $requestOption, $parameters = [], $extraHeaders = [])

Here's an example:

$client->v1Request('/openapp/v1/files/search/'.{$node}, ['keyword' => 'something', 'sort' => '+datetime', 'limit' => 100]);

License

The MIT License (MIT). Please see License File for more information.