From b4649d8c2d840f0e49b8a7cd7f2b7284c145c7df Mon Sep 17 00:00:00 2001 From: Oluwafemi Tairu Date: Sat, 18 Dec 2021 15:22:23 +0100 Subject: [PATCH] feat: updated documentation --- README.md | 91 +++++++++++++++++++++++++++++++++++++++ poetry.lock | 4 +- pyproject.toml | 20 ++++++++- setup.py | 32 -------------- thepeer_sdk/core/links.py | 6 +++ thepeer_sdk/core/users.py | 6 ++- 6 files changed, 123 insertions(+), 36 deletions(-) delete mode 100644 setup.py diff --git a/README.md b/README.md index 75a14a1..06c659c 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,10 @@ # Thepeer Python SDK ![GitHub issues](https://img.shields.io/github/issues/Emmarex/thepeer-sdk-python) +![PyPI - Python Version](https://img.shields.io/pypi/pyversions/thepeer-sdk) +![PyPI](https://img.shields.io/pypi/v/thepeer-sdk) ![PyPI - Downloads](https://img.shields.io/pypi/dm/thepeer-sdk) +![PyPI - License](https://img.shields.io/pypi/l/thepeer-sdk) [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit) Python SDK for [Thepeer](https://thepeer.co/). @@ -34,21 +37,109 @@ thepeer_sdk_client.list_users() ### Available Methods #### User - index_user + : Index a particular user on Thepeer + + **parameters**: + - name(str) + - identifier(str) + : unique user identifier + - email(str) + + **returns**: dict + - list_users + : Get the list of all indexed users + + **parameters**: + - page(int) + : page number to return + - perPage(int) + : amount of records to return per page + + **returns**: dict + - update_user + : Update your user's identifier when they make a profile update to their identifier on your platform. + + **parameters**: + - user_ref(str) + : the reference returned when the user was indexed + - user_identifier(str) + : unique user identifier + + **returns**: dict + - delete_user + : Delete a user in the event that a user deactivates their account on your platform + + **parameters**: + - user_ref(str) + : the reference returned when the user was indexed + + **returns**: dict #### Link - get_user_links + : This returns all linked accounts associated with a user. + + **parameters**: + - user_ref(str) + : the reference returned when the user was indexed + + **returns**: dict + - get_link + : Get a linked account details + + **parameters**: + - link_id(str) + : link ID + + **returns**: dict #### Send - verify_receipt + : Verify a particular receipt. + + **parameters**: + - receipt_ref(str) + : reference of the receipt to process + + **returns**: dict + - process_receipt + : Process receipts generated from Thepeer inline. + + **parameters**: + - receipt_ref(str) + : reference of the receipt to process + - event(str) + + **returns**: dict #### Direct Charge - charge_link + : Charge your user's linked account at any time + + **parameters**: + - link_id(str) + : id of the link to charge + - amount(int) + : amount to charge + - remark(str) + : narration of the charge + + **returns**: dict + - authorize_charge + : authorize direct charge request via webhooks + + **parameters**: + - charge_ref(str) + : direct charge reference + - event(str) + + **returns**: dict ## Upgrade diff --git a/poetry.lock b/poetry.lock index a93c071..35814d0 100644 --- a/poetry.lock +++ b/poetry.lock @@ -250,8 +250,8 @@ testing = ["pytest (>=4.6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytes [metadata] lock-version = "1.1" -python-versions = "3.7.12" -content-hash = "3f686b25cc971984a5aa31faed3b2248d020018bf83a30d565a0b1931a3308c8" +python-versions = "^3.7.12" +content-hash = "a3af2329c551a2ffeade1b43a71049f25e7d8f58b16ea2f6e7706c476b6b0872" [metadata.files] autopep8 = [ diff --git a/pyproject.toml b/pyproject.toml index f903a12..818bf41 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,9 +4,27 @@ version = "0.0.1" description = "Python SDK for Thepeer" authors = ["Oluwafemi Tairu "] license = "Apache-2.0" +keywords = ["thepeer", "thepeer-sdk"] +readme = "README.md" +homepage = "https://github.com/Emmarex/thepeer-sdk-python" +repository = "https://github.com/Emmarex/thepeer-sdk-python" +include = [ + "LICENSE", +] +classifiers=[ + "Natural Language :: English", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "License :: OSI Approved :: Apache Software License", + "Development Status :: 4 - Beta", + "Intended Audience :: Developers" +] [tool.poetry.dependencies] -python = "3.7.12" +python = "^3.7.12" requests = "^2.26.0" [tool.poetry.dev-dependencies] diff --git a/setup.py b/setup.py deleted file mode 100644 index 87dde91..0000000 --- a/setup.py +++ /dev/null @@ -1,32 +0,0 @@ -from setuptools import find_packages, setup - -with open("README.md", "r") as fh: - long_description = fh.read() - -setup( - name='thepeer-sdk', - version='0.0.1', - author="Tairu Oluwafemi Emmanuel", - author_email="developer.emmarex@gmail.com", - description="", - long_description=long_description, - long_description_content_type="text/markdown", - url="https://github.com/Emmarex/thepeer-sdk-python", - download_url="", - keywords=['thepeer'], - include_package_data=True, - packages=find_packages(), - python_requires='~=3.7', - classifiers=[ - "Natural Language :: English", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.10" - "Programming Language :: Python :: 3.11" - "License :: OSI Approved :: Apache Software License", - "Development Status :: 4 - Beta", - # "Development Status :: 6 - Mature", - "Intended Audience :: Developers" - ], -) diff --git a/thepeer_sdk/core/links.py b/thepeer_sdk/core/links.py index b16594c..0d158ec 100644 --- a/thepeer_sdk/core/links.py +++ b/thepeer_sdk/core/links.py @@ -17,6 +17,9 @@ def __init__(self) -> None: def get_user_links(self, user_ref: str) -> dict: """ This returns all linked accounts associated with a user. + + :params user_ref: str + the reference returned when the user was indexed """ if not user_ref or user_ref.strip() == "": @@ -30,6 +33,9 @@ def get_user_links(self, user_ref: str) -> dict: def get_link(self, link_id: str) -> dict: """ Get a linked account details + + :params link_id: str + link ID """ if not link_id or link_id.strip() == "": diff --git a/thepeer_sdk/core/users.py b/thepeer_sdk/core/users.py index 1e09a20..36c2b0b 100644 --- a/thepeer_sdk/core/users.py +++ b/thepeer_sdk/core/users.py @@ -35,7 +35,7 @@ def index_user(self, name: str, identifier: str, email: str) -> dict: } ) - def list_users(self, page: int = 1, perPage: int = 10) -> dict: + def list_users(self, page: int = 1, per_page: int = 10) -> dict: """ Get the list of all indexed users @@ -47,6 +47,10 @@ def list_users(self, page: int = 1, perPage: int = 10) -> dict: """ return self.api_client.make_get( url=f'{self.API_BASE_URL}/users', + query_params={ + "page": page, + "perPage": per_page + } ) def update_user(self, user_ref: str, user_identifier: str) -> dict: