Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion mpt_api_client/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
from mpt_api_client.models.attachment_model import AttachmentModel
from mpt_api_client.models.document_model import DocumentModel
from mpt_api_client.models.file_model import FileModel
from mpt_api_client.models.file_resource_model import FileResourceModel
from mpt_api_client.models.media_model import MediaModel
from mpt_api_client.models.meta import Meta, Pagination
from mpt_api_client.models.model import Model, ResourceData
from mpt_api_client.models.model_collection import ModelCollection
from mpt_api_client.models.term_variant_model import TermVariantModel

__all__ = ["FileModel", "Meta", "Model", "ModelCollection", "Pagination", "ResourceData"] # noqa: WPS410
__all__ = [ # noqa: WPS410
"AttachmentModel",
"DocumentModel",
"FileModel",
"FileResourceModel",
"MediaModel",
"Meta",
"Model",
"ModelCollection",
"Pagination",
"ResourceData",
"TermVariantModel",
]
5 changes: 5 additions & 0 deletions mpt_api_client/models/attachment_model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from mpt_api_client.models.file_resource_model import FileResourceModel


class AttachmentModel(FileResourceModel):
"""Base model for attachment resources. Inherits fields from FileResourceModel."""
15 changes: 15 additions & 0 deletions mpt_api_client/models/document_model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from mpt_api_client.models.file_resource_model import FileResourceModel


class DocumentModel(FileResourceModel):
"""Base model for document resources.

Attributes:
status: Document status.
filename: Original file name.
url: URL to access the document.
"""

status: str | None = None
filename: str | None = None
url: str | None = None
19 changes: 19 additions & 0 deletions mpt_api_client/models/file_resource_model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from mpt_api_client.models.model import Model


class FileResourceModel(Model):
"""Base model for file-like resources (attachments, documents, media, term variants).

Attributes:
name: Resource name.
type: Resource type.
size: File size in bytes.
description: Resource description.
content_type: MIME content type.
"""

name: str | None = None
type: str | None = None
size: int | None = None
description: str | None = None
content_type: str | None = None
17 changes: 17 additions & 0 deletions mpt_api_client/models/media_model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from mpt_api_client.models.file_resource_model import FileResourceModel


class MediaModel(FileResourceModel):
"""Base model for media resources.

Attributes:
status: Media status.
filename: Original file name.
display_order: Display order of the media item.
url: URL to access the media file.
"""

status: str | None = None
filename: str | None = None
display_order: int | None = None
url: str | None = None
19 changes: 19 additions & 0 deletions mpt_api_client/models/term_variant_model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from mpt_api_client.models.file_resource_model import FileResourceModel


class TermVariantModel(FileResourceModel):
"""Base model for term variant resources.

Attributes:
asset_url: URL to the variant asset.
language_code: Language code for this variant.
status: Variant status.
filename: Original file name.
file_id: Identifier of the uploaded file.
"""

asset_url: str | None = None
language_code: str | None = None
status: str | None = None
filename: str | None = None
file_id: str | None = None
6 changes: 3 additions & 3 deletions mpt_api_client/resources/billing/credit_memo_attachments.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
AsyncCollectionMixin,
CollectionMixin,
)
from mpt_api_client.models import Model
from mpt_api_client.models import AttachmentModel
from mpt_api_client.resources.billing.mixins import AsyncAttachmentMixin, AttachmentMixin


class CreditMemoAttachment(Model):
"""Credit Memo Attachment resource."""
class CreditMemoAttachment(AttachmentModel):
"""Credit Memo Attachment resource. Inherits fields from AttachmentModel."""


class CreditMemoAttachmentsServiceConfig:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
AsyncCollectionMixin,
CollectionMixin,
)
from mpt_api_client.models import Model
from mpt_api_client.models import AttachmentModel
from mpt_api_client.resources.billing.mixins import AsyncAttachmentMixin, AttachmentMixin


class CustomLedgerAttachment(Model):
"""Custom Ledger Attachment resource."""
class CustomLedgerAttachment(AttachmentModel):
"""Custom Ledger Attachment resource. Inherits fields from AttachmentModel."""


class CustomLedgerAttachmentsServiceConfig:
Expand Down
6 changes: 3 additions & 3 deletions mpt_api_client/resources/billing/invoice_attachments.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
AsyncCollectionMixin,
CollectionMixin,
)
from mpt_api_client.models import Model
from mpt_api_client.models import AttachmentModel
from mpt_api_client.resources.billing.mixins import AsyncAttachmentMixin, AttachmentMixin


class InvoiceAttachment(Model):
"""Invoice Attachment resource."""
class InvoiceAttachment(AttachmentModel):
"""Invoice Attachment resource. Inherits fields from AttachmentModel."""


class InvoiceAttachmentsServiceConfig:
Expand Down
6 changes: 3 additions & 3 deletions mpt_api_client/resources/billing/journal_attachments.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
AsyncCollectionMixin,
CollectionMixin,
)
from mpt_api_client.models import Model
from mpt_api_client.models import AttachmentModel
from mpt_api_client.resources.billing.mixins import AsyncAttachmentMixin, AttachmentMixin


class JournalAttachment(Model):
"""Journal Attachment resource."""
class JournalAttachment(AttachmentModel):
"""Journal Attachment resource. Inherits fields from AttachmentModel."""


class JournalAttachmentsServiceConfig:
Expand Down
6 changes: 3 additions & 3 deletions mpt_api_client/resources/billing/ledger_attachments.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
AsyncCollectionMixin,
CollectionMixin,
)
from mpt_api_client.models import Model
from mpt_api_client.models import AttachmentModel
from mpt_api_client.resources.billing.mixins import AsyncAttachmentMixin, AttachmentMixin


class LedgerAttachment(Model):
"""Ledger Attachment resource."""
class LedgerAttachment(AttachmentModel):
"""Ledger Attachment resource. Inherits fields from AttachmentModel."""


class LedgerAttachmentsServiceConfig:
Expand Down
6 changes: 3 additions & 3 deletions mpt_api_client/resources/billing/statement_attachments.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
AsyncCollectionMixin,
CollectionMixin,
)
from mpt_api_client.models import Model
from mpt_api_client.models import AttachmentModel
from mpt_api_client.resources.billing.mixins import AsyncAttachmentMixin, AttachmentMixin


class StatementAttachment(Model):
"""Statement Attachment resource."""
class StatementAttachment(AttachmentModel):
"""Statement Attachment resource. Inherits fields from AttachmentModel."""


class StatementAttachmentsServiceConfig:
Expand Down
20 changes: 5 additions & 15 deletions mpt_api_client/resources/catalog/pricing_policy_attachments.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,22 @@
DownloadFileMixin,
ModifiableResourceMixin,
)
from mpt_api_client.models import Model
from mpt_api_client.models import AttachmentModel
from mpt_api_client.models.model import BaseModel


class PricingPolicyAttachment(Model):
class PricingPolicyAttachment(AttachmentModel):
"""Pricing Policy Attachment resource.

Attributes:
name: Attachment name.
type: Attachment type.
size: File size in bytes.
description: Attachment description.
file_name: Original file name.
content_type: MIME content type of the attachment.
status: Attachment status.
audit: Audit information (created, updated events).
"""

name: str | None
type: str | None
size: int | None
description: str | None
file_name: str | None
content_type: str | None
status: str | None
audit: BaseModel | None
file_name: str | None = None
status: str | None = None
audit: BaseModel | None = None


class PricingPolicyAttachmentsServiceConfig:
Expand Down
28 changes: 4 additions & 24 deletions mpt_api_client/resources/catalog/product_term_variants.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
DownloadFileMixin,
ModifiableResourceMixin,
)
from mpt_api_client.models import Model
from mpt_api_client.models import TermVariantModel
from mpt_api_client.models.model import BaseModel
from mpt_api_client.resources.mixins import (
AsyncPublishableMixin,
Expand All @@ -19,36 +19,16 @@
)


class TermVariant(Model):
class TermVariant(TermVariantModel):
"""Term variant resource.
Attributes:
type: Variant type.
asset_url: URL to the term variant asset.
language_code: Language code for this variant.
name: Variant name.
description: Variant description.
status: Variant status.
filename: Original file name.
size: File size in bytes.
content_type: MIME content type of the file.
terms_and_conditions: Reference to the parent terms and conditions.
file_id: Identifier of the uploaded file.
audit: Audit information (created, updated events).
"""

type: str | None
asset_url: str | None
language_code: str | None
name: str | None
description: str | None
status: str | None
filename: str | None
size: int | None
content_type: str | None
terms_and_conditions: BaseModel | None
file_id: str | None
audit: BaseModel | None
terms_and_conditions: BaseModel | None = None
audit: BaseModel | None = None


class TermVariantServiceConfig:
Expand Down
26 changes: 5 additions & 21 deletions mpt_api_client/resources/catalog/products_documents.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
CollectionMixin,
ModifiableResourceMixin,
)
from mpt_api_client.models import Model
from mpt_api_client.models import DocumentModel
from mpt_api_client.models.model import BaseModel
from mpt_api_client.resources.mixins import (
AsyncDocumentMixin,
Expand All @@ -15,34 +15,18 @@
)


class Document(Model):
class Document(DocumentModel):
"""Document resource.

Attributes:
name: Document name.
type: Document type.
description: Document description.
status: Document status.
filename: Original file name.
size: File size in bytes.
content_type: MIME content type of the document.
url: URL to access the document.
language: Language code of the document.
product: Reference to the product.
audit: Audit information (created, updated events).
"""

name: str | None
type: str | None
description: str | None
status: str | None
filename: str | None
size: int | None
content_type: str | None
url: str | None
language: str | None
product: BaseModel | None
audit: BaseModel | None
language: str | None = None
product: BaseModel | None = None
audit: BaseModel | None = None


class DocumentServiceConfig:
Expand Down
26 changes: 4 additions & 22 deletions mpt_api_client/resources/catalog/products_media.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
CollectionMixin,
ModifiableResourceMixin,
)
from mpt_api_client.models import Model
from mpt_api_client.models import MediaModel
from mpt_api_client.models.model import BaseModel
from mpt_api_client.resources.mixins import (
AsyncMediaMixin,
Expand All @@ -15,34 +15,16 @@
)


class Media(Model):
class Media(MediaModel):
"""Media resource.

Attributes:
name: Media name.
type: Media type.
description: Media description.
status: Media status.
filename: Original file name.
size: File size in bytes.
content_type: MIME content type of the media file.
display_order: Display order of the media item.
url: URL to access the media file.
product: Reference to the product.
audit: Audit information (created, updated events).
"""

name: str | None
type: str | None
description: str | None
status: str | None
filename: str | None
size: int | None
content_type: str | None
display_order: int | None
url: str | None
product: BaseModel | None
audit: BaseModel | None
product: BaseModel | None = None
audit: BaseModel | None = None


class MediaServiceConfig:
Expand Down
Loading