ask-smapi-sdk 1.0.0
The SMAPI SDK package is the python library for Alexa Skill Management API (SMAPI) which contains operations that allow you to programmatically manage and test Alexa skills and related resources such as interaction models
License: Apache 2.0
Requires Python: >2.6, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*
Keywords: SMAPI SDK,Alexa Skills Kit,Alexa,SMAPI

==========================================================
ASK SMAPI SDK - Alexa Skills Management API Python Library
==========================================================

``ask-smapi-sdk`` is the Python library package for Alexa
Skill Management API (SMAPI). SMAPI is a set of API
operations that allow you to programmatically manage
and test Alexa skills and related resources such as
interaction models. More information on SMAPI can be
found at `Alexa Developer Documentation <https://developer.amazon.com/docs/smapi/smapi-overview.html>`__.

Quick Start
-----------

Install ASK SMAPI SDK
=====================

Installation from PyPI
----------------------

Assuming that you have Python and ``virtualenv`` installed, you can
install the package and it's dependencies (``ask-smapi-model``) from PyPI
as follows:

.. code-block:: sh

    $ virtualenv venv
    $ . venv/bin/activate
    $ pip install ask-smapi-sdk


Installation from Github
------------------------

.. code-block:: sh

    $ git clone https://github.com/alexa/alexa-skills-kit-sdk-for-python.git
    $ cd alexa-skills-kit-sdk-for-python/ask-smapi-sdk
    $ virtualenv venv
    ...
    $ . venv/bin/activate
    $ python setup.py install

Install NPM and the ASK CLI
===========================
- Install NPM using the instructions provided here: `get-npm <https://www.npmjs.com/get-npm>`__.
- This is needed to get started with the ASK CLI, which will be used to generate
  Login with Amazon tokens you will need to access SMAPI.

Assuming that you have ``npm`` installed, you can install the package
from NPM as follows:

.. code-block:: sh

    $ npm install ask-cli -g

Generate Login with Amazon Keys
===============================
- Create a new security profile for your Amazon Developer account by following the instructions
  provided here: `Generate LWA Keys <https://developer.amazon.com/docs/smapi/ask-cli-command-reference.html#generate-lwa-tokens>`__.
- This will generate ``Client ID`` and ``Client Secret`` keys.
- Using the ASK CLI, run: ask util generate-lwa-tokens. You will be asked to provide the ``Client ID``
  and ``Client Secret`` keys from the previous step. This will return the following JSON with a ``Refresh Token``:

.. code-block:: json

    {
      "access_token": "ACCESS_TOKEN",
      "refresh_token": "REFRESH_TOKEN",
      "token_type": "bearer",
      "expires_in": 3600,
      "expires_at": "2019-11-19T20:25:06.584Z"
    }


Configure SMAPI Client
======================
- Import StandardSmapiBuilder from ask_smapi_sdk.
- Create an instance of StandardSmapiBuilder passing clientId, clientSecret and refreshToken as parameters.
- Create a smapiClient instance by invoking client method on builder instance.
- You can invoke SMAPI method call using the smapi_client instance and passing parameters corresponding to the method signatures.


---------------
Usage Examples
---------------

For the complete list of functions, please see the ASK SMAPI SDK documentation.

List Skills
===========
.. code-block:: python

    from ask_smapi_sdk import StandardSmapiBuilder

    smapi_client = StandardSmapiBuilder(client_id='Client ID', client_secret='Client Secret Key', refresh_token='Refresh Token').client()
    try:
        result = smapi_client.list_skills_for_vendor_v1(vendor_id='Vemdor ID', full_response=True)
        print("==========================================")
        print(result.headers)
        print(result.body)
        print("==========================================")
    except Exception as e:
        print(e.message)

Get Skill Manifest
==================
.. code-block:: python

    from ask_smapi_sdk import StandardSmapiBuilder

    smapi_client = StandardSmapiBuilder(client_id='Client ID', client_secret='Client Secret Key', refresh_token='Refresh Token').client()
    try:
        result = smapi_client.get_skill_manifest_v1(skill_id='SKILL ID', stage='SKILL STAGE')
        print("==========================================")
        print(result)
        print("==========================================")
    except Exception as e:
        print(e.message)

-------------
Documentation
-------------

- SMAPI SDK Reference Documentation.
- `SMAPI Documentation <https://developer.amazon.com/docs/smapi/smapi-overview.html>`__

-------------
Got Feedback?
-------------

- We would like to hear about your bugs, feature requests, questions or quick feedback.
  Please search for the `existing issues <https://github.com/alexa/alexa-skills-kit-sdk-for-python/issues>`_ before opening a new one. It would also be helpful
  if you follow the templates for issue and pull request creation. Please follow the `contributing guidelines <https://github.com/alexa/alexa-skills-kit-sdk-for-python/blob/master/CONTRIBUTING.md>`__
- Request and vote for `Alexa features <https://alexa.uservoice.com/forums/906892-alexa-skills-developer-voice-and-vote>`__


=========
CHANGELOG
=========

1.0.0
-----

* Initial release ask smapi sdk.