Giter VIP home page Giter VIP logo

temboo_client's Introduction

C++ Temboo Client

Temboo Client implementation with C++11 using lambda functions for callbacks.

This library is hosted in Biicode C++ dependency manager.

Biicode block lasote/temboo_client

Also in github repository https://github.com/lasote/temboo_client

Build status

Visual Studio 2012: Build status

Linux gcc: Build Status

Want to try it?

The project has many dependencies, we recommend you to use biicode to handle them:

Get started with biicode

Include this header in your source code file:

#include "lasote/temboo_client/client.h"

Download the required dependencies:

bii find

Build the project:

bii cpp:build # to build the project

Take a look to the example: http://www.biicode.com/examples/temboo_client

How to use it?

Look the complete method list in client.h:

#include "lasote/temboo_client/client.h"
#include <iostream>

using namespace lasote;

int main() {

  TembooClient client("lasote", "myFirstApp", "XXXXXXXXXXXXXXXXXXXXX");

  //Error callback
  ERR_F error_cb = [] (int status, string desc) {
	  cout << "Error: " << status <<  endl  << desc;
  };

  //keep return value from TembooClient, its necessary for asynchronous calls

  //Get available choreos for suplied credentials
  auto c1 = client.list_choreos([] (jsonxx::Object out) {
  	   auto arr = out.get<jsonxx::Array>("resources");
       cout << "Choreos first on list: " << arr.get<jsonxx::String>(0) << endl << endl;
  }, error_cb);

  // Details for choreos "Library/Google/Geocoding/GeocodeByAddress"
  auto c2 = client.details_choreos([] (jsonxx::Object out) {
       cout << "Details choreos: " << out << endl << endl;
  }, error_cb, "Library/Google/Geocoding/GeocodeByAddress");

  // Execute a choreos
  vector<pair<string, string>> params;
  pair<string, string> param1;
  param1.first = "Address"; param1.second = "Estadio Santiago Bernabeu";
  params.push_back(param1);

  auto c3 = client.run_choreos([param1] (jsonxx::Object out) {
  	   jsonxx::Object output = out.get<jsonxx::Object>("output");
       cout << "Address: " << param1.second << endl;
       cout << "Latitude: " << output.get<jsonxx::String>("Latitude") << endl;
       cout << "Longitude: " << output.get<jsonxx::String>("Longitude") << endl << endl;
  }, error_cb, "Library/Google/Geocoding/GeocodeByAddress", params);

  //Executions
  auto c4 = client.list_choreos_executions([] (jsonxx::Object out) {
       cout << "Executions: " << out << endl;
  }, error_cb);

  auto c5 = client.get_choreo_executions([] (jsonxx::Object out) {
       cout << "Response to run: " << out << endl;
  }, error_cb, "CHOREOS_EXEC_ID");

  auto c6 = client.delete_choreo_executions([] (void) {
        cout << "Deleted!";
  }, error_cb, "CHOREOS_EXEC_ID");


  // Now run all requests
  run_loop();
}

temboo_client's People

Contributors

lasote avatar

Watchers

James Cloos avatar  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.