Skip to content

Commit

Permalink
Add bot service sdk to support microsoft.botservice (Azure#2328)
Browse files Browse the repository at this point in the history
* first commit of swagger and tests

* rename test files as per convention

* regenrate recordings

* ran crud tests

* test email and teams channels

* skype and telegram

* add sms channel test

* add directline and webchat tests (Failing)

* Add resource preparer for crud bots

* final email channel

* final tests

* new line after setup.cfg

* fix failing tests python>3.6

* add cookie cutter template

* address comments
  • Loading branch information
swagatmishra2007 authored and lmazuel committed Apr 3, 2018
1 parent e5cd190 commit e49cf5e
Show file tree
Hide file tree
Showing 64 changed files with 5,121 additions and 0 deletions.
9 changes: 9 additions & 0 deletions azure-mgmt-botservice/HISTORY.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.. :changelog:
Release History
===============

0.1.0 (1970-01-01)
++++++++++++++++++

* Initial Release
2 changes: 2 additions & 0 deletions azure-mgmt-botservice/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
include *.rst
include azure_bdist_wheel.py
49 changes: 49 additions & 0 deletions azure-mgmt-botservice/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
Microsoft Azure SDK for Python
==============================

This is the Microsoft Azure Bot Service Client Library.

Azure Resource Manager (ARM) is the next generation of management APIs that
replace the old Azure Service Management (ASM).

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

For the older Azure Service Management (ASM) libraries, see
`azure-servicemanagement-legacy <https://pypi.python.org/pypi/azure-servicemanagement-legacy>`__ library.

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 `Bot Service
<https://docs.microsoft.com/python/azure/>`__
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.
1 change: 1 addition & 0 deletions azure-mgmt-botservice/azure/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__import__('pkg_resources').declare_namespace(__name__)
1 change: 1 addition & 0 deletions azure-mgmt-botservice/azure/mgmt/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__import__('pkg_resources').declare_namespace(__name__)
18 changes: 18 additions & 0 deletions azure-mgmt-botservice/azure/mgmt/botservice/__init__.py
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 .azure_bot_service import AzureBotService
from .version import VERSION

__all__ = ['AzureBotService']

__version__ = VERSION

96 changes: 96 additions & 0 deletions azure-mgmt-botservice/azure/mgmt/botservice/azure_bot_service.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# 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 ServiceClient
from msrest import Serializer, Deserializer
from msrestazure import AzureConfiguration
from .version import VERSION
from .operations.bots_operations import BotsOperations
from .operations.bot_services_operations import BotServicesOperations
from .operations.channels_operations import ChannelsOperations
from .operations.operations import Operations
from . import models


class AzureBotServiceConfiguration(AzureConfiguration):
"""Configuration for AzureBotService
Note that all parameters used to create this instance are saved as instance
attributes.
:param credentials: Credentials needed for the client to connect to Azure.
:type credentials: :mod:`A msrestazure Credentials
object<msrestazure.azure_active_directory>`
:param subscription_id: Azure Subscription ID.
:type subscription_id: str
:param str base_url: Service URL
"""

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

if credentials is None:
raise ValueError("Parameter 'credentials' must not be None.")
if subscription_id is None:
raise ValueError("Parameter 'subscription_id' must not be None.")
if not base_url:
base_url = 'https://management.azure.com'

super(AzureBotServiceConfiguration, self).__init__(base_url)

self.add_user_agent('azure-mgmt-botservice/{}'.format(VERSION))
self.add_user_agent('Azure-SDK-For-Python')

self.credentials = credentials
self.subscription_id = subscription_id


class AzureBotService(object):
"""Azure Bot Service is a platform for creating smart conversational agents.
:ivar config: Configuration for client.
:vartype config: AzureBotServiceConfiguration
:ivar bots: Bots operations
:vartype bots: azure.mgmt.botservice.operations.BotsOperations
:ivar bot_services: BotServices operations
:vartype bot_services: azure.mgmt.botservice.operations.BotServicesOperations
:ivar channels: Channels operations
:vartype channels: azure.mgmt.botservice.operations.ChannelsOperations
:ivar operations: Operations operations
:vartype operations: azure.mgmt.botservice.operations.Operations
:param credentials: Credentials needed for the client to connect to Azure.
:type credentials: :mod:`A msrestazure Credentials
object<msrestazure.azure_active_directory>`
:param subscription_id: Azure Subscription ID.
:type subscription_id: str
:param str base_url: Service URL
"""

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

self.config = AzureBotServiceConfiguration(credentials, subscription_id, base_url)
self._client = ServiceClient(self.config.credentials, self.config)

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self.api_version = '2017-12-01'
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)

self.bots = BotsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.bot_services = BotServicesOperations(
self._client, self.config, self._serialize, self._deserialize)
self.channels = ChannelsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.operations = Operations(
self._client, self.config, self._serialize, self._deserialize)
98 changes: 98 additions & 0 deletions azure-mgmt-botservice/azure/mgmt/botservice/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# 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 .sku import Sku
from .resource import Resource
from .bot_properties import BotProperties
from .bot import Bot
from .channel import Channel
from .bot_channel import BotChannel
from .facebook_channel_properties import FacebookChannelProperties
from .facebook_channel import FacebookChannel
from .email_channel_properties import EmailChannelProperties
from .email_channel import EmailChannel
from .ms_teams_channel_properties import MsTeamsChannelProperties
from .ms_teams_channel import MsTeamsChannel
from .skype_channel_properties import SkypeChannelProperties
from .skype_channel import SkypeChannel
from .kik_channel_properties import KikChannelProperties
from .kik_channel import KikChannel
from .web_chat_site import WebChatSite
from .web_chat_channel_properties import WebChatChannelProperties
from .web_chat_channel import WebChatChannel
from .direct_line_site import DirectLineSite
from .direct_line_channel_properties import DirectLineChannelProperties
from .direct_line_channel import DirectLineChannel
from .telegram_channel_properties import TelegramChannelProperties
from .telegram_channel import TelegramChannel
from .sms_channel_properties import SmsChannelProperties
from .sms_channel import SmsChannel
from .slack_channel_properties import SlackChannelProperties
from .slack_channel import SlackChannel
from .error_body import ErrorBody
from .error import Error, ErrorException
from .operation_display_info import OperationDisplayInfo
from .operation_entity import OperationEntity
from .check_name_availability_request_body import CheckNameAvailabilityRequestBody
from .check_name_availability_response_body import CheckNameAvailabilityResponseBody
from .bot_paged import BotPaged
from .bot_channel_paged import BotChannelPaged
from .operation_entity_paged import OperationEntityPaged
from .azure_bot_service_enums import (
SkuName,
SkuTier,
Kind,
ChannelName,
)

__all__ = [
'Sku',
'Resource',
'BotProperties',
'Bot',
'Channel',
'BotChannel',
'FacebookChannelProperties',
'FacebookChannel',
'EmailChannelProperties',
'EmailChannel',
'MsTeamsChannelProperties',
'MsTeamsChannel',
'SkypeChannelProperties',
'SkypeChannel',
'KikChannelProperties',
'KikChannel',
'WebChatSite',
'WebChatChannelProperties',
'WebChatChannel',
'DirectLineSite',
'DirectLineChannelProperties',
'DirectLineChannel',
'TelegramChannelProperties',
'TelegramChannel',
'SmsChannelProperties',
'SmsChannel',
'SlackChannelProperties',
'SlackChannel',
'ErrorBody',
'Error', 'ErrorException',
'OperationDisplayInfo',
'OperationEntity',
'CheckNameAvailabilityRequestBody',
'CheckNameAvailabilityResponseBody',
'BotPaged',
'BotChannelPaged',
'OperationEntityPaged',
'SkuName',
'SkuTier',
'Kind',
'ChannelName',
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# 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 SkuName(Enum):

f0 = "F0"
s1 = "S1"


class SkuTier(Enum):

free = "Free"
standard = "Standard"


class Kind(Enum):

sdk = "sdk"
designer = "designer"
bot = "bot"
function = "function"


class ChannelName(Enum):

facebook_channel = "FacebookChannel"
email_channel = "EmailChannel"
62 changes: 62 additions & 0 deletions azure-mgmt-botservice/azure/mgmt/botservice/models/bot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# 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 .resource import Resource


class Bot(Resource):
"""Bot resource definition.
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar id: Specifies the resource ID.
:vartype id: str
:ivar name: Specifies the name of the resource.
:vartype name: str
:param location: Specifies the location of the resource.
:type location: str
:ivar type: Specifies the type of the resource.
:vartype type: str
:param tags: Contains resource tags defined as key/value pairs.
:type tags: dict[str, str]
:param sku: Gets or sets the SKU of the resource.
:type sku: ~azure.mgmt.botservice.models.Sku
:param kind: Required. Gets or sets the Kind of the resource. Possible
values include: 'sdk', 'designer', 'bot', 'function'
:type kind: str or ~azure.mgmt.botservice.models.Kind
:param etag: Entity Tag
:type etag: str
:param properties: The set of properties specific to bot resource
:type properties: ~azure.mgmt.botservice.models.BotProperties
"""

_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
}

_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'location': {'key': 'location', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'tags': {'key': 'tags', 'type': '{str}'},
'sku': {'key': 'sku', 'type': 'Sku'},
'kind': {'key': 'kind', 'type': 'str'},
'etag': {'key': 'etag', 'type': 'str'},
'properties': {'key': 'properties', 'type': 'BotProperties'},
}

def __init__(self, location=None, tags=None, sku=None, kind=None, etag=None, properties=None):
super(Bot, self).__init__(location=location, tags=tags, sku=sku, kind=kind, etag=etag)
self.properties = properties
Loading

0 comments on commit e49cf5e

Please sign in to comment.