8000 adding connector · ericmicrofocus/botbuilder-python@55aa761 · GitHub
[go: up one dir, main page]

Skip to content

Commit 55aa761

Browse files
committed
adding connector
1 parent 1337b93 commit 55aa761

File tree

5 files changed

+274
-0
lines changed

5 files changed

+274
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for
5+
# license information.
6+
#
7+
# Code generated by Microsoft (R) AutoRest Code Generator.
< 10000 code>8+
# Changes may cause incorrect behavior and will be lost if the code is
9+
# regenerated.
10+
# --------------------------------------------------------------------------
11+
12+
from .teams_connector_client import TeamsConnectorClient
13+
from .version import VERSION
14+
15+
__all__ = ["TeamsConnectorClient"]
16+
17+
__version__ = VERSION
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for
5+
# license information.
6+
#
7+
# Code generated by Microsoft (R) AutoRest Code Generator.
8+
# Changes may cause incorrect behavior and will be lost if the code is
9+
# regenerated.
10+
# --------------------------------------------------------------------------
11+
12+
from .teams_operations import TeamsOperations
13+
14+
__all__ = [
15+
"TeamsOperations",
16+
]
Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for
5+
# license information.
6+
#
7+
# Code generated by Microsoft (R) AutoRest Code Generator.
8+
# Changes may cause incorrect behavior and will be lost if the code is
9+
# regenerated.
10+
# --------------------------------------------------------------------------
11+
12+
from msrest.pipeline import ClientRawResponse
13+
from msrest.exceptions import HttpOperationError
14+
15+
from .. import models
16+
17+
18+
class TeamsOperations(object):
19+
"""TeamsOperations operations.
20+
21+
:param client: Client for service requests.
22+
:param config: Configuration of service client.
23+
:param serializer: An object model serializer.
24+
:param deserializer: An object model deserializer.
25+
"""
26+
27+
models = models
28+
29+
def __init__(self, client, config, serializer, deserializer):
30+
31+
self._client = client
32+
self._serialize = serializer
33+
self._deserialize = deserializer
34+
35+
self.config = config
36+
37+
def fetch_channel_list(
38+
self, team_id, custom_headers=None, raw=False, **operation_config
39+
):
40+
"""Fetches channel list for a given team.
41+
42+
Fetch the channel list.
43+
44+
:param team_id: Team Id
45+
:type team_id: str
46+
:param dict custom_headers: headers that will be added to the request
47+
:param bool raw: returns the direct response alongside the
48+
deserialized response
49+
:param operation_config: :ref:`Operation configuration
50+
overrides<msrest:optionsforoperations>`.
51+
:return: ConversationList or ClientRawResponse if raw=true
52+
:rtype: ~botframework.connector.teams.models.ConversationList or
53+
~msrest.pipeline.ClientRawResponse
54+
:raises:
55+
:class:`HttpOperationError<msrest.exceptions.HttpOperationError>`
56+
"""
57+
# Construct URL
58+
url = self.fetch_channel_list.metadata["url"]
59+
path_format_arguments = {
60+
"teamId": self._serialize.url("team_id", team_id, "str")
61+
}
62+
url = self._client.format_url(url, **path_format_arguments)
63+
64+
# Construct parameters
65+
query_parameters = {}
66+
67+
# Construct headers
68+
header_parameters = {}
69+
header_parameters["Accept"] = "application/json"
70+
if custom_headers:
71+
header_parameters.update(custom_headers)
72+
73+
# Construct and send request
74+
request = self._client.get(url, query_parameters, header_parameters)
75+
response = self._client.send(request, stream=False, **operation_config)
76+
77+
if response.status_code not in [200]:
78+
raise HttpOperationError(self._deserialize, response)
79+
80+
deserialized = None
81+
82+
if response.status_code == 200:
83+
deserialized = self._deserialize("ConversationList", response)
84+
85+
if raw:
86+
client_raw_response = ClientRawResponse(deserialized, response)
87+
return client_raw_response
88+
89+
return deserialized
90+
91+
fetch_channel_list.metadata = {"url": "/v3/teams/{teamId}/conversations"}
92+
93+
def fetch_team_details(
94+
self, team_id, custom_headers=None, raw=False, **operation_config
95+
):
96+
"""Fetches details related to a team.
97+
98+
Fetch details for a team.
99+
100+
:param team_id: Team Id
101+
:type team_id: str
102+
:param dict custom_headers: headers that will be added to the request
103+
:param bool raw: returns the direct response alongside the
104+
deserialized response
105+
:param operation_config: :ref:`Operation configuration
106+
overrides<msrest:optionsforoperations>`.
107+
:return: TeamDetails or ClientRawResponse if raw=true
108+
:rtype: ~botframework.connector.teams.models.TeamDetails or
109+
~msrest.pipeline.ClientRawResponse
110+
:raises:
111+
:class:`HttpOperationError<msrest.exceptions.HttpOperationError>`
112+
"""
113+
# Construct URL
114+
url = self.fetch_team_details.metadata["url"]
115+
path_format_arguments = {
116+
"teamId": self._serialize.url("team_id", team_id, "str")
117+
}
118+
url = self._client.format_url(url, **path_format_arguments)
119+
120+
# Construct parameters
121+
query_parameters = {}
122+
123+
# Construct headers
124+
header_parameters = {}
125+
header_parameters["Accept"] = "application/json"
126+
if custom_headers:
127+
header_parameters.update(custom_headers)
128+
129+
# Construct and send request
130+
request = self._client.get(url, query_parameters, header_parameters)
131+
response = self._client.send(request, stream=False, **operation_config)
132+
133+
if response.status_code not in [200]:
134+
raise HttpOperationError(self._deserialize, response)
135+
136+
deserialized = None
137+
138+
if response.status_code == 200:
139+
deserialized = self._deserialize("TeamDetails", response)
140+
141+
if raw:
142+
client_raw_response = ClientRawResponse(deserialized, response)
143+
return client_raw_response
144+
145+
return deserialized
146+
147+
fetch_team_details.metadata = {"url": "/v3/teams/{teamId}"}
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for
5+
# license information.
6+
#
7+
# Code generated by Microsoft (R) AutoRest Code Generator.
8+
# Changes may cause incorrect behavior and will be lost if the code is
9+
# regenerated.
10+
# --------------------------------------------------------------------------
11+
12+
from msrest.service_client import SDKClient
13+
from msrest import Configuration, Serializer, Deserializer
14+
from .version import VERSION
15+
from msrest.exceptions import HttpOperationError
16+
from .operations.teams_operations import TeamsOperations
17+
from . import models
18+
19+
20+
class TeamsConnectorClientConfiguration(Configuration):
21+
"""Configuration for TeamsConnectorClient
22+
Note that all parameters used to create this instance are saved as instance
23+
attributes.
24+
25+
:param credentials: Subscription credentials which uniquely identify
26+
client subscription.
27+
:type credentials: None
28+
:param str base_url: Service URL
29+
"""
30+
31+
def __init__(self, credentials, base_url=None):
32+
33+
if credentials is None:
34+
raise ValueError("Parameter 'credentials' must not be None.")
35+
if not base_url:
36+
base_url = "https://api.botframework.com"
37+
38+
super(TeamsConnectorClientConfiguration, self).__init__(base_url)
39+
40+
self.add_user_agent("botframework-connector/{}".format(VERSION))
41+
42+
self.credentials = credentials
43+
44+
45+
class TeamsConnectorClient(SDKClient):
46+
"""The Bot Connector REST API extension for Microsoft Teams allows your bot to perform extended operations on to Microsoft Teams channel configured in the
47+
[Bot Framework Developer Portal](https://dev.botframework.com). The Connector service uses industry-standard REST and JSON over HTTPS.
48+
Client libraries for this REST API are available. See below for a list.
49+
Authentication for both the Bot Connector and Bot State REST APIs is accomplished with JWT Bearer tokens, and is
50+
described in detail in the [Connector Authentication](https://docs.botframework.com/en-us/restapi/authentication) document.
51+
# Client Libraries for the Bot Connector REST API
52+
* [Bot Builder for C#](https://docs.botframework.com/en-us/csharp/builder/sdkreference/)
53+
* [Bot Builder for Node.js](https://docs.botframework.com/en-us/node/builder/overview/)
54+
© 2016 Microsoft
55+
56+
:ivar config: Configuration for client.
57+
:vartype config: TeamsConnectorClientConfiguration
58+
59+
:ivar teams: Teams operations
60+
:vartype teams: botframework.connector.teams.operations.TeamsOperations
61+
62+
:param credentials: Subscription credentials which uniquely identify
63+
client subscription.
64+
:type credentials: None
65+
:param str base_url: Service URL
66+
"""
67+
68+
def __init__(self, credentials, base_url=None):
69+
70+
self.config = TeamsConnectorClientConfiguration(credentials, base_url)
71+
super(TeamsConnectorClient, self).__init__(self.config.credentials, self.config)
72+
73+
client_models = {
74+
k: v for k, v in models.__dict__.items() if isinstance(v, type)
75+
}
76+
self.api_version = "v3"
77+
self._serialize = Serializer(client_models)
78+
self._deserialize = Deserializer(client_models)
79+
80+
self.teams = TeamsOperations(
81+
self._client, self.config, self._serialize, self._deserialize
82+
)
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for
5+
# license information.
6+
#
7+
# Code generated by Microsoft (R) AutoRest Code Generator.
8+
# Changes may cause incorrect behavior and will be lost if the code is
9+
# regenerated.
10+
# --------------------------------------------------------------------------
11+
12+
VERSION = "v3"

0 commit comments

Comments
 (0)
0