From dedefdcf08855972c407449e08d7c37eb3defd15 Mon Sep 17 00:00:00 2001 From: Laurent Mazuel Date: Fri, 21 Dec 2018 15:19:32 -0800 Subject: [PATCH] Latest content moderator --- .../content_moderator_client.py | 64 +- .../contentmoderator/models/__init__.py | 29 +- .../models/_content_moderator_client_enums.py | 29 - .../vision/contentmoderator/models/_models.py | 891 +++++++++--------- .../contentmoderator/models/_models_py3.py | 507 +++++----- .../operations/image_moderation_operations.py | 132 +-- .../list_management_image_lists_operations.py | 66 +- .../list_management_image_operations.py | 66 +- .../list_management_term_lists_operations.py | 66 +- .../list_management_term_operations.py | 44 +- .../operations/reviews_operations.py | 126 +-- .../operations/text_moderation_operations.py | 51 +- .../vision/contentmoderator/version.py | 3 +- 13 files changed, 1042 insertions(+), 1032 deletions(-) delete mode 100644 azure-cognitiveservices-vision-contentmoderator/azure/cognitiveservices/vision/contentmoderator/models/_content_moderator_client_enums.py diff --git a/azure-cognitiveservices-vision-contentmoderator/azure/cognitiveservices/vision/contentmoderator/content_moderator_client.py b/azure-cognitiveservices-vision-contentmoderator/azure/cognitiveservices/vision/contentmoderator/content_moderator_client.py index 9a5bb979a67d..8090bb66c2d1 100644 --- a/azure-cognitiveservices-vision-contentmoderator/azure/cognitiveservices/vision/contentmoderator/content_moderator_client.py +++ b/azure-cognitiveservices-vision-contentmoderator/azure/cognitiveservices/vision/contentmoderator/content_moderator_client.py @@ -9,7 +9,7 @@ # regenerated. # -------------------------------------------------------------------------- -from msrest.service_client import ServiceClient +from msrest.service_client import SDKClient from msrest import Configuration, Serializer, Deserializer from .version import VERSION from .operations.image_moderation_operations import ImageModerationOperations @@ -27,55 +27,36 @@ class ContentModeratorClientConfiguration(Configuration): Note that all parameters used to create this instance are saved as instance attributes. - :param base_url_parameter: Supported Azure regions for Content Moderator - endpoints. Possible values include: 'westus.api.cognitive.microsoft.com', - 'westus2.api.cognitive.microsoft.com', - 'eastus.api.cognitive.microsoft.com', - 'eastus2.api.cognitive.microsoft.com', - 'westcentralus.api.cognitive.microsoft.com', - 'southcentralus.api.cognitive.microsoft.com', - 'westeurope.api.cognitive.microsoft.com', - 'northeurope.api.cognitive.microsoft.com', - 'southeastasia.api.cognitive.microsoft.com', - 'eastasia.api.cognitive.microsoft.com', - 'australiaeast.api.cognitive.microsoft.com', - 'brazilsouth.api.cognitive.microsoft.com', - 'contentmoderatortest.azure-api.net' - :type base_url_parameter: str or - ~azure.cognitiveservices.vision.contentmoderator.models.AzureRegionBaseUrl + :param endpoint: Supported Cognitive Services endpoints (protocol and + hostname, for example: https://westus.api.cognitive.microsoft.com). + :type endpoint: str :param credentials: Subscription credentials which uniquely identify client subscription. :type credentials: None """ def __init__( - self, base_url_parameter, credentials): + self, endpoint, credentials): - if base_url_parameter is None: - raise ValueError("Parameter 'base_url_parameter' must not be None.") + if endpoint is None: + raise ValueError("Parameter 'endpoint' must not be None.") if credentials is None: raise ValueError("Parameter 'credentials' must not be None.") - base_url = 'https://{baseUrl}' + base_url = '{Endpoint}' super(ContentModeratorClientConfiguration, self).__init__(base_url) self.add_user_agent('azure-cognitiveservices-vision-contentmoderator/{}'.format(VERSION)) - self.base_url_parameter = base_url_parameter + self.endpoint = endpoint self.credentials = credentials -class ContentModeratorClient(object): +class ContentModeratorClient(SDKClient): """You use the API to scan your content as it is generated. Content Moderator then processes your content and sends the results along with relevant information either back to your systems or to the built-in review tool. You can use this information to take decisions e.g. take it down, send to human judge, etc. When using the API, images need to have a minimum of 128 pixels and a maximum file size of 4MB. Text can be at most 1024 characters long. If the content passed to the text API or the image API exceeds the size limits, the API will return an error code that informs about the issue. - This API is currently available in: - * West US - westus.api.cognitive.microsoft.com - * East US 2 - eastus2.api.cognitive.microsoft.com - * West Central US - westcentralus.api.cognitive.microsoft.com - * West Europe - westeurope.api.cognitive.microsoft.com - * Southeast Asia - southeastasia.api.cognitive.microsoft.com . :ivar config: Configuration for client. :vartype config: ContentModeratorClientConfiguration @@ -95,32 +76,19 @@ class ContentModeratorClient(object): :ivar reviews: Reviews operations :vartype reviews: azure.cognitiveservices.vision.contentmoderator.operations.ReviewsOperations - :param base_url_parameter: Supported Azure regions for Content Moderator - endpoints. Possible values include: 'westus.api.cognitive.microsoft.com', - 'westus2.api.cognitive.microsoft.com', - 'eastus.api.cognitive.microsoft.com', - 'eastus2.api.cognitive.microsoft.com', - 'westcentralus.api.cognitive.microsoft.com', - 'southcentralus.api.cognitive.microsoft.com', - 'westeurope.api.cognitive.microsoft.com', - 'northeurope.api.cognitive.microsoft.com', - 'southeastasia.api.cognitive.microsoft.com', - 'eastasia.api.cognitive.microsoft.com', - 'australiaeast.api.cognitive.microsoft.com', - 'brazilsouth.api.cognitive.microsoft.com', - 'contentmoderatortest.azure-api.net' - :type base_url_parameter: str or - ~azure.cognitiveservices.vision.contentmoderator.models.AzureRegionBaseUrl + :param endpoint: Supported Cognitive Services endpoints (protocol and + hostname, for example: https://westus.api.cognitive.microsoft.com). + :type endpoint: str :param credentials: Subscription credentials which uniquely identify client subscription. :type credentials: None """ def __init__( - self, base_url_parameter, credentials): + self, endpoint, credentials): - self.config = ContentModeratorClientConfiguration(base_url_parameter, credentials) - self._client = ServiceClient(self.config.credentials, self.config) + self.config = ContentModeratorClientConfiguration(endpoint, credentials) + super(ContentModeratorClient, self).__init__(self.config.credentials, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self.api_version = '1.0' diff --git a/azure-cognitiveservices-vision-contentmoderator/azure/cognitiveservices/vision/contentmoderator/models/__init__.py b/azure-cognitiveservices-vision-contentmoderator/azure/cognitiveservices/vision/contentmoderator/models/__init__.py index 47f0599d7a68..f22d72f611f2 100644 --- a/azure-cognitiveservices-vision-contentmoderator/azure/cognitiveservices/vision/contentmoderator/models/__init__.py +++ b/azure-cognitiveservices-vision-contentmoderator/azure/cognitiveservices/vision/contentmoderator/models/__init__.py @@ -14,10 +14,12 @@ from ._models_py3 import APIError from ._models_py3 import Address from ._models_py3 import Body - from ._models_py3 import BodyMetadata from ._models_py3 import BodyModel from ._models_py3 import Candidate from ._models_py3 import Classification + from ._models_py3 import ClassificationCategory1 + from ._models_py3 import ClassificationCategory2 + from ._models_py3 import ClassificationCategory3 from ._models_py3 import Content from ._models_py3 import CreateReviewBodyItem from ._models_py3 import CreateReviewBodyItemMetadataItem @@ -40,7 +42,6 @@ from ._models_py3 import ImageAdditionalInfoItem from ._models_py3 import ImageIds from ._models_py3 import ImageList - from ._models_py3 import ImageListMetadata from ._models_py3 import Job from ._models_py3 import JobExecutionReportDetails from ._models_py3 import JobId @@ -52,14 +53,12 @@ from ._models_py3 import PII from ._models_py3 import Phone from ._models_py3 import RefreshIndex - from ._models_py3 import RefreshIndexAdvancedInfoItem from ._models_py3 import Review - from ._models_py3 import Score + from ._models_py3 import SSN from ._models_py3 import Screen from ._models_py3 import Status from ._models_py3 import Tag from ._models_py3 import TermList - from ._models_py3 import TermListMetadata from ._models_py3 import Terms from ._models_py3 import TermsData from ._models_py3 import TermsInList @@ -74,10 +73,12 @@ from ._models import APIError from ._models import Address from ._models import Body - from ._models import BodyMetadata from ._models import BodyModel from ._models import Candidate from ._models import Classification + from ._models import ClassificationCategory1 + from ._models import ClassificationCategory2 + from ._models import ClassificationCategory3 from ._models import Content from ._models import CreateReviewBodyItem from ._models import CreateReviewBodyItemMetadataItem @@ -100,7 +101,6 @@ from ._models import ImageAdditionalInfoItem from ._models import ImageIds from ._models import ImageList - from ._models import ImageListMetadata from ._models import Job from ._models import JobExecutionReportDetails from ._models import JobId @@ -112,14 +112,12 @@ from ._models import PII from ._models import Phone from ._models import RefreshIndex - from ._models import RefreshIndexAdvancedInfoItem from ._models import Review - from ._models import Score + from ._models import SSN from ._models import Screen from ._models import Status from ._models import Tag from ._models import TermList - from ._models import TermListMetadata from ._models import Terms from ._models import TermsData from ._models import TermsInList @@ -130,17 +128,18 @@ from ._models import VideoFrameBodyItemMetadataItem from ._models import VideoFrameBodyItemReviewerResultTagsItem from ._models import APIErrorException -from ._content_moderator_client_enums import AzureRegionBaseUrl __all__=[ 'APIError', 'Address', 'Body', - 'BodyMetadata', 'BodyModel', 'Candidate', 'Classification', + 'ClassificationCategory1', + 'ClassificationCategory2', + 'ClassificationCategory3', 'Content', 'CreateReviewBodyItem', 'CreateReviewBodyItemMetadataItem', @@ -163,7 +162,6 @@ 'ImageAdditionalInfoItem', 'ImageIds', 'ImageList', - 'ImageListMetadata', 'Job', 'JobExecutionReportDetails', 'JobId', @@ -175,14 +173,12 @@ 'PII', 'Phone', 'RefreshIndex', - 'RefreshIndexAdvancedInfoItem', 'Review', - 'Score', + 'SSN', 'Screen', 'Status', 'Tag', 'TermList', - 'TermListMetadata', 'Terms', 'TermsData', 'TermsInList', @@ -193,5 +189,4 @@ 'VideoFrameBodyItemMetadataItem', 'VideoFrameBodyItemReviewerResultTagsItem', 'APIErrorException', - 'AzureRegionBaseUrl', ] diff --git a/azure-cognitiveservices-vision-contentmoderator/azure/cognitiveservices/vision/contentmoderator/models/_content_moderator_client_enums.py b/azure-cognitiveservices-vision-contentmoderator/azure/cognitiveservices/vision/contentmoderator/models/_content_moderator_client_enums.py deleted file mode 100644 index c635d83e56a9..000000000000 --- a/azure-cognitiveservices-vision-contentmoderator/azure/cognitiveservices/vision/contentmoderator/models/_content_moderator_client_enums.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from enum import Enum - - -class AzureRegionBaseUrl(Enum): - - westusapicognitivemicrosoftcom = "westus.api.cognitive.microsoft.com" - westus2apicognitivemicrosoftcom = "westus2.api.cognitive.microsoft.com" - eastusapicognitivemicrosoftcom = "eastus.api.cognitive.microsoft.com" - eastus2apicognitivemicrosoftcom = "eastus2.api.cognitive.microsoft.com" - westcentralusapicognitivemicrosoftcom = "westcentralus.api.cognitive.microsoft.com" - southcentralusapicognitivemicrosoftcom = "southcentralus.api.cognitive.microsoft.com" - westeuropeapicognitivemicrosoftcom = "westeurope.api.cognitive.microsoft.com" - northeuropeapicognitivemicrosoftcom = "northeurope.api.cognitive.microsoft.com" - southeastasiaapicognitivemicrosoftcom = "southeastasia.api.cognitive.microsoft.com" - eastasiaapicognitivemicrosoftcom = "eastasia.api.cognitive.microsoft.com" - australiaeastapicognitivemicrosoftcom = "australiaeast.api.cognitive.microsoft.com" - brazilsouthapicognitivemicrosoftcom = "brazilsouth.api.cognitive.microsoft.com" - contentmoderatortestazure_apinet = "contentmoderatortest.azure-api.net" diff --git a/azure-cognitiveservices-vision-contentmoderator/azure/cognitiveservices/vision/contentmoderator/models/_models.py b/azure-cognitiveservices-vision-contentmoderator/azure/cognitiveservices/vision/contentmoderator/models/_models.py index 34182d72fdb9..2921ef601d9c 100644 --- a/azure-cognitiveservices-vision-contentmoderator/azure/cognitiveservices/vision/contentmoderator/models/_models.py +++ b/azure-cognitiveservices-vision-contentmoderator/azure/cognitiveservices/vision/contentmoderator/models/_models.py @@ -24,9 +24,9 @@ class APIError(Model): 'error': {'key': 'Error', 'type': 'Error'}, } - def __init__(self, error=None): - super(APIError, self).__init__() - self.error = error + def __init__(self, **kwargs): + super(APIError, self).__init__(**kwargs) + self.error = kwargs.get('error', None) class APIErrorException(HttpOperationError): @@ -55,10 +55,10 @@ class Address(Model): 'index': {'key': 'Index', 'type': 'int'}, } - def __init__(self, text=None, index=None): - super(Address, self).__init__() - self.text = text - self.index = index + def __init__(self, **kwargs): + super(Address, self).__init__(**kwargs) + self.text = kwargs.get('text', None) + self.index = kwargs.get('index', None) class Body(Model): @@ -69,41 +69,20 @@ class Body(Model): :param description: Description of the list. :type description: str :param metadata: Metadata of the list. - :type metadata: - ~azure.cognitiveservices.vision.contentmoderator.models.BodyMetadata + :type metadata: dict[str, str] """ _attribute_map = { 'name': {'key': 'Name', 'type': 'str'}, 'description': {'key': 'Description', 'type': 'str'}, - 'metadata': {'key': 'Metadata', 'type': 'BodyMetadata'}, - } - - def __init__(self, name=None, description=None, metadata=None): - super(Body, self).__init__() - self.name = name - self.description = description - self.metadata = metadata - - -class BodyMetadata(Model): - """Metadata of the list. - - :param key_one: Optional key value pair to describe your list. - :type key_one: str - :param key_two: Optional key value pair to describe your list. - :type key_two: str - """ - - _attribute_map = { - 'key_one': {'key': 'Key One', 'type': 'str'}, - 'key_two': {'key': 'Key Two', 'type': 'str'}, + 'metadata': {'key': 'Metadata', 'type': '{str}'}, } - def __init__(self, key_one=None, key_two=None): - super(BodyMetadata, self).__init__() - self.key_one = key_one - self.key_two = key_two + def __init__(self, **kwargs): + super(Body, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.description = kwargs.get('description', None) + self.metadata = kwargs.get('metadata', None) class BodyModel(Model): @@ -120,10 +99,10 @@ class BodyModel(Model): 'value': {'key': 'Value', 'type': 'str'}, } - def __init__(self, data_representation="URL", value=None): - super(BodyModel, self).__init__() - self.data_representation = data_representation - self.value = value + def __init__(self, **kwargs): + super(BodyModel, self).__init__(**kwargs) + self.data_representation = kwargs.get('data_representation', "URL") + self.value = kwargs.get('value', None) class Candidate(Model): @@ -140,47 +119,109 @@ class Candidate(Model): 'confidence': {'key': 'Confidence', 'type': 'float'}, } - def __init__(self, text=None, confidence=None): - super(Candidate, self).__init__() - self.text = text - self.confidence = confidence + def __init__(self, **kwargs): + super(Candidate, self).__init__(**kwargs) + self.text = kwargs.get('text', None) + self.confidence = kwargs.get('confidence', None) class Classification(Model): """The classification details of the text. - :param category1: + :param category1: The category1 score details of the text. Click here for more + details on category classification. :type category1: - ~azure.cognitiveservices.vision.contentmoderator.models.Score - :param category2: + ~azure.cognitiveservices.vision.contentmoderator.models.ClassificationCategory1 + :param category2: The category2 score details of the text. Click here for more + details on category classification. :type category2: - ~azure.cognitiveservices.vision.contentmoderator.models.Score - :param category3: + ~azure.cognitiveservices.vision.contentmoderator.models.ClassificationCategory2 + :param category3: The category3 score details of the text. Click here for more + details on category classification. :type category3: - ~azure.cognitiveservices.vision.contentmoderator.models.Score + ~azure.cognitiveservices.vision.contentmoderator.models.ClassificationCategory3 :param review_recommended: The review recommended flag. :type review_recommended: bool """ _attribute_map = { - 'category1': {'key': 'Category1', 'type': 'Score'}, - 'category2': {'key': 'Category2', 'type': 'Score'}, - 'category3': {'key': 'Category3', 'type': 'Score'}, + 'category1': {'key': 'Category1', 'type': 'ClassificationCategory1'}, + 'category2': {'key': 'Category2', 'type': 'ClassificationCategory2'}, + 'category3': {'key': 'Category3', 'type': 'ClassificationCategory3'}, 'review_recommended': {'key': 'ReviewRecommended', 'type': 'bool'}, } - def __init__(self, category1=None, category2=None, category3=None, review_recommended=None): - super(Classification, self).__init__() - self.category1 = category1 - self.category2 = category2 - self.category3 = category3 - self.review_recommended = review_recommended + def __init__(self, **kwargs): + super(Classification, self).__init__(**kwargs) + self.category1 = kwargs.get('category1', None) + self.category2 = kwargs.get('category2', None) + self.category3 = kwargs.get('category3', None) + self.review_recommended = kwargs.get('review_recommended', None) + + +class ClassificationCategory1(Model): + """The category1 score details of the text. Click here for more + details on category classification. + + :param score: The category1 score. + :type score: float + """ + + _attribute_map = { + 'score': {'key': 'Score', 'type': 'float'}, + } + + def __init__(self, **kwargs): + super(ClassificationCategory1, self).__init__(**kwargs) + self.score = kwargs.get('score', None) + + +class ClassificationCategory2(Model): + """The category2 score details of the text. Click here for more + details on category classification. + + :param score: The category2 score. + :type score: float + """ + + _attribute_map = { + 'score': {'key': 'Score', 'type': 'float'}, + } + + def __init__(self, **kwargs): + super(ClassificationCategory2, self).__init__(**kwargs) + self.score = kwargs.get('score', None) + + +class ClassificationCategory3(Model): + """The category3 score details of the text. Click here for more + details on category classification. + + :param score: The category3 score. + :type score: float + """ + + _attribute_map = { + 'score': {'key': 'Score', 'type': 'float'}, + } + + def __init__(self, **kwargs): + super(ClassificationCategory3, self).__init__(**kwargs) + self.score = kwargs.get('score', None) class Content(Model): """Content. - :param content_value: Content to evaluate for a job. + All required parameters must be populated in order to send to Azure. + + :param content_value: Required. Content to evaluate for a job. :type content_value: str """ @@ -192,20 +233,23 @@ class Content(Model): 'content_value': {'key': 'ContentValue', 'type': 'str'}, } - def __init__(self, content_value): - super(Content, self).__init__() - self.content_value = content_value + def __init__(self, **kwargs): + super(Content, self).__init__(**kwargs) + self.content_value = kwargs.get('content_value', None) class CreateReviewBodyItem(Model): """Schema items of the body. - :param type: Type of the content. Possible values include: 'Image', 'Text' + All required parameters must be populated in order to send to Azure. + + :param type: Required. Type of the content. Possible values include: + 'Image', 'Text' :type type: str or ~azure.cognitiveservices.vision.contentmoderator.models.enum - :param content: Content to review. + :param content: Required. Content to review. :type content: str - :param content_id: Content Identifier. + :param content_id: Required. Content Identifier. :type content_id: str :param callback_endpoint: Optional CallbackEndpoint. :type callback_endpoint: str @@ -228,21 +272,23 @@ class CreateReviewBodyItem(Model): 'metadata': {'key': 'Metadata', 'type': '[CreateReviewBodyItemMetadataItem]'}, } - def __init__(self, type, content, content_id, callback_endpoint=None, metadata=None): - super(CreateReviewBodyItem, self).__init__() - self.type = type - self.content = content - self.content_id = content_id - self.callback_endpoint = callback_endpoint - self.metadata = metadata + def __init__(self, **kwargs): + super(CreateReviewBodyItem, self).__init__(**kwargs) + self.type = kwargs.get('type', None) + self.content = kwargs.get('content', None) + self.content_id = kwargs.get('content_id', None) + self.callback_endpoint = kwargs.get('callback_endpoint', None) + self.metadata = kwargs.get('metadata', None) class CreateReviewBodyItemMetadataItem(Model): """CreateReviewBodyItemMetadataItem. - :param key: Your key parameter. + All required parameters must be populated in order to send to Azure. + + :param key: Required. Your key parameter. :type key: str - :param value: Your value parameter. + :param value: Required. Your value parameter. :type value: str """ @@ -256,10 +302,10 @@ class CreateReviewBodyItemMetadataItem(Model): 'value': {'key': 'Value', 'type': 'str'}, } - def __init__(self, key, value): - super(CreateReviewBodyItemMetadataItem, self).__init__() - self.key = key - self.value = value + def __init__(self, **kwargs): + super(CreateReviewBodyItemMetadataItem, self).__init__(**kwargs) + self.key = kwargs.get('key', None) + self.value = kwargs.get('value', None) class CreateVideoReviewsBodyItem(Model): @@ -268,20 +314,23 @@ class CreateVideoReviewsBodyItem(Model): Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to Azure. + :param video_frames: Optional metadata details. :type video_frames: list[~azure.cognitiveservices.vision.contentmoderator.models.CreateVideoReviewsBodyItemVideoFramesItem] :param metadata: Optional metadata details. :type metadata: list[~azure.cognitiveservices.vision.contentmoderator.models.CreateVideoReviewsBodyItemMetadataItem] - :ivar type: Type of the content. Default value: "Video" . + :ivar type: Required. Type of the content. Default value: "Video" . :vartype type: str - :param content: Video content url to review. + :param content: Required. Video content url to review. :type content: str - :param content_id: Content Identifier. + :param content_id: Required. Content Identifier. :type content_id: str - :param status: Status of the video(Complete,Unpublished,Pending). Possible - values include: 'Complete', 'Unpublished', 'Pending' + :param status: Required. Status of the + video(Complete,Unpublished,Pending). Possible values include: 'Complete', + 'Unpublished', 'Pending' :type status: str or ~azure.cognitiveservices.vision.contentmoderator.models.enum :param timescale: Timescale of the video. @@ -310,23 +359,25 @@ class CreateVideoReviewsBodyItem(Model): type = "Video" - def __init__(self, content, content_id, status, video_frames=None, metadata=None, timescale=None, callback_endpoint=None): - super(CreateVideoReviewsBodyItem, self).__init__() - self.video_frames = video_frames - self.metadata = metadata - self.content = content - self.content_id = content_id - self.status = status - self.timescale = timescale - self.callback_endpoint = callback_endpoint + def __init__(self, **kwargs): + super(CreateVideoReviewsBodyItem, self).__init__(**kwargs) + self.video_frames = kwargs.get('video_frames', None) + self.metadata = kwargs.get('metadata', None) + self.content = kwargs.get('content', None) + self.content_id = kwargs.get('content_id', None) + self.status = kwargs.get('status', None) + self.timescale = kwargs.get('timescale', None) + self.callback_endpoint = kwargs.get('callback_endpoint', None) class CreateVideoReviewsBodyItemMetadataItem(Model): """CreateVideoReviewsBodyItemMetadataItem. - :param key: Your key parameter. + All required parameters must be populated in order to send to Azure. + + :param key: Required. Your key parameter. :type key: str - :param value: Your value parameter. + :param value: Required. Your value parameter. :type value: str """ @@ -340,20 +391,22 @@ class CreateVideoReviewsBodyItemMetadataItem(Model): 'value': {'key': 'Value', 'type': 'str'}, } - def __init__(self, key, value): - super(CreateVideoReviewsBodyItemMetadataItem, self).__init__() - self.key = key - self.value = value + def __init__(self, **kwargs): + super(CreateVideoReviewsBodyItemMetadataItem, self).__init__(**kwargs) + self.key = kwargs.get('key', None) + self.value = kwargs.get('value', None) class CreateVideoReviewsBodyItemVideoFramesItem(Model): """CreateVideoReviewsBodyItemVideoFramesItem. - :param id: Id of the frame. + All required parameters must be populated in order to send to Azure. + + :param id: Required. Id of the frame. :type id: str - :param timestamp: Timestamp of the frame. + :param timestamp: Required. Timestamp of the frame. :type timestamp: int - :param frame_image: Frame image Url. + :param frame_image: Required. Frame image Url. :type frame_image: str :param reviewer_result_tags: :type reviewer_result_tags: @@ -377,21 +430,23 @@ class CreateVideoReviewsBodyItemVideoFramesItem(Model): 'metadata': {'key': 'Metadata', 'type': '[CreateVideoReviewsBodyItemVideoFramesItemMetadataItem]'}, } - def __init__(self, id, timestamp, frame_image, reviewer_result_tags=None, metadata=None): - super(CreateVideoReviewsBodyItemVideoFramesItem, self).__init__() - self.id = id - self.timestamp = timestamp - self.frame_image = frame_image - self.reviewer_result_tags = reviewer_result_tags - self.metadata = metadata + def __init__(self, **kwargs): + super(CreateVideoReviewsBodyItemVideoFramesItem, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.timestamp = kwargs.get('timestamp', None) + self.frame_image = kwargs.get('frame_image', None) + self.reviewer_result_tags = kwargs.get('reviewer_result_tags', None) + self.metadata = kwargs.get('metadata', None) class CreateVideoReviewsBodyItemVideoFramesItemMetadataItem(Model): """CreateVideoReviewsBodyItemVideoFramesItemMetadataItem. - :param key: Your key parameter. + All required parameters must be populated in order to send to Azure. + + :param key: Required. Your key parameter. :type key: str - :param value: Your value parameter. + :param value: Required. Your value parameter. :type value: str """ @@ -405,18 +460,20 @@ class CreateVideoReviewsBodyItemVideoFramesItemMetadataItem(Model): 'value': {'key': 'Value', 'type': 'str'}, } - def __init__(self, key, value): - super(CreateVideoReviewsBodyItemVideoFramesItemMetadataItem, self).__init__() - self.key = key - self.value = value + def __init__(self, **kwargs): + super(CreateVideoReviewsBodyItemVideoFramesItemMetadataItem, self).__init__(**kwargs) + self.key = kwargs.get('key', None) + self.value = kwargs.get('value', None) class CreateVideoReviewsBodyItemVideoFramesItemReviewerResultTagsItem(Model): """CreateVideoReviewsBodyItemVideoFramesItemReviewerResultTagsItem. - :param key: Your key parameter. + All required parameters must be populated in order to send to Azure. + + :param key: Required. Your key parameter. :type key: str - :param value: Your value parameter. + :param value: Required. Your value parameter. :type value: str """ @@ -430,10 +487,10 @@ class CreateVideoReviewsBodyItemVideoFramesItemReviewerResultTagsItem(Model): 'value': {'key': 'Value', 'type': 'str'}, } - def __init__(self, key, value): - super(CreateVideoReviewsBodyItemVideoFramesItemReviewerResultTagsItem, self).__init__() - self.key = key - self.value = value + def __init__(self, **kwargs): + super(CreateVideoReviewsBodyItemVideoFramesItemReviewerResultTagsItem, self).__init__(**kwargs) + self.key = kwargs.get('key', None) + self.value = kwargs.get('value', None) class DetectedLanguage(Model): @@ -454,11 +511,11 @@ class DetectedLanguage(Model): 'tracking_id': {'key': 'TrackingId', 'type': 'str'}, } - def __init__(self, detected_language=None, status=None, tracking_id=None): - super(DetectedLanguage, self).__init__() - self.detected_language = detected_language - self.status = status - self.tracking_id = tracking_id + def __init__(self, **kwargs): + super(DetectedLanguage, self).__init__(**kwargs) + self.detected_language = kwargs.get('detected_language', None) + self.status = kwargs.get('status', None) + self.tracking_id = kwargs.get('tracking_id', None) class DetectedTerms(Model): @@ -483,12 +540,12 @@ class DetectedTerms(Model): 'term': {'key': 'Term', 'type': 'str'}, } - def __init__(self, index=None, original_index=None, list_id=None, term=None): - super(DetectedTerms, self).__init__() - self.index = index - self.original_index = original_index - self.list_id = list_id - self.term = term + def __init__(self, **kwargs): + super(DetectedTerms, self).__init__(**kwargs) + self.index = kwargs.get('index', None) + self.original_index = kwargs.get('original_index', None) + self.list_id = kwargs.get('list_id', None) + self.term = kwargs.get('term', None) class Email(Model): @@ -512,12 +569,12 @@ class Email(Model): 'index': {'key': 'Index', 'type': 'int'}, } - def __init__(self, detected=None, sub_type=None, text=None, index=None): - super(Email, self).__init__() - self.detected = detected - self.sub_type = sub_type - self.text = text - self.index = index + def __init__(self, **kwargs): + super(Email, self).__init__(**kwargs) + self.detected = kwargs.get('detected', None) + self.sub_type = kwargs.get('sub_type', None) + self.text = kwargs.get('text', None) + self.index = kwargs.get('index', None) class Error(Model): @@ -534,10 +591,10 @@ class Error(Model): 'message': {'key': 'Message', 'type': 'str'}, } - def __init__(self, code=None, message=None): - super(Error, self).__init__() - self.code = code - self.message = message + def __init__(self, **kwargs): + super(Error, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) class Evaluate(Model): @@ -554,7 +611,7 @@ class Evaluate(Model): :param is_image_adult_classified: Indicates if an image is classified as adult. :type is_image_adult_classified: bool - :param racy_classification_score: The racy classication score. + :param racy_classification_score: The racy classification score. :type racy_classification_score: float :param is_image_racy_classified: Indicates if the image is classified as racy. @@ -579,17 +636,17 @@ class Evaluate(Model): 'status': {'key': 'Status', 'type': 'Status'}, } - def __init__(self, cache_id=None, result=None, tracking_id=None, adult_classification_score=None, is_image_adult_classified=None, racy_classification_score=None, is_image_racy_classified=None, advanced_info=None, status=None): - super(Evaluate, self).__init__() - self.cache_id = cache_id - self.result = result - self.tracking_id = tracking_id - self.adult_classification_score = adult_classification_score - self.is_image_adult_classified = is_image_adult_classified - self.racy_classification_score = racy_classification_score - self.is_image_racy_classified = is_image_racy_classified - self.advanced_info = advanced_info - self.status = status + def __init__(self, **kwargs): + super(Evaluate, self).__init__(**kwargs) + self.cache_id = kwargs.get('cache_id', None) + self.result = kwargs.get('result', None) + self.tracking_id = kwargs.get('tracking_id', None) + self.adult_classification_score = kwargs.get('adult_classification_score', None) + self.is_image_adult_classified = kwargs.get('is_image_adult_classified', None) + self.racy_classification_score = kwargs.get('racy_classification_score', None) + self.is_image_racy_classified = kwargs.get('is_image_racy_classified', None) + self.advanced_info = kwargs.get('advanced_info', None) + self.status = kwargs.get('status', None) class Face(Model): @@ -612,12 +669,12 @@ class Face(Model): 'top': {'key': 'Top', 'type': 'int'}, } - def __init__(self, bottom=None, left=None, right=None, top=None): - super(Face, self).__init__() - self.bottom = bottom - self.left = left - self.right = right - self.top = top + def __init__(self, **kwargs): + super(Face, self).__init__(**kwargs) + self.bottom = kwargs.get('bottom', None) + self.left = kwargs.get('left', None) + self.right = kwargs.get('right', None) + self.top = kwargs.get('top', None) class FoundFaces(Model): @@ -652,15 +709,15 @@ class FoundFaces(Model): 'faces': {'key': 'Faces', 'type': '[Face]'}, } - def __init__(self, status=None, tracking_id=None, cache_id=None, result=None, count=None, advanced_info=None, faces=None): - super(FoundFaces, self).__init__() - self.status = status - self.tracking_id = tracking_id - self.cache_id = cache_id - self.result = result - self.count = count - self.advanced_info = advanced_info - self.faces = faces + def __init__(self, **kwargs): + super(FoundFaces, self).__init__(**kwargs) + self.status = kwargs.get('status', None) + self.tracking_id = kwargs.get('tracking_id', None) + self.cache_id = kwargs.get('cache_id', None) + self.result = kwargs.get('result', None) + self.count = kwargs.get('count', None) + self.advanced_info = kwargs.get('advanced_info', None) + self.faces = kwargs.get('faces', None) class Frame(Model): @@ -685,12 +742,12 @@ class Frame(Model): 'reviewer_result_tags': {'key': 'ReviewerResultTags', 'type': '[Tag]'}, } - def __init__(self, timestamp=None, frame_image=None, metadata=None, reviewer_result_tags=None): - super(Frame, self).__init__() - self.timestamp = timestamp - self.frame_image = frame_image - self.metadata = metadata - self.reviewer_result_tags = reviewer_result_tags + def __init__(self, **kwargs): + super(Frame, self).__init__(**kwargs) + self.timestamp = kwargs.get('timestamp', None) + self.frame_image = kwargs.get('frame_image', None) + self.metadata = kwargs.get('metadata', None) + self.reviewer_result_tags = kwargs.get('reviewer_result_tags', None) class Frames(Model): @@ -708,10 +765,10 @@ class Frames(Model): 'video_frames': {'key': 'VideoFrames', 'type': '[Frame]'}, } - def __init__(self, review_id=None, video_frames=None): - super(Frames, self).__init__() - self.review_id = review_id - self.video_frames = video_frames + def __init__(self, **kwargs): + super(Frames, self).__init__(**kwargs) + self.review_id = kwargs.get('review_id', None) + self.video_frames = kwargs.get('video_frames', None) class IPA(Model): @@ -731,11 +788,11 @@ class IPA(Model): 'index': {'key': 'Index', 'type': 'int'}, } - def __init__(self, sub_type=None, text=None, index=None): - super(IPA, self).__init__() - self.sub_type = sub_type - self.text = text - self.index = index + def __init__(self, **kwargs): + super(IPA, self).__init__(**kwargs) + self.sub_type = kwargs.get('sub_type', None) + self.text = kwargs.get('text', None) + self.index = kwargs.get('index', None) class Image(Model): @@ -760,12 +817,12 @@ class Image(Model): 'tracking_id': {'key': 'TrackingId', 'type': 'str'}, } - def __init__(self, content_id=None, additional_info=None, status=None, tracking_id=None): - super(Image, self).__init__() - self.content_id = content_id - self.additional_info = additional_info - self.status = status - self.tracking_id = tracking_id + def __init__(self, **kwargs): + super(Image, self).__init__(**kwargs) + self.content_id = kwargs.get('content_id', None) + self.additional_info = kwargs.get('additional_info', None) + self.status = kwargs.get('status', None) + self.tracking_id = kwargs.get('tracking_id', None) class ImageAdditionalInfoItem(Model): @@ -782,10 +839,10 @@ class ImageAdditionalInfoItem(Model): 'value': {'key': 'Value', 'type': 'str'}, } - def __init__(self, key=None, value=None): - super(ImageAdditionalInfoItem, self).__init__() - self.key = key - self.value = value + def __init__(self, **kwargs): + super(ImageAdditionalInfoItem, self).__init__(**kwargs) + self.key = kwargs.get('key', None) + self.value = kwargs.get('value', None) class ImageIds(Model): @@ -809,12 +866,12 @@ class ImageIds(Model): 'tracking_id': {'key': 'TrackingId', 'type': 'str'}, } - def __init__(self, content_source=None, content_ids=None, status=None, tracking_id=None): - super(ImageIds, self).__init__() - self.content_source = content_source - self.content_ids = content_ids - self.status = status - self.tracking_id = tracking_id + def __init__(self, **kwargs): + super(ImageIds, self).__init__(**kwargs) + self.content_source = kwargs.get('content_source', None) + self.content_ids = kwargs.get('content_ids', None) + self.status = kwargs.get('status', None) + self.tracking_id = kwargs.get('tracking_id', None) class ImageList(Model): @@ -827,43 +884,22 @@ class ImageList(Model): :param description: Description for image list. :type description: str :param metadata: Image List Metadata. - :type metadata: - ~azure.cognitiveservices.vision.contentmoderator.models.ImageListMetadata + :type metadata: dict[str, str] """ _attribute_map = { 'id': {'key': 'Id', 'type': 'int'}, 'name': {'key': 'Name', 'type': 'str'}, 'description': {'key': 'Description', 'type': 'str'}, - 'metadata': {'key': 'Metadata', 'type': 'ImageListMetadata'}, - } - - def __init__(self, id=None, name=None, description=None, metadata=None): - super(ImageList, self).__init__() - self.id = id - self.name = name - self.description = description - self.metadata = metadata - - -class ImageListMetadata(Model): - """Image List Metadata. - - :param key_one: Optional Key value pair to describe your list. - :type key_one: str - :param key_two: Optional Key value pair to describe your list. - :type key_two: str - """ - - _attribute_map = { - 'key_one': {'key': 'Key One', 'type': 'str'}, - 'key_two': {'key': 'Key Two', 'type': 'str'}, + 'metadata': {'key': 'Metadata', 'type': '{str}'}, } - def __init__(self, key_one=None, key_two=None): - super(ImageListMetadata, self).__init__() - self.key_one = key_one - self.key_two = key_two + def __init__(self, **kwargs): + super(ImageList, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.name = kwargs.get('name', None) + self.description = kwargs.get('description', None) + self.metadata = kwargs.get('metadata', None) class Job(Model): @@ -904,17 +940,17 @@ class Job(Model): 'job_execution_report': {'key': 'JobExecutionReport', 'type': '[JobExecutionReportDetails]'}, } - def __init__(self, id=None, team_name=None, status=None, workflow_id=None, type=None, call_back_endpoint=None, review_id=None, result_meta_data=None, job_execution_report=None): - super(Job, self).__init__() - self.id = id - self.team_name = team_name - self.status = status - self.workflow_id = workflow_id - self.type = type - self.call_back_endpoint = call_back_endpoint - self.review_id = review_id - self.result_meta_data = result_meta_data - self.job_execution_report = job_execution_report + def __init__(self, **kwargs): + super(Job, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.team_name = kwargs.get('team_name', None) + self.status = kwargs.get('status', None) + self.workflow_id = kwargs.get('workflow_id', None) + self.type = kwargs.get('type', None) + self.call_back_endpoint = kwargs.get('call_back_endpoint', None) + self.review_id = kwargs.get('review_id', None) + self.result_meta_data = kwargs.get('result_meta_data', None) + self.job_execution_report = kwargs.get('job_execution_report', None) class JobExecutionReportDetails(Model): @@ -931,10 +967,10 @@ class JobExecutionReportDetails(Model): 'msg': {'key': 'Msg', 'type': 'str'}, } - def __init__(self, ts=None, msg=None): - super(JobExecutionReportDetails, self).__init__() - self.ts = ts - self.msg = msg + def __init__(self, **kwargs): + super(JobExecutionReportDetails, self).__init__(**kwargs) + self.ts = kwargs.get('ts', None) + self.msg = kwargs.get('msg', None) class JobId(Model): @@ -948,9 +984,9 @@ class JobId(Model): 'job_id': {'key': 'JobId', 'type': 'str'}, } - def __init__(self, job_id=None): - super(JobId, self).__init__() - self.job_id = job_id + def __init__(self, **kwargs): + super(JobId, self).__init__(**kwargs) + self.job_id = kwargs.get('job_id', None) class JobListResult(Model): @@ -964,9 +1000,9 @@ class JobListResult(Model): 'value': {'key': 'Value', 'type': '[str]'}, } - def __init__(self, value=None): - super(JobListResult, self).__init__() - self.value = value + def __init__(self, **kwargs): + super(JobListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) class KeyValuePair(Model): @@ -983,10 +1019,10 @@ class KeyValuePair(Model): 'value': {'key': 'Value', 'type': 'str'}, } - def __init__(self, key=None, value=None): - super(KeyValuePair, self).__init__() - self.key = key - self.value = value + def __init__(self, **kwargs): + super(KeyValuePair, self).__init__(**kwargs) + self.key = kwargs.get('key', None) + self.value = kwargs.get('value', None) class Match(Model): @@ -1012,13 +1048,13 @@ class Match(Model): 'label': {'key': 'Label', 'type': 'str'}, } - def __init__(self, score=None, match_id=None, source=None, tags=None, label=None): - super(Match, self).__init__() - self.score = score - self.match_id = match_id - self.source = source - self.tags = tags - self.label = label + def __init__(self, **kwargs): + super(Match, self).__init__(**kwargs) + self.score = kwargs.get('score', None) + self.match_id = kwargs.get('match_id', None) + self.source = kwargs.get('source', None) + self.tags = kwargs.get('tags', None) + self.label = kwargs.get('label', None) class MatchResponse(Model): @@ -1046,13 +1082,13 @@ class MatchResponse(Model): 'status': {'key': 'Status', 'type': 'Status'}, } - def __init__(self, tracking_id=None, cache_id=None, is_match=None, matches=None, status=None): - super(MatchResponse, self).__init__() - self.tracking_id = tracking_id - self.cache_id = cache_id - self.is_match = is_match - self.matches = matches - self.status = status + def __init__(self, **kwargs): + super(MatchResponse, self).__init__(**kwargs) + self.tracking_id = kwargs.get('tracking_id', None) + self.cache_id = kwargs.get('cache_id', None) + self.is_match = kwargs.get('is_match', None) + self.matches = kwargs.get('matches', None) + self.status = kwargs.get('status', None) class OCR(Model): @@ -1087,15 +1123,15 @@ class OCR(Model): 'candidates': {'key': 'Candidates', 'type': '[Candidate]'}, } - def __init__(self, status=None, metadata=None, tracking_id=None, cache_id=None, language=None, text=None, candidates=None): - super(OCR, self).__init__() - self.status = status - self.metadata = metadata - self.tracking_id = tracking_id - self.cache_id = cache_id - self.language = language - self.text = text - self.candidates = candidates + def __init__(self, **kwargs): + super(OCR, self).__init__(**kwargs) + self.status = kwargs.get('status', None) + self.metadata = kwargs.get('metadata', None) + self.tracking_id = kwargs.get('tracking_id', None) + self.cache_id = kwargs.get('cache_id', None) + self.language = kwargs.get('language', None) + self.text = kwargs.get('text', None) + self.candidates = kwargs.get('candidates', None) class PII(Model): @@ -1104,6 +1140,9 @@ class PII(Model): :param email: :type email: list[~azure.cognitiveservices.vision.contentmoderator.models.Email] + :param ssn: + :type ssn: + list[~azure.cognitiveservices.vision.contentmoderator.models.SSN] :param ipa: :type ipa: list[~azure.cognitiveservices.vision.contentmoderator.models.IPA] @@ -1117,17 +1156,19 @@ class PII(Model): _attribute_map = { 'email': {'key': 'Email', 'type': '[Email]'}, + 'ssn': {'key': 'SSN', 'type': '[SSN]'}, 'ipa': {'key': 'IPA', 'type': '[IPA]'}, 'phone': {'key': 'Phone', 'type': '[Phone]'}, 'address': {'key': 'Address', 'type': '[Address]'}, } - def __init__(self, email=None, ipa=None, phone=None, address=None): - super(PII, self).__init__() - self.email = email - self.ipa = ipa - self.phone = phone - self.address = address + def __init__(self, **kwargs): + super(PII, self).__init__(**kwargs) + self.email = kwargs.get('email', None) + self.ssn = kwargs.get('ssn', None) + self.ipa = kwargs.get('ipa', None) + self.phone = kwargs.get('phone', None) + self.address = kwargs.get('address', None) class Phone(Model): @@ -1148,11 +1189,11 @@ class Phone(Model): 'index': {'key': 'Index', 'type': 'int'}, } - def __init__(self, country_code=None, text=None, index=None): - super(Phone, self).__init__() - self.country_code = country_code - self.text = text - self.index = index + def __init__(self, **kwargs): + super(Phone, self).__init__(**kwargs) + self.country_code = kwargs.get('country_code', None) + self.text = kwargs.get('text', None) + self.index = kwargs.get('index', None) class RefreshIndex(Model): @@ -1163,8 +1204,7 @@ class RefreshIndex(Model): :param is_update_success: Update success status. :type is_update_success: bool :param advanced_info: Advanced info list. - :type advanced_info: - list[~azure.cognitiveservices.vision.contentmoderator.models.RefreshIndexAdvancedInfoItem] + :type advanced_info: list[dict[str, str]] :param status: Refresh index status. :type status: ~azure.cognitiveservices.vision.contentmoderator.models.Status @@ -1175,38 +1215,18 @@ class RefreshIndex(Model): _attribute_map = { 'content_source_id': {'key': 'ContentSourceId', 'type': 'str'}, 'is_update_success': {'key': 'IsUpdateSuccess', 'type': 'bool'}, - 'advanced_info': {'key': 'AdvancedInfo', 'type': '[RefreshIndexAdvancedInfoItem]'}, + 'advanced_info': {'key': 'AdvancedInfo', 'type': '[{str}]'}, 'status': {'key': 'Status', 'type': 'Status'}, 'tracking_id': {'key': 'TrackingId', 'type': 'str'}, } - def __init__(self, content_source_id=None, is_update_success=None, advanced_info=None, status=None, tracking_id=None): - super(RefreshIndex, self).__init__() - self.content_source_id = content_source_id - self.is_update_success = is_update_success - self.advanced_info = advanced_info - self.status = status - self.tracking_id = tracking_id - - -class RefreshIndexAdvancedInfoItem(Model): - """RefreshIndexAdvancedInfoItem. - - :param key_one: Key parameter to describe advanced info. - :type key_one: str - :param key_two: Key parameter to describe advanced info. - :type key_two: str - """ - - _attribute_map = { - 'key_one': {'key': 'Key One', 'type': 'str'}, - 'key_two': {'key': 'Key Two', 'type': 'str'}, - } - - def __init__(self, key_one=None, key_two=None): - super(RefreshIndexAdvancedInfoItem, self).__init__() - self.key_one = key_one - self.key_two = key_two + def __init__(self, **kwargs): + super(RefreshIndex, self).__init__(**kwargs) + self.content_source_id = kwargs.get('content_source_id', None) + self.is_update_success = kwargs.get('is_update_success', None) + self.advanced_info = kwargs.get('advanced_info', None) + self.status = kwargs.get('status', None) + self.tracking_id = kwargs.get('tracking_id', None) class Review(Model): @@ -1249,36 +1269,38 @@ class Review(Model): 'callback_endpoint': {'key': 'CallbackEndpoint', 'type': 'str'}, } - def __init__(self, review_id=None, sub_team=None, status=None, reviewer_result_tags=None, created_by=None, metadata=None, type=None, content=None, content_id=None, callback_endpoint=None): - super(Review, self).__init__() - self.review_id = review_id - self.sub_team = sub_team - self.status = status - self.reviewer_result_tags = reviewer_result_tags - self.created_by = created_by - self.metadata = metadata - self.type = type - self.content = content - self.content_id = content_id - self.callback_endpoint = callback_endpoint + def __init__(self, **kwargs): + super(Review, self).__init__(**kwargs) + self.review_id = kwargs.get('review_id', None) + self.sub_team = kwargs.get('sub_team', None) + self.status = kwargs.get('status', None) + self.reviewer_result_tags = kwargs.get('reviewer_result_tags', None) + self.created_by = kwargs.get('created_by', None) + self.metadata = kwargs.get('metadata', None) + self.type = kwargs.get('type', None) + self.content = kwargs.get('content', None) + self.content_id = kwargs.get('content_id', None) + self.callback_endpoint = kwargs.get('callback_endpoint', None) -class Score(Model): - """The classification score details of the text. Click here for more - details on category classification. +class SSN(Model): + """Detected SSN details. - :param score: The category score. - :type score: float + :param text: Detected SSN in the input text content. + :type text: str + :param index: Index(Location) of the SSN in the input text content. + :type index: int """ _attribute_map = { - 'score': {'key': 'Score', 'type': 'float'}, + 'text': {'key': 'Text', 'type': 'str'}, + 'index': {'key': 'Index', 'type': 'int'}, } - def __init__(self, score=None): - super(Score, self).__init__() - self.score = score + def __init__(self, **kwargs): + super(SSN, self).__init__(**kwargs) + self.text = kwargs.get('text', None) + self.index = kwargs.get('index', None) class Screen(Model): @@ -1322,18 +1344,18 @@ class Screen(Model): 'tracking_id': {'key': 'TrackingId', 'type': 'str'}, } - def __init__(self, original_text=None, normalized_text=None, auto_corrected_text=None, misrepresentation=None, classification=None, status=None, pii=None, language=None, terms=None, tracking_id=None): - super(Screen, self).__init__() - self.original_text = original_text - self.normalized_text = normalized_text - self.auto_corrected_text = auto_corrected_text - self.misrepresentation = misrepresentation - self.classification = classification - self.status = status - self.pii = pii - self.language = language - self.terms = terms - self.tracking_id = tracking_id + def __init__(self, **kwargs): + super(Screen, self).__init__(**kwargs) + self.original_text = kwargs.get('original_text', None) + self.normalized_text = kwargs.get('normalized_text', None) + self.auto_corrected_text = kwargs.get('auto_corrected_text', None) + self.misrepresentation = kwargs.get('misrepresentation', None) + self.classification = kwargs.get('classification', None) + self.status = kwargs.get('status', None) + self.pii = kwargs.get('pii', None) + self.language = kwargs.get('language', None) + self.terms = kwargs.get('terms', None) + self.tracking_id = kwargs.get('tracking_id', None) class Status(Model): @@ -1353,11 +1375,11 @@ class Status(Model): 'exception': {'key': 'Exception', 'type': 'str'}, } - def __init__(self, code=None, description=None, exception=None): - super(Status, self).__init__() - self.code = code - self.description = description - self.exception = exception + def __init__(self, **kwargs): + super(Status, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.description = kwargs.get('description', None) + self.exception = kwargs.get('exception', None) class Tag(Model): @@ -1374,10 +1396,10 @@ class Tag(Model): 'value': {'key': 'Value', 'type': 'str'}, } - def __init__(self, key=None, value=None): - super(Tag, self).__init__() - self.key = key - self.value = value + def __init__(self, **kwargs): + super(Tag, self).__init__(**kwargs) + self.key = kwargs.get('key', None) + self.value = kwargs.get('value', None) class TermList(Model): @@ -1390,43 +1412,22 @@ class TermList(Model): :param description: Description for term list. :type description: str :param metadata: Term list metadata. - :type metadata: - ~azure.cognitiveservices.vision.contentmoderator.models.TermListMetadata + :type metadata: dict[str, str] """ _attribute_map = { 'id': {'key': 'Id', 'type': 'int'}, 'name': {'key': 'Name', 'type': 'str'}, 'description': {'key': 'Description', 'type': 'str'}, - 'metadata': {'key': 'Metadata', 'type': 'TermListMetadata'}, + 'metadata': {'key': 'Metadata', 'type': '{str}'}, } - def __init__(self, id=None, name=None, description=None, metadata=None): - super(TermList, self).__init__() - self.id = id - self.name = name - self.description = description - self.metadata = metadata - - -class TermListMetadata(Model): - """Term list metadata. - - :param key_one: Optional Key value pair to describe your list. - :type key_one: str - :param key_two: Optional Key value pair to describe your list. - :type key_two: str - """ - - _attribute_map = { - 'key_one': {'key': 'Key One', 'type': 'str'}, - 'key_two': {'key': 'Key Two', 'type': 'str'}, - } - - def __init__(self, key_one=None, key_two=None): - super(TermListMetadata, self).__init__() - self.key_one = key_one - self.key_two = key_two + def __init__(self, **kwargs): + super(TermList, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.name = kwargs.get('name', None) + self.description = kwargs.get('description', None) + self.metadata = kwargs.get('metadata', None) class Terms(Model): @@ -1445,10 +1446,10 @@ class Terms(Model): 'paging': {'key': 'Paging', 'type': 'TermsPaging'}, } - def __init__(self, data=None, paging=None): - super(Terms, self).__init__() - self.data = data - self.paging = paging + def __init__(self, **kwargs): + super(Terms, self).__init__(**kwargs) + self.data = kwargs.get('data', None) + self.paging = kwargs.get('paging', None) class TermsData(Model): @@ -1473,12 +1474,12 @@ class TermsData(Model): 'tracking_id': {'key': 'TrackingId', 'type': 'str'}, } - def __init__(self, language=None, terms=None, status=None, tracking_id=None): - super(TermsData, self).__init__() - self.language = language - self.terms = terms - self.status = status - self.tracking_id = tracking_id + def __init__(self, **kwargs): + super(TermsData, self).__init__(**kwargs) + self.language = kwargs.get('language', None) + self.terms = kwargs.get('terms', None) + self.status = kwargs.get('status', None) + self.tracking_id = kwargs.get('tracking_id', None) class TermsInList(Model): @@ -1492,9 +1493,9 @@ class TermsInList(Model): 'term': {'key': 'Term', 'type': 'str'}, } - def __init__(self, term=None): - super(TermsInList, self).__init__() - self.term = term + def __init__(self, **kwargs): + super(TermsInList, self).__init__(**kwargs) + self.term = kwargs.get('term', None) class TermsPaging(Model): @@ -1517,20 +1518,22 @@ class TermsPaging(Model): 'returned': {'key': 'Returned', 'type': 'int'}, } - def __init__(self, total=None, limit=None, offset=None, returned=None): - super(TermsPaging, self).__init__() - self.total = total - self.limit = limit - self.offset = offset - self.returned = returned + def __init__(self, **kwargs): + super(TermsPaging, self).__init__(**kwargs) + self.total = kwargs.get('total', None) + self.limit = kwargs.get('limit', None) + self.offset = kwargs.get('offset', None) + self.returned = kwargs.get('returned', None) class TranscriptModerationBodyItem(Model): """Schema items of the body. - :param timestamp: Timestamp of the image. + All required parameters must be populated in order to send to Azure. + + :param timestamp: Required. Timestamp of the image. :type timestamp: str - :param terms: Optional metadata details. + :param terms: Required. Optional metadata details. :type terms: list[~azure.cognitiveservices.vision.contentmoderator.models.TranscriptModerationBodyItemTermsItem] """ @@ -1545,18 +1548,20 @@ class TranscriptModerationBodyItem(Model): 'terms': {'key': 'Terms', 'type': '[TranscriptModerationBodyItemTermsItem]'}, } - def __init__(self, timestamp, terms): - super(TranscriptModerationBodyItem, self).__init__() - self.timestamp = timestamp - self.terms = terms + def __init__(self, **kwargs): + super(TranscriptModerationBodyItem, self).__init__(**kwargs) + self.timestamp = kwargs.get('timestamp', None) + self.terms = kwargs.get('terms', None) class TranscriptModerationBodyItemTermsItem(Model): """TranscriptModerationBodyItemTermsItem. - :param index: Index of the word + All required parameters must be populated in order to send to Azure. + + :param index: Required. Index of the word :type index: int - :param term: Detected word. + :param term: Required. Detected word. :type term: str """ @@ -1570,18 +1575,20 @@ class TranscriptModerationBodyItemTermsItem(Model): 'term': {'key': 'Term', 'type': 'str'}, } - def __init__(self, index, term): - super(TranscriptModerationBodyItemTermsItem, self).__init__() - self.index = index - self.term = term + def __init__(self, **kwargs): + super(TranscriptModerationBodyItemTermsItem, self).__init__(**kwargs) + self.index = kwargs.get('index', None) + self.term = kwargs.get('term', None) class VideoFrameBodyItem(Model): """Schema items of the body. - :param timestamp: Timestamp of the frame. + All required parameters must be populated in order to send to Azure. + + :param timestamp: Required. Timestamp of the frame. :type timestamp: str - :param frame_image: Content to review. + :param frame_image: Required. Content to review. :type frame_image: str :param reviewer_result_tags: :type reviewer_result_tags: @@ -1603,20 +1610,22 @@ class VideoFrameBodyItem(Model): 'metadata': {'key': 'Metadata', 'type': '[VideoFrameBodyItemMetadataItem]'}, } - def __init__(self, timestamp, frame_image, reviewer_result_tags=None, metadata=None): - super(VideoFrameBodyItem, self).__init__() - self.timestamp = timestamp - self.frame_image = frame_image - self.reviewer_result_tags = reviewer_result_tags - self.metadata = metadata + def __init__(self, **kwargs): + super(VideoFrameBodyItem, self).__init__(**kwargs) + self.timestamp = kwargs.get('timestamp', None) + self.frame_image = kwargs.get('frame_image', None) + self.reviewer_result_tags = kwargs.get('reviewer_result_tags', None) + self.metadata = kwargs.get('metadata', None) class VideoFrameBodyItemMetadataItem(Model): """VideoFrameBodyItemMetadataItem. - :param key: Your key parameter. + All required parameters must be populated in order to send to Azure. + + :param key: Required. Your key parameter. :type key: str - :param value: Your value parameter. + :param value: Required. Your value parameter. :type value: str """ @@ -1630,18 +1639,20 @@ class VideoFrameBodyItemMetadataItem(Model): 'value': {'key': 'Value', 'type': 'str'}, } - def __init__(self, key, value): - super(VideoFrameBodyItemMetadataItem, self).__init__() - self.key = key - self.value = value + def __init__(self, **kwargs): + super(VideoFrameBodyItemMetadataItem, self).__init__(**kwargs) + self.key = kwargs.get('key', None) + self.value = kwargs.get('value', None) class VideoFrameBodyItemReviewerResultTagsItem(Model): """VideoFrameBodyItemReviewerResultTagsItem. - :param key: Your key parameter. + All required parameters must be populated in order to send to Azure. + + :param key: Required. Your key parameter. :type key: str - :param value: Your value parameter. + :param value: Required. Your value parameter. :type value: str """ @@ -1655,7 +1666,7 @@ class VideoFrameBodyItemReviewerResultTagsItem(Model): 'value': {'key': 'Value', 'type': 'str'}, } - def __init__(self, key, value): - super(VideoFrameBodyItemReviewerResultTagsItem, self).__init__() - self.key = key - self.value = value + def __init__(self, **kwargs): + super(VideoFrameBodyItemReviewerResultTagsItem, self).__init__(**kwargs) + self.key = kwargs.get('key', None) + self.value = kwargs.get('value', None) diff --git a/azure-cognitiveservices-vision-contentmoderator/azure/cognitiveservices/vision/contentmoderator/models/_models_py3.py b/azure-cognitiveservices-vision-contentmoderator/azure/cognitiveservices/vision/contentmoderator/models/_models_py3.py index 34182d72fdb9..c67240f89978 100644 --- a/azure-cognitiveservices-vision-contentmoderator/azure/cognitiveservices/vision/contentmoderator/models/_models_py3.py +++ b/azure-cognitiveservices-vision-contentmoderator/azure/cognitiveservices/vision/contentmoderator/models/_models_py3.py @@ -24,8 +24,8 @@ class APIError(Model): 'error': {'key': 'Error', 'type': 'Error'}, } - def __init__(self, error=None): - super(APIError, self).__init__() + def __init__(self, *, error=None, **kwargs) -> None: + super(APIError, self).__init__(**kwargs) self.error = error @@ -55,8 +55,8 @@ class Address(Model): 'index': {'key': 'Index', 'type': 'int'}, } - def __init__(self, text=None, index=None): - super(Address, self).__init__() + def __init__(self, *, text: str=None, index: int=None, **kwargs) -> None: + super(Address, self).__init__(**kwargs) self.text = text self.index = index @@ -69,43 +69,22 @@ class Body(Model): :param description: Description of the list. :type description: str :param metadata: Metadata of the list. - :type metadata: - ~azure.cognitiveservices.vision.contentmoderator.models.BodyMetadata + :type metadata: dict[str, str] """ _attribute_map = { 'name': {'key': 'Name', 'type': 'str'}, 'description': {'key': 'Description', 'type': 'str'}, - 'metadata': {'key': 'Metadata', 'type': 'BodyMetadata'}, + 'metadata': {'key': 'Metadata', 'type': '{str}'}, } - def __init__(self, name=None, description=None, metadata=None): - super(Body, self).__init__() + def __init__(self, *, name: str=None, description: str=None, metadata=None, **kwargs) -> None: + super(Body, self).__init__(**kwargs) self.name = name self.description = description self.metadata = metadata -class BodyMetadata(Model): - """Metadata of the list. - - :param key_one: Optional key value pair to describe your list. - :type key_one: str - :param key_two: Optional key value pair to describe your list. - :type key_two: str - """ - - _attribute_map = { - 'key_one': {'key': 'Key One', 'type': 'str'}, - 'key_two': {'key': 'Key Two', 'type': 'str'}, - } - - def __init__(self, key_one=None, key_two=None): - super(BodyMetadata, self).__init__() - self.key_one = key_one - self.key_two = key_two - - class BodyModel(Model): """BodyModel. @@ -120,8 +99,8 @@ class BodyModel(Model): 'value': {'key': 'Value', 'type': 'str'}, } - def __init__(self, data_representation="URL", value=None): - super(BodyModel, self).__init__() + def __init__(self, *, data_representation: str="URL", value: str=None, **kwargs) -> None: + super(BodyModel, self).__init__(**kwargs) self.data_representation = data_representation self.value = value @@ -140,8 +119,8 @@ class Candidate(Model): 'confidence': {'key': 'Confidence', 'type': 'float'}, } - def __init__(self, text=None, confidence=None): - super(Candidate, self).__init__() + def __init__(self, *, text: str=None, confidence: float=None, **kwargs) -> None: + super(Candidate, self).__init__(**kwargs) self.text = text self.confidence = confidence @@ -149,38 +128,100 @@ def __init__(self, text=None, confidence=None): class Classification(Model): """The classification details of the text. - :param category1: + :param category1: The category1 score details of the text. Click here for more + details on category classification. :type category1: - ~azure.cognitiveservices.vision.contentmoderator.models.Score - :param category2: + ~azure.cognitiveservices.vision.contentmoderator.models.ClassificationCategory1 + :param category2: The category2 score details of the text. Click here for more + details on category classification. :type category2: - ~azure.cognitiveservices.vision.contentmoderator.models.Score - :param category3: + ~azure.cognitiveservices.vision.contentmoderator.models.ClassificationCategory2 + :param category3: The category3 score details of the text. Click here for more + details on category classification. :type category3: - ~azure.cognitiveservices.vision.contentmoderator.models.Score + ~azure.cognitiveservices.vision.contentmoderator.models.ClassificationCategory3 :param review_recommended: The review recommended flag. :type review_recommended: bool """ _attribute_map = { - 'category1': {'key': 'Category1', 'type': 'Score'}, - 'category2': {'key': 'Category2', 'type': 'Score'}, - 'category3': {'key': 'Category3', 'type': 'Score'}, + 'category1': {'key': 'Category1', 'type': 'ClassificationCategory1'}, + 'category2': {'key': 'Category2', 'type': 'ClassificationCategory2'}, + 'category3': {'key': 'Category3', 'type': 'ClassificationCategory3'}, 'review_recommended': {'key': 'ReviewRecommended', 'type': 'bool'}, } - def __init__(self, category1=None, category2=None, category3=None, review_recommended=None): - super(Classification, self).__init__() + def __init__(self, *, category1=None, category2=None, category3=None, review_recommended: bool=None, **kwargs) -> None: + super(Classification, self).__init__(**kwargs) self.category1 = category1 self.category2 = category2 self.category3 = category3 self.review_recommended = review_recommended +class ClassificationCategory1(Model): + """The category1 score details of the text. Click here for more + details on category classification. + + :param score: The category1 score. + :type score: float + """ + + _attribute_map = { + 'score': {'key': 'Score', 'type': 'float'}, + } + + def __init__(self, *, score: float=None, **kwargs) -> None: + super(ClassificationCategory1, self).__init__(**kwargs) + self.score = score + + +class ClassificationCategory2(Model): + """The category2 score details of the text. Click here for more + details on category classification. + + :param score: The category2 score. + :type score: float + """ + + _attribute_map = { + 'score': {'key': 'Score', 'type': 'float'}, + } + + def __init__(self, *, score: float=None, **kwargs) -> None: + super(ClassificationCategory2, self).__init__(**kwargs) + self.score = score + + +class ClassificationCategory3(Model): + """The category3 score details of the text. Click here for more + details on category classification. + + :param score: The category3 score. + :type score: float + """ + + _attribute_map = { + 'score': {'key': 'Score', 'type': 'float'}, + } + + def __init__(self, *, score: float=None, **kwargs) -> None: + super(ClassificationCategory3, self).__init__(**kwargs) + self.score = score + + class Content(Model): """Content. - :param content_value: Content to evaluate for a job. + All required parameters must be populated in order to send to Azure. + + :param content_value: Required. Content to evaluate for a job. :type content_value: str """ @@ -192,20 +233,23 @@ class Content(Model): 'content_value': {'key': 'ContentValue', 'type': 'str'}, } - def __init__(self, content_value): - super(Content, self).__init__() + def __init__(self, *, content_value: str, **kwargs) -> None: + super(Content, self).__init__(**kwargs) self.content_value = content_value class CreateReviewBodyItem(Model): """Schema items of the body. - :param type: Type of the content. Possible values include: 'Image', 'Text' + All required parameters must be populated in order to send to Azure. + + :param type: Required. Type of the content. Possible values include: + 'Image', 'Text' :type type: str or ~azure.cognitiveservices.vision.contentmoderator.models.enum - :param content: Content to review. + :param content: Required. Content to review. :type content: str - :param content_id: Content Identifier. + :param content_id: Required. Content Identifier. :type content_id: str :param callback_endpoint: Optional CallbackEndpoint. :type callback_endpoint: str @@ -228,8 +272,8 @@ class CreateReviewBodyItem(Model): 'metadata': {'key': 'Metadata', 'type': '[CreateReviewBodyItemMetadataItem]'}, } - def __init__(self, type, content, content_id, callback_endpoint=None, metadata=None): - super(CreateReviewBodyItem, self).__init__() + def __init__(self, *, type, content: str, content_id: str, callback_endpoint: str=None, metadata=None, **kwargs) -> None: + super(CreateReviewBodyItem, self).__init__(**kwargs) self.type = type self.content = content self.content_id = content_id @@ -240,9 +284,11 @@ def __init__(self, type, content, content_id, callback_endpoint=None, metadata=N class CreateReviewBodyItemMetadataItem(Model): """CreateReviewBodyItemMetadataItem. - :param key: Your key parameter. + All required parameters must be populated in order to send to Azure. + + :param key: Required. Your key parameter. :type key: str - :param value: Your value parameter. + :param value: Required. Your value parameter. :type value: str """ @@ -256,8 +302,8 @@ class CreateReviewBodyItemMetadataItem(Model): 'value': {'key': 'Value', 'type': 'str'}, } - def __init__(self, key, value): - super(CreateReviewBodyItemMetadataItem, self).__init__() + def __init__(self, *, key: str, value: str, **kwargs) -> None: + super(CreateReviewBodyItemMetadataItem, self).__init__(**kwargs) self.key = key self.value = value @@ -268,20 +314,23 @@ class CreateVideoReviewsBodyItem(Model): Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to Azure. + :param video_frames: Optional metadata details. :type video_frames: list[~azure.cognitiveservices.vision.contentmoderator.models.CreateVideoReviewsBodyItemVideoFramesItem] :param metadata: Optional metadata details. :type metadata: list[~azure.cognitiveservices.vision.contentmoderator.models.CreateVideoReviewsBodyItemMetadataItem] - :ivar type: Type of the content. Default value: "Video" . + :ivar type: Required. Type of the content. Default value: "Video" . :vartype type: str - :param content: Video content url to review. + :param content: Required. Video content url to review. :type content: str - :param content_id: Content Identifier. + :param content_id: Required. Content Identifier. :type content_id: str - :param status: Status of the video(Complete,Unpublished,Pending). Possible - values include: 'Complete', 'Unpublished', 'Pending' + :param status: Required. Status of the + video(Complete,Unpublished,Pending). Possible values include: 'Complete', + 'Unpublished', 'Pending' :type status: str or ~azure.cognitiveservices.vision.contentmoderator.models.enum :param timescale: Timescale of the video. @@ -310,8 +359,8 @@ class CreateVideoReviewsBodyItem(Model): type = "Video" - def __init__(self, content, content_id, status, video_frames=None, metadata=None, timescale=None, callback_endpoint=None): - super(CreateVideoReviewsBodyItem, self).__init__() + def __init__(self, *, content: str, content_id: str, status, video_frames=None, metadata=None, timescale: int=None, callback_endpoint: str=None, **kwargs) -> None: + super(CreateVideoReviewsBodyItem, self).__init__(**kwargs) self.video_frames = video_frames self.metadata = metadata self.content = content @@ -324,9 +373,11 @@ def __init__(self, content, content_id, status, video_frames=None, metadata=None class CreateVideoReviewsBodyItemMetadataItem(Model): """CreateVideoReviewsBodyItemMetadataItem. - :param key: Your key parameter. + All required parameters must be populated in order to send to Azure. + + :param key: Required. Your key parameter. :type key: str - :param value: Your value parameter. + :param value: Required. Your value parameter. :type value: str """ @@ -340,8 +391,8 @@ class CreateVideoReviewsBodyItemMetadataItem(Model): 'value': {'key': 'Value', 'type': 'str'}, } - def __init__(self, key, value): - super(CreateVideoReviewsBodyItemMetadataItem, self).__init__() + def __init__(self, *, key: str, value: str, **kwargs) -> None: + super(CreateVideoReviewsBodyItemMetadataItem, self).__init__(**kwargs) self.key = key self.value = value @@ -349,11 +400,13 @@ def __init__(self, key, value): class CreateVideoReviewsBodyItemVideoFramesItem(Model): """CreateVideoReviewsBodyItemVideoFramesItem. - :param id: Id of the frame. + All required parameters must be populated in order to send to Azure. + + :param id: Required. Id of the frame. :type id: str - :param timestamp: Timestamp of the frame. + :param timestamp: Required. Timestamp of the frame. :type timestamp: int - :param frame_image: Frame image Url. + :param frame_image: Required. Frame image Url. :type frame_image: str :param reviewer_result_tags: :type reviewer_result_tags: @@ -377,8 +430,8 @@ class CreateVideoReviewsBodyItemVideoFramesItem(Model): 'metadata': {'key': 'Metadata', 'type': '[CreateVideoReviewsBodyItemVideoFramesItemMetadataItem]'}, } - def __init__(self, id, timestamp, frame_image, reviewer_result_tags=None, metadata=None): - super(CreateVideoReviewsBodyItemVideoFramesItem, self).__init__() + def __init__(self, *, id: str, timestamp: int, frame_image: str, reviewer_result_tags=None, metadata=None, **kwargs) -> None: + super(CreateVideoReviewsBodyItemVideoFramesItem, self).__init__(**kwargs) self.id = id self.timestamp = timestamp self.frame_image = frame_image @@ -389,9 +442,11 @@ def __init__(self, id, timestamp, frame_image, reviewer_result_tags=None, metada class CreateVideoReviewsBodyItemVideoFramesItemMetadataItem(Model): """CreateVideoReviewsBodyItemVideoFramesItemMetadataItem. - :param key: Your key parameter. + All required parameters must be populated in order to send to Azure. + + :param key: Required. Your key parameter. :type key: str - :param value: Your value parameter. + :param value: Required. Your value parameter. :type value: str """ @@ -405,8 +460,8 @@ class CreateVideoReviewsBodyItemVideoFramesItemMetadataItem(Model): 'value': {'key': 'Value', 'type': 'str'}, } - def __init__(self, key, value): - super(CreateVideoReviewsBodyItemVideoFramesItemMetadataItem, self).__init__() + def __init__(self, *, key: str, value: str, **kwargs) -> None: + super(CreateVideoReviewsBodyItemVideoFramesItemMetadataItem, self).__init__(**kwargs) self.key = key self.value = value @@ -414,9 +469,11 @@ def __init__(self, key, value): class CreateVideoReviewsBodyItemVideoFramesItemReviewerResultTagsItem(Model): """CreateVideoReviewsBodyItemVideoFramesItemReviewerResultTagsItem. - :param key: Your key parameter. + All required parameters must be populated in order to send to Azure. + + :param key: Required. Your key parameter. :type key: str - :param value: Your value parameter. + :param value: Required. Your value parameter. :type value: str """ @@ -430,8 +487,8 @@ class CreateVideoReviewsBodyItemVideoFramesItemReviewerResultTagsItem(Model): 'value': {'key': 'Value', 'type': 'str'}, } - def __init__(self, key, value): - super(CreateVideoReviewsBodyItemVideoFramesItemReviewerResultTagsItem, self).__init__() + def __init__(self, *, key: str, value: str, **kwargs) -> None: + super(CreateVideoReviewsBodyItemVideoFramesItemReviewerResultTagsItem, self).__init__(**kwargs) self.key = key self.value = value @@ -454,8 +511,8 @@ class DetectedLanguage(Model): 'tracking_id': {'key': 'TrackingId', 'type': 'str'}, } - def __init__(self, detected_language=None, status=None, tracking_id=None): - super(DetectedLanguage, self).__init__() + def __init__(self, *, detected_language: str=None, status=None, tracking_id: str=None, **kwargs) -> None: + super(DetectedLanguage, self).__init__(**kwargs) self.detected_language = detected_language self.status = status self.tracking_id = tracking_id @@ -483,8 +540,8 @@ class DetectedTerms(Model): 'term': {'key': 'Term', 'type': 'str'}, } - def __init__(self, index=None, original_index=None, list_id=None, term=None): - super(DetectedTerms, self).__init__() + def __init__(self, *, index: int=None, original_index: int=None, list_id: int=None, term: str=None, **kwargs) -> None: + super(DetectedTerms, self).__init__(**kwargs) self.index = index self.original_index = original_index self.list_id = list_id @@ -512,8 +569,8 @@ class Email(Model): 'index': {'key': 'Index', 'type': 'int'}, } - def __init__(self, detected=None, sub_type=None, text=None, index=None): - super(Email, self).__init__() + def __init__(self, *, detected: str=None, sub_type: str=None, text: str=None, index: int=None, **kwargs) -> None: + super(Email, self).__init__(**kwargs) self.detected = detected self.sub_type = sub_type self.text = text @@ -534,8 +591,8 @@ class Error(Model): 'message': {'key': 'Message', 'type': 'str'}, } - def __init__(self, code=None, message=None): - super(Error, self).__init__() + def __init__(self, *, code: str=None, message: str=None, **kwargs) -> None: + super(Error, self).__init__(**kwargs) self.code = code self.message = message @@ -554,7 +611,7 @@ class Evaluate(Model): :param is_image_adult_classified: Indicates if an image is classified as adult. :type is_image_adult_classified: bool - :param racy_classification_score: The racy classication score. + :param racy_classification_score: The racy classification score. :type racy_classification_score: float :param is_image_racy_classified: Indicates if the image is classified as racy. @@ -579,8 +636,8 @@ class Evaluate(Model): 'status': {'key': 'Status', 'type': 'Status'}, } - def __init__(self, cache_id=None, result=None, tracking_id=None, adult_classification_score=None, is_image_adult_classified=None, racy_classification_score=None, is_image_racy_classified=None, advanced_info=None, status=None): - super(Evaluate, self).__init__() + def __init__(self, *, cache_id: str=None, result: bool=None, tracking_id: str=None, adult_classification_score: float=None, is_image_adult_classified: bool=None, racy_classification_score: float=None, is_image_racy_classified: bool=None, advanced_info=None, status=None, **kwargs) -> None: + super(Evaluate, self).__init__(**kwargs) self.cache_id = cache_id self.result = result self.tracking_id = tracking_id @@ -612,8 +669,8 @@ class Face(Model): 'top': {'key': 'Top', 'type': 'int'}, } - def __init__(self, bottom=None, left=None, right=None, top=None): - super(Face, self).__init__() + def __init__(self, *, bottom: int=None, left: int=None, right: int=None, top: int=None, **kwargs) -> None: + super(Face, self).__init__(**kwargs) self.bottom = bottom self.left = left self.right = right @@ -652,8 +709,8 @@ class FoundFaces(Model): 'faces': {'key': 'Faces', 'type': '[Face]'}, } - def __init__(self, status=None, tracking_id=None, cache_id=None, result=None, count=None, advanced_info=None, faces=None): - super(FoundFaces, self).__init__() + def __init__(self, *, status=None, tracking_id: str=None, cache_id: str=None, result: bool=None, count: int=None, advanced_info=None, faces=None, **kwargs) -> None: + super(FoundFaces, self).__init__(**kwargs) self.status = status self.tracking_id = tracking_id self.cache_id = cache_id @@ -685,8 +742,8 @@ class Frame(Model): 'reviewer_result_tags': {'key': 'ReviewerResultTags', 'type': '[Tag]'}, } - def __init__(self, timestamp=None, frame_image=None, metadata=None, reviewer_result_tags=None): - super(Frame, self).__init__() + def __init__(self, *, timestamp: str=None, frame_image: str=None, metadata=None, reviewer_result_tags=None, **kwargs) -> None: + super(Frame, self).__init__(**kwargs) self.timestamp = timestamp self.frame_image = frame_image self.metadata = metadata @@ -708,8 +765,8 @@ class Frames(Model): 'video_frames': {'key': 'VideoFrames', 'type': '[Frame]'}, } - def __init__(self, review_id=None, video_frames=None): - super(Frames, self).__init__() + def __init__(self, *, review_id: str=None, video_frames=None, **kwargs) -> None: + super(Frames, self).__init__(**kwargs) self.review_id = review_id self.video_frames = video_frames @@ -731,8 +788,8 @@ class IPA(Model): 'index': {'key': 'Index', 'type': 'int'}, } - def __init__(self, sub_type=None, text=None, index=None): - super(IPA, self).__init__() + def __init__(self, *, sub_type: str=None, text: str=None, index: int=None, **kwargs) -> None: + super(IPA, self).__init__(**kwargs) self.sub_type = sub_type self.text = text self.index = index @@ -760,8 +817,8 @@ class Image(Model): 'tracking_id': {'key': 'TrackingId', 'type': 'str'}, } - def __init__(self, content_id=None, additional_info=None, status=None, tracking_id=None): - super(Image, self).__init__() + def __init__(self, *, content_id: str=None, additional_info=None, status=None, tracking_id: str=None, **kwargs) -> None: + super(Image, self).__init__(**kwargs) self.content_id = content_id self.additional_info = additional_info self.status = status @@ -782,8 +839,8 @@ class ImageAdditionalInfoItem(Model): 'value': {'key': 'Value', 'type': 'str'}, } - def __init__(self, key=None, value=None): - super(ImageAdditionalInfoItem, self).__init__() + def __init__(self, *, key: str=None, value: str=None, **kwargs) -> None: + super(ImageAdditionalInfoItem, self).__init__(**kwargs) self.key = key self.value = value @@ -809,8 +866,8 @@ class ImageIds(Model): 'tracking_id': {'key': 'TrackingId', 'type': 'str'}, } - def __init__(self, content_source=None, content_ids=None, status=None, tracking_id=None): - super(ImageIds, self).__init__() + def __init__(self, *, content_source: str=None, content_ids=None, status=None, tracking_id: str=None, **kwargs) -> None: + super(ImageIds, self).__init__(**kwargs) self.content_source = content_source self.content_ids = content_ids self.status = status @@ -827,45 +884,24 @@ class ImageList(Model): :param description: Description for image list. :type description: str :param metadata: Image List Metadata. - :type metadata: - ~azure.cognitiveservices.vision.contentmoderator.models.ImageListMetadata + :type metadata: dict[str, str] """ _attribute_map = { 'id': {'key': 'Id', 'type': 'int'}, 'name': {'key': 'Name', 'type': 'str'}, 'description': {'key': 'Description', 'type': 'str'}, - 'metadata': {'key': 'Metadata', 'type': 'ImageListMetadata'}, + 'metadata': {'key': 'Metadata', 'type': '{str}'}, } - def __init__(self, id=None, name=None, description=None, metadata=None): - super(ImageList, self).__init__() + def __init__(self, *, id: int=None, name: str=None, description: str=None, metadata=None, **kwargs) -> None: + super(ImageList, self).__init__(**kwargs) self.id = id self.name = name self.description = description self.metadata = metadata -class ImageListMetadata(Model): - """Image List Metadata. - - :param key_one: Optional Key value pair to describe your list. - :type key_one: str - :param key_two: Optional Key value pair to describe your list. - :type key_two: str - """ - - _attribute_map = { - 'key_one': {'key': 'Key One', 'type': 'str'}, - 'key_two': {'key': 'Key Two', 'type': 'str'}, - } - - def __init__(self, key_one=None, key_two=None): - super(ImageListMetadata, self).__init__() - self.key_one = key_one - self.key_two = key_two - - class Job(Model): """The Job object. @@ -904,8 +940,8 @@ class Job(Model): 'job_execution_report': {'key': 'JobExecutionReport', 'type': '[JobExecutionReportDetails]'}, } - def __init__(self, id=None, team_name=None, status=None, workflow_id=None, type=None, call_back_endpoint=None, review_id=None, result_meta_data=None, job_execution_report=None): - super(Job, self).__init__() + def __init__(self, *, id: str=None, team_name: str=None, status: str=None, workflow_id: str=None, type: str=None, call_back_endpoint: str=None, review_id: str=None, result_meta_data=None, job_execution_report=None, **kwargs) -> None: + super(Job, self).__init__(**kwargs) self.id = id self.team_name = team_name self.status = status @@ -931,8 +967,8 @@ class JobExecutionReportDetails(Model): 'msg': {'key': 'Msg', 'type': 'str'}, } - def __init__(self, ts=None, msg=None): - super(JobExecutionReportDetails, self).__init__() + def __init__(self, *, ts: str=None, msg: str=None, **kwargs) -> None: + super(JobExecutionReportDetails, self).__init__(**kwargs) self.ts = ts self.msg = msg @@ -948,8 +984,8 @@ class JobId(Model): 'job_id': {'key': 'JobId', 'type': 'str'}, } - def __init__(self, job_id=None): - super(JobId, self).__init__() + def __init__(self, *, job_id: str=None, **kwargs) -> None: + super(JobId, self).__init__(**kwargs) self.job_id = job_id @@ -964,8 +1000,8 @@ class JobListResult(Model): 'value': {'key': 'Value', 'type': '[str]'}, } - def __init__(self, value=None): - super(JobListResult, self).__init__() + def __init__(self, *, value=None, **kwargs) -> None: + super(JobListResult, self).__init__(**kwargs) self.value = value @@ -983,8 +1019,8 @@ class KeyValuePair(Model): 'value': {'key': 'Value', 'type': 'str'}, } - def __init__(self, key=None, value=None): - super(KeyValuePair, self).__init__() + def __init__(self, *, key: str=None, value: str=None, **kwargs) -> None: + super(KeyValuePair, self).__init__(**kwargs) self.key = key self.value = value @@ -1012,8 +1048,8 @@ class Match(Model): 'label': {'key': 'Label', 'type': 'str'}, } - def __init__(self, score=None, match_id=None, source=None, tags=None, label=None): - super(Match, self).__init__() + def __init__(self, *, score: float=None, match_id: int=None, source: str=None, tags=None, label: str=None, **kwargs) -> None: + super(Match, self).__init__(**kwargs) self.score = score self.match_id = match_id self.source = source @@ -1046,8 +1082,8 @@ class MatchResponse(Model): 'status': {'key': 'Status', 'type': 'Status'}, } - def __init__(self, tracking_id=None, cache_id=None, is_match=None, matches=None, status=None): - super(MatchResponse, self).__init__() + def __init__(self, *, tracking_id: str=None, cache_id: str=None, is_match: bool=None, matches=None, status=None, **kwargs) -> None: + super(MatchResponse, self).__init__(**kwargs) self.tracking_id = tracking_id self.cache_id = cache_id self.is_match = is_match @@ -1087,8 +1123,8 @@ class OCR(Model): 'candidates': {'key': 'Candidates', 'type': '[Candidate]'}, } - def __init__(self, status=None, metadata=None, tracking_id=None, cache_id=None, language=None, text=None, candidates=None): - super(OCR, self).__init__() + def __init__(self, *, status=None, metadata=None, tracking_id: str=None, cache_id: str=None, language: str=None, text: str=None, candidates=None, **kwargs) -> None: + super(OCR, self).__init__(**kwargs) self.status = status self.metadata = metadata self.tracking_id = tracking_id @@ -1104,6 +1140,9 @@ class PII(Model): :param email: :type email: list[~azure.cognitiveservices.vision.contentmoderator.models.Email] + :param ssn: + :type ssn: + list[~azure.cognitiveservices.vision.contentmoderator.models.SSN] :param ipa: :type ipa: list[~azure.cognitiveservices.vision.contentmoderator.models.IPA] @@ -1117,14 +1156,16 @@ class PII(Model): _attribute_map = { 'email': {'key': 'Email', 'type': '[Email]'}, + 'ssn': {'key': 'SSN', 'type': '[SSN]'}, 'ipa': {'key': 'IPA', 'type': '[IPA]'}, 'phone': {'key': 'Phone', 'type': '[Phone]'}, 'address': {'key': 'Address', 'type': '[Address]'}, } - def __init__(self, email=None, ipa=None, phone=None, address=None): - super(PII, self).__init__() + def __init__(self, *, email=None, ssn=None, ipa=None, phone=None, address=None, **kwargs) -> None: + super(PII, self).__init__(**kwargs) self.email = email + self.ssn = ssn self.ipa = ipa self.phone = phone self.address = address @@ -1148,8 +1189,8 @@ class Phone(Model): 'index': {'key': 'Index', 'type': 'int'}, } - def __init__(self, country_code=None, text=None, index=None): - super(Phone, self).__init__() + def __init__(self, *, country_code: str=None, text: str=None, index: int=None, **kwargs) -> None: + super(Phone, self).__init__(**kwargs) self.country_code = country_code self.text = text self.index = index @@ -1163,8 +1204,7 @@ class RefreshIndex(Model): :param is_update_success: Update success status. :type is_update_success: bool :param advanced_info: Advanced info list. - :type advanced_info: - list[~azure.cognitiveservices.vision.contentmoderator.models.RefreshIndexAdvancedInfoItem] + :type advanced_info: list[dict[str, str]] :param status: Refresh index status. :type status: ~azure.cognitiveservices.vision.contentmoderator.models.Status @@ -1175,13 +1215,13 @@ class RefreshIndex(Model): _attribute_map = { 'content_source_id': {'key': 'ContentSourceId', 'type': 'str'}, 'is_update_success': {'key': 'IsUpdateSuccess', 'type': 'bool'}, - 'advanced_info': {'key': 'AdvancedInfo', 'type': '[RefreshIndexAdvancedInfoItem]'}, + 'advanced_info': {'key': 'AdvancedInfo', 'type': '[{str}]'}, 'status': {'key': 'Status', 'type': 'Status'}, 'tracking_id': {'key': 'TrackingId', 'type': 'str'}, } - def __init__(self, content_source_id=None, is_update_success=None, advanced_info=None, status=None, tracking_id=None): - super(RefreshIndex, self).__init__() + def __init__(self, *, content_source_id: str=None, is_update_success: bool=None, advanced_info=None, status=None, tracking_id: str=None, **kwargs) -> None: + super(RefreshIndex, self).__init__(**kwargs) self.content_source_id = content_source_id self.is_update_success = is_update_success self.advanced_info = advanced_info @@ -1189,26 +1229,6 @@ def __init__(self, content_source_id=None, is_update_success=None, advanced_info self.tracking_id = tracking_id -class RefreshIndexAdvancedInfoItem(Model): - """RefreshIndexAdvancedInfoItem. - - :param key_one: Key parameter to describe advanced info. - :type key_one: str - :param key_two: Key parameter to describe advanced info. - :type key_two: str - """ - - _attribute_map = { - 'key_one': {'key': 'Key One', 'type': 'str'}, - 'key_two': {'key': 'Key Two', 'type': 'str'}, - } - - def __init__(self, key_one=None, key_two=None): - super(RefreshIndexAdvancedInfoItem, self).__init__() - self.key_one = key_one - self.key_two = key_two - - class Review(Model): """The Review object. @@ -1249,8 +1269,8 @@ class Review(Model): 'callback_endpoint': {'key': 'CallbackEndpoint', 'type': 'str'}, } - def __init__(self, review_id=None, sub_team=None, status=None, reviewer_result_tags=None, created_by=None, metadata=None, type=None, content=None, content_id=None, callback_endpoint=None): - super(Review, self).__init__() + def __init__(self, *, review_id: str=None, sub_team: str=None, status: str=None, reviewer_result_tags=None, created_by: str=None, metadata=None, type: str=None, content: str=None, content_id: str=None, callback_endpoint: str=None, **kwargs) -> None: + super(Review, self).__init__(**kwargs) self.review_id = review_id self.sub_team = sub_team self.status = status @@ -1263,22 +1283,24 @@ def __init__(self, review_id=None, sub_team=None, status=None, reviewer_result_t self.callback_endpoint = callback_endpoint -class Score(Model): - """The classification score details of the text. Click here for more - details on category classification. +class SSN(Model): + """Detected SSN details. - :param score: The category score. - :type score: float + :param text: Detected SSN in the input text content. + :type text: str + :param index: Index(Location) of the SSN in the input text content. + :type index: int """ _attribute_map = { - 'score': {'key': 'Score', 'type': 'float'}, + 'text': {'key': 'Text', 'type': 'str'}, + 'index': {'key': 'Index', 'type': 'int'}, } - def __init__(self, score=None): - super(Score, self).__init__() - self.score = score + def __init__(self, *, text: str=None, index: int=None, **kwargs) -> None: + super(SSN, self).__init__(**kwargs) + self.text = text + self.index = index class Screen(Model): @@ -1322,8 +1344,8 @@ class Screen(Model): 'tracking_id': {'key': 'TrackingId', 'type': 'str'}, } - def __init__(self, original_text=None, normalized_text=None, auto_corrected_text=None, misrepresentation=None, classification=None, status=None, pii=None, language=None, terms=None, tracking_id=None): - super(Screen, self).__init__() + def __init__(self, *, original_text: str=None, normalized_text: str=None, auto_corrected_text: str=None, misrepresentation=None, classification=None, status=None, pii=None, language: str=None, terms=None, tracking_id: str=None, **kwargs) -> None: + super(Screen, self).__init__(**kwargs) self.original_text = original_text self.normalized_text = normalized_text self.auto_corrected_text = auto_corrected_text @@ -1353,8 +1375,8 @@ class Status(Model): 'exception': {'key': 'Exception', 'type': 'str'}, } - def __init__(self, code=None, description=None, exception=None): - super(Status, self).__init__() + def __init__(self, *, code: int=None, description: str=None, exception: str=None, **kwargs) -> None: + super(Status, self).__init__(**kwargs) self.code = code self.description = description self.exception = exception @@ -1374,8 +1396,8 @@ class Tag(Model): 'value': {'key': 'Value', 'type': 'str'}, } - def __init__(self, key=None, value=None): - super(Tag, self).__init__() + def __init__(self, *, key: str=None, value: str=None, **kwargs) -> None: + super(Tag, self).__init__(**kwargs) self.key = key self.value = value @@ -1390,45 +1412,24 @@ class TermList(Model): :param description: Description for term list. :type description: str :param metadata: Term list metadata. - :type metadata: - ~azure.cognitiveservices.vision.contentmoderator.models.TermListMetadata + :type metadata: dict[str, str] """ _attribute_map = { 'id': {'key': 'Id', 'type': 'int'}, 'name': {'key': 'Name', 'type': 'str'}, 'description': {'key': 'Description', 'type': 'str'}, - 'metadata': {'key': 'Metadata', 'type': 'TermListMetadata'}, + 'metadata': {'key': 'Metadata', 'type': '{str}'}, } - def __init__(self, id=None, name=None, description=None, metadata=None): - super(TermList, self).__init__() + def __init__(self, *, id: int=None, name: str=None, description: str=None, metadata=None, **kwargs) -> None: + super(TermList, self).__init__(**kwargs) self.id = id self.name = name self.description = description self.metadata = metadata -class TermListMetadata(Model): - """Term list metadata. - - :param key_one: Optional Key value pair to describe your list. - :type key_one: str - :param key_two: Optional Key value pair to describe your list. - :type key_two: str - """ - - _attribute_map = { - 'key_one': {'key': 'Key One', 'type': 'str'}, - 'key_two': {'key': 'Key Two', 'type': 'str'}, - } - - def __init__(self, key_one=None, key_two=None): - super(TermListMetadata, self).__init__() - self.key_one = key_one - self.key_two = key_two - - class Terms(Model): """Terms properties. @@ -1445,8 +1446,8 @@ class Terms(Model): 'paging': {'key': 'Paging', 'type': 'TermsPaging'}, } - def __init__(self, data=None, paging=None): - super(Terms, self).__init__() + def __init__(self, *, data=None, paging=None, **kwargs) -> None: + super(Terms, self).__init__(**kwargs) self.data = data self.paging = paging @@ -1473,8 +1474,8 @@ class TermsData(Model): 'tracking_id': {'key': 'TrackingId', 'type': 'str'}, } - def __init__(self, language=None, terms=None, status=None, tracking_id=None): - super(TermsData, self).__init__() + def __init__(self, *, language: str=None, terms=None, status=None, tracking_id: str=None, **kwargs) -> None: + super(TermsData, self).__init__(**kwargs) self.language = language self.terms = terms self.status = status @@ -1492,8 +1493,8 @@ class TermsInList(Model): 'term': {'key': 'Term', 'type': 'str'}, } - def __init__(self, term=None): - super(TermsInList, self).__init__() + def __init__(self, *, term: str=None, **kwargs) -> None: + super(TermsInList, self).__init__(**kwargs) self.term = term @@ -1517,8 +1518,8 @@ class TermsPaging(Model): 'returned': {'key': 'Returned', 'type': 'int'}, } - def __init__(self, total=None, limit=None, offset=None, returned=None): - super(TermsPaging, self).__init__() + def __init__(self, *, total: int=None, limit: int=None, offset: int=None, returned: int=None, **kwargs) -> None: + super(TermsPaging, self).__init__(**kwargs) self.total = total self.limit = limit self.offset = offset @@ -1528,9 +1529,11 @@ def __init__(self, total=None, limit=None, offset=None, returned=None): class TranscriptModerationBodyItem(Model): """Schema items of the body. - :param timestamp: Timestamp of the image. + All required parameters must be populated in order to send to Azure. + + :param timestamp: Required. Timestamp of the image. :type timestamp: str - :param terms: Optional metadata details. + :param terms: Required. Optional metadata details. :type terms: list[~azure.cognitiveservices.vision.contentmoderator.models.TranscriptModerationBodyItemTermsItem] """ @@ -1545,8 +1548,8 @@ class TranscriptModerationBodyItem(Model): 'terms': {'key': 'Terms', 'type': '[TranscriptModerationBodyItemTermsItem]'}, } - def __init__(self, timestamp, terms): - super(TranscriptModerationBodyItem, self).__init__() + def __init__(self, *, timestamp: str, terms, **kwargs) -> None: + super(TranscriptModerationBodyItem, self).__init__(**kwargs) self.timestamp = timestamp self.terms = terms @@ -1554,9 +1557,11 @@ def __init__(self, timestamp, terms): class TranscriptModerationBodyItemTermsItem(Model): """TranscriptModerationBodyItemTermsItem. - :param index: Index of the word + All required parameters must be populated in order to send to Azure. + + :param index: Required. Index of the word :type index: int - :param term: Detected word. + :param term: Required. Detected word. :type term: str """ @@ -1570,8 +1575,8 @@ class TranscriptModerationBodyItemTermsItem(Model): 'term': {'key': 'Term', 'type': 'str'}, } - def __init__(self, index, term): - super(TranscriptModerationBodyItemTermsItem, self).__init__() + def __init__(self, *, index: int, term: str, **kwargs) -> None: + super(TranscriptModerationBodyItemTermsItem, self).__init__(**kwargs) self.index = index self.term = term @@ -1579,9 +1584,11 @@ def __init__(self, index, term): class VideoFrameBodyItem(Model): """Schema items of the body. - :param timestamp: Timestamp of the frame. + All required parameters must be populated in order to send to Azure. + + :param timestamp: Required. Timestamp of the frame. :type timestamp: str - :param frame_image: Content to review. + :param frame_image: Required. Content to review. :type frame_image: str :param reviewer_result_tags: :type reviewer_result_tags: @@ -1603,8 +1610,8 @@ class VideoFrameBodyItem(Model): 'metadata': {'key': 'Metadata', 'type': '[VideoFrameBodyItemMetadataItem]'}, } - def __init__(self, timestamp, frame_image, reviewer_result_tags=None, metadata=None): - super(VideoFrameBodyItem, self).__init__() + def __init__(self, *, timestamp: str, frame_image: str, reviewer_result_tags=None, metadata=None, **kwargs) -> None: + super(VideoFrameBodyItem, self).__init__(**kwargs) self.timestamp = timestamp self.frame_image = frame_image self.reviewer_result_tags = reviewer_result_tags @@ -1614,9 +1621,11 @@ def __init__(self, timestamp, frame_image, reviewer_result_tags=None, metadata=N class VideoFrameBodyItemMetadataItem(Model): """VideoFrameBodyItemMetadataItem. - :param key: Your key parameter. + All required parameters must be populated in order to send to Azure. + + :param key: Required. Your key parameter. :type key: str - :param value: Your value parameter. + :param value: Required. Your value parameter. :type value: str """ @@ -1630,8 +1639,8 @@ class VideoFrameBodyItemMetadataItem(Model): 'value': {'key': 'Value', 'type': 'str'}, } - def __init__(self, key, value): - super(VideoFrameBodyItemMetadataItem, self).__init__() + def __init__(self, *, key: str, value: str, **kwargs) -> None: + super(VideoFrameBodyItemMetadataItem, self).__init__(**kwargs) self.key = key self.value = value @@ -1639,9 +1648,11 @@ def __init__(self, key, value): class VideoFrameBodyItemReviewerResultTagsItem(Model): """VideoFrameBodyItemReviewerResultTagsItem. - :param key: Your key parameter. + All required parameters must be populated in order to send to Azure. + + :param key: Required. Your key parameter. :type key: str - :param value: Your value parameter. + :param value: Required. Your value parameter. :type value: str """ @@ -1655,7 +1666,7 @@ class VideoFrameBodyItemReviewerResultTagsItem(Model): 'value': {'key': 'Value', 'type': 'str'}, } - def __init__(self, key, value): - super(VideoFrameBodyItemReviewerResultTagsItem, self).__init__() + def __init__(self, *, key: str, value: str, **kwargs) -> None: + super(VideoFrameBodyItemReviewerResultTagsItem, self).__init__(**kwargs) self.key = key self.value = value diff --git a/azure-cognitiveservices-vision-contentmoderator/azure/cognitiveservices/vision/contentmoderator/operations/image_moderation_operations.py b/azure-cognitiveservices-vision-contentmoderator/azure/cognitiveservices/vision/contentmoderator/operations/image_moderation_operations.py index e83ca7599164..a6d8e0b3f975 100644 --- a/azure-cognitiveservices-vision-contentmoderator/azure/cognitiveservices/vision/contentmoderator/operations/image_moderation_operations.py +++ b/azure-cognitiveservices-vision-contentmoderator/azure/cognitiveservices/vision/contentmoderator/operations/image_moderation_operations.py @@ -53,9 +53,9 @@ def find_faces( :class:`APIErrorException` """ # Construct URL - url = '/contentmoderator/moderate/v1.0/ProcessImage/FindFaces' + url = self.find_faces.metadata['url'] path_format_arguments = { - 'baseUrl': self._serialize.url("self.config.base_url_parameter", self.config.base_url_parameter, 'str', skip_quote=True) + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) @@ -66,13 +66,13 @@ def find_faces( # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + header_parameters['Accept'] = 'application/json' if custom_headers: header_parameters.update(custom_headers) # Construct and send request - request = self._client.post(url, query_parameters) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.APIErrorException(self._deserialize, response) @@ -87,6 +87,7 @@ def find_faces( return client_raw_response return deserialized + find_faces.metadata = {'url': '/contentmoderator/moderate/v1.0/ProcessImage/FindFaces'} def ocr_method( self, language, cache_image=None, enhanced=False, custom_headers=None, raw=False, **operation_config): @@ -115,9 +116,9 @@ def ocr_method( :class:`APIErrorException` """ # Construct URL - url = '/contentmoderator/moderate/v1.0/ProcessImage/OCR' + url = self.ocr_method.metadata['url'] path_format_arguments = { - 'baseUrl': self._serialize.url("self.config.base_url_parameter", self.config.base_url_parameter, 'str', skip_quote=True) + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) @@ -131,13 +132,13 @@ def ocr_method( # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + header_parameters['Accept'] = 'application/json' if custom_headers: header_parameters.update(custom_headers) # Construct and send request - request = self._client.post(url, query_parameters) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.APIErrorException(self._deserialize, response) @@ -152,6 +153,7 @@ def ocr_method( return client_raw_response return deserialized + ocr_method.metadata = {'url': '/contentmoderator/moderate/v1.0/ProcessImage/OCR'} def evaluate_method( self, cache_image=None, custom_headers=None, raw=False, **operation_config): @@ -173,9 +175,9 @@ def evaluate_method( :class:`APIErrorException` """ # Construct URL - url = '/contentmoderator/moderate/v1.0/ProcessImage/Evaluate' + url = self.evaluate_method.metadata['url'] path_format_arguments = { - 'baseUrl': self._serialize.url("self.config.base_url_parameter", self.config.base_url_parameter, 'str', skip_quote=True) + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) @@ -186,13 +188,13 @@ def evaluate_method( # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + header_parameters['Accept'] = 'application/json' if custom_headers: header_parameters.update(custom_headers) # Construct and send request - request = self._client.post(url, query_parameters) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.APIErrorException(self._deserialize, response) @@ -207,6 +209,7 @@ def evaluate_method( return client_raw_response return deserialized + evaluate_method.metadata = {'url': '/contentmoderator/moderate/v1.0/ProcessImage/Evaluate'} def match_method( self, list_id=None, cache_image=None, custom_headers=None, raw=False, **operation_config): @@ -237,9 +240,9 @@ def match_method( :class:`APIErrorException` """ # Construct URL - url = '/contentmoderator/moderate/v1.0/ProcessImage/Match' + url = self.match_method.metadata['url'] path_format_arguments = { - 'baseUrl': self._serialize.url("self.config.base_url_parameter", self.config.base_url_parameter, 'str', skip_quote=True) + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) @@ -252,13 +255,13 @@ def match_method( # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + header_parameters['Accept'] = 'application/json' if custom_headers: header_parameters.update(custom_headers) # Construct and send request - request = self._client.post(url, query_parameters) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.APIErrorException(self._deserialize, response) @@ -273,6 +276,7 @@ def match_method( return client_raw_response return deserialized + match_method.metadata = {'url': '/contentmoderator/moderate/v1.0/ProcessImage/Match'} def find_faces_file_input( self, image_stream, cache_image=None, custom_headers=None, raw=False, callback=None, **operation_config): @@ -301,9 +305,9 @@ def find_faces_file_input( :class:`APIErrorException` """ # Construct URL - url = '/contentmoderator/moderate/v1.0/ProcessImage/FindFaces' + url = self.find_faces_file_input.metadata['url'] path_format_arguments = { - 'baseUrl': self._serialize.url("self.config.base_url_parameter", self.config.base_url_parameter, 'str', skip_quote=True) + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) @@ -314,6 +318,7 @@ def find_faces_file_input( # Construct headers header_parameters = {} + header_parameters['Accept'] = 'application/json' header_parameters['Content-Type'] = 'image/gif' if custom_headers: header_parameters.update(custom_headers) @@ -322,9 +327,8 @@ def find_faces_file_input( body_content = self._client.stream_upload(image_stream, callback) # Construct and send request - request = self._client.post(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.APIErrorException(self._deserialize, response) @@ -339,6 +343,7 @@ def find_faces_file_input( return client_raw_response return deserialized + find_faces_file_input.metadata = {'url': '/contentmoderator/moderate/v1.0/ProcessImage/FindFaces'} def find_faces_url_input( self, content_type, cache_image=None, data_representation="URL", value=None, custom_headers=None, raw=False, **operation_config): @@ -368,9 +373,9 @@ def find_faces_url_input( image_url = models.BodyModel(data_representation=data_representation, value=value) # Construct URL - url = '/contentmoderator/moderate/v1.0/ProcessImage/FindFaces' + url = self.find_faces_url_input.metadata['url'] path_format_arguments = { - 'baseUrl': self._serialize.url("self.config.base_url_parameter", self.config.base_url_parameter, 'str', skip_quote=True) + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) @@ -381,6 +386,7 @@ def find_faces_url_input( # Construct headers header_parameters = {} + header_parameters['Accept'] = 'application/json' header_parameters['Content-Type'] = 'application/json; charset=utf-8' if custom_headers: header_parameters.update(custom_headers) @@ -390,9 +396,8 @@ def find_faces_url_input( body_content = self._serialize.body(image_url, 'BodyModel') # Construct and send request - request = self._client.post(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.APIErrorException(self._deserialize, response) @@ -407,6 +412,7 @@ def find_faces_url_input( return client_raw_response return deserialized + find_faces_url_input.metadata = {'url': '/contentmoderator/moderate/v1.0/ProcessImage/FindFaces'} def ocr_url_input( self, language, content_type, cache_image=None, enhanced=False, data_representation="URL", value=None, custom_headers=None, raw=False, **operation_config): @@ -443,9 +449,9 @@ def ocr_url_input( image_url = models.BodyModel(data_representation=data_representation, value=value) # Construct URL - url = '/contentmoderator/moderate/v1.0/ProcessImage/OCR' + url = self.ocr_url_input.metadata['url'] path_format_arguments = { - 'baseUrl': self._serialize.url("self.config.base_url_parameter", self.config.base_url_parameter, 'str', skip_quote=True) + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) @@ -459,6 +465,7 @@ def ocr_url_input( # Construct headers header_parameters = {} + header_parameters['Accept'] = 'application/json' header_parameters['Content-Type'] = 'application/json; charset=utf-8' if custom_headers: header_parameters.update(custom_headers) @@ -468,9 +475,8 @@ def ocr_url_input( body_content = self._serialize.body(image_url, 'BodyModel') # Construct and send request - request = self._client.post(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.APIErrorException(self._deserialize, response) @@ -485,6 +491,7 @@ def ocr_url_input( return client_raw_response return deserialized + ocr_url_input.metadata = {'url': '/contentmoderator/moderate/v1.0/ProcessImage/OCR'} def ocr_file_input( self, language, image_stream, cache_image=None, enhanced=False, custom_headers=None, raw=False, callback=None, **operation_config): @@ -520,9 +527,9 @@ def ocr_file_input( :class:`APIErrorException` """ # Construct URL - url = '/contentmoderator/moderate/v1.0/ProcessImage/OCR' + url = self.ocr_file_input.metadata['url'] path_format_arguments = { - 'baseUrl': self._serialize.url("self.config.base_url_parameter", self.config.base_url_parameter, 'str', skip_quote=True) + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) @@ -536,6 +543,7 @@ def ocr_file_input( # Construct headers header_parameters = {} + header_parameters['Accept'] = 'application/json' header_parameters['Content-Type'] = 'image/gif' if custom_headers: header_parameters.update(custom_headers) @@ -544,9 +552,8 @@ def ocr_file_input( body_content = self._client.stream_upload(image_stream, callback) # Construct and send request - request = self._client.post(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.APIErrorException(self._deserialize, response) @@ -561,6 +568,7 @@ def ocr_file_input( return client_raw_response return deserialized + ocr_file_input.metadata = {'url': '/contentmoderator/moderate/v1.0/ProcessImage/OCR'} def evaluate_file_input( self, image_stream, cache_image=None, custom_headers=None, raw=False, callback=None, **operation_config): @@ -589,9 +597,9 @@ def evaluate_file_input( :class:`APIErrorException` """ # Construct URL - url = '/contentmoderator/moderate/v1.0/ProcessImage/Evaluate' + url = self.evaluate_file_input.metadata['url'] path_format_arguments = { - 'baseUrl': self._serialize.url("self.config.base_url_parameter", self.config.base_url_parameter, 'str', skip_quote=True) + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) @@ -602,6 +610,7 @@ def evaluate_file_input( # Construct headers header_parameters = {} + header_parameters['Accept'] = 'application/json' header_parameters['Content-Type'] = 'image/gif' if custom_headers: header_parameters.update(custom_headers) @@ -610,9 +619,8 @@ def evaluate_file_input( body_content = self._client.stream_upload(image_stream, callback) # Construct and send request - request = self._client.post(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.APIErrorException(self._deserialize, response) @@ -627,6 +635,7 @@ def evaluate_file_input( return client_raw_response return deserialized + evaluate_file_input.metadata = {'url': '/contentmoderator/moderate/v1.0/ProcessImage/Evaluate'} def evaluate_url_input( self, content_type, cache_image=None, data_representation="URL", value=None, custom_headers=None, raw=False, **operation_config): @@ -656,9 +665,9 @@ def evaluate_url_input( image_url = models.BodyModel(data_representation=data_representation, value=value) # Construct URL - url = '/contentmoderator/moderate/v1.0/ProcessImage/Evaluate' + url = self.evaluate_url_input.metadata['url'] path_format_arguments = { - 'baseUrl': self._serialize.url("self.config.base_url_parameter", self.config.base_url_parameter, 'str', skip_quote=True) + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) @@ -669,6 +678,7 @@ def evaluate_url_input( # Construct headers header_parameters = {} + header_parameters['Accept'] = 'application/json' header_parameters['Content-Type'] = 'application/json; charset=utf-8' if custom_headers: header_parameters.update(custom_headers) @@ -678,9 +688,8 @@ def evaluate_url_input( body_content = self._serialize.body(image_url, 'BodyModel') # Construct and send request - request = self._client.post(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.APIErrorException(self._deserialize, response) @@ -695,6 +704,7 @@ def evaluate_url_input( return client_raw_response return deserialized + evaluate_url_input.metadata = {'url': '/contentmoderator/moderate/v1.0/ProcessImage/Evaluate'} def match_url_input( self, content_type, list_id=None, cache_image=None, data_representation="URL", value=None, custom_headers=None, raw=False, **operation_config): @@ -733,9 +743,9 @@ def match_url_input( image_url = models.BodyModel(data_representation=data_representation, value=value) # Construct URL - url = '/contentmoderator/moderate/v1.0/ProcessImage/Match' + url = self.match_url_input.metadata['url'] path_format_arguments = { - 'baseUrl': self._serialize.url("self.config.base_url_parameter", self.config.base_url_parameter, 'str', skip_quote=True) + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) @@ -748,6 +758,7 @@ def match_url_input( # Construct headers header_parameters = {} + header_parameters['Accept'] = 'application/json' header_parameters['Content-Type'] = 'application/json; charset=utf-8' if custom_headers: header_parameters.update(custom_headers) @@ -757,9 +768,8 @@ def match_url_input( body_content = self._serialize.body(image_url, 'BodyModel') # Construct and send request - request = self._client.post(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.APIErrorException(self._deserialize, response) @@ -774,6 +784,7 @@ def match_url_input( return client_raw_response return deserialized + match_url_input.metadata = {'url': '/contentmoderator/moderate/v1.0/ProcessImage/Match'} def match_file_input( self, image_stream, list_id=None, cache_image=None, custom_headers=None, raw=False, callback=None, **operation_config): @@ -811,9 +822,9 @@ def match_file_input( :class:`APIErrorException` """ # Construct URL - url = '/contentmoderator/moderate/v1.0/ProcessImage/Match' + url = self.match_file_input.metadata['url'] path_format_arguments = { - 'baseUrl': self._serialize.url("self.config.base_url_parameter", self.config.base_url_parameter, 'str', skip_quote=True) + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) @@ -826,6 +837,7 @@ def match_file_input( # Construct headers header_parameters = {} + header_parameters['Accept'] = 'application/json' header_parameters['Content-Type'] = 'image/gif' if custom_headers: header_parameters.update(custom_headers) @@ -834,9 +846,8 @@ def match_file_input( body_content = self._client.stream_upload(image_stream, callback) # Construct and send request - request = self._client.post(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.APIErrorException(self._deserialize, response) @@ -851,3 +862,4 @@ def match_file_input( return client_raw_response return deserialized + match_file_input.metadata = {'url': '/contentmoderator/moderate/v1.0/ProcessImage/Match'} diff --git a/azure-cognitiveservices-vision-contentmoderator/azure/cognitiveservices/vision/contentmoderator/operations/list_management_image_lists_operations.py b/azure-cognitiveservices-vision-contentmoderator/azure/cognitiveservices/vision/contentmoderator/operations/list_management_image_lists_operations.py index d5e4a2d64c5b..a893a43a0856 100644 --- a/azure-cognitiveservices-vision-contentmoderator/azure/cognitiveservices/vision/contentmoderator/operations/list_management_image_lists_operations.py +++ b/azure-cognitiveservices-vision-contentmoderator/azure/cognitiveservices/vision/contentmoderator/operations/list_management_image_lists_operations.py @@ -53,9 +53,9 @@ def get_details( :class:`APIErrorException` """ # Construct URL - url = '/contentmoderator/lists/v1.0/imagelists/{listId}' + url = self.get_details.metadata['url'] path_format_arguments = { - 'baseUrl': self._serialize.url("self.config.base_url_parameter", self.config.base_url_parameter, 'str', skip_quote=True), + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), 'listId': self._serialize.url("list_id", list_id, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -65,13 +65,13 @@ def get_details( # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + header_parameters['Accept'] = 'application/json' if custom_headers: header_parameters.update(custom_headers) # Construct and send request - request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.APIErrorException(self._deserialize, response) @@ -86,6 +86,7 @@ def get_details( return client_raw_response return deserialized + get_details.metadata = {'url': '/contentmoderator/lists/v1.0/imagelists/{listId}'} def delete( self, list_id, custom_headers=None, raw=False, **operation_config): @@ -104,9 +105,9 @@ def delete( :class:`APIErrorException` """ # Construct URL - url = '/contentmoderator/lists/v1.0/imagelists/{listId}' + url = self.delete.metadata['url'] path_format_arguments = { - 'baseUrl': self._serialize.url("self.config.base_url_parameter", self.config.base_url_parameter, 'str', skip_quote=True), + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), 'listId': self._serialize.url("list_id", list_id, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -116,13 +117,13 @@ def delete( # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + header_parameters['Accept'] = 'application/json' if custom_headers: header_parameters.update(custom_headers) # Construct and send request - request = self._client.delete(url, query_parameters) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.APIErrorException(self._deserialize, response) @@ -137,6 +138,7 @@ def delete( return client_raw_response return deserialized + delete.metadata = {'url': '/contentmoderator/lists/v1.0/imagelists/{listId}'} def update( self, list_id, content_type, body, custom_headers=None, raw=False, **operation_config): @@ -162,9 +164,9 @@ def update( :class:`APIErrorException` """ # Construct URL - url = '/contentmoderator/lists/v1.0/imagelists/{listId}' + url = self.update.metadata['url'] path_format_arguments = { - 'baseUrl': self._serialize.url("self.config.base_url_parameter", self.config.base_url_parameter, 'str', skip_quote=True), + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), 'listId': self._serialize.url("list_id", list_id, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -174,6 +176,7 @@ def update( # Construct headers header_parameters = {} + header_parameters['Accept'] = 'application/json' header_parameters['Content-Type'] = 'application/json; charset=utf-8' if custom_headers: header_parameters.update(custom_headers) @@ -183,9 +186,8 @@ def update( body_content = self._serialize.body(body, 'Body') # Construct and send request - request = self._client.put(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.APIErrorException(self._deserialize, response) @@ -200,6 +202,7 @@ def update( return client_raw_response return deserialized + update.metadata = {'url': '/contentmoderator/lists/v1.0/imagelists/{listId}'} def create( self, content_type, body, custom_headers=None, raw=False, **operation_config): @@ -223,9 +226,9 @@ def create( :class:`APIErrorException` """ # Construct URL - url = '/contentmoderator/lists/v1.0/imagelists' + url = self.create.metadata['url'] path_format_arguments = { - 'baseUrl': self._serialize.url("self.config.base_url_parameter", self.config.base_url_parameter, 'str', skip_quote=True) + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) @@ -234,6 +237,7 @@ def create( # Construct headers header_parameters = {} + header_parameters['Accept'] = 'application/json' header_parameters['Content-Type'] = 'application/json; charset=utf-8' if custom_headers: header_parameters.update(custom_headers) @@ -243,9 +247,8 @@ def create( body_content = self._serialize.body(body, 'Body') # Construct and send request - request = self._client.post(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.APIErrorException(self._deserialize, response) @@ -260,6 +263,7 @@ def create( return client_raw_response return deserialized + create.metadata = {'url': '/contentmoderator/lists/v1.0/imagelists'} def get_all_image_lists( self, custom_headers=None, raw=False, **operation_config): @@ -278,9 +282,9 @@ def get_all_image_lists( :class:`APIErrorException` """ # Construct URL - url = '/contentmoderator/lists/v1.0/imagelists' + url = self.get_all_image_lists.metadata['url'] path_format_arguments = { - 'baseUrl': self._serialize.url("self.config.base_url_parameter", self.config.base_url_parameter, 'str', skip_quote=True) + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) @@ -289,13 +293,13 @@ def get_all_image_lists( # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + header_parameters['Accept'] = 'application/json' if custom_headers: header_parameters.update(custom_headers) # Construct and send request - request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.APIErrorException(self._deserialize, response) @@ -310,6 +314,7 @@ def get_all_image_lists( return client_raw_response return deserialized + get_all_image_lists.metadata = {'url': '/contentmoderator/lists/v1.0/imagelists'} def refresh_index_method( self, list_id, custom_headers=None, raw=False, **operation_config): @@ -330,9 +335,9 @@ def refresh_index_method( :class:`APIErrorException` """ # Construct URL - url = '/contentmoderator/lists/v1.0/imagelists/{listId}/RefreshIndex' + url = self.refresh_index_method.metadata['url'] path_format_arguments = { - 'baseUrl': self._serialize.url("self.config.base_url_parameter", self.config.base_url_parameter, 'str', skip_quote=True), + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), 'listId': self._serialize.url("list_id", list_id, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -342,13 +347,13 @@ def refresh_index_method( # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + header_parameters['Accept'] = 'application/json' if custom_headers: header_parameters.update(custom_headers) # Construct and send request - request = self._client.post(url, query_parameters) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.APIErrorException(self._deserialize, response) @@ -363,3 +368,4 @@ def refresh_index_method( return client_raw_response return deserialized + refresh_index_method.metadata = {'url': '/contentmoderator/lists/v1.0/imagelists/{listId}/RefreshIndex'} diff --git a/azure-cognitiveservices-vision-contentmoderator/azure/cognitiveservices/vision/contentmoderator/operations/list_management_image_operations.py b/azure-cognitiveservices-vision-contentmoderator/azure/cognitiveservices/vision/contentmoderator/operations/list_management_image_operations.py index 4fc1454d266e..a203a2f79a75 100644 --- a/azure-cognitiveservices-vision-contentmoderator/azure/cognitiveservices/vision/contentmoderator/operations/list_management_image_operations.py +++ b/azure-cognitiveservices-vision-contentmoderator/azure/cognitiveservices/vision/contentmoderator/operations/list_management_image_operations.py @@ -55,9 +55,9 @@ def add_image( :class:`APIErrorException` """ # Construct URL - url = '/contentmoderator/lists/v1.0/imagelists/{listId}/images' + url = self.add_image.metadata['url'] path_format_arguments = { - 'baseUrl': self._serialize.url("self.config.base_url_parameter", self.config.base_url_parameter, 'str', skip_quote=True), + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), 'listId': self._serialize.url("list_id", list_id, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -71,13 +71,13 @@ def add_image( # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + header_parameters['Accept'] = 'application/json' if custom_headers: header_parameters.update(custom_headers) # Construct and send request - request = self._client.post(url, query_parameters) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.APIErrorException(self._deserialize, response) @@ -92,6 +92,7 @@ def add_image( return client_raw_response return deserialized + add_image.metadata = {'url': '/contentmoderator/lists/v1.0/imagelists/{listId}/images'} def delete_all_images( self, list_id, custom_headers=None, raw=False, **operation_config): @@ -110,9 +111,9 @@ def delete_all_images( :class:`APIErrorException` """ # Construct URL - url = '/contentmoderator/lists/v1.0/imagelists/{listId}/images' + url = self.delete_all_images.metadata['url'] path_format_arguments = { - 'baseUrl': self._serialize.url("self.config.base_url_parameter", self.config.base_url_parameter, 'str', skip_quote=True), + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), 'listId': self._serialize.url("list_id", list_id, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -122,13 +123,13 @@ def delete_all_images( # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + header_parameters['Accept'] = 'application/json' if custom_headers: header_parameters.update(custom_headers) # Construct and send request - request = self._client.delete(url, query_parameters) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.APIErrorException(self._deserialize, response) @@ -143,6 +144,7 @@ def delete_all_images( return client_raw_response return deserialized + delete_all_images.metadata = {'url': '/contentmoderator/lists/v1.0/imagelists/{listId}/images'} def get_all_image_ids( self, list_id, custom_headers=None, raw=False, **operation_config): @@ -163,9 +165,9 @@ def get_all_image_ids( :class:`APIErrorException` """ # Construct URL - url = '/contentmoderator/lists/v1.0/imagelists/{listId}/images' + url = self.get_all_image_ids.metadata['url'] path_format_arguments = { - 'baseUrl': self._serialize.url("self.config.base_url_parameter", self.config.base_url_parameter, 'str', skip_quote=True), + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), 'listId': self._serialize.url("list_id", list_id, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -175,13 +177,13 @@ def get_all_image_ids( # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + header_parameters['Accept'] = 'application/json' if custom_headers: header_parameters.update(custom_headers) # Construct and send request - request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.APIErrorException(self._deserialize, response) @@ -196,6 +198,7 @@ def get_all_image_ids( return client_raw_response return deserialized + get_all_image_ids.metadata = {'url': '/contentmoderator/lists/v1.0/imagelists/{listId}/images'} def delete_image( self, list_id, image_id, custom_headers=None, raw=False, **operation_config): @@ -216,9 +219,9 @@ def delete_image( :class:`APIErrorException` """ # Construct URL - url = '/contentmoderator/lists/v1.0/imagelists/{listId}/images/{ImageId}' + url = self.delete_image.metadata['url'] path_format_arguments = { - 'baseUrl': self._serialize.url("self.config.base_url_parameter", self.config.base_url_parameter, 'str', skip_quote=True), + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), 'listId': self._serialize.url("list_id", list_id, 'str'), 'ImageId': self._serialize.url("image_id", image_id, 'str') } @@ -229,13 +232,13 @@ def delete_image( # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + header_parameters['Accept'] = 'application/json' if custom_headers: header_parameters.update(custom_headers) # Construct and send request - request = self._client.delete(url, query_parameters) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.APIErrorException(self._deserialize, response) @@ -250,6 +253,7 @@ def delete_image( return client_raw_response return deserialized + delete_image.metadata = {'url': '/contentmoderator/lists/v1.0/imagelists/{listId}/images/{ImageId}'} def add_image_url_input( self, list_id, content_type, tag=None, label=None, data_representation="URL", value=None, custom_headers=None, raw=False, **operation_config): @@ -281,9 +285,9 @@ def add_image_url_input( image_url = models.BodyModel(data_representation=data_representation, value=value) # Construct URL - url = '/contentmoderator/lists/v1.0/imagelists/{listId}/images' + url = self.add_image_url_input.metadata['url'] path_format_arguments = { - 'baseUrl': self._serialize.url("self.config.base_url_parameter", self.config.base_url_parameter, 'str', skip_quote=True), + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), 'listId': self._serialize.url("list_id", list_id, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -297,6 +301,7 @@ def add_image_url_input( # Construct headers header_parameters = {} + header_parameters['Accept'] = 'application/json' header_parameters['Content-Type'] = 'application/json; charset=utf-8' if custom_headers: header_parameters.update(custom_headers) @@ -306,9 +311,8 @@ def add_image_url_input( body_content = self._serialize.body(image_url, 'BodyModel') # Construct and send request - request = self._client.post(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.APIErrorException(self._deserialize, response) @@ -323,6 +327,7 @@ def add_image_url_input( return client_raw_response return deserialized + add_image_url_input.metadata = {'url': '/contentmoderator/lists/v1.0/imagelists/{listId}/images'} def add_image_file_input( self, list_id, image_stream, tag=None, label=None, custom_headers=None, raw=False, callback=None, **operation_config): @@ -353,9 +358,9 @@ def add_image_file_input( :class:`APIErrorException` """ # Construct URL - url = '/contentmoderator/lists/v1.0/imagelists/{listId}/images' + url = self.add_image_file_input.metadata['url'] path_format_arguments = { - 'baseUrl': self._serialize.url("self.config.base_url_parameter", self.config.base_url_parameter, 'str', skip_quote=True), + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), 'listId': self._serialize.url("list_id", list_id, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -369,6 +374,7 @@ def add_image_file_input( # Construct headers header_parameters = {} + header_parameters['Accept'] = 'application/json' header_parameters['Content-Type'] = 'image/gif' if custom_headers: header_parameters.update(custom_headers) @@ -377,9 +383,8 @@ def add_image_file_input( body_content = self._client.stream_upload(image_stream, callback) # Construct and send request - request = self._client.post(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.APIErrorException(self._deserialize, response) @@ -394,3 +399,4 @@ def add_image_file_input( return client_raw_response return deserialized + add_image_file_input.metadata = {'url': '/contentmoderator/lists/v1.0/imagelists/{listId}/images'} diff --git a/azure-cognitiveservices-vision-contentmoderator/azure/cognitiveservices/vision/contentmoderator/operations/list_management_term_lists_operations.py b/azure-cognitiveservices-vision-contentmoderator/azure/cognitiveservices/vision/contentmoderator/operations/list_management_term_lists_operations.py index bdbb684f44aa..a55512a39948 100644 --- a/azure-cognitiveservices-vision-contentmoderator/azure/cognitiveservices/vision/contentmoderator/operations/list_management_term_lists_operations.py +++ b/azure-cognitiveservices-vision-contentmoderator/azure/cognitiveservices/vision/contentmoderator/operations/list_management_term_lists_operations.py @@ -53,9 +53,9 @@ def get_details( :class:`APIErrorException` """ # Construct URL - url = '/contentmoderator/lists/v1.0/termlists/{listId}' + url = self.get_details.metadata['url'] path_format_arguments = { - 'baseUrl': self._serialize.url("self.config.base_url_parameter", self.config.base_url_parameter, 'str', skip_quote=True), + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), 'listId': self._serialize.url("list_id", list_id, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -65,13 +65,13 @@ def get_details( # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + header_parameters['Accept'] = 'application/json' if custom_headers: header_parameters.update(custom_headers) # Construct and send request - request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.APIErrorException(self._deserialize, response) @@ -86,6 +86,7 @@ def get_details( return client_raw_response return deserialized + get_details.metadata = {'url': '/contentmoderator/lists/v1.0/termlists/{listId}'} def delete( self, list_id, custom_headers=None, raw=False, **operation_config): @@ -104,9 +105,9 @@ def delete( :class:`APIErrorException` """ # Construct URL - url = '/contentmoderator/lists/v1.0/termlists/{listId}' + url = self.delete.metadata['url'] path_format_arguments = { - 'baseUrl': self._serialize.url("self.config.base_url_parameter", self.config.base_url_parameter, 'str', skip_quote=True), + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), 'listId': self._serialize.url("list_id", list_id, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -116,13 +117,13 @@ def delete( # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + header_parameters['Accept'] = 'application/json' if custom_headers: header_parameters.update(custom_headers) # Construct and send request - request = self._client.delete(url, query_parameters) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.APIErrorException(self._deserialize, response) @@ -137,6 +138,7 @@ def delete( return client_raw_response return deserialized + delete.metadata = {'url': '/contentmoderator/lists/v1.0/termlists/{listId}'} def update( self, list_id, content_type, body, custom_headers=None, raw=False, **operation_config): @@ -162,9 +164,9 @@ def update( :class:`APIErrorException` """ # Construct URL - url = '/contentmoderator/lists/v1.0/termlists/{listId}' + url = self.update.metadata['url'] path_format_arguments = { - 'baseUrl': self._serialize.url("self.config.base_url_parameter", self.config.base_url_parameter, 'str', skip_quote=True), + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), 'listId': self._serialize.url("list_id", list_id, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -174,6 +176,7 @@ def update( # Construct headers header_parameters = {} + header_parameters['Accept'] = 'application/json' header_parameters['Content-Type'] = 'application/json; charset=utf-8' if custom_headers: header_parameters.update(custom_headers) @@ -183,9 +186,8 @@ def update( body_content = self._serialize.body(body, 'Body') # Construct and send request - request = self._client.put(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.APIErrorException(self._deserialize, response) @@ -200,6 +202,7 @@ def update( return client_raw_response return deserialized + update.metadata = {'url': '/contentmoderator/lists/v1.0/termlists/{listId}'} def create( self, content_type, body, custom_headers=None, raw=False, **operation_config): @@ -223,9 +226,9 @@ def create( :class:`APIErrorException` """ # Construct URL - url = '/contentmoderator/lists/v1.0/termlists' + url = self.create.metadata['url'] path_format_arguments = { - 'baseUrl': self._serialize.url("self.config.base_url_parameter", self.config.base_url_parameter, 'str', skip_quote=True) + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) @@ -234,6 +237,7 @@ def create( # Construct headers header_parameters = {} + header_parameters['Accept'] = 'application/json' header_parameters['Content-Type'] = 'application/json; charset=utf-8' if custom_headers: header_parameters.update(custom_headers) @@ -243,9 +247,8 @@ def create( body_content = self._serialize.body(body, 'Body') # Construct and send request - request = self._client.post(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.APIErrorException(self._deserialize, response) @@ -260,6 +263,7 @@ def create( return client_raw_response return deserialized + create.metadata = {'url': '/contentmoderator/lists/v1.0/termlists'} def get_all_term_lists( self, custom_headers=None, raw=False, **operation_config): @@ -278,9 +282,9 @@ def get_all_term_lists( :class:`APIErrorException` """ # Construct URL - url = '/contentmoderator/lists/v1.0/termlists' + url = self.get_all_term_lists.metadata['url'] path_format_arguments = { - 'baseUrl': self._serialize.url("self.config.base_url_parameter", self.config.base_url_parameter, 'str', skip_quote=True) + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) @@ -289,13 +293,13 @@ def get_all_term_lists( # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + header_parameters['Accept'] = 'application/json' if custom_headers: header_parameters.update(custom_headers) # Construct and send request - request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.APIErrorException(self._deserialize, response) @@ -310,6 +314,7 @@ def get_all_term_lists( return client_raw_response return deserialized + get_all_term_lists.metadata = {'url': '/contentmoderator/lists/v1.0/termlists'} def refresh_index_method( self, list_id, language, custom_headers=None, raw=False, **operation_config): @@ -332,9 +337,9 @@ def refresh_index_method( :class:`APIErrorException` """ # Construct URL - url = '/contentmoderator/lists/v1.0/termlists/{listId}/RefreshIndex' + url = self.refresh_index_method.metadata['url'] path_format_arguments = { - 'baseUrl': self._serialize.url("self.config.base_url_parameter", self.config.base_url_parameter, 'str', skip_quote=True), + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), 'listId': self._serialize.url("list_id", list_id, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -345,13 +350,13 @@ def refresh_index_method( # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + header_parameters['Accept'] = 'application/json' if custom_headers: header_parameters.update(custom_headers) # Construct and send request - request = self._client.post(url, query_parameters) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.APIErrorException(self._deserialize, response) @@ -366,3 +371,4 @@ def refresh_index_method( return client_raw_response return deserialized + refresh_index_method.metadata = {'url': '/contentmoderator/lists/v1.0/termlists/{listId}/RefreshIndex'} diff --git a/azure-cognitiveservices-vision-contentmoderator/azure/cognitiveservices/vision/contentmoderator/operations/list_management_term_operations.py b/azure-cognitiveservices-vision-contentmoderator/azure/cognitiveservices/vision/contentmoderator/operations/list_management_term_operations.py index bae3190cb9ad..706c43552f53 100644 --- a/azure-cognitiveservices-vision-contentmoderator/azure/cognitiveservices/vision/contentmoderator/operations/list_management_term_operations.py +++ b/azure-cognitiveservices-vision-contentmoderator/azure/cognitiveservices/vision/contentmoderator/operations/list_management_term_operations.py @@ -54,9 +54,9 @@ def add_term( :class:`APIErrorException` """ # Construct URL - url = '/contentmoderator/lists/v1.0/termlists/{listId}/terms/{term}' + url = self.add_term.metadata['url'] path_format_arguments = { - 'baseUrl': self._serialize.url("self.config.base_url_parameter", self.config.base_url_parameter, 'str', skip_quote=True), + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), 'listId': self._serialize.url("list_id", list_id, 'str'), 'term': self._serialize.url("term", term, 'str') } @@ -68,13 +68,13 @@ def add_term( # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + header_parameters['Accept'] = 'application/json' if custom_headers: header_parameters.update(custom_headers) # Construct and send request - request = self._client.post(url, query_parameters) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [201]: raise models.APIErrorException(self._deserialize, response) @@ -89,6 +89,7 @@ def add_term( return client_raw_response return deserialized + add_term.metadata = {'url': '/contentmoderator/lists/v1.0/termlists/{listId}/terms/{term}'} def delete_term( self, list_id, term, language, custom_headers=None, raw=False, **operation_config): @@ -111,9 +112,9 @@ def delete_term( :class:`APIErrorException` """ # Construct URL - url = '/contentmoderator/lists/v1.0/termlists/{listId}/terms/{term}' + url = self.delete_term.metadata['url'] path_format_arguments = { - 'baseUrl': self._serialize.url("self.config.base_url_parameter", self.config.base_url_parameter, 'str', skip_quote=True), + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), 'listId': self._serialize.url("list_id", list_id, 'str'), 'term': self._serialize.url("term", term, 'str') } @@ -125,13 +126,13 @@ def delete_term( # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + header_parameters['Accept'] = 'application/json' if custom_headers: header_parameters.update(custom_headers) # Construct and send request - request = self._client.delete(url, query_parameters) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [204]: raise models.APIErrorException(self._deserialize, response) @@ -146,6 +147,7 @@ def delete_term( return client_raw_response return deserialized + delete_term.metadata = {'url': '/contentmoderator/lists/v1.0/termlists/{listId}/terms/{term}'} def get_all_terms( self, list_id, language, offset=None, limit=None, custom_headers=None, raw=False, **operation_config): @@ -171,9 +173,9 @@ def get_all_terms( :class:`APIErrorException` """ # Construct URL - url = '/contentmoderator/lists/v1.0/termlists/{listId}/terms' + url = self.get_all_terms.metadata['url'] path_format_arguments = { - 'baseUrl': self._serialize.url("self.config.base_url_parameter", self.config.base_url_parameter, 'str', skip_quote=True), + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), 'listId': self._serialize.url("list_id", list_id, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -188,13 +190,13 @@ def get_all_terms( # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + header_parameters['Accept'] = 'application/json' if custom_headers: header_parameters.update(custom_headers) # Construct and send request - request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.APIErrorException(self._deserialize, response) @@ -209,6 +211,7 @@ def get_all_terms( return client_raw_response return deserialized + get_all_terms.metadata = {'url': '/contentmoderator/lists/v1.0/termlists/{listId}/terms'} def delete_all_terms( self, list_id, language, custom_headers=None, raw=False, **operation_config): @@ -230,9 +233,9 @@ def delete_all_terms( :class:`APIErrorException` """ # Construct URL - url = '/contentmoderator/lists/v1.0/termlists/{listId}/terms' + url = self.delete_all_terms.metadata['url'] path_format_arguments = { - 'baseUrl': self._serialize.url("self.config.base_url_parameter", self.config.base_url_parameter, 'str', skip_quote=True), + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), 'listId': self._serialize.url("list_id", list_id, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -243,13 +246,13 @@ def delete_all_terms( # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + header_parameters['Accept'] = 'application/json' if custom_headers: header_parameters.update(custom_headers) # Construct and send request - request = self._client.delete(url, query_parameters) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [204]: raise models.APIErrorException(self._deserialize, response) @@ -264,3 +267,4 @@ def delete_all_terms( return client_raw_response return deserialized + delete_all_terms.metadata = {'url': '/contentmoderator/lists/v1.0/termlists/{listId}/terms'} diff --git a/azure-cognitiveservices-vision-contentmoderator/azure/cognitiveservices/vision/contentmoderator/operations/reviews_operations.py b/azure-cognitiveservices-vision-contentmoderator/azure/cognitiveservices/vision/contentmoderator/operations/reviews_operations.py index 1b8fa5b960f3..ee2c968d9b99 100644 --- a/azure-cognitiveservices-vision-contentmoderator/azure/cognitiveservices/vision/contentmoderator/operations/reviews_operations.py +++ b/azure-cognitiveservices-vision-contentmoderator/azure/cognitiveservices/vision/contentmoderator/operations/reviews_operations.py @@ -55,9 +55,9 @@ def get_review( :class:`APIErrorException` """ # Construct URL - url = '/contentmoderator/review/v1.0/teams/{teamName}/reviews/{reviewId}' + url = self.get_review.metadata['url'] path_format_arguments = { - 'baseUrl': self._serialize.url("self.config.base_url_parameter", self.config.base_url_parameter, 'str', skip_quote=True), + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), 'teamName': self._serialize.url("team_name", team_name, 'str'), 'reviewId': self._serialize.url("review_id", review_id, 'str') } @@ -68,13 +68,13 @@ def get_review( # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + header_parameters['Accept'] = 'application/json' if custom_headers: header_parameters.update(custom_headers) # Construct and send request - request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.APIErrorException(self._deserialize, response) @@ -89,6 +89,7 @@ def get_review( return client_raw_response return deserialized + get_review.metadata = {'url': '/contentmoderator/review/v1.0/teams/{teamName}/reviews/{reviewId}'} def get_job_details( self, team_name, job_id, custom_headers=None, raw=False, **operation_config): @@ -110,9 +111,9 @@ def get_job_details( :class:`APIErrorException` """ # Construct URL - url = '/contentmoderator/review/v1.0/teams/{teamName}/jobs/{JobId}' + url = self.get_job_details.metadata['url'] path_format_arguments = { - 'baseUrl': self._serialize.url("self.config.base_url_parameter", self.config.base_url_parameter, 'str', skip_quote=True), + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), 'teamName': self._serialize.url("team_name", team_name, 'str'), 'JobId': self._serialize.url("job_id", job_id, 'str') } @@ -123,13 +124,13 @@ def get_job_details( # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + header_parameters['Accept'] = 'application/json' if custom_headers: header_parameters.update(custom_headers) # Construct and send request - request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.APIErrorException(self._deserialize, response) @@ -144,6 +145,7 @@ def get_job_details( return client_raw_response return deserialized + get_job_details.metadata = {'url': '/contentmoderator/review/v1.0/teams/{teamName}/jobs/{JobId}'} def create_reviews( self, url_content_type, team_name, create_review_body, sub_team=None, custom_headers=None, raw=False, **operation_config): @@ -193,9 +195,9 @@ def create_reviews( :class:`APIErrorException` """ # Construct URL - url = '/contentmoderator/review/v1.0/teams/{teamName}/reviews' + url = self.create_reviews.metadata['url'] path_format_arguments = { - 'baseUrl': self._serialize.url("self.config.base_url_parameter", self.config.base_url_parameter, 'str', skip_quote=True), + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), 'teamName': self._serialize.url("team_name", team_name, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -207,6 +209,7 @@ def create_reviews( # Construct headers header_parameters = {} + header_parameters['Accept'] = 'application/json' header_parameters['Content-Type'] = 'application/json; charset=utf-8' if custom_headers: header_parameters.update(custom_headers) @@ -216,9 +219,8 @@ def create_reviews( body_content = self._serialize.body(create_review_body, '[CreateReviewBodyItem]') # Construct and send request - request = self._client.post(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.APIErrorException(self._deserialize, response) @@ -233,6 +235,7 @@ def create_reviews( return client_raw_response return deserialized + create_reviews.metadata = {'url': '/contentmoderator/review/v1.0/teams/{teamName}/reviews'} def create_job( self, team_name, content_type, content_id, workflow_name, job_content_type, content_value, call_back_endpoint=None, custom_headers=None, raw=False, **operation_config): @@ -312,9 +315,9 @@ def create_job( content = models.Content(content_value=content_value) # Construct URL - url = '/contentmoderator/review/v1.0/teams/{teamName}/jobs' + url = self.create_job.metadata['url'] path_format_arguments = { - 'baseUrl': self._serialize.url("self.config.base_url_parameter", self.config.base_url_parameter, 'str', skip_quote=True), + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), 'teamName': self._serialize.url("team_name", team_name, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -329,6 +332,7 @@ def create_job( # Construct headers header_parameters = {} + header_parameters['Accept'] = 'application/json' header_parameters['Content-Type'] = 'application/json; charset=utf-8' if custom_headers: header_parameters.update(custom_headers) @@ -338,9 +342,8 @@ def create_job( body_content = self._serialize.body(content, 'Content') # Construct and send request - request = self._client.post(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.APIErrorException(self._deserialize, response) @@ -355,6 +358,7 @@ def create_job( return client_raw_response return deserialized + create_job.metadata = {'url': '/contentmoderator/review/v1.0/teams/{teamName}/jobs'} def add_video_frame( self, team_name, review_id, timescale=None, custom_headers=None, raw=False, **operation_config): @@ -400,9 +404,9 @@ def add_video_frame( :class:`APIErrorException` """ # Construct URL - url = '/contentmoderator/review/v1.0/teams/{teamName}/reviews/{reviewId}/frames' + url = self.add_video_frame.metadata['url'] path_format_arguments = { - 'baseUrl': self._serialize.url("self.config.base_url_parameter", self.config.base_url_parameter, 'str', skip_quote=True), + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), 'teamName': self._serialize.url("team_name", team_name, 'str'), 'reviewId': self._serialize.url("review_id", review_id, 'str') } @@ -415,13 +419,12 @@ def add_video_frame( # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' if custom_headers: header_parameters.update(custom_headers) # Construct and send request - request = self._client.post(url, query_parameters) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.APIErrorException(self._deserialize, response) @@ -429,6 +432,7 @@ def add_video_frame( if raw: client_raw_response = ClientRawResponse(None, response) return client_raw_response + add_video_frame.metadata = {'url': '/contentmoderator/review/v1.0/teams/{teamName}/reviews/{reviewId}/frames'} def get_video_frames( self, team_name, review_id, start_seed=None, no_of_records=None, filter=None, custom_headers=None, raw=False, **operation_config): @@ -480,9 +484,9 @@ def get_video_frames( :class:`APIErrorException` """ # Construct URL - url = '/contentmoderator/review/v1.0/teams/{teamName}/reviews/{reviewId}/frames' + url = self.get_video_frames.metadata['url'] path_format_arguments = { - 'baseUrl': self._serialize.url("self.config.base_url_parameter", self.config.base_url_parameter, 'str', skip_quote=True), + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), 'teamName': self._serialize.url("team_name", team_name, 'str'), 'reviewId': self._serialize.url("review_id", review_id, 'str') } @@ -499,13 +503,13 @@ def get_video_frames( # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + header_parameters['Accept'] = 'application/json' if custom_headers: header_parameters.update(custom_headers) # Construct and send request - request = self._client.get(url, query_parameters) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.APIErrorException(self._deserialize, response) @@ -520,6 +524,7 @@ def get_video_frames( return client_raw_response return deserialized + get_video_frames.metadata = {'url': '/contentmoderator/review/v1.0/teams/{teamName}/reviews/{reviewId}/frames'} def publish_video_review( self, team_name, review_id, custom_headers=None, raw=False, **operation_config): @@ -540,9 +545,9 @@ def publish_video_review( :class:`APIErrorException` """ # Construct URL - url = '/contentmoderator/review/v1.0/teams/{teamName}/reviews/{reviewId}/publish' + url = self.publish_video_review.metadata['url'] path_format_arguments = { - 'baseUrl': self._serialize.url("self.config.base_url_parameter", self.config.base_url_parameter, 'str', skip_quote=True), + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), 'teamName': self._serialize.url("team_name", team_name, 'str'), 'reviewId': self._serialize.url("review_id", review_id, 'str') } @@ -553,13 +558,12 @@ def publish_video_review( # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' if custom_headers: header_parameters.update(custom_headers) # Construct and send request - request = self._client.post(url, query_parameters) - response = self._client.send(request, header_parameters, stream=False, **operation_config) + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [204]: raise models.APIErrorException(self._deserialize, response) @@ -567,6 +571,7 @@ def publish_video_review( if raw: client_raw_response = ClientRawResponse(None, response) return client_raw_response + publish_video_review.metadata = {'url': '/contentmoderator/review/v1.0/teams/{teamName}/reviews/{reviewId}/publish'} def add_video_transcript_moderation_result( self, content_type, team_name, review_id, transcript_moderation_body, custom_headers=None, raw=False, **operation_config): @@ -596,9 +601,9 @@ def add_video_transcript_moderation_result( :class:`APIErrorException` """ # Construct URL - url = '/contentmoderator/review/v1.0/teams/{teamName}/reviews/{reviewId}/transcriptmoderationresult' + url = self.add_video_transcript_moderation_result.metadata['url'] path_format_arguments = { - 'baseUrl': self._serialize.url("self.config.base_url_parameter", self.config.base_url_parameter, 'str', skip_quote=True), + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), 'teamName': self._serialize.url("team_name", team_name, 'str'), 'reviewId': self._serialize.url("review_id", review_id, 'str') } @@ -618,9 +623,8 @@ def add_video_transcript_moderation_result( body_content = self._serialize.body(transcript_moderation_body, '[TranscriptModerationBodyItem]') # Construct and send request - request = self._client.put(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [204]: raise models.APIErrorException(self._deserialize, response) @@ -628,6 +632,7 @@ def add_video_transcript_moderation_result( if raw: client_raw_response = ClientRawResponse(None, response) return client_raw_response + add_video_transcript_moderation_result.metadata = {'url': '/contentmoderator/review/v1.0/teams/{teamName}/reviews/{reviewId}/transcriptmoderationresult'} def add_video_transcript( self, team_name, review_id, vt_tfile, custom_headers=None, raw=False, callback=None, **operation_config): @@ -657,9 +662,9 @@ def add_video_transcript( :class:`APIErrorException` """ # Construct URL - url = '/contentmoderator/review/v1.0/teams/{teamName}/reviews/{reviewId}/transcript' + url = self.add_video_transcript.metadata['url'] path_format_arguments = { - 'baseUrl': self._serialize.url("self.config.base_url_parameter", self.config.base_url_parameter, 'str', skip_quote=True), + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), 'teamName': self._serialize.url("team_name", team_name, 'str'), 'reviewId': self._serialize.url("review_id", review_id, 'str') } @@ -679,9 +684,8 @@ def add_video_transcript( body_content = self._client.stream_upload(vt_tfile, callback) # Construct and send request - request = self._client.put(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [204]: raise models.APIErrorException(self._deserialize, response) @@ -689,6 +693,7 @@ def add_video_transcript( if raw: client_raw_response = ClientRawResponse(None, response) return client_raw_response + add_video_transcript.metadata = {'url': '/contentmoderator/review/v1.0/teams/{teamName}/reviews/{reviewId}/transcript'} def create_video_reviews( self, content_type, team_name, create_video_reviews_body, sub_team=None, custom_headers=None, raw=False, **operation_config): @@ -738,9 +743,9 @@ def create_video_reviews( :class:`APIErrorException` """ # Construct URL - url = '/contentmoderator/review/v1.0/teams/{teamName}/reviews' + url = self.create_video_reviews.metadata['url'] path_format_arguments = { - 'baseUrl': self._serialize.url("self.config.base_url_parameter", self.config.base_url_parameter, 'str', skip_quote=True), + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), 'teamName': self._serialize.url("team_name", team_name, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -752,6 +757,7 @@ def create_video_reviews( # Construct headers header_parameters = {} + header_parameters['Accept'] = 'application/json' header_parameters['Content-Type'] = 'application/json; charset=utf-8' if custom_headers: header_parameters.update(custom_headers) @@ -761,9 +767,8 @@ def create_video_reviews( body_content = self._serialize.body(create_video_reviews_body, '[CreateVideoReviewsBodyItem]') # Construct and send request - request = self._client.post(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.APIErrorException(self._deserialize, response) @@ -778,6 +783,7 @@ def create_video_reviews( return client_raw_response return deserialized + create_video_reviews.metadata = {'url': '/contentmoderator/review/v1.0/teams/{teamName}/reviews'} def add_video_frame_url( self, content_type, team_name, review_id, video_frame_body, timescale=None, custom_headers=None, raw=False, **operation_config): @@ -809,9 +815,9 @@ def add_video_frame_url( :class:`APIErrorException` """ # Construct URL - url = '/contentmoderator/review/v1.0/teams/{teamName}/reviews/{reviewId}/frames' + url = self.add_video_frame_url.metadata['url'] path_format_arguments = { - 'baseUrl': self._serialize.url("self.config.base_url_parameter", self.config.base_url_parameter, 'str', skip_quote=True), + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), 'teamName': self._serialize.url("team_name", team_name, 'str'), 'reviewId': self._serialize.url("review_id", review_id, 'str') } @@ -833,9 +839,8 @@ def add_video_frame_url( body_content = self._serialize.body(video_frame_body, '[VideoFrameBodyItem]') # Construct and send request - request = self._client.post(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [204]: raise models.APIErrorException(self._deserialize, response) @@ -843,6 +848,7 @@ def add_video_frame_url( if raw: client_raw_response = ClientRawResponse(None, response) return client_raw_response + add_video_frame_url.metadata = {'url': '/contentmoderator/review/v1.0/teams/{teamName}/reviews/{reviewId}/frames'} def add_video_frame_stream( self, content_type, team_name, review_id, frame_image_zip, frame_metadata, timescale=None, custom_headers=None, raw=False, **operation_config): @@ -875,9 +881,9 @@ def add_video_frame_stream( :class:`APIErrorException` """ # Construct URL - url = '/contentmoderator/review/v1.0/teams/{teamName}/reviews/{reviewId}/frames' + url = self.add_video_frame_stream.metadata['url'] path_format_arguments = { - 'baseUrl': self._serialize.url("self.config.base_url_parameter", self.config.base_url_parameter, 'str', skip_quote=True), + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), 'teamName': self._serialize.url("team_name", team_name, 'str'), 'reviewId': self._serialize.url("review_id", review_id, 'str') } @@ -902,9 +908,8 @@ def add_video_frame_stream( } # Construct and send request - request = self._client.post(url, query_parameters) - response = self._client.send_formdata( - request, header_parameters, form_data_content, stream=False, **operation_config) + request = self._client.post(url, query_parameters, header_parameters, form_content=form_data_content) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [204]: raise models.APIErrorException(self._deserialize, response) @@ -912,3 +917,4 @@ def add_video_frame_stream( if raw: client_raw_response = ClientRawResponse(None, response) return client_raw_response + add_video_frame_stream.metadata = {'url': '/contentmoderator/review/v1.0/teams/{teamName}/reviews/{reviewId}/frames'} diff --git a/azure-cognitiveservices-vision-contentmoderator/azure/cognitiveservices/vision/contentmoderator/operations/text_moderation_operations.py b/azure-cognitiveservices-vision-contentmoderator/azure/cognitiveservices/vision/contentmoderator/operations/text_moderation_operations.py index 053f8ebd9268..baf744da1366 100644 --- a/azure-cognitiveservices-vision-contentmoderator/azure/cognitiveservices/vision/contentmoderator/operations/text_moderation_operations.py +++ b/azure-cognitiveservices-vision-contentmoderator/azure/cognitiveservices/vision/contentmoderator/operations/text_moderation_operations.py @@ -34,19 +34,19 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def screen_text( - self, language, text_content_type, text_content, autocorrect=False, pii=False, list_id=None, classify=False, custom_headers=None, raw=False, **operation_config): + self, text_content_type, text_content, language=None, autocorrect=False, pii=False, list_id=None, classify=False, custom_headers=None, raw=False, callback=None, **operation_config): """Detect profanity and match against custom and shared blacklists. Detects profanity in more than 100 languages and match against custom and shared blacklists. - :param language: Language of the terms. - :type language: str :param text_content_type: The content type. Possible values include: 'text/plain', 'text/html', 'text/xml', 'text/markdown' :type text_content_type: str :param text_content: Content to screen. - :type text_content: str + :type text_content: Generator + :param language: Language of the text. + :type language: str :param autocorrect: Autocorrect text. :type autocorrect: bool :param pii: Detect personal identifiable information. @@ -58,6 +58,11 @@ def screen_text( :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response + :param callback: When specified, will be called with each chunk of + data that is streamed. The callback should take two arguments, the + bytes of the current chunk of data and the response object. If the + data is uploading, response will be None. + :type callback: Callable[Bytes, response=None] :param operation_config: :ref:`Operation configuration overrides`. :return: Screen or ClientRawResponse if raw=true @@ -67,15 +72,16 @@ def screen_text( :class:`APIErrorException` """ # Construct URL - url = '/contentmoderator/moderate/v1.0/ProcessText/Screen/' + url = self.screen_text.metadata['url'] path_format_arguments = { - 'baseUrl': self._serialize.url("self.config.base_url_parameter", self.config.base_url_parameter, 'str', skip_quote=True) + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} - query_parameters['language'] = self._serialize.query("language", language, 'str') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') if autocorrect is not None: query_parameters['autocorrect'] = self._serialize.query("autocorrect", autocorrect, 'bool') if pii is not None: @@ -87,18 +93,18 @@ def screen_text( # Construct headers header_parameters = {} + header_parameters['Accept'] = 'application/json' header_parameters['Content-Type'] = 'text/plain' if custom_headers: header_parameters.update(custom_headers) header_parameters['Content-Type'] = self._serialize.header("text_content_type", text_content_type, 'str') # Construct body - body_content = self._serialize.body(text_content, 'str') + body_content = self._client.stream_upload(text_content, callback) # Construct and send request - request = self._client.post(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.APIErrorException(self._deserialize, response) @@ -113,9 +119,10 @@ def screen_text( return client_raw_response return deserialized + screen_text.metadata = {'url': '/contentmoderator/moderate/v1.0/ProcessText/Screen/'} def detect_language( - self, text_content_type, text_content, custom_headers=None, raw=False, **operation_config): + self, text_content_type, text_content, custom_headers=None, raw=False, callback=None, **operation_config): """This operation will detect the language of given input content. Returns the ISO 639-3 code for the predominant language comprising the submitted text. @@ -125,10 +132,15 @@ def detect_language( 'text/plain', 'text/html', 'text/xml', 'text/markdown' :type text_content_type: str :param text_content: Content to screen. - :type text_content: str + :type text_content: Generator :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response + :param callback: When specified, will be called with each chunk of + data that is streamed. The callback should take two arguments, the + bytes of the current chunk of data and the response object. If the + data is uploading, response will be None. + :type callback: Callable[Bytes, response=None] :param operation_config: :ref:`Operation configuration overrides`. :return: DetectedLanguage or ClientRawResponse if raw=true @@ -139,9 +151,9 @@ def detect_language( :class:`APIErrorException` """ # Construct URL - url = '/contentmoderator/moderate/v1.0/ProcessText/DetectLanguage' + url = self.detect_language.metadata['url'] path_format_arguments = { - 'baseUrl': self._serialize.url("self.config.base_url_parameter", self.config.base_url_parameter, 'str', skip_quote=True) + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) @@ -150,18 +162,18 @@ def detect_language( # Construct headers header_parameters = {} + header_parameters['Accept'] = 'application/json' header_parameters['Content-Type'] = 'text/plain' if custom_headers: header_parameters.update(custom_headers) header_parameters['Content-Type'] = self._serialize.header("text_content_type", text_content_type, 'str') # Construct body - body_content = self._serialize.body(text_content, 'str') + body_content = self._client.stream_upload(text_content, callback) # Construct and send request - request = self._client.post(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: raise models.APIErrorException(self._deserialize, response) @@ -176,3 +188,4 @@ def detect_language( return client_raw_response return deserialized + detect_language.metadata = {'url': '/contentmoderator/moderate/v1.0/ProcessText/DetectLanguage'} diff --git a/azure-cognitiveservices-vision-contentmoderator/azure/cognitiveservices/vision/contentmoderator/version.py b/azure-cognitiveservices-vision-contentmoderator/azure/cognitiveservices/vision/contentmoderator/version.py index c995f7836cef..e0ec669828cb 100644 --- a/azure-cognitiveservices-vision-contentmoderator/azure/cognitiveservices/vision/contentmoderator/version.py +++ b/azure-cognitiveservices-vision-contentmoderator/azure/cognitiveservices/vision/contentmoderator/version.py @@ -9,4 +9,5 @@ # regenerated. # -------------------------------------------------------------------------- -VERSION = "0.2.0" +VERSION = "0.1.0" +