Merge pull request #9 from Eledio/feature/updateDocs

Update documentation
This commit is contained in:
Richard Kubíček
2025-03-03 20:50:55 +01:00
committed by GitHub
3 changed files with 61 additions and 70 deletions

View File

@@ -15,20 +15,16 @@ Functions:
- (none) - (none)
Usage: Usage:
import superfaktura.bank_account >>> import superfaktura.bank_account
>>> # Create an instance of BankAccount
# Create an instance of BankAccount >>> bank = superfaktura.bank_account.BankAccount()
bank = superfaktura.bank_account.BankAccount() >>> # Retrieve a list of bank accounts
>>> accounts = bank.list()
# Retrieve a list of bank accounts >>> # Get the default bank account
accounts = bank.list() >>> default_account = bank.default()
>>> # Create or update a bank account
# Get the default bank account >>> data = {"account": "1234567890", "bank_code": "1234567890", "default": True}
default_account = bank.default() >>> bank.post(data)
# Create or update a bank account
data = {"account": "1234567890", "bank_code": "1234567890", "default": True}
bank.post(data)
""" """
import json import json
@@ -84,11 +80,11 @@ class BankAccount(SuperFakturaAPI):
- post: Creates or updates a bank account. - post: Creates or updates a bank account.
Usage: Usage:
bank = BankAccount() >>> bank = BankAccount()
accounts = bank.list() >>> accounts = bank.list()
default_account = bank.default() >>> default_account = bank.default()
data = {"account": "1234567890", "bank_code": "1234567890", "default": True} >>> data = {"account": "1234567890", "bank_code": "1234567890", "default": True}
bank.post(data) >>> bank.post(data)
""" """
def __init__(self): def __init__(self):

View File

@@ -16,38 +16,35 @@ Functions:
- (none) - (none)
Usage: Usage:
import superfaktura.invoice >>> import superfaktura.invoice
>>> # Create an instance of Invoice
# Create an instance of Invoice >>> invoice = superfaktura.invoice.Invoice()
invoice = superfaktura.invoice.Invoice() >>> # Create an invoice
>>> invoice.add(
# Create an invoice invoice_model=InvoiceModel(
invoice.add( type=InvoiceType.INVOICE,
invoice=superfaktura.invoice.InvoiceModel( name="My First Invoice",
type=superfaktura.invoice.InvoiceType.PROFORMA, due=Date("2025-04-01"),
name="Invoice 3", invoice_currency=Currencies.EUR,
due=superfaktura.invoice.Date("2025-02-01"),
invoice_currency=superfaktura.invoice.Currencies.CZK,
header_comment="We invoice you for services", header_comment="We invoice you for services",
bank_accounts=[bank.default().as_dict()], bank_accounts=[bank.default().as_dict()],
), ),
items=[ items=[
superfaktura.invoice.InvoiceItem(name="Services", unit_price=100, quantity=1, InvoiceItem(
unit="ks", tax=21), name="Website Development", unit_price=1000.0, quantity=1, tax=20
superfaktura.invoice.InvoiceItem(name="SIM card", unit_price=50, quantity=1, ),
tax=21, unit="ks"), InvoiceItem(
superfaktura.invoice.InvoiceItem( name="Hosting Service (1 year)", unit_price=500.0, quantity=1, tax=20
name="SIM card 2", unit_price=75, quantity=1, tax=21, unit="ks"
), ),
], ],
contact=superfaktura.client_contacts.ClientContactModel( contact=ClientContactModel(
name="Richard Kubíček", name="John Doe",
email="kubicekr@eledio.com", email="john.doe@examle.com",
phone="+420 123 456 789", phone="+1 555-1234",
address="Jaroslava Foglara 861/1", address="123 Main Street, New York",
ico="123", ico="987654321",
update=True, update=True,
country_id=57, country_id=225,
), ),
) )
""" """
@@ -217,31 +214,32 @@ class Invoice(SuperFakturaAPI):
- update: Updates an existing invoice. - update: Updates an existing invoice.
Usage: Usage:
invoice = Invoice() >>> invoice = Invoice()
invoice.add( >>> invoice.add(
invoice=InvoiceModel( invoice_model=InvoiceModel(
type=InvoiceType.PROFORMA, type=InvoiceType.INVOICE,
name="Invoice 3", name="My First Invoice",
due=Date("2025-02-01"), due=Date("2025-04-01"),
invoice_currency=Currencies.CZK, invoice_currency=Currencies.EUR,
header_comment="We invoice you for services", header_comment="We invoice you for services",
bank_accounts=[bank.default().as_dict()], bank_accounts=[bank.default().as_dict()],
), ),
items=[ items=[
InvoiceItem(name="Services", unit_price=100, quantity=1, unit="ks", tax=21),
InvoiceItem(name="SIM card", unit_price=50, quantity=1, tax=21, unit="ks"),
InvoiceItem( InvoiceItem(
name="SIM card 2", unit_price=75, quantity=1, tax=21, unit="ks" name="Website Development", unit_price=1000.0, quantity=1, tax=20
),
InvoiceItem(
name="Hosting Service (1 year)", unit_price=500.0, quantity=1, tax=20
), ),
], ],
contact=ClientContactModel( contact=ClientContactModel(
name="Richard Kubíček", name="John Doe",
email="kubicekr@eledio.com", email="john.doe@examle.com",
phone="+420 123 456 789", phone="+1 555-1234",
address="Jaroslava Foglara 861/1", address="123 Main Street, New York",
ico="123", ico="987654321",
update=True, update=True,
country_id=57, country_id=225,
), ),
) )
""" """

View File

@@ -14,16 +14,13 @@ Functions:
- post: Creates or updates data in the SuperFaktura API. - post: Creates or updates data in the SuperFaktura API.
Usage: Usage:
import superfaktura.superfaktura_api >>> import superfaktura.superfaktura_api
>>> # Create an instance of SuperFakturaAPI
# Create an instance of SuperFakturaAPI >>> api = superfaktura.superfaktura_api.SuperFakturaAPI()
api = superfaktura.superfaktura_api.SuperFakturaAPI() >>> # Retrieve data from the SuperFaktura API
>>> incoming_data = api.get('endpoint')
# Retrieve data from the SuperFaktura API >>> # Create or update data in the SuperFaktura API
data = api.get('endpoint') >>> api.post('endpoint', outgoing_data)
# Create or update data in the SuperFaktura API
api.post('endpoint', data)
""" """
import os import os