Skip to main content

API wrapper for versatileapi in Python

Project description

simpleverse

Test PyPI Maintainability

API wrapper for versatileapi in Python

Install

pip install simpleverse

CLI

Workaround for simpleverse's CLI
$ simv -h
usage: simv [-h]
            {create_like,cl,create_user,cu,update_user,uu,get_like,gl,get_image,gi,get_post,gp,get_user,gu,submit_post,sp,submit_image,si,repl,rl}
            ...

Simple command for sending requests to versatileapi

positional arguments:
  {create_like,cl,create_user,cu,update_user,uu,get_like,gl,get_image,gi,get_post,gp,get_user,gu,submit_post,sp,submit_image,si,repl,rl}
    create_like (cl)
    create_user (cu)
    update_user (uu)
    get_like (gl)
    get_image (gi)
    get_post (gp)
    get_user (gu)
    submit_post (sp)
    submit_image (si)
    repl (rl)

optional arguments:
  -h, --help            show this help message and exit

$ simv cu -n eggplants -d "https://github.com/eggplants/simpleverseを書きました。"
b6e4ae19fc2c59ce55c726de44a40dc825faa04d

$ simv gu -u b6e4ae19fc2c59ce55c726de44a40dc825faa04d
{
    'id': 'b6e4ae19fc2c59ce55c726de44a40dc825faa04d',
    '_created_at': '2021-09-19T04:35:11.765+00:00',
    '_updated_at': '2021-09-19T04:35:11.765+00:00',
    '_user_id': 'b6e4ae19fc2c59ce55c726de44a40dc825faa04d',
    'description': 'https://github.com/eggplants/simpleverseを書きました。',
    'name': 'eggplants'
}

$ simv sp "コレはテストです"
00210022-a452-4be7-a873-d369b1bf8d70

$ simv gp -p 00210022-a452-4be7-a873-d369b1bf8d70
{
    'id': '00210022-a452-4be7-a873-d369b1bf8d70',
    '_created_at': '2021-09-19T04:45:42.017+00:00',
    '_updated_at': '2021-09-19T04:45:42.017+00:00',
    '_user_id': 'b6e4ae19fc2c59ce55c726de44a40dc825faa04d',
    'text': 'コレはテストです'
}

$ simv uu -n eggplants -d "こんにちは。https://github.com/eggplants/simpleverseを書きました。"
b6e4ae19fc2c59ce55c726de44a40dc825faa04d

$ simv gu -u b6e4ae19fc2c59ce55c726de44a40dc825faa04d
{
    'id': 'b6e4ae19fc2c59ce55c726de44a40dc825faa04d',
    '_created_at': '2021-09-19T04:35:11.765+00:00',
    '_updated_at': '2021-09-19T04:46:53.659+00:00',
    '_user_id': 'b6e4ae19fc2c59ce55c726de44a40dc825faa04d',
    'description': 'こんにちは。https://github.com/eggplants/simpleverseを書きました。',
    'name': 'eggplants'
}

# All posts by a specific user
$ simv gp | jq '.[]|select(._user_id=="b6e4ae19fc2c59ce55c726de44a40dc825faa04d")'
{
  "_created_at": "2021-09-18T18:50:33.316+00:00",
  "_updated_at": "2021-09-18T18:50:33.316+00:00",
  "_user_id": "b6e4ae19fc2c59ce55c726de44a40dc825faa04d",
  "id": "12d7d6c5-1412-4299-9fe0-4e11c5261aab",
  "text": "test"
}
{
  "_created_at": "2021-09-19T04:10:35.054+00:00",
  "_updated_at": "2021-09-19T04:10:35.054+00:00",
  "_user_id": "b6e4ae19fc2c59ce55c726de44a40dc825faa04d",
  "id": "81dd0981-de48-47b6-bb81-2bc33579d0d1",
  "text": "hello woooooooold!"
}
{
  "_created_at": "2021-09-19T04:14:44.837+00:00",
  "_updated_at": "2021-09-19T04:14:44.837+00:00",
  "_user_id": "b6e4ae19fc2c59ce55c726de44a40dc825faa04d",
  "id": "b281751f-03a9-47b0-ace1-2dc1be620a2a",
  "text": "hello woooooooold!\n(this post submitted by https://git.io/JzmhD)"
}
{
  "_created_at": "2021-09-19T04:39:57.808+00:00",
  "_updated_at": "2021-09-19T04:39:57.808+00:00",
  "_user_id": "b6e4ae19fc2c59ce55c726de44a40dc825faa04d",
  "id": "d2f875a4-540e-4332-ae4e-5ac80d435449",
  "text": "a"
}
{
  "_created_at": "2021-09-19T04:45:42.017+00:00",
  "_updated_at": "2021-09-19T04:45:42.017+00:00",
  "_user_id": "b6e4ae19fc2c59ce55c726de44a40dc825faa04d",
  "id": "00210022-a452-4be7-a873-d369b1bf8d70",
  "text": "コレはテストです"
}

Library

Classes and its methods of simpleverse
from simpleverse import (
    CreateLike,
    CreateUser,
    GetImageInfo,
    GetLikeInfo,
    GetPostInfo,
    GetUserInfo,
    SubmitImage,
    SubmitPost,
)


class CreateLike(BaseVerseRequests):
    def create_like(self, post_id: str, like_count: int) -> str: ...

class CreateUser(BaseVerseRequests):
    def create_user(self, name: str, description: str) -> str: ...
    def update_user(self, name: str, description: str) -> str: ...

class GetImageInfo(BaseVerseRequests):
    def get_image_all(self) -> List[ImageInfo]: ...
    def get_image(self, image_id: str) -> ImageInfo: ...
    def get_image_OData(
        self,
        filter_: Optional[str] = ...,
        order_by: Optional[str] = ...,
        limit: Optional[int] = ...,
        skip: Optional[int] = ...,
    ) -> List[ImageInfo]: ...

class GetLikeInfo(BaseVerseRequests):
    def get_like_all(self) -> List[LikeInfo]: ...
    def get_like(self, post_id: str) -> LikeInfo: ...
    def get_like_OData(
        self,
        filter_: Optional[str] = ...,
        order_by: Optional[str] = ...,
        limit: Optional[int] = ...,
        skip: Optional[int] = ...,
    ) -> List[LikeInfo]: ...

class GetPostInfo(BaseVerseRequests):
    def get_post_all(self) -> List[PostInfo]: ...
    def get_post(self, post_id: str) -> PostInfo: ...
    def get_post_OData(
        self,
        filter_: Optional[str] = ...,
        order_by: Optional[str] = ...,
        limit: Optional[int] = ...,
        skip: Optional[int] = ...,
    ) -> List[PostInfo]: ...

class GetUserInfo(BaseVerseRequests):
    def get_user_all(self) -> List[UserInfo]: ...
    def get_user(self, user_id: str) -> UserInfo: ...
    def get_user_OData(
        self,
        filter_: Optional[str] = ...,
        order_by: Optional[str] = ...,
        limit: Optional[int] = ...,
        skip: Optional[int] = ...,
    ) -> List[UserInfo]: ...

class SubmitImage(BaseVerseRequests):
    def submit_image(self, image_data: str, post_id: str) -> str: ...

class SubmitPost(BaseVerseRequests):
    def submit_post(
        self,
        text: str,
        rep_user_id: Optional[str] = ...,
        rep_post_id: Optional[str] = ...,
        test: bool = ...,
    ) -> str: ...

Links

Docs

WebUI Clients (deploying somewhare)

CUI Clients

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

simpleverse-0.9.0.tar.gz (11.6 kB view details)

Uploaded Source

Built Distribution

simpleverse-0.9.0-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

File details

Details for the file simpleverse-0.9.0.tar.gz.

File metadata

  • Download URL: simpleverse-0.9.0.tar.gz
  • Upload date:
  • Size: 11.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.13

File hashes

Hashes for simpleverse-0.9.0.tar.gz
Algorithm Hash digest
SHA256 d474b447ddfb11c8e0dfef9deed0ee986c923b08bbfedeb0a14ce7dfeee11f59
MD5 f7640e837a795e32875384cba4355967
BLAKE2b-256 dd1c642e2ed41b52c5d0d1459b40db99fc9545497ac0c6e32e8f1f77e9025d2d

See more details on using hashes here.

File details

Details for the file simpleverse-0.9.0-py3-none-any.whl.

File metadata

  • Download URL: simpleverse-0.9.0-py3-none-any.whl
  • Upload date:
  • Size: 13.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.13

File hashes

Hashes for simpleverse-0.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2b8f32abb5cc18ee43ff63e0c057104d451533f4371492cd0b40b6ee0e0a87f9
MD5 5a1effebd42b38497de9ff66087fe8f4
BLAKE2b-256 bad5cc7362deda56172db7e1fccac7a792c415293cc420bf0e32b98cd6acd6ef

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page