Done
Details
Assignee
Maurizio PillituMaurizio PillituReporter
Matt JoyceMatt Joyce(Deactivated)Priority
HighLabels
Details
Details
Assignee
Maurizio Pillitu
Maurizio PillituReporter
Matt Joyce
Matt Joyce(Deactivated)Priority
Labels
Created June 29, 2017 at 6:35 PM
Updated July 2, 2017 at 3:44 PM
Resolved July 2, 2017 at 3:44 PM
After discussing the path forward in implementing support for the open api swagger spec
( ref: https://github.com/symphonyoss/symphony-api-spec )
I am now of the opinion that the language binding layer should be JUST the base codegen components of the parsing / version locking of the spec file.
Then the python-symphony module, will consume this base language binding layer to build a more user friendly set of methods / abstractions.
this new repo would be called `python-symphony-binding`
it would build a python module called symphonybinding
the repo would be focused on
version locking a swagger spec for the python language binding
unit / functional testing of codegen objects and working with bravado codegen project to ensure successful code generation based on swagger file.
supporting any necessary modifications to the spec file and working with open api spec to ensure conformity
Example of Use in python-symphony:
import symphony import symphonybinding from .base import Base class Agent(Base): def __init__(self, url, session, keymngr, crt, key): self.__url__ = url self.__session__ = session self.__keymngr__ = keymngr self.__crt__ = crt self.__key__ = key self.__rest__ = symphony.RESTful(self.__url__, self.__session__, self.__keymngr__, self.__crt__, self.__key__) try: CG = symphonybinding.SymCodegen() self.__agent__, self.__agentdepr__, self.__pod__, self.__pod_deprecated__ = CG.codegen(self.__url__ + 'agent/') except Exception as err: print err
import ast import json import unicodedata class Base(object): def __init__(self, *args, **kwargs): super(Base, self).__init__(*args, **kwargs) def remove_control_characters(self, s): return "".join(ch for ch in s if unicodedata.category(ch)[0] != "C") def test_echo(self, test_string): ''' echo test ''' response = self.__agent__.Util.post_v1_util_echo(sessionToken=self.__session__, keyManagerToken=self.__keymngr__, echoInput={"message": test_string} ).result() return response def send_message(self, threadid, msgFormat, message): ''' send message to threadid/stream ''' # using deprecated v3 message create because of bug in codegen of v4 ( multipart/form-data ) response = self.__agentdepr__.Messages.post_v3_stream_sid_message_create(sessionToken=self.__session__, keyManagerToken=self.__keymngr__, sid=threadid, message={"format": msgFormat, "message": message} ).result() return response