swe/space-sdk

This package is abandoned and no longer maintained. No replacement package was suggested.

A PHP package to interact with JetBrains Space (autogenerated).

v19.0.1 2024-05-28 05:55 UTC

README

GitHub issues Packagist Downloads Packagist Version License PHP Version

Simplify your PHP connection to JetBrains Space with this package. It represents the whole Space HTTP API and is always up-to-date (checks every day at 3am GMT for updates).

Installation

Install this package with composer require swe/space-sdk and you're done. Don't forget to create an application in your Space Organisation for the client credentials flow and grand permissions. The (most) permissions for each request are included in the comments, like so:

final class Blog extends AbstractApi
{
    /**
     * Permissions that may be checked: Article.View
     *
     * @param array $request
     * @param array $response
     * @return array
     * @throws GuzzleException
     */
    final public function getAllBlogPosts(array $request = [], array $response = []): array
    {
        $uri = 'blog';

        return $this->client->get($this->buildUrl($uri), $request, $response);
    }
}

Examples:

use Swe\SpaceSDK\HttpClient;
use Swe\SpaceSDK\Space;

$clientId = 'Your Client ID Here';
$clientSecret = 'Your Client Secret Here';
$url = 'Your Space URL';

$space = new Space(new HttpClient($url, $clientId, $clientSecret));

// Let's create a project.
$projectInformation = $space->projects()->createProject([
    'key' => [
        'key' => 'MY_PROJECT',
    ],
    'name' => 'My Project',
]);

// Create a new channel if not exist.
if ($space->chats()->channels()->isNameFree(['name' => 'General'])) {
    $channel = $space->chats()->channels()->addNewChannel([
        'name' => 'General',
        'description' => 'No specific topic..',
        'private' => false,
    ]);
}

Information

All package classes are generated automatically. Please submit your issues on GitHub.