Skip to content

Commit

Permalink
feat: updated documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Emmarex committed Dec 18, 2021
1 parent 25b8bb8 commit b4649d8
Show file tree
Hide file tree
Showing 6 changed files with 123 additions and 36 deletions.
91 changes: 91 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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/).
Expand Down Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 19 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,27 @@ version = "0.0.1"
description = "Python SDK for Thepeer"
authors = ["Oluwafemi Tairu <tairuoluwafemi09@gmail.com>"]
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]
Expand Down
32 changes: 0 additions & 32 deletions setup.py

This file was deleted.

6 changes: 6 additions & 0 deletions thepeer_sdk/core/links.py
Original file line number Diff line number Diff line change
Expand Up @@ -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() == "":
Expand All @@ -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() == "":
Expand Down
6 changes: 5 additions & 1 deletion thepeer_sdk/core/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down

0 comments on commit b4649d8

Please sign in to comment.