1
+ from office365 .runtime .client_result import ClientResult
2
+ from office365 .runtime .client_value_collection import ClientValueCollection
3
+ from office365 .runtime .paths .resource_path import ResourcePath
1
4
from office365 .runtime .queries .service_operation import ServiceOperationQuery
2
5
from office365 .sharepoint .base_entity import BaseEntity
3
- from office365 .sharepoint .contentcenter .machinelearning .model_collection import SPMachineLearningModelCollection
6
+ from office365 .sharepoint .compliance .tag import ComplianceTag
7
+ from office365 .sharepoint .contentcenter .machinelearning .enabled import SPMachineLearningEnabled
8
+ from office365 .sharepoint .contentcenter .machinelearning .models .collection import SPMachineLearningModelCollection
9
+ from office365 .sharepoint .contentcenter .machinelearning .samples .collection import SPMachineLearningSampleCollection
10
+ from office365 .sharepoint .contentcenter .syntex_models_landing_info import SyntexModelsLandingInfo
4
11
5
12
6
13
class SPMachineLearningHub (BaseEntity ):
7
14
15
+ def get_by_content_type_id (self , content_type_id ):
16
+ """
17
+ :param str content_type_id:
18
+ """
19
+ return_type = SyntexModelsLandingInfo (self .context )
20
+ payload = {
21
+ "contentTypeId" : content_type_id
22
+ }
23
+ qry = ServiceOperationQuery (self , "GetByContentTypeId" , None , payload , None , return_type )
24
+ self .context .add_query (qry )
25
+ return return_type
26
+
8
27
def get_models (self , list_id = None , model_types = None , publication_types = None ,
9
28
include_management_not_allowed_models = None ):
10
29
"""
@@ -24,6 +43,20 @@ def get_models(self, list_id=None, model_types=None, publication_types=None,
24
43
self .context .add_query (qry )
25
44
return return_type
26
45
46
+ def get_retention_labels (self ):
47
+ return_type = ClientResult (self .context , ClientValueCollection (ComplianceTag ))
48
+ qry = ServiceOperationQuery (self , "GetRetentionLabels" , None , None , None , return_type )
49
+ self .context .add_query (qry )
50
+ return return_type
51
+
52
+ def get_property (self , name , default_value = None ):
53
+ if default_value is None :
54
+ property_mapping = {
55
+ "MachineLearningEnabled" : self .machine_learning_enabled ,
56
+ }
57
+ default_value = property_mapping .get (name , None )
58
+ return super (SPMachineLearningHub , self ).get_property (name , default_value )
59
+
27
60
@property
28
61
def is_default_content_center (self ):
29
62
"""
@@ -38,6 +71,24 @@ def machine_learning_capture_enabled(self):
38
71
"""
39
72
return self .properties .get ("MachineLearningCaptureEnabled" , None )
40
73
74
+ @property
75
+ def machine_learning_enabled (self ):
76
+ return self .properties .get ("MachineLearningEnabled" ,
77
+ SPMachineLearningEnabled (self .context ,
78
+ ResourcePath ("MachineLearningEnabled" , self .resource_path )))
79
+
80
+ @property
81
+ def models (self ):
82
+ return self .properties .get ("Models" ,
83
+ SPMachineLearningModelCollection (self .context ,
84
+ ResourcePath ("Models" , self .resource_path )))
85
+
86
+ @property
87
+ def samples (self ):
88
+ return self .properties .get ("Samples" ,
89
+ SPMachineLearningSampleCollection (self .context ,
90
+ ResourcePath ("Samples" , self .resource_path )))
91
+
41
92
@property
42
93
def entity_type_name (self ):
43
94
return "Microsoft.Office.Server.ContentCenter.SPMachineLearningHub"
0 commit comments