Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/argonism/piyo

🐣 esa API v1 client library, written in python
https://github.com/argonism/piyo

Last synced: 2 days ago
JSON representation

🐣 esa API v1 client library, written in python

Awesome Lists containing this project

README

        

# 🐣 piyo
esa API v1 client library, written in Python

[![Downloads](https://static.pepy.tech/badge/piyo)](https://pepy.tech/project/piyo)
[![Downloads](https://static.pepy.tech/badge/piyo/month)](https://pepy.tech/project/piyo)
[![Downloads](https://static.pepy.tech/badge/piyo/week)](https://pepy.tech/project/piyo)

## Installation

Install this library using pip from [PyPI](https://pypi.org/project/piyo/)

``` shell
pip install piyo
```

## Usage By purpose

### Preparation

```python
from piyo import Client

client = Client(access_token='', current_team='')
```

### Search article

Set search keywords and options.

See official documents for details: https://docs.esa.io/posts/102#%E8%A8%98%E4%BA%8B

``` python
keywords = ["diary", "secret"]
search_options = {
"sort": "created"
}
posts = client.posts(keywords=keywords, search_options=search_options)
```

## Usage

``` python
from piyo import Client

client = Client(access_token='', current_team='')
# Client will look up environment variables "ESA_ACCESS_TOKEN", so you can set access token
# to ESA_ACCESS_TOKEN instead of pass it to Client.

client.user()
#=> GET /v1/user

client.teams()
#=> GET /v1/teams

client.team()
#=> GET /v1/teams/

client.stats()
#=> GET /v1/teams//stats

client.members()
#=> GET /v1/teams//members

client.delete_member()
#=> DELETE /v1/teams//members/1

client.posts(keywords=["diary secret"], search_options={"sort": "created"})
#=> GET /v1/teams//posts

client.post(1)
#=> GET /v1/teams//posts/1

client.create_post({post: {name: "hi!"}})
#=> POST /v1/teams//posts

client.update_post(1, {post: {name: "hi!"}})
#=> PATCH /v1/teams//posts/1

client.delete_post(1)
#=> DELETE /v1/teams//posts/1

client.comments()
#=> GET /v1/teams//comments

client.comments(1)
#=> GET /v1/teams//posts/1/comments

client.create_comment(1, {"comment":{"body_md":"LGTM!"}})
#=> POST /v1/teams//posts/1/comments

client.update_comment(234, {"comment":{"body_md":"LGTM!"}})
#=> PATCH /v1/teams//comments/234

client.delete_comment(234)
#=> DELETE /v1/teams//comments/234

client.comment(234)
#=> GET /v1/teams//comments/234

client.add_post_star(1)
#=> POST /v1/teams//posts/1/star

client.delete_post_star(1)
#=> DELETE /v1/teams//posts/1/star

client.stargazers(1)
#=> GET /v1/teams//posts/1/stargazers

client.add_comment_star(234)
#=> POST /v1/teams//comment/234/star

client.delete_comment_star(234)
#=> DELETE /v1/teams//comment/234/star

client.watchers(1)
#=> POST /v1/teams//posts/1/watchers

client.add_watch(1)
#=> POST /v1/teams//posts/1/watch

client.delete_watch(1)
#=> DELETE /v1/teams//posts/1/watch

client.batch_move({})
#=> POST /v1/teams//posts/1/watch

client.regenerate_invitation()
#=> POST /v1/teams//invitation_regenerator

client.send_invitation({"member": {"emails": ["[email protected]"]})
#=> POST /v1/teams//invitations

client.delete_invitation("mee93383edf699b525e01842d34078e28")
#=> DELETE /v1/teams//invitations/mee93383edf699b525e01842d34078e28

client.invitations()
#=> GET /v1/teams//invitations

client.emojis()
#=> GET /v1/teams//emojis

client.create_emoji({"emoji": {"code": "funny", "image": base64}})
#=> POST /v1/teams//emojis

client.delete_emoji("test_emoji")
#=> DELETE /v1/teams//emojis/test_emoji

```

## Development

issues and pull requests are always welcome!

run integration test

``` shell
python3 tests/integration_test.py
```

run unit test

``` shell
python3 tests/.py -v
```