<html>
<head>
<base href="https://wiki.asterisk.org/wiki">
<link rel="stylesheet" href="/wiki/s/en/2176/25/9/_/styles/combined.css?spaceKey=AST&forWysiwyg=true" type="text/css">
</head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
<h2><a href="https://wiki.asterisk.org/wiki/display/AST/Asterisk+Client+Library+Generator">Asterisk Client Library Generator</a></h2>
<h4>Page <b>added</b> by <a href="https://wiki.asterisk.org/wiki/display/~espiceland">Erin Spiceland</a>
</h4>
<br/>
<div class="notificationGreySide">
<h1><a name="AsteriskClientLibraryGenerator-AsteriskClientLibraryGenerator"></a>Asterisk Client Library Generator</h1>
<p>Generator for client libraries for <a href="/wiki/display/AST/Asterisk+12+API+Improvements#Asterisk12APIImprovements-Asterisk12APIImprovementsRESTfulHTTPAPI">Asterisk's REST API</a> which is provided by res_http_stasis.</p>
<h2><a name="AsteriskClientLibraryGenerator-Languages"></a>Languages</h2>
<ul>
        <li>Python</li>
        <li>JavaScript</li>
        <li>Perl</li>
        <li>format such that additional language support is not difficult.</li>
</ul>
<h1><a name="AsteriskClientLibraryGenerator-NameForPythonLibrary"></a>Name For Python Library</h1>
<p>Suggestions have included, the following. Still open for debate. Erin wishes we could use the same name for libraries written in multiple languages.</p>
<ul>
        <li>AsteriskPy</li>
        <li>AsterPy, AstraPy</li>
        <li>AsteRESTpy</li>
        <li>PAsteREST</li>
        <li>AsteREST</li>
</ul>
<h1><a name="AsteriskClientLibraryGenerator-Librarystructure"></a>Library structure</h1>
<ul>
        <li>Top-level library or object or structure
        <ul>
                <li>Asterisk.get_info()</li>
                <li>Endpoints.get_endpoints()</li>
                <li>Channels.get_channels()</li>
                <li>Bridges.get_bridges()</li>
                <li>Recordings.get_recordings()</li>
                <li>Endpoint.get_endpoint(id)</li>
                <li>Channel.get_channel(id)</li>
                <li>Bridges.get_bridge(id)</li>
                <li>Recordings.get_recording(id)</li>
                <li>add_event_handler(event_name, function)</li>
                <li>remove_event_handler(event_name, function)</li>
        </ul>
        </li>
        <li>Each object in the Swagger resource files
        <ul>
                <li>Methods listed therein</li>
                <li>Relevant object attribute getters</li>
                <li>add_event_handler(event_name, function)</li>
                <li>remove_event_handler(event_name, function)</li>
        </ul>
        </li>
</ul>
<h1><a name="AsteriskClientLibraryGenerator-Events%2Fmessages%2Fcallbacks%2Fpubsub"></a>Events/messages/callbacks/pub-sub</h1>
<ul>
        <li>Methods that can should return an object</li>
        <li>Methods that can't return an object but finish synchronously should return true/false.</li>
        <li>Methods that can't finish synchronously should have a topic to which subscriptions could be made
        <ul>
                <li>Should these functions accept an optional function and perform the subscribe internally? This would save the developer from having to remember method->topic relationships. Sort of self-documenting code.</li>
        </ul>
        </li>
</ul>
<h1><a name="AsteriskClientLibraryGenerator-Projectlocationanddirectorystructure"></a>Project location and directory structure</h1>
<p>This project is located at git@git.digum.internal/team/espiceland/asterisk_rest_libraries.git. Inside asterisk_rest_libraries</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">asterisk_rest_libraries
generate_library.py
api.py
test_api_calls.py
test_asterispy.py
perl/
lib/
templates/
... et. al.
python/
lib/
__init__.py
asteriskpy.py
asterisk_rest_api.py
errors.py
... and generated files
templates/
copyright.proto
class_def.proto
method_def.proto
... and perhaps more in the future
test_resources/
asterisk.json
bridges.json
channels.json
endpoints.json
recordings.json
resources.json
... and perhaps more in the future</pre>
</div></div>
</div>
<div id="commentsSection" class="wiki-content pageSection">
<div style="float: right;" class="grey">
<a href="https://wiki.asterisk.org/wiki/users/removespacenotification.action?spaceKey=AST">Stop watching space</a>
<span style="padding: 0px 5px;">|</span>
<a href="https://wiki.asterisk.org/wiki/users/editmyemailsettings.action">Change email notification preferences</a>
</div>
<a href="https://wiki.asterisk.org/wiki/display/AST/Asterisk+Client+Library+Generator">View Online</a>
|
<a href="https://wiki.asterisk.org/wiki/display/AST/Asterisk+Client+Library+Generator?showComments=true&showCommentArea=true#addcomment">Add Comment</a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>