From 8771bb9bebf690a4af6ad4cbf9a39ca910e86430 Mon Sep 17 00:00:00 2001 From: Fsoky Community <61309653+Fsoky@users.noreply.github.com> Date: Thu, 1 Apr 2021 19:38:27 +0600 Subject: [PATCH] Update README.md Documentation --- README.md | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2e4edd8..6e7e790 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,54 @@ # Donation-Alerts-API-Python -This module for python. With help this module, you can interact with API Donation Alerts +This module for python. With help this module, you can interact with API Donation Alerts + +`pip install donationalerts_api -U` + +[PyPi](https://pypi.org/project/donationalerts-api/) + +[Official documentation Donation alerts API](https://www.donationalerts.com/apidoc) + +[Donation alerts application clients](https://www.donationalerts.com/application/clients) + + +|Main class|Description| +|----------|-----------| +|DonationAlertsApi(client_id, client_secret, redirect_uri, scope)|Request to API Donation Alerts| + +|Method|Description| +|------|-----------| +|login()|Returns link for connect to API| +|get_code()|Returns code access application| +|get_access_token(code)|Receive access token for the application (necessarily: transfer argument code which you got by get_code)| +|get_donations(access_token)|Receive information about donate (messages)| +|get_user(access_token)|Receive information about user| +|send_custom_alert(access_token, external_id, headline, messages, image_url=None, sound_url=None, is_shown=0)|Send custom alert| + + +### Example: +```py +from flask import Flask, redirect +from donationalerts_api import DonationAlertsApi + +client = Flask(__name__) +api = DonationAlertsApi("9999", "a43f67k9920h01a2wdw", "http://127.0.0.1:5000/login", "scopes") + + +@client.route("/", methods=["get"]) +def index(): + redirect(api.login()) + + +@client.route("/login", methods=["get"]) +def login(): + code = api.get_code() + access_token = api.get_access_token(code) + + user = api.get_user(access_token) + donations = api.get_donations(access_token) + + api.send_custom_alert(access_token, 12, "Test headline", "Test something message...") + + return user +``` + +![](https://static-s.aa-cdn.net/img/gp/20600007776348/FZc95BN57EpF2FOL2JDLaRQ1H2ibGnRVbvAY_F6sja-C8_q1qQGCXZYcNTjTZi7ZISE=w300?v=1)