Skip to content

Commit f0dbe52

Browse files
Merge pull request #64 from JaviCerveraIngram/CPS-37-models
CPS-37 Updated models for v17.0 & added FulfillmentAutomation.create_request()
2 parents 9e928ee + b05be68 commit f0dbe52

File tree

11 files changed

+367
-116
lines changed

11 files changed

+367
-116
lines changed

connect/models/__init__.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@
1616
from .marketplace import Activation, Agreement, AgreementStats, Contract, Marketplace
1717
from .parameters import Constraints, Param, ValueChoice
1818
from .product import CustomerUiSettings, Document, DownloadLink, Item, Product, \
19-
ProductConfiguration, Renewal
19+
ProductCategory, ProductConfiguration, ProductFamily, ProductStats, ProductStatsInfo, Renewal
2020
from .server_error_response import ServerErrorResponse
21-
from .tier_config import Template, TierAccount, TierAccounts, TierConfig, TierConfigRequest
21+
from .tier_config import Configuration, Template, TierAccount, TierAccounts, TierConfig, \
22+
TierConfigRequest
2223
from .usage import UsageFile, UsageListing, UsageRecord, UsageRecords
2324

2425
__all__ = [
@@ -30,6 +31,7 @@
3031
'Asset',
3132
'BaseModel',
3233
'Company',
34+
'Configuration',
3335
'Connection',
3436
'Constraints',
3537
'Contact',
@@ -52,7 +54,11 @@
5254
'Param',
5355
'PhoneNumber',
5456
'Product',
57+
'ProductCategory',
5558
'ProductConfiguration',
59+
'ProductFamily',
60+
'ProductStats',
61+
'ProductStatsInfo',
5662
'Renewal',
5763
'ServerErrorResponse',
5864
'Template',

connect/models/event.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,21 @@ class Events(BaseModel):
4242

4343
updated = None # type: EventInfo
4444
""" (:py:class:`.EventInfo`) Update event. """
45+
46+
approved = None # type: EventInfo
47+
""" (:py:class:`.EventInfo`) Approve event. """
48+
49+
uploaded = None # type: EventInfo
50+
""" (:py:class:`.EventInfo`) Uploaded event. """
51+
52+
submitted = None # type: EventInfo
53+
""" (:py:class:`.EventInfo`) Submit event. """
54+
55+
accepted = None # type: EventInfo
56+
""" (:py:class:`.EventInfo`) Accept event. """
57+
58+
rejected = None # type: EventInfo
59+
""" (:py:class:`.EventInfo`) Reject event. """
60+
61+
closed = None # type: EventInfo
62+
""" (:py:class:`.EventInfo`) Close event. """

connect/models/parameters.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
from typing import List, Optional
77

8+
import connect.models
89
from .base import BaseModel
910
from connect.models.schemas import ValueChoiceSchema, ConstraintsSchema, ParamSchema
1011

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

39+
unique = None # type: bool
40+
""" (bool) Is the constraint unique? """
41+
3842

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

62-
value_choices = None # type: Optional[List[ValueChoice]]
63-
""" (List[str]|None) Available dropdown choices for parameter. """
64-
6566
# Undocumented fields (they appear in PHP SDK)
67+
6668
title = None # type: Optional[str]
6769
""" (str|None) Title for parameter. """
6870

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

7274
constraints = None # type: Optional[Constraints]
7375
""" (:py:class:`.Constraints` | None) Parameter constraints. """
76+
77+
value_choices = None # type: Optional[List[ValueChoice]]
78+
""" (List[str]|None) Available dropdown choices for parameter. """
79+
80+
phase = None # type: Optional[str]
81+
""" (str|None) Param phase. """
82+
83+
events = None # type: Optional[connect.models.Events]
84+
""" (:py:class:`.Events` | None) Events. """
85+
86+
marketplace = None # type: Optional[connect.models.Marketplace]
87+
""" (:py:class:`.Marketplace` | None) Marketplace. """

connect/models/product.py

Lines changed: 94 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66
import datetime
77
from typing import List, Optional, Union
88

9+
import connect.models
910
from .base import BaseModel
10-
from connect.models.schemas import ProductConfigurationSchema, DownloadLinkSchema, DocumentSchema,\
11-
CustomerUiSettingsSchema, ProductSchema, RenewalSchema, ItemSchema
11+
from connect.models.schemas import ProductConfigurationSchema, DownloadLinkSchema, DocumentSchema, \
12+
CustomerUiSettingsSchema, ProductSchema, RenewalSchema, ItemSchema, ProductFamilySchema, \
13+
ProductCategorySchema, ProductStatsInfoSchema, ProductStatsSchema
1214

1315

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

39+
visible_for = None # title: str
40+
""" (str) Link visibility. One of: admin, user. """
41+
3742

3843
class Document(BaseModel):
3944
""" Document for a product. """
@@ -46,9 +51,6 @@ class Document(BaseModel):
4651
url = None # title: str
4752
""" (str) Document URL. """
4853

49-
visible_for = None # title: str
50-
""" (str) Document visibility. One of: admin, user. """
51-
5254

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

7072

73+
class ProductFamily(BaseModel):
74+
""" Represents a family of products """
75+
76+
_schema = ProductFamilySchema()
77+
78+
name = None # type: str
79+
""" (str) Family name. """
80+
81+
82+
class ProductCategory(BaseModel):
83+
""" Represents a product category. """
84+
85+
_schema = ProductCategorySchema()
86+
87+
name = None # type: str
88+
""" (str) Category name. """
89+
90+
parent = None # type: Optional[ProductCategory]
91+
""" (:py:class:`.ProductCategory` | None) Reference to parent category. """
92+
93+
children = None # type: Optional[List[ProductCategory]]
94+
""" (List[:py:class:`.ProductCategory`] | None) List of children categories. """
95+
96+
family = None # type: Optional[ProductFamily]
97+
""" (:py:class:`.ProductFamily` | None) Product family. """
98+
99+
100+
class ProductStatsInfo(BaseModel):
101+
_schema = ProductStatsInfoSchema()
102+
103+
distribution = None # type: int
104+
""" (int) Number of distributions related to the product. """
105+
106+
sourcing = None # type: int
107+
""" (int) Number of sourcings related to the product. """
108+
109+
110+
class ProductStats(BaseModel):
111+
""" Statistics of product use. """
112+
113+
_schema = ProductStatsSchema()
114+
115+
listing = None # type: int
116+
""" (int) Number of listings (direct use of product by provider). """
117+
118+
agreements = None # type: ProductStatsInfo
119+
""" (:py:class:`.ProductStatsInfo`) Agreements related to the product. """
120+
121+
contracts = None # type: ProductStatsInfo
122+
""" (:py:class:`.ProductStatsInfo`) Contracts related to the product """
123+
124+
71125
class Product(BaseModel):
72126
""" Represents basic marketing information about salable items, parameters, configurations,
73127
latest published version and connections.
@@ -94,12 +148,29 @@ class Product(BaseModel):
94148
version = None # type: int
95149
""" (int) Version of product. """
96150

151+
published_at = None # type: Optional[datetime.datetime]
152+
""" (datetime.datetime) Date of publishing. """
153+
97154
configurations = None # type: ProductConfiguration
98155
""" (:py:class:`.ProductConfiguration`) Product configuration. """
99156

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

160+
category = None # type: Optional[ProductCategory]
161+
""" (:py:class:`.ProductCategory` | None) Reference to ProductCategory Object. """
162+
163+
owner = None # type: Optional[connect.models.Company]
164+
""" (:py:class:`.Company` | None) """
165+
166+
latest = None # type: Optional[bool]
167+
""" (bool|None) true if version is latest or for master versions without versions,
168+
false otherwise.
169+
"""
170+
171+
stats = None # type: Optional[ProductStats]
172+
""" (:py:class:``.ProductStats) Statistics of product use, depends on account of callee. """
173+
103174

104175
class Renewal(BaseModel):
105176
""" Item renewal data. """
@@ -138,10 +209,27 @@ class Item(BaseModel):
138209
(empty for all other types).
139210
"""
140211

212+
params = None # type: List[connect.models.Param]
213+
""" (List[:py:class:`.Param` | None] List of Item and Item x Marketplace Configuration Phase
214+
Parameter Context-Bound Object
215+
"""
216+
217+
# Undocumented fields (they appear in PHP SDK)
218+
219+
display_name = None # type: str
220+
""" (str) Display name. """
221+
141222
global_id = None # type: str
142223
""" (str) Global id. """
143224

144-
# Undocumented fields (they appear in PHP SDK)
225+
item_type = None # type: str
226+
""" (str) Item type. """
145227

146228
period = None # type: str
147229
""" (str) Period. """
230+
231+
type = None # type: str
232+
""" (str) Type. """
233+
234+
name = None # type: str
235+
""" (str) Name. """

0 commit comments

Comments
 (0)