Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AutoPR] cognitiveservices/data-plane/CustomImageSearch #2555

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions azure-cognitiveservices-search-customimagesearch/HISTORY.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.. :changelog:
Release History
===============

0.1.0 (2018-12-11)
++++++++++++++++++

* Initial Release
5 changes: 5 additions & 0 deletions azure-cognitiveservices-search-customimagesearch/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
include *.rst
include azure/__init__.py
include azure/cognitiveservices/__init__.py
include azure/cognitiveservices/search/__init__.py

43 changes: 43 additions & 0 deletions azure-cognitiveservices-search-customimagesearch/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
Microsoft Azure SDK for Python
==============================

This is the Microsoft Azure Cognitive Services Custom Image Search Client Library.

This package has been tested with Python 2.7, 3.4, 3.5, 3.6 and 3.7.

For a more complete set of Azure libraries, see the `azure <https://pypi.python.org/pypi/azure>`__ bundle package.


Compatibility
=============

**IMPORTANT**: If you have an earlier version of the azure package
(version < 1.0), you should uninstall it before installing this package.

You can check the version using pip:

.. code:: shell

pip freeze

If you see azure==0.11.0 (or any version below 1.0), uninstall it first:

.. code:: shell

pip uninstall azure


Usage
=====

For code examples, see `Cognitive Services Custom Image Search
<https://docs.microsoft.com/python/api/overview/azure/cognitive-services>`__
on docs.microsoft.com.


Provide Feedback
================

If you encounter any bugs or have suggestions, please file an issue in the
`Issues <https://github.com/Azure/azure-sdk-for-python/issues>`__
section of the project.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__path__ = __import__('pkgutil').extend_path(__path__, __name__)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__path__ = __import__('pkgutil').extend_path(__path__, __name__)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__path__ = __import__('pkgutil').extend_path(__path__, __name__)
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# 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 .custom_image_search_api import CustomImageSearchAPI
from .version import VERSION

__all__ = ['CustomImageSearchAPI']

__version__ = VERSION

Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# 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.service_client import SDKClient
from msrest import Configuration, Serializer, Deserializer
from .version import VERSION
from .operations.custom_instance_operations import CustomInstanceOperations
from . import models


class CustomImageSearchAPIConfiguration(Configuration):
"""Configuration for CustomImageSearchAPI
Note that all parameters used to create this instance are saved as instance
attributes.
:param credentials: Subscription credentials which uniquely identify
client subscription.
:type credentials: None
:param str base_url: Service URL
"""

def __init__(
self, credentials, base_url=None):

if credentials is None:
raise ValueError("Parameter 'credentials' must not be None.")
if not base_url:
base_url = 'https://api.cognitive.microsoft.com/bingcustomsearch/v7.0'

super(CustomImageSearchAPIConfiguration, self).__init__(base_url)

self.add_user_agent('azure-cognitiveservices-search-customimagesearch/{}'.format(VERSION))

self.credentials = credentials


class CustomImageSearchAPI(SDKClient):
"""The Bing Custom Image Search API lets you send an image search query to Bing and get back image search results customized to meet your custom search definition.
:ivar config: Configuration for client.
:vartype config: CustomImageSearchAPIConfiguration
:ivar custom_instance: CustomInstance operations
:vartype custom_instance: azure.cognitiveservices.search.customimagesearch.operations.CustomInstanceOperations
:param credentials: Subscription credentials which uniquely identify
client subscription.
:type credentials: None
:param str base_url: Service URL
"""

def __init__(
self, credentials, base_url=None):

self.config = CustomImageSearchAPIConfiguration(credentials, base_url)
super(CustomImageSearchAPI, 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'
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)

self.custom_instance = CustomInstanceOperations(
self._client, self.config, self._serialize, self._deserialize)
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# 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.
# --------------------------------------------------------------------------

try:
from .image_object_py3 import ImageObject
from .images_py3 import Images
from .search_results_answer_py3 import SearchResultsAnswer
from .query_py3 import Query
from .answer_py3 import Answer
from .media_object_py3 import MediaObject
from .response_py3 import Response
from .thing_py3 import Thing
from .creative_work_py3 import CreativeWork
from .identifiable_py3 import Identifiable
from .error_py3 import Error
from .error_response_py3 import ErrorResponse, ErrorResponseException
from .web_page_py3 import WebPage
from .response_base_py3 import ResponseBase
except (SyntaxError, ImportError):
from .image_object import ImageObject
from .images import Images
from .search_results_answer import SearchResultsAnswer
from .query import Query
from .answer import Answer
from .media_object import MediaObject
from .response import Response
from .thing import Thing
from .creative_work import CreativeWork
from .identifiable import Identifiable
from .error import Error
from .error_response import ErrorResponse, ErrorResponseException
from .web_page import WebPage
from .response_base import ResponseBase
from .custom_image_search_api_enums import (
ErrorCode,
ErrorSubCode,
ImageAspect,
ImageColor,
Freshness,
ImageContent,
ImageType,
ImageLicense,
SafeSearch,
ImageSize,
)

__all__ = [
'ImageObject',
'Images',
'SearchResultsAnswer',
'Query',
'Answer',
'MediaObject',
'Response',
'Thing',
'CreativeWork',
'Identifiable',
'Error',
'ErrorResponse', 'ErrorResponseException',
'WebPage',
'ResponseBase',
'ErrorCode',
'ErrorSubCode',
'ImageAspect',
'ImageColor',
'Freshness',
'ImageContent',
'ImageType',
'ImageLicense',
'SafeSearch',
'ImageSize',
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# 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 .response import Response


class Answer(Response):
"""Defines an answer.
You probably want to use the sub-classes and not this class directly. Known
sub-classes are: SearchResultsAnswer
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 _type: Required. Constant filled by server.
:type _type: str
:ivar id: A String identifier.
:vartype id: str
:ivar read_link: The URL that returns this resource.
:vartype read_link: str
:ivar web_search_url: The URL To Bing's search result for this item.
:vartype web_search_url: str
"""

_validation = {
'_type': {'required': True},
'id': {'readonly': True},
'read_link': {'readonly': True},
'web_search_url': {'readonly': True},
}

_attribute_map = {
'_type': {'key': '_type', 'type': 'str'},
'id': {'key': 'id', 'type': 'str'},
'read_link': {'key': 'readLink', 'type': 'str'},
'web_search_url': {'key': 'webSearchUrl', 'type': 'str'},
}

_subtype_map = {
'_type': {'SearchResultsAnswer': 'SearchResultsAnswer'}
}

def __init__(self, **kwargs):
super(Answer, self).__init__(**kwargs)
self._type = 'Answer'
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# 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 .response import Response


class Answer(Response):
"""Defines an answer.
You probably want to use the sub-classes and not this class directly. Known
sub-classes are: SearchResultsAnswer
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 _type: Required. Constant filled by server.
:type _type: str
:ivar id: A String identifier.
:vartype id: str
:ivar read_link: The URL that returns this resource.
:vartype read_link: str
:ivar web_search_url: The URL To Bing's search result for this item.
:vartype web_search_url: str
"""

_validation = {
'_type': {'required': True},
'id': {'readonly': True},
'read_link': {'readonly': True},
'web_search_url': {'readonly': True},
}

_attribute_map = {
'_type': {'key': '_type', 'type': 'str'},
'id': {'key': 'id', 'type': 'str'},
'read_link': {'key': 'readLink', 'type': 'str'},
'web_search_url': {'key': 'webSearchUrl', 'type': 'str'},
}

_subtype_map = {
'_type': {'SearchResultsAnswer': 'SearchResultsAnswer'}
}

def __init__(self, **kwargs) -> None:
super(Answer, self).__init__(**kwargs)
self._type = 'Answer'
Loading