API Reference

io_beep_boop.api

This module defines the models used by the IO App API, and defines a client to interact with the API in a (kind of) Pythonic way.

io_beep_boop.api.client

class io_beep_boop.api.client.IOServiceClient(token: str, base_url: str = 'https://api.io.italia.it/api/v1', user_agent: str | None = None)

Simplified wrapper for the IO App API.

Send a message to the user with the given fiscal_code on behalf of the service identified by the PEC given in legal_mail.

send_message(fiscal_code: str, content: MessageContent, time_to_live: int = 3600, default_addresses: DefaultAddresses | None = None)

Send a message to the user with the given fiscal_code.

get_message(fiscal_code: str, message_id: str)

Get the message with the given message_id addressed to the user with the given fiscal_code.

get_profile(fiscal_code: str)

Get the profile of the user with the given fiscal_code.

get_subscriptions_on_day(date: date)

Get a list of hashed fiscal codes which subscribed and unsubscribed from the service on the given date.

Warning

Requires special authorization.

io_beep_boop.api.models

class io_beep_boop.api.models.Payee(*, fiscal_code: str)
fiscal_code: str
class io_beep_boop.api.models.PaymentData(*, amount: int, notice_number: str, invalid_after_due_date: bool, payee: Payee)
amount: int
notice_number: str
invalid_after_due_date: bool
payee: Payee
class io_beep_boop.api.models.PrescriptionData(*, nre: str, iup: str, prescriber_fiscal_code: str)
nre: str
iup: str
prescriber_fiscal_code: str
class io_beep_boop.api.models.LegalData(*, sender_email_from: str, has_attachment: bool, message_unique_id: str, original_message_url: str, pec_server_service_id: str)
sender_email_from: str
has_attachment: bool
message_unique_id: str
original_message_url: str
pec_server_service_id: str
class io_beep_boop.api.models.EuCovidCert(*, auth_code: str)
auth_code: str
class io_beep_boop.api.models.MessageContent(*, subject: str, markdown: str, payment_data: PaymentData | None = None, prescription_data: PrescriptionData | None = None, legal_data: LegalData | None = None, eu_covid_cert: EuCovidCert | None = None, due_date: datetime)
subject: str
markdown: str
payment_data: PaymentData | None
prescription_data: PrescriptionData | None
legal_data: LegalData | None
eu_covid_cert: EuCovidCert | None
due_date: datetime
class io_beep_boop.api.models.DefaultAddresses(*, email: str)
email: str
class io_beep_boop.api.models.SendMessageResponse(*, id: str)
id: str
class io_beep_boop.api.models.NotificationStatus(*, email: str)
email: str
class io_beep_boop.api.models.GetMessageResponse(*, message: MessageContent, notification: NotificationStatus)
message: MessageContent
notification: NotificationStatus
class io_beep_boop.api.models.UserProfile(*, sender_allowed: bool)
sender_allowed: bool
class io_beep_boop.api.models.SubscriptionsFeed(*, date_utc: date, subscriptions: list[str], unsubscriptions: list[str])
date_utc: date
subscriptions: list[str]
unsubscriptions: list[str]