API for Markdown Notes app.
Project description
Getting Started with MdNotes
Getting Started
Introduction
API for Markdown Notes app.
Install the Package
The package is compatible with Python versions 2 >=2.7.9 and 3 >=3.4.
Install the package from PyPi using the following pip command:
pip install Md-Notes-api==1.0.0
You can also view the package at: https://pypi.python.org/pypi/Md-Notes-api
Initialize the API Client
The following parameters are configurable for the API Client:
| Parameter | Type | Description |
|---|---|---|
o_auth_client_id |
string |
OAuth 2 Client ID |
o_auth_redirect_uri |
string |
OAuth 2 Redirection endpoint or Callback Uri |
environment |
Environment | The API environment. Default: Environment.PRODUCTION |
timeout |
float |
The value to use for connection timeout. Default: 60 |
max_retries |
int |
The number of times to retry an endpoint call if it fails. Default: 3 |
backoff_factor |
float |
A backoff factor to apply between attempts after the second try. Default: 0 |
The API client can be initialized as follows:
from mdnotes.mdnotes_client import MdnotesClient
from mdnotes.configuration import Environment
client = MdnotesClient(
o_auth_client_id='OAuthClientId',
o_auth_redirect_uri='OAuthRedirectUri',
environment = Environment.PRODUCTION,)
You must now authorize the client.
Authorization
Your application must obtain user authorization before it can execute an endpoint call. The SDK uses OAuth 2.0 Implicit Grant to obtain a user's consent to perform an API request on user's behalf.
This process requires the presence of a client-side JavaScript code on the redirect URI page to receive the access token after the consent step is completed.
1- Obtain user consent
To obtain user's consent, you must redirect the user to the authorization page. The get_authorization_url() method creates the URL to the authorization page.
auth_url = client.auth.get_authorization_url()
2- Handle the OAuth server response
Once the user responds to the consent request, the OAuth 2.0 server responds to your application's access request by redirecting the user to the redirect URI specified set in Configuration.
The redirect URI will receive the access token as the token argument in the URL fragment.
https://example.com/oauth/callback#token=XXXXXXXXXXXXXXXXXXXXXXXXX
The access token must be extracted by the client-side JavaScript code. The access token can be used to authorize any further endpoint calls by the JavaScript code.
Client Class Documentation
MdNotes Client
The gateway for the SDK. This class acts as a factory for the Controllers and also holds the configuration of the SDK.
Controllers
| Name | Description |
|---|---|
| service | Gets ServiceController |
| user | Gets UserController |
API Reference
List of APIs
Service
Overview
Get instance
An instance of the ServiceController class can be accessed from the API Client.
service_controller = client.service
Get Status
def get_status(self)
Response Type
Example Usage
result = service_controller.get_status()
User
Overview
Get instance
An instance of the UserController class can be accessed from the API Client.
user_controller = client.user
Get User
def get_user(self)
Response Type
Example Usage
result = user_controller.get_user()
Model Reference
Structures
Note
Class Name
Note
Fields
| Name | Type | Tags | Description |
|---|---|---|---|
id |
`long | int` | Required |
title |
string |
Required | - |
body |
string |
Required | - |
user_id |
`long | int` | Required |
created_at |
string |
Required | - |
updated_at |
string |
Required | - |
Example (as JSON)
{
"id": 112,
"title": "title4",
"body": "body6",
"user_id": 208,
"created_at": "created_at2",
"updated_at": "updated_at4"
}
User
Class Name
User
Fields
| Name | Type | Tags | Description |
|---|---|---|---|
id |
int |
Required | - |
name |
string |
Required | - |
email |
string |
Required | - |
created_at |
string |
Required | - |
updated_at |
string |
Required | - |
Example (as JSON)
{
"id": 112,
"name": "name0",
"email": "email6",
"created_at": "created_at2",
"updated_at": "updated_at4"
}
Service Status
Class Name
ServiceStatus
Fields
| Name | Type | Tags | Description |
|---|---|---|---|
app |
string |
Required | - |
moto |
string |
Required | - |
notes |
int |
Required | - |
users |
int |
Required | - |
time |
string |
Required | - |
os |
string |
Required | - |
php_version |
string |
Required | - |
status |
string |
Required | - |
Example (as JSON)
{
"app": "app2",
"moto": "moto8",
"notes": 134,
"users": 202,
"time": "time0",
"os": "os8",
"php_version": "php_version4",
"status": "status8"
}
O Auth Token
OAuth 2 Authorization endpoint response
Class Name
OAuthToken
Fields
| Name | Type | Tags | Description |
|---|---|---|---|
access_token |
string |
Required | Access token |
token_type |
string |
Required | Type of access token |
expires_in |
`long | int` | Optional |
scope |
string |
Optional | List of scopes granted This is a space-delimited list of strings. |
expiry |
`long | int` | Optional |
Example (as JSON)
{
"access_token": "access_token8",
"token_type": "token_type2",
"expires_in": null,
"scope": null,
"expiry": null
}
Enumerations
O Auth Provider Error
OAuth 2 Authorization error codes
Class Name
OAuthProviderErrorEnum
Fields
| Name | Description |
|---|---|
INVALID_REQUEST |
The request is missing a required parameter, includes an unsupported parameter value (other than grant type), repeats a parameter, includes multiple credentials, utilizes more than one mechanism for authenticating the client, or is otherwise malformed. |
INVALID_CLIENT |
Client authentication failed (e.g., unknown client, no client authentication included, or unsupported authentication method). |
INVALID_GRANT |
The provided authorization grant (e.g., authorization code, resource owner credentials) or refresh token is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client. |
UNAUTHORIZED_CLIENT |
The authenticated client is not authorized to use this authorization grant type. |
UNSUPPORTED_GRANT_TYPE |
The authorization grant type is not supported by the authorization server. |
INVALID_SCOPE |
The requested scope is invalid, unknown, malformed, or exceeds the scope granted by the resource owner. |
Exceptions
O Auth Provider
OAuth 2 Authorization endpoint exception
Class Name
OAuthProviderException
Fields
| Name | Type | Tags | Description |
|---|---|---|---|
error |
OAuthProviderErrorEnum |
Required | Error code |
error_description |
string |
Optional | Human-readable text providing additional information on error. Used to assist the client developer in understanding the error that occurred. |
error_uri |
string |
Optional | A URI identifying a human-readable web page with information about the error, used to provide the client developer with additional information about the error |
Example (as JSON)
{
"error": "invalid_request",
"error_description": null,
"error_uri": null
}
Utility Classes Documentation
ApiHelper
A utility class for processing API Calls. Also contains classes for supporting standard datetime formats.
Methods
| Name | Description |
|---|---|
| json_deserialize | Deserializes a JSON string to a Python dictionary. |
Classes
| Name | Description |
|---|---|
| HttpDateTime | A wrapper for datetime to support HTTP date format. |
| UnixDateTime | A wrapper for datetime to support Unix date format. |
| RFC3339DateTime | A wrapper for datetime to support RFC3339 format. |
Common Code Documentation
HttpResponse
Http response received.
Parameters
| Name | Type | Description |
|---|---|---|
| status_code | int | The status code returned by the server. |
| reason_phrase | str | The reason phrase returned by the server. |
| headers | dict | Response headers. |
| text | str | Response body. |
| request | HttpRequest | The request that resulted in this response. |
HttpRequest
Represents a single Http Request.
Parameters
| Name | Type | Tag | Description |
|---|---|---|---|
| http_method | HttpMethodEnum | The HTTP method of the request. | |
| query_url | str | The endpoint URL for the API request. | |
| headers | dict | optional | Request headers. |
| query_parameters | dict | optional | Query parameters to add in the URL. |
| parameters | dict | str | optional | Request body, either as a serialized string or else a list of parameters to form encode. |
| files | dict | optional | Files to be sent with the request. |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file Md-Notes-api-1.0.0.tar.gz.
File metadata
- Download URL: Md-Notes-api-1.0.0.tar.gz
- Upload date:
- Size: 20.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.34.0 CPython/3.6.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd1c242bd77b0c2c645f4caa430b2d42fa3e528c8670b5aaddc57f1cd230f6aa
|
|
| MD5 |
ac494e062e602865b404b576ea179916
|
|
| BLAKE2b-256 |
6ad9f139e251a5f2e9fcf5f6c1d7176895a0ec0ee50b149d03deebdd3cd528aa
|
File details
Details for the file Md_Notes_api-1.0.0-py3-none-any.whl.
File metadata
- Download URL: Md_Notes_api-1.0.0-py3-none-any.whl
- Upload date:
- Size: 28.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.34.0 CPython/3.6.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc28ec3afa0cfe257497eff1facaf67c29a32cf2749d74ee2db41c6fea3b05f1
|
|
| MD5 |
bc35a369a7b496ae7a3238caba9b3524
|
|
| BLAKE2b-256 |
8fcd91a2e32ba783f81db094b7909238e99c7c6e0aeb2db40f387b2ce6b537e0
|