Skip to content

Commit

Permalink
Generated from a480bbd7a62e78214034b6a9ab11c9bd5c1f9c30 (#2352)
Browse files Browse the repository at this point in the history
Add SSN parameter
  • Loading branch information
AutorestCI authored Apr 5, 2018
1 parent 341109b commit df13f52
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from .classification import Classification
from .status import Status
from .email import Email
from .ssn import SSN
from .ipa import IPA
from .phone import Phone
from .address import Address
Expand Down Expand Up @@ -84,6 +85,7 @@
'Classification',
'Status',
'Email',
'SSN',
'IPA',
'Phone',
'Address',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,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]
Expand All @@ -31,14 +34,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):
def __init__(self, email=None, ssn=None, ipa=None, phone=None, address=None):
super(PII, self).__init__()
self.email = email
self.ssn = ssn
self.ipa = ipa
self.phone = phone
self.address = address
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# 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 msrest.serialization import Model


class SSN(Model):
"""Detected SSN details.
: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 = {
'text': {'key': 'Text', 'type': 'str'},
'index': {'key': 'Index', 'type': 'int'},
}

def __init__(self, text=None, index=None):
super(SSN, self).__init__()
self.text = text
self.index = index
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ 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, language, text_content_type, text_content, 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
Expand All @@ -46,7 +46,7 @@ def screen_text(
'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 autocorrect: Autocorrect text.
:type autocorrect: bool
:param pii: Detect personal identifiable information.
Expand All @@ -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<msrest:optionsforoperations>`.
:return: Screen or ClientRawResponse if raw=true
Expand Down Expand Up @@ -93,7 +98,7 @@ def screen_text(
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)
Expand All @@ -116,7 +121,7 @@ def screen_text(
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 <a href="http://www-01.sil.org/iso639-3/codes.asp">ISO 639-3
code</a> for the predominant language comprising the submitted text.
Expand All @@ -126,10 +131,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<msrest:optionsforoperations>`.
:return: DetectedLanguage or ClientRawResponse if raw=true
Expand Down Expand Up @@ -157,7 +167,7 @@ def detect_language(
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)
Expand Down

0 comments on commit df13f52

Please sign in to comment.