# Mochi API Client
The Mochi API Client is a Python library designed to simplify interacting with the Mochi API, allowing developers to easily create, retrieve, update, and delete cards and decks within their Python applications.
Features
- Simplified access to the Mochi API endpoints
- Methods for managing cards, decks, and templates
- Support for custom fields and attachments in cards
- Easy to integrate with Python applications
## Installation
Install the Mochi API Client using pip:
```sh
pip install mochi-api-client
```
# Quick Start
Here's a quick example to get you started:
```python
from mochi.client import Mochi
from mochi.auth import Auth
auth = Auth.Token("find api token in mochi settings page")
mochi = Mochi(auth=auth)
# list decks
decks = mochi.decks.list_decks()
print(decks)
if len(decks) < 1:
# Working with decks
new_deck = mochi.decks.create_deck(name="My new deck")
print(new_deck)
# Working with cards
new_card = mochi.cards.create_card("New card content", (decks[0])["id"])
print(new_card)
# Working with templates
templates = mochi.templates.list_templates()
print(templates)
mochi.close()
```
## Diagrams
### Sequence Diagram
A sequence diagram to show the interaction between the client and the API when creating a new card.
## Sequence Diagram for Creating a Card
```mermaid
sequenceDiagram
participant User
participant MochiClient as Mochi Client
participant CardsAPI as Cards API
User->>MochiClient: create_card(content, deck_id, kwargs)
MochiClient->>CardsAPI: POST /cards
CardsAPI-->>MochiClient: 201 Created
MochiClient-->>User: New card details
```
## Class Diagram
```mermaid
classDiagram
class Mochi {
-session: Session
-cards: Cards
-decks: Decks
-templates: Templates
+__init__(auth: Auth, base_url: str)
+close()
}
class Auth {
+Token(api_key: str)
}
class Cards {
+__init__(session: Session, base_url: str)
+create_card(content: str, deck_id: str, kwargs: dict)
+get_card(card_id: str)
+update_card(card_id: str, kwargs: dict)
+delete_card(card_id: str)
+list_cards(deck_id: str)
}
class Decks {
+__init__(session: Session, base_url: str)
+create_deck(name: str, kwargs: dict)
+get_deck(deck_id: str)
+update_deck(deck_id: str, kwargs: dict)
+delete_deck(deck_id: str)
+list_decks()
}
class Templates {
+__init__(session: Session, base_url: str)
+get_template(template_id: str)
+list_templates()
}
Mochi --> Auth
Mochi --> Cards
Mochi --> Decks
Mochi --> Templates
```
## Documentation
For detailed documentation on all available methods and their parameters, visit Mochi API Documentation.
## Contributing
Contributions are welcome! Please read our Contributing Guide for details on how to submit pull requests, report issues, and suggest improvements.
## License
This project is licensed under the MIT License - see the LICENSE file for details.
## Support
If you encounter any problems or have suggestions, please file an issue on the GitHub issue tracker.
Raw data
{
"_id": null,
"home_page": "https://github.com/gsejas/mochi-api-client",
"name": "mochi-api-client",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.10",
"maintainer_email": null,
"keywords": "mochi, api, client, wrapper, spaced repetition",
"author": "GSejas",
"author_email": "jsequeira03@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/0a/b5/33c1438b5e91e2f446db833b478398475a7db71b71262a7430bec1058dd8/mochi_api_client-0.1.4.tar.gz",
"platform": null,
"description": "# Mochi API Client\nThe Mochi API Client is a Python library designed to simplify interacting with the Mochi API, allowing developers to easily create, retrieve, update, and delete cards and decks within their Python applications.\n\nFeatures\n- Simplified access to the Mochi API endpoints\n- Methods for managing cards, decks, and templates\n- Support for custom fields and attachments in cards\n- Easy to integrate with Python applications\n\n## Installation\nInstall the Mochi API Client using pip:\n\n```sh\n pip install mochi-api-client\n```\n\n# Quick Start\nHere's a quick example to get you started:\n\n```python\nfrom mochi.client import Mochi\nfrom mochi.auth import Auth\n\nauth = Auth.Token(\"find api token in mochi settings page\")\nmochi = Mochi(auth=auth)\n\n\n# list decks\ndecks = mochi.decks.list_decks()\nprint(decks)\n\nif len(decks) < 1:\n\n # Working with decks\n new_deck = mochi.decks.create_deck(name=\"My new deck\")\n print(new_deck)\n\n# Working with cards\nnew_card = mochi.cards.create_card(\"New card content\", (decks[0])[\"id\"])\nprint(new_card)\n\n# Working with templates\ntemplates = mochi.templates.list_templates()\nprint(templates)\n\nmochi.close()\n```\n\n## Diagrams\n\n\n\n\n### Sequence Diagram\nA sequence diagram to show the interaction between the client and the API when creating a new card.\n\n## Sequence Diagram for Creating a Card\n\n```mermaid\nsequenceDiagram\n participant User\n participant MochiClient as Mochi Client\n participant CardsAPI as Cards API\n\n User->>MochiClient: create_card(content, deck_id, kwargs)\n MochiClient->>CardsAPI: POST /cards\n CardsAPI-->>MochiClient: 201 Created\n MochiClient-->>User: New card details\n```\n\n## Class Diagram\n\n```mermaid\nclassDiagram\n class Mochi {\n -session: Session\n -cards: Cards\n -decks: Decks\n -templates: Templates\n +__init__(auth: Auth, base_url: str)\n +close()\n }\n\n class Auth {\n +Token(api_key: str)\n }\n\n class Cards {\n +__init__(session: Session, base_url: str)\n +create_card(content: str, deck_id: str, kwargs: dict)\n +get_card(card_id: str)\n +update_card(card_id: str, kwargs: dict)\n +delete_card(card_id: str)\n +list_cards(deck_id: str)\n }\n\n class Decks {\n +__init__(session: Session, base_url: str)\n +create_deck(name: str, kwargs: dict)\n +get_deck(deck_id: str)\n +update_deck(deck_id: str, kwargs: dict)\n +delete_deck(deck_id: str)\n +list_decks()\n }\n\n class Templates {\n +__init__(session: Session, base_url: str)\n +get_template(template_id: str)\n +list_templates()\n }\n\n Mochi --> Auth\n Mochi --> Cards\n Mochi --> Decks\n Mochi --> Templates\n```\n\n## Documentation\nFor detailed documentation on all available methods and their parameters, visit Mochi API Documentation.\n\n## Contributing\nContributions are welcome! Please read our Contributing Guide for details on how to submit pull requests, report issues, and suggest improvements.\n\n## License\nThis project is licensed under the MIT License - see the LICENSE file for details.\n\n## Support\nIf you encounter any problems or have suggestions, please file an issue on the GitHub issue tracker.",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python wrapper for the Mochi spaced repetition platform API",
"version": "0.1.4",
"project_urls": {
"Homepage": "https://github.com/gsejas/mochi-api-client",
"Repository": "https://github.com/gsejas/mochi-api-client"
},
"split_keywords": [
"mochi",
" api",
" client",
" wrapper",
" spaced repetition"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "2d755d5729bba882c862e91ec7039f9a538a7b6248603efef5d71bf3b52ebe6b",
"md5": "bae207d1cbfe218cdabc5873658f3c32",
"sha256": "3c076b90b16aeb39049afcfa9771bbb30b2309849d9c16d92a699e13bc8a5d7b"
},
"downloads": -1,
"filename": "mochi_api_client-0.1.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "bae207d1cbfe218cdabc5873658f3c32",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.10",
"size": 16088,
"upload_time": "2024-11-17T20:38:49",
"upload_time_iso_8601": "2024-11-17T20:38:49.653313Z",
"url": "https://files.pythonhosted.org/packages/2d/75/5d5729bba882c862e91ec7039f9a538a7b6248603efef5d71bf3b52ebe6b/mochi_api_client-0.1.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "0ab533c1438b5e91e2f446db833b478398475a7db71b71262a7430bec1058dd8",
"md5": "d022df018c3ff9af9ec55243dd8b8edd",
"sha256": "cff8e8c7dde1569c01e998732b5e46582873e7516f6d8bef61c696e247a7da5d"
},
"downloads": -1,
"filename": "mochi_api_client-0.1.4.tar.gz",
"has_sig": false,
"md5_digest": "d022df018c3ff9af9ec55243dd8b8edd",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.10",
"size": 12965,
"upload_time": "2024-11-17T20:38:51",
"upload_time_iso_8601": "2024-11-17T20:38:51.397183Z",
"url": "https://files.pythonhosted.org/packages/0a/b5/33c1438b5e91e2f446db833b478398475a7db71b71262a7430bec1058dd8/mochi_api_client-0.1.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-17 20:38:51",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "gsejas",
"github_project": "mochi-api-client",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "mochi-api-client"
}