Skip to content

Commit acd002c

Browse files
author
Alejandro Casanovas
authored
Merge pull request googleapis#345 from teamoo/patch-1
Implement alternative Protocol for financials API
2 parents 9837efb + a31cb8d commit acd002c

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

‎O365/connection.py‎

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,53 @@ def __init__(self, api_version='v2.0', default_resource=None,
260260
'ItemAttachment'
261261
self.max_top_value = 999 # Max $top parameter value
262262

263+
class MSBusinessCentral365Protocol(Protocol):
264+
265+
""" A Microsoft Business Central Protocol Implementation
266+
https://docs.microsoft.com/en-us/dynamics-nav/api-reference/v1.0/endpoints-apis-for-dynamics
267+
"""
268+
269+
_protocol_url = 'https://api.businesscentral.dynamics.com/'
270+
_oauth_scope_prefix = 'https://api.businesscentral.dynamics.com/'
271+
_oauth_scopes = DEFAULT_SCOPES
272+
_protocol_scope_prefix = 'https://api.businesscentral.dynamics.com/'
273+
274+
def __init__(self, api_version='v1.0', default_resource=None,environment=None,
275+
**kwargs):
276+
""" Create a new Microsoft Graph protocol object
277+
278+
_protocol_url = 'https://api.businesscentral.dynamics.com/'
279+
280+
_oauth_scope_prefix = 'https://api.businesscentral.dynamics.com/'
281+
282+
:param str api_version: api version to use
283+
:param str default_resource: the default resource to use when there is
284+
nothing explicitly specified during the requests
285+
"""
286+
if environment:
287+
_version = "2.0"
288+
_environment = "/"+environment
289+
else:
290+
_version = "1.0"
291+
_environment = ''
292+
293+
self._protocol_url = ("{}v{}{}/api/").format(self._protocol_url,_version,_environment)
263294

295+
super().__init__(protocol_url=self._protocol_url,
296+
api_version=api_version,
297+
default_resource=default_resource,
298+
casing_function=camelcase,
299+
protocol_scope_prefix=self._protocol_scope_prefix,
300+
**kwargs)
301+
302+
self.keyword_data_store['message_type'] = 'microsoft.graph.message'
303+
self.keyword_data_store['event_message_type'] = 'microsoft.graph.eventMessage'
304+
self.keyword_data_store[
305+
'file_attachment_type'] = '#microsoft.graph.fileAttachment'
306+
self.keyword_data_store[
307+
'item_attachment_type'] = '#microsoft.graph.itemAttachment'
308+
self.max_top_value = 999 # Max $top parameter value
309+
264310
class Connection:
265311
""" Handles all communication (requests) between the app and the server """
266312

0 commit comments

Comments
 (0)