Skip to content

Commit

Permalink
Merge 0e653ef into 195ecd6
Browse files Browse the repository at this point in the history
  • Loading branch information
polidog committed Jan 28, 2018
2 parents 195ecd6 + 0e653ef commit 2657cc2
Show file tree
Hide file tree
Showing 15 changed files with 1,030 additions and 1,093 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -3,3 +3,4 @@ demo.php
vendor
.idea
.php_cs.cache
composer.lock
80 changes: 40 additions & 40 deletions README.md
Expand Up @@ -7,7 +7,7 @@
[![Total Downloads](https://poser.pugx.org/polidog/esa-php/downloads)](https://packagist.org/packages/polidog/esa-php)
[![License](https://poser.pugx.org/polidog/esa-php/license)](https://packagist.org/packages/polidog/esa-php)

esa API v1 client library, written in PHP
esa API v2 client library, written in PHP

## Installation

Expand All @@ -30,129 +30,129 @@ composer.phar require polidog/esa-php
require 'vendor/autoload.php';
$client = new Polidog\Esa\Client("<access_token>", "foobar");
$api = \Polidog\Esa\Api::factory("<access_token>", "foobar");
$client->user();
$api->user();
// GET /v1/user
$client->teams();
$api->teams();
// GET /v1/teams
$client->team('bar');
$api->team('bar');
// GET /v1/teams/bar
$client->stats()
$api->stats()
// GET /v1/teams/foobar/stats
$client->members();
$api->members();
// GET /v1/teams/foobar/members
$client->posts();
$api->posts();
// GET /v1/teams/foobar/posts
$client->posts(["q" => "in:help"]);
$api->posts(["q" => "in:help"]);
// GET /v1/teams/foobar/posts?q=in%3Ahelp
$client->createPost(["name" => "foo"]);
$api->createPost(["name" => "foo"]);
// POST /v1/teams/foobar/posts
$client->updatePost(1, ["name" => "bar"]);
$api->updatePost(1, ["name" => "bar"]);
// PATCH /v1/teams/foobar/posts/1
$client->deletePost(1);
$api->deletePost(1);
// DELETE /v1/teams/foobar/posts/1
// Comment API
$client->comments(1); /* post number */
$api->comments(1); /* post number */
// GET /v1/teams/foobar/posts/1/comments
$client->createComment(1, ['body_md' => 'baz']);
$api->createComment(1, ['body_md' => 'baz']);
// POST /v1/teams/foobar/posts/1/comments
$client->comment(123); /* comment id */
$api->comment(123); /* comment id */
// GET /v1/teams/foobar/comments/123
$client->updateComment(123, ['body_md' => 'bazbaz']);
$api->updateComment(123, ['body_md' => 'bazbaz']);
// PATCH /v1/teams/foobar/comments/123
$client->deleteComment(123);
$api->deleteComment(123);
// DELETE /v1/teams/foobar/comments/123
$client->comments();
$api->comments();
// GET /v1/teams/foobar/comments
$client->createSharing(1);
$api->createSharing(1);
// POST /v1/teams/foobar/posts/1/sharing
$client->deleteSharing(1);
$api->deleteSharing(1);
// DELETE /v1/teams/foobar/posts/1/sharing
# Star API
$client->postStargazers(1);
$api->postStargazers(1);
// GET /v1/teams/foobar/posts/1/stargazers
$client->addPostStar(1);
$api->addPostStar(1);
// POST /v1/teams/foobar/posts/1/star
$client->deletePostStar(1);
$api->deletePostStar(1);
// DELETE /v1/teams/foobar/posts/1/star
$client->commentStargazers(123);
$api->commentStargazers(123);
// GET /v1/teams/foobar/comments/123/stargazers
$client->addCommentStar(123);
$api->addCommentStar(123);
// POST /v1/teams/foobar/comments/123/star
$client->deleteCommentStar(123);
$api->deleteCommentStar(123);
// DELETE /v1/teams/foobar/comments/123/star
# Watch API
$client->watchers(1);
$api->watchers(1);
// GET /v1/teams/foobar/posts/1/watchers
$client->addWatch(1);
$api->addWatch(1);
// POST /v1/teams/foobar/posts/1/watch
$client->deleteWtach(1);
$api->deleteWtach(1);
// DELETE /v1/teams/foobar/posts/1/watch
# Categories API
$client->categories();
$api->categories();
// GET /v1/teams/foobar/categories
# Tags API
$client->tags();
$api->tags();
// GET /v1/teams/foobar/tags
# Invitation API
$client->invitation();
$api->invitation();
// GET /v1/teams/foobar/invitation
$client->regenerateInvitation();
$api->regenerateInvitation();
// POST /v1/teams/foobar/invitation_regenerator
$client->pendingInvitations();
$api->pendingInvitations();
// GET /v1/teams/foobar/invitations
$client->sendInvitation(['test@test.com','test2@test.com']);
$api->sendInvitation(['test@test.com','test2@test.com']);
// POST /v1/teams/foobar/invitations
$client->cancelInvitation($code);
$api->cancelInvitation($code);
// DELETE /v1/teams/foobar/invitations/baz
# Emoji API
$client->emojis();
$api->emojis();
// GET /v1/teams/foobar/emojis
$client->createEmoji(['code' => 'team_emoji', image: '/path/to/image');
$api->createEmoji(['code' => 'team_emoji', image: '/path/to/image');
// POST /v1/teams/foobar/emojis
$client->createEmoji(['code' => 'alias_code', origin_code: 'team_emoji');
$api->createEmoji(['code' => 'alias_code', origin_code: 'team_emoji');
// POST /v1/teams/foobar/emojis
$client->deleteEmoji('team_emoji');
$api->deleteEmoji('team_emoji');
// DELETE /v1/teams/foobar/emojis/team_emoji
```

Expand Down
12 changes: 8 additions & 4 deletions composer.json
Expand Up @@ -13,16 +13,20 @@
"guzzlehttp/guzzle": "~6.0"
},
"require-dev": {
"phpunit/phpunit": "4.6.7",
"phpunit/phpcov": "*",
"phake/phake": "2.*",
"satooshi/php-coveralls": "dev-master"
"satooshi/php-coveralls": "^2.0",
"phpunit/phpunit": "^5.7",
"fabpot/php-cs-fixer": "^2.10"
},
"autoload": {
"psr-4": {
"Polidog\\Esa\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"Polidog\\Esa\\Test\\": "tests"
}
},
"scripts": {
"test": "./vendor/bin/phpunit"
}
Expand Down
5 changes: 2 additions & 3 deletions phpunit.xml.dist
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false" colors="true" bootstrap="tests/bootstrap.php">
<phpunit backupGlobals="false" colors="true">
<testsuites>
<testsuite name="Test Suite">
<directory>./tests/</directory>
Expand All @@ -17,6 +17,5 @@

<logging>
<log type="coverage-clover" target="build/clover.xml"/>
<log type="coverage-php" target="build/coverage.cov"/>
</logging>
</phpunit>
</phpunit>

0 comments on commit 2657cc2

Please sign in to comment.