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
10 changes: 8 additions & 2 deletions connect/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@
from .marketplace import Activation, Agreement, AgreementStats, Contract, Marketplace
from .parameters import Constraints, Param, ValueChoice
from .product import CustomerUiSettings, Document, DownloadLink, Item, Product, \
ProductConfiguration, Renewal
ProductCategory, ProductConfiguration, ProductFamily, ProductStats, ProductStatsInfo, Renewal
from .server_error_response import ServerErrorResponse
from .tier_config import Template, TierAccount, TierAccounts, TierConfig, TierConfigRequest
from .tier_config import Configuration, Template, TierAccount, TierAccounts, TierConfig, \
TierConfigRequest
from .usage import UsageFile, UsageListing, UsageRecord, UsageRecords

__all__ = [
Expand All @@ -30,6 +31,7 @@
'Asset',
'BaseModel',
'Company',
'Configuration',
'Connection',
'Constraints',
'Contact',
Expand All @@ -52,7 +54,11 @@
'Param',
'PhoneNumber',
'Product',
'ProductCategory',
'ProductConfiguration',
'ProductFamily',
'ProductStats',
'ProductStatsInfo',
'Renewal',
'ServerErrorResponse',
'Template',
Expand Down
18 changes: 18 additions & 0 deletions connect/models/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,21 @@ class Events(BaseModel):

updated = None # type: EventInfo
""" (:py:class:`.EventInfo`) Update event. """

approved = None # type: EventInfo
""" (:py:class:`.EventInfo`) Approve event. """

uploaded = None # type: EventInfo
""" (:py:class:`.EventInfo`) Uploaded event. """

submitted = None # type: EventInfo
""" (:py:class:`.EventInfo`) Submit event. """

accepted = None # type: EventInfo
""" (:py:class:`.EventInfo`) Accept event. """

rejected = None # type: EventInfo
""" (:py:class:`.EventInfo`) Reject event. """

closed = None # type: EventInfo
""" (:py:class:`.EventInfo`) Close event. """
20 changes: 17 additions & 3 deletions connect/models/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from typing import List, Optional

import connect.models
from .base import BaseModel
from connect.models.schemas import ValueChoiceSchema, ConstraintsSchema, ParamSchema

Expand Down Expand Up @@ -35,6 +36,9 @@ class Constraints(BaseModel):
choices = None # type: List[ValueChoice]
""" (List[:py:class:`.ValueChoice`]) Parameter value choices. """

unique = None # type: bool
""" (bool) Is the constraint unique? """


class Param(BaseModel):
""" Parameters are used in product and asset definitions. """
Expand All @@ -59,10 +63,8 @@ class Param(BaseModel):
value_choice = None # type: Optional[List[str]]
""" (List[str]|None) Available choices for parameter. """

value_choices = None # type: Optional[List[ValueChoice]]
""" (List[str]|None) Available dropdown choices for parameter. """

# Undocumented fields (they appear in PHP SDK)

title = None # type: Optional[str]
""" (str|None) Title for parameter. """

Expand All @@ -71,3 +73,15 @@ class Param(BaseModel):

constraints = None # type: Optional[Constraints]
""" (:py:class:`.Constraints` | None) Parameter constraints. """

value_choices = None # type: Optional[List[ValueChoice]]
""" (List[str]|None) Available dropdown choices for parameter. """

phase = None # type: Optional[str]
""" (str|None) Param phase. """

events = None # type: Optional[connect.models.Events]
""" (:py:class:`.Events` | None) Events. """

marketplace = None # type: Optional[connect.models.Marketplace]
""" (:py:class:`.Marketplace` | None) Marketplace. """
100 changes: 94 additions & 6 deletions connect/models/product.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
import datetime
from typing import List, Optional, Union

import connect.models
from .base import BaseModel
from connect.models.schemas import ProductConfigurationSchema, DownloadLinkSchema, DocumentSchema,\
CustomerUiSettingsSchema, ProductSchema, RenewalSchema, ItemSchema
from connect.models.schemas import ProductConfigurationSchema, DownloadLinkSchema, DocumentSchema, \
CustomerUiSettingsSchema, ProductSchema, RenewalSchema, ItemSchema, ProductFamilySchema, \
ProductCategorySchema, ProductStatsInfoSchema, ProductStatsSchema


class ProductConfiguration(BaseModel):
Expand All @@ -34,6 +36,9 @@ class DownloadLink(BaseModel):
url = None # type: str
""" (str) Link URL. """

visible_for = None # title: str
""" (str) Link visibility. One of: admin, user. """


class Document(BaseModel):
""" Document for a product. """
Expand All @@ -46,9 +51,6 @@ class Document(BaseModel):
url = None # title: str
""" (str) Document URL. """

visible_for = None # title: str
""" (str) Document visibility. One of: admin, user. """


class CustomerUiSettings(BaseModel):
""" Customer Ui Settings for a product. """
Expand All @@ -68,6 +70,58 @@ class CustomerUiSettings(BaseModel):
""" (List[:py:class:`.Document`]) Documents. """


class ProductFamily(BaseModel):
""" Represents a family of products """

_schema = ProductFamilySchema()

name = None # type: str
""" (str) Family name. """


class ProductCategory(BaseModel):
""" Represents a product category. """

_schema = ProductCategorySchema()

name = None # type: str
""" (str) Category name. """

parent = None # type: Optional[ProductCategory]
""" (:py:class:`.ProductCategory` | None) Reference to parent category. """

children = None # type: Optional[List[ProductCategory]]
""" (List[:py:class:`.ProductCategory`] | None) List of children categories. """

family = None # type: Optional[ProductFamily]
""" (:py:class:`.ProductFamily` | None) Product family. """


class ProductStatsInfo(BaseModel):
_schema = ProductStatsInfoSchema()

distribution = None # type: int
""" (int) Number of distributions related to the product. """

sourcing = None # type: int
""" (int) Number of sourcings related to the product. """


class ProductStats(BaseModel):
""" Statistics of product use. """

_schema = ProductStatsSchema()

listing = None # type: int
""" (int) Number of listings (direct use of product by provider). """

agreements = None # type: ProductStatsInfo
""" (:py:class:`.ProductStatsInfo`) Agreements related to the product. """

contracts = None # type: ProductStatsInfo
""" (:py:class:`.ProductStatsInfo`) Contracts related to the product """


class Product(BaseModel):
""" Represents basic marketing information about salable items, parameters, configurations,
latest published version and connections.
Expand All @@ -94,12 +148,29 @@ class Product(BaseModel):
version = None # type: int
""" (int) Version of product. """

published_at = None # type: Optional[datetime.datetime]
""" (datetime.datetime) Date of publishing. """

configurations = None # type: ProductConfiguration
""" (:py:class:`.ProductConfiguration`) Product configuration. """

customer_ui_settings = None # type: CustomerUiSettings
""" (:py:class:`.CustomerUiSettings`) Customer Ui Settings. """

category = None # type: Optional[ProductCategory]
""" (:py:class:`.ProductCategory` | None) Reference to ProductCategory Object. """

owner = None # type: Optional[connect.models.Company]
""" (:py:class:`.Company` | None) """

latest = None # type: Optional[bool]
""" (bool|None) true if version is latest or for master versions without versions,
false otherwise.
"""

stats = None # type: Optional[ProductStats]
""" (:py:class:``.ProductStats) Statistics of product use, depends on account of callee. """


class Renewal(BaseModel):
""" Item renewal data. """
Expand Down Expand Up @@ -138,10 +209,27 @@ class Item(BaseModel):
(empty for all other types).
"""

params = None # type: List[connect.models.Param]
""" (List[:py:class:`.Param` | None] List of Item and Item x Marketplace Configuration Phase
Parameter Context-Bound Object
"""

# Undocumented fields (they appear in PHP SDK)

display_name = None # type: str
""" (str) Display name. """

global_id = None # type: str
""" (str) Global id. """

# Undocumented fields (they appear in PHP SDK)
item_type = None # type: str
""" (str) Item type. """

period = None # type: str
""" (str) Period. """

type = None # type: str
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

type is python function ... but looks like more or less safe to use it here

""" (str) Type. """

name = None # type: str
""" (str) Name. """
Loading