Skip to main content

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:

    pip install mochi-api-client

Quick Start

Here's a quick example to get you started:

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

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

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.

Metadata

Release files for mochi-api-client 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mochi-api-client 0.1.4
File Size Uploaded Provenance Actions
mochi_api_client-0.1.4.tar.gz 13.0 kB Without provenance Details for mochi_api_client-0.1.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mochi-api-client 0.1.4
File Interpreter ABI Platform Actions
mochi_api_client-0.1.4-py3-none-any.whl Python 3 none any Details for mochi_api_client-0.1.4-py3-none-any.whl

Total release size: 29.1 kB

Release files / mochi_api_client-0.1.4.tar.gz

Download URL mochi_api_client-0.1.4.tar.gz
Size 13.0 kB
Tags Source
SHA-256 checksum
How to use checksums
cff8e8c7dde1569c01e998732b5e46582873e7516f6d8bef61c696e247a7da5d
BLAKE2b-256 checksum
How to use checksums
0ab533c1438b5e91e2f446db833b478398475a7db71b71262a7430bec1058dd8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.4 CPython/3.12.7 Linux/6.5.0-1025-azure

Release files / mochi_api_client-0.1.4-py3-none-any.whl

Download URL mochi_api_client-0.1.4-py3-none-any.whl
Size 16.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3c076b90b16aeb39049afcfa9771bbb30b2309849d9c16d92a699e13bc8a5d7b
BLAKE2b-256 checksum
How to use checksums
2d755d5729bba882c862e91ec7039f9a538a7b6248603efef5d71bf3b52ebe6b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.4 CPython/3.12.7 Linux/6.5.0-1025-azure

Security for mochi-api-client 0.1.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page