Giter VIP home page Giter VIP logo

connector-cli's Introduction

Connector CLI

This tool is a companion tool to sesampy.

Init

$ mkdir hubspot-connector
$ cd hubspot-connector
$ connectorpy init
$ ls
manifest.json

Expand and upload

$ connectorpy expand
$ cd .expanded
$ ls
test-env.json
node-metadata.conf.json
pipes
systems
$ sesampy upload

Development

Do your work with Management Studio and your dev node, e.g. add a system and add company and contact pipes.

OAuth2 setup

If the system is using oauth2, you can use the following tool to add secrets to the system. The tool expects a system with the following secrets and environment variables:

{
  "_id": "{{@ system @}}",
  "type": "system:[..]",
  [..]
  "oauth2": {
    "access_token": "$SECRET(oauth_access_token)",
    "client_id": "$SECRET(oauth_client_id)",
    "client_secret": "$SECRET(oauth_client_secret)",
    "refresh_token": "$SECRET(oauth_refresh_token)",
    "token_url": {{@ token_url @}}
  }
  [..]
}

The connector manifest also need to include the following re-usable oauth2 properties:

{
  [..]
  "auth": "oauth2",
  "oauth2": {
    "scopes": ["account:*", "business:*", "customer:*", "invoice:*", "product:*", "sales_tax:*", "transaction:*", "user:*", "vendor:*"],
    "token_url": "https://api.waveapps.com/oauth2/token/",
    "login_url": "https://api.waveapps.com/oauth2/authorize/"
  }
  [..]
}

This is how the tool is used:

$ oauthlogin.py --client_secret ZziobpmZ0DWC[..] --client_id gZLMgMG1[..] --service_url https://datahub-a6a45974.sesam.cloud/api --service_jwt eyJ0eXAiOiJKV1QiLCJhb[..]]

This tool will add oauth system secrets and add token_url to the environment variables:
  Service API: https://datahub-a6a45974.sesam.cloud/api
  System id: xxxxxx

To continue open the following link in your browser:
  Link: https://api.waveapps.com/oauth2/authorize/?client_id=gZLMgMG[..]

 * Serving Flask app 'oauthlogin' (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off
 * Running on http://127.0.0.1:5010/ (Press CTRL+C to quit)
Updated secret: oauth_access_token
Updated secret: oauth_refresh_token
Updated secret: oauth_client_id
Updated secret: oauth_client_secret
Updated environment variables

Download and collapse

$ sesampy download
$ cd ..
$ connectorpy collapse
$ ls
manifest.json
templates
.expanded
$ ls templates
company.json
contact.json
system.json

Re-use templates across datatypes

You can re-use templates across datatypes by using the same template on multiple datatypes. In order to do development, only the datatype that has a template that matches the name of the datatype is used during collapse. The other datatypes are silently ignored.

$ cat manifest.json 
{
  "datatypes": {
    "customer": {
      "template": "templates/customer.json" # the customer datatype is used during collapse
    },
    "product": {
      "template": "templates/customer.json" # the product datatype is ignored during collapse
    }
  },
  "system-template": "templates/system.json"
}

To reflect changes from the datatype used during collapse onto the other datatypes in your development environment one currently has to perform the following steps:

$ sesampy download
$ cd ..
$ connectorpy collapse
$ connectorpy expand
$ cd .expanded
$ sesampy upload

connector-cli's People

Contributors

baardbouvet avatar branislavjenco avatar

Watchers

Geir O. Grønmo avatar Axel Borge avatar  avatar Tarjei Næss Skrede avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.