# 🐣 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='<access_token>', current_team='<team_name>')
```
### 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='<access_token>', current_team='<team_name>')
# 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/<team_name>
client.stats()
#=> GET /v1/teams/<team_name>/stats
client.members()
#=> GET /v1/teams/<team_name>/members
client.delete_member()
#=> DELETE /v1/teams/<team_name>/members/1
client.posts(keywords=["diary secret"], search_options={"sort": "created"})
#=> GET /v1/teams/<team_name>/posts
client.post(1)
#=> GET /v1/teams/<team_name>/posts/1
client.create_post({post: {name: "hi!"}})
#=> POST /v1/teams/<team_name>/posts
client.update_post(1, {post: {name: "hi!"}})
#=> PATCH /v1/teams/<team_name>/posts/1
client.delete_post(1)
#=> DELETE /v1/teams/<team_name>/posts/1
client.comments()
#=> GET /v1/teams/<team_name>/comments
client.comments(1)
#=> GET /v1/teams/<team_name>/posts/1/comments
client.create_comment(1, {"comment":{"body_md":"LGTM!"}})
#=> POST /v1/teams/<team_name>/posts/1/comments
client.update_comment(234, {"comment":{"body_md":"LGTM!"}})
#=> PATCH /v1/teams/<team_name>/comments/234
client.delete_comment(234)
#=> DELETE /v1/teams/<team_name>/comments/234
client.comment(234)
#=> GET /v1/teams/<team_name>/comments/234
client.add_post_star(1)
#=> POST /v1/teams/<team_name>/posts/1/star
client.delete_post_star(1)
#=> DELETE /v1/teams/<team_name>/posts/1/star
client.stargazers(1)
#=> GET /v1/teams/<team_name>/posts/1/stargazers
client.add_comment_star(234)
#=> POST /v1/teams/<team_name>/comment/234/star
client.delete_comment_star(234)
#=> DELETE /v1/teams/<team_name>/comment/234/star
client.watchers(1)
#=> POST /v1/teams/<team_name>/posts/1/watchers
client.add_watch(1)
#=> POST /v1/teams/<team_name>/posts/1/watch
client.delete_watch(1)
#=> DELETE /v1/teams/<team_name>/posts/1/watch
client.batch_move({})
#=> POST /v1/teams/<team_name>/posts/1/watch
client.regenerate_invitation()
#=> POST /v1/teams/<team_name>/invitation_regenerator
client.send_invitation({"member": {"emails": ["foo@example.com"]})
#=> POST /v1/teams/<team_name>/invitations
client.delete_invitation("mee93383edf699b525e01842d34078e28")
#=> DELETE /v1/teams/<team_name>/invitations/mee93383edf699b525e01842d34078e28
client.invitations()
#=> GET /v1/teams/<team_name>/invitations
client.emojis()
#=> GET /v1/teams/<team_name>/emojis
client.create_emoji({"emoji": {"code": "funny", "image": base64}})
#=> POST /v1/teams/<team_name>/emojis
client.delete_emoji("test_emoji")
#=> DELETE /v1/teams/<team_name>/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/<test_file>.py -v
```
Raw data
{
"_id": null,
"home_page": "https://github.com/argonism/piyo",
"name": "piyo",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "esa api client esa.io python",
"author": "k-ush",
"author_email": "argoooooon@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/8a/03/c6496cf6805a96e6028bd660549a665bc034905d155895cc8fae37f9af1d/piyo-1.1.2.tar.gz",
"platform": null,
"description": "# \ud83d\udc23 piyo\nesa API v1 client library, written in Python\n\n[![Downloads](https://static.pepy.tech/badge/piyo)](https://pepy.tech/project/piyo)\n[![Downloads](https://static.pepy.tech/badge/piyo/month)](https://pepy.tech/project/piyo)\n[![Downloads](https://static.pepy.tech/badge/piyo/week)](https://pepy.tech/project/piyo)\n\n## Installation\n\nInstall this library using pip from [PyPI](https://pypi.org/project/piyo/)\n\n``` shell\npip install piyo\n```\n\n## Usage By purpose\n\n### Preparation\n\n```python\nfrom piyo import Client\n\nclient = Client(access_token='<access_token>', current_team='<team_name>')\n``` \n\n### Search article\n\nSet search keywords and options.\n\nSee official documents for details: https://docs.esa.io/posts/102#%E8%A8%98%E4%BA%8B\n\n``` python\nkeywords = [\"diary\", \"secret\"]\nsearch_options = {\n \"sort\": \"created\"\n}\nposts = client.posts(keywords=keywords, search_options=search_options)\n``` \n\n## Usage\n\n``` python\nfrom piyo import Client\n\nclient = Client(access_token='<access_token>', current_team='<team_name>')\n# Client will look up environment variables \"ESA_ACCESS_TOKEN\", so you can set access token \n# to ESA_ACCESS_TOKEN instead of pass it to Client.\n\nclient.user()\n#=> GET /v1/user\n\nclient.teams()\n#=> GET /v1/teams\n\nclient.team()\n#=> GET /v1/teams/<team_name>\n\nclient.stats()\n#=> GET /v1/teams/<team_name>/stats\n\nclient.members()\n#=> GET /v1/teams/<team_name>/members\n\nclient.delete_member()\n#=> DELETE /v1/teams/<team_name>/members/1\n\nclient.posts(keywords=[\"diary secret\"], search_options={\"sort\": \"created\"})\n#=> GET /v1/teams/<team_name>/posts\n\nclient.post(1)\n#=> GET /v1/teams/<team_name>/posts/1\n\nclient.create_post({post: {name: \"hi!\"}})\n#=> POST /v1/teams/<team_name>/posts\n\nclient.update_post(1, {post: {name: \"hi!\"}})\n#=> PATCH /v1/teams/<team_name>/posts/1\n\nclient.delete_post(1)\n#=> DELETE /v1/teams/<team_name>/posts/1\n\nclient.comments()\n#=> GET /v1/teams/<team_name>/comments\n\nclient.comments(1)\n#=> GET /v1/teams/<team_name>/posts/1/comments\n\nclient.create_comment(1, {\"comment\":{\"body_md\":\"LGTM!\"}})\n#=> POST /v1/teams/<team_name>/posts/1/comments\n\nclient.update_comment(234, {\"comment\":{\"body_md\":\"LGTM!\"}})\n#=> PATCH /v1/teams/<team_name>/comments/234\n\nclient.delete_comment(234)\n#=> DELETE /v1/teams/<team_name>/comments/234\n\nclient.comment(234)\n#=> GET /v1/teams/<team_name>/comments/234\n\nclient.add_post_star(1)\n#=> POST /v1/teams/<team_name>/posts/1/star\n\nclient.delete_post_star(1)\n#=> DELETE /v1/teams/<team_name>/posts/1/star\n\nclient.stargazers(1)\n#=> GET /v1/teams/<team_name>/posts/1/stargazers\n\nclient.add_comment_star(234)\n#=> POST /v1/teams/<team_name>/comment/234/star\n\nclient.delete_comment_star(234)\n#=> DELETE /v1/teams/<team_name>/comment/234/star\n\nclient.watchers(1)\n#=> POST /v1/teams/<team_name>/posts/1/watchers\n\nclient.add_watch(1)\n#=> POST /v1/teams/<team_name>/posts/1/watch\n\nclient.delete_watch(1)\n#=> DELETE /v1/teams/<team_name>/posts/1/watch\n\nclient.batch_move({})\n#=> POST /v1/teams/<team_name>/posts/1/watch\n\nclient.regenerate_invitation()\n#=> POST /v1/teams/<team_name>/invitation_regenerator\n\nclient.send_invitation({\"member\": {\"emails\": [\"foo@example.com\"]})\n#=> POST /v1/teams/<team_name>/invitations\n\nclient.delete_invitation(\"mee93383edf699b525e01842d34078e28\")\n#=> DELETE /v1/teams/<team_name>/invitations/mee93383edf699b525e01842d34078e28\n\nclient.invitations()\n#=> GET /v1/teams/<team_name>/invitations\n\nclient.emojis()\n#=> GET /v1/teams/<team_name>/emojis\n\nclient.create_emoji({\"emoji\": {\"code\": \"funny\", \"image\": base64}})\n#=> POST /v1/teams/<team_name>/emojis\n\nclient.delete_emoji(\"test_emoji\")\n#=> DELETE /v1/teams/<team_name>/emojis/test_emoji\n\n```\n\n## Development\n\nissues and pull requests are always welcome!\n\nrun integration test\n\n``` shell\npython3 tests/integration_test.py\n```\n\nrun unit test\n\n``` shell\npython3 tests/<test_file>.py -v\n```\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "esa API v1 client library, written in python",
"version": "1.1.2",
"project_urls": {
"Homepage": "https://github.com/argonism/piyo"
},
"split_keywords": [
"esa",
"api",
"client",
"esa.io",
"python"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "8a03c6496cf6805a96e6028bd660549a665bc034905d155895cc8fae37f9af1d",
"md5": "fed459e1aacf2f1eb2c1727ea20b20cd",
"sha256": "c8a800662c982b5c21a9af8e5ed8055af930c6fa4e19a6fddb566d39e30c43c5"
},
"downloads": -1,
"filename": "piyo-1.1.2.tar.gz",
"has_sig": false,
"md5_digest": "fed459e1aacf2f1eb2c1727ea20b20cd",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 5204,
"upload_time": "2023-10-05T08:33:45",
"upload_time_iso_8601": "2023-10-05T08:33:45.745015Z",
"url": "https://files.pythonhosted.org/packages/8a/03/c6496cf6805a96e6028bd660549a665bc034905d155895cc8fae37f9af1d/piyo-1.1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-10-05 08:33:45",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "argonism",
"github_project": "piyo",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "piyo"
}