Skip to content

Commit

Permalink
updated pythonsdk for new swagger api-version for botservice (#3073)
Browse files Browse the repository at this point in the history
* add newly generated python sdk

* added tests for sdk changes

* generated sdk with latest autorest

* generated sdk with autorest.python=3.x and fixed tests

* BotService packagin
  • Loading branch information
swagatmishra2007 authored and lmazuel committed Aug 7, 2018
1 parent 4a62ff7 commit a73e7e6
Show file tree
Hide file tree
Showing 113 changed files with 4,730 additions and 1,118 deletions.
2 changes: 1 addition & 1 deletion azure-mgmt-botservice/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Release History
===============

0.1.0 (1970-01-01)
0.1.0 (2018-08-07)
++++++++++++++++++

* Initial Release
4 changes: 2 additions & 2 deletions azure-mgmt-botservice/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ 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.
This package has been tested with Python 2.7, 3.4, 3.5, 3.6 and 3.7.

For the older Azure Service Management (ASM) libraries, see
`azure-servicemanagement-legacy <https://pypi.python.org/pypi/azure-servicemanagement-legacy>`__ library.
Expand Down Expand Up @@ -37,7 +37,7 @@ Usage
=====

For code examples, see `Bot Service
<https://docs.microsoft.com/python/azure/>`__
<https://docs.microsoft.com/python/api/overview/azure/>`__
on docs.microsoft.com.


Expand Down
18 changes: 9 additions & 9 deletions azure-mgmt-botservice/azure/mgmt/botservice/azure_bot_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
# regenerated.
# --------------------------------------------------------------------------

from msrest.service_client import ServiceClient
from msrest.service_client import SDKClient
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 .operations.bot_connection_operations import BotConnectionOperations
from . import models


Expand Down Expand Up @@ -52,20 +52,20 @@ def __init__(
self.subscription_id = subscription_id


class AzureBotService(object):
class AzureBotService(SDKClient):
"""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
:ivar bot_connection: BotConnection operations
:vartype bot_connection: azure.mgmt.botservice.operations.BotConnectionOperations
:param credentials: Credentials needed for the client to connect to Azure.
:type credentials: :mod:`A msrestazure Credentials
Expand All @@ -79,18 +79,18 @@ 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)
super(AzureBotService, 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 = '2017-12-01'
self.api_version = '2018-07-12'
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)
self.bot_connection = BotConnectionOperations(
self._client, self.config, self._serialize, self._deserialize)
133 changes: 99 additions & 34 deletions azure-mgmt-botservice/azure/mgmt/botservice/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,43 +9,98 @@
# 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
try:
from .sku_py3 import Sku
from .resource_py3 import Resource
from .bot_properties_py3 import BotProperties
from .bot_py3 import Bot
from .channel_py3 import Channel
from .bot_channel_py3 import BotChannel
from .facebook_page_py3 import FacebookPage
from .facebook_channel_properties_py3 import FacebookChannelProperties
from .facebook_channel_py3 import FacebookChannel
from .email_channel_properties_py3 import EmailChannelProperties
from .email_channel_py3 import EmailChannel
from .ms_teams_channel_properties_py3 import MsTeamsChannelProperties
from .ms_teams_channel_py3 import MsTeamsChannel
from .skype_channel_properties_py3 import SkypeChannelProperties
from .skype_channel_py3 import SkypeChannel
from .kik_channel_properties_py3 import KikChannelProperties
from .kik_channel_py3 import KikChannel
from .web_chat_site_py3 import WebChatSite
from .web_chat_channel_properties_py3 import WebChatChannelProperties
from .web_chat_channel_py3 import WebChatChannel
from .direct_line_site_py3 import DirectLineSite
from .direct_line_channel_properties_py3 import DirectLineChannelProperties
from .direct_line_channel_py3 import DirectLineChannel
from .telegram_channel_properties_py3 import TelegramChannelProperties
from .telegram_channel_py3 import TelegramChannel
from .sms_channel_properties_py3 import SmsChannelProperties
from .sms_channel_py3 import SmsChannel
from .slack_channel_properties_py3 import SlackChannelProperties
from .slack_channel_py3 import SlackChannel
from .connection_item_name_py3 import ConnectionItemName
from .connection_setting_parameter_py3 import ConnectionSettingParameter
from .connection_setting_properties_py3 import ConnectionSettingProperties
from .connection_setting_py3 import ConnectionSetting
from .service_provider_parameter_py3 import ServiceProviderParameter
from .service_provider_properties_py3 import ServiceProviderProperties
from .service_provider_py3 import ServiceProvider
from .service_provider_response_list_py3 import ServiceProviderResponseList
from .error_body_py3 import ErrorBody
from .error_py3 import Error, ErrorException
from .operation_display_info_py3 import OperationDisplayInfo
from .operation_entity_py3 import OperationEntity
from .check_name_availability_request_body_py3 import CheckNameAvailabilityRequestBody
from .check_name_availability_response_body_py3 import CheckNameAvailabilityResponseBody
except (SyntaxError, ImportError):
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_page import FacebookPage
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 .connection_item_name import ConnectionItemName
from .connection_setting_parameter import ConnectionSettingParameter
from .connection_setting_properties import ConnectionSettingProperties
from .connection_setting import ConnectionSetting
from .service_provider_parameter import ServiceProviderParameter
from .service_provider_properties import ServiceProviderProperties
from .service_provider import ServiceProvider
from .service_provider_response_list import ServiceProviderResponseList
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 .connection_setting_paged import ConnectionSettingPaged
from .azure_bot_service_enums import (
SkuName,
SkuTier,
Expand All @@ -60,6 +115,7 @@
'Bot',
'Channel',
'BotChannel',
'FacebookPage',
'FacebookChannelProperties',
'FacebookChannel',
'EmailChannelProperties',
Expand All @@ -82,6 +138,14 @@
'SmsChannel',
'SlackChannelProperties',
'SlackChannel',
'ConnectionItemName',
'ConnectionSettingParameter',
'ConnectionSettingProperties',
'ConnectionSetting',
'ServiceProviderParameter',
'ServiceProviderProperties',
'ServiceProvider',
'ServiceProviderResponseList',
'ErrorBody',
'Error', 'ErrorException',
'OperationDisplayInfo',
Expand All @@ -91,6 +155,7 @@
'BotPaged',
'BotChannelPaged',
'OperationEntityPaged',
'ConnectionSettingPaged',
'SkuName',
'SkuTier',
'Kind',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,35 @@
from enum import Enum


class SkuName(Enum):
class SkuName(str, Enum):

f0 = "F0"
s1 = "S1"


class SkuTier(Enum):
class SkuTier(str, Enum):

free = "Free"
standard = "Standard"


class Kind(Enum):
class Kind(str, Enum):

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


class ChannelName(Enum):
class ChannelName(str, Enum):

facebook_channel = "FacebookChannel"
email_channel = "EmailChannel"
kik_channel = "KikChannel"
telegram_channel = "TelegramChannel"
slack_channel = "SlackChannel"
ms_teams_channel = "MsTeamsChannel"
skype_channel = "SkypeChannel"
web_chat_channel = "WebChatChannel"
direct_line_channel = "DirectLineChannel"
sms_channel = "SmsChannel"
6 changes: 3 additions & 3 deletions azure-mgmt-botservice/azure/mgmt/botservice/models/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,6 @@ class Bot(Resource):
'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
def __init__(self, **kwargs):
super(Bot, self).__init__(**kwargs)
self.properties = kwargs.get('properties', None)
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,6 @@ class BotChannel(Resource):
'properties': {'key': 'properties', 'type': 'Channel'},
}

def __init__(self, location=None, tags=None, sku=None, kind=None, etag=None, properties=None):
super(BotChannel, self).__init__(location=location, tags=tags, sku=sku, kind=kind, etag=etag)
self.properties = properties
def __init__(self, **kwargs):
super(BotChannel, self).__init__(**kwargs)
self.properties = kwargs.get('properties', None)
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_py3 import Resource


class BotChannel(Resource):
"""Bot channel 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 channel resource
:type properties: ~azure.mgmt.botservice.models.Channel
"""

_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': 'Channel'},
}

def __init__(self, *, location: str=None, tags=None, sku=None, kind=None, etag: str=None, properties=None, **kwargs) -> None:
super(BotChannel, self).__init__(location=location, tags=tags, sku=sku, kind=kind, etag=etag, **kwargs)
self.properties = properties
Loading

0 comments on commit a73e7e6

Please sign in to comment.