Pachube

Dependents:   Pachube_TestProgram _DearMrJeffMourich StarBoardOrangeExpansion2 Toragi_2011_04_Pachube ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Pachube.h Source File

Pachube.h

00001 /**
00002  * Pachube API interface driver. (Version 0.0.1)
00003  *
00004  * Copyright (C) 2010 Shinichiro Nakamura (CuBeatSystems)
00005  * http://shinta.main.jp/
00006  */
00007 
00008 #ifndef _PACHUBE_H_
00009 #define _PACHUBE_H_
00010 
00011 #include <string>
00012 
00013 class Pachube {
00014 public:
00015 
00016     explicit Pachube(std::string APIKEY);
00017 
00018     virtual ~Pachube();
00019 
00020     /*
00021      * =================================================================
00022      *  Environments (feeds)
00023      * =================================================================
00024      */
00025 
00026     /**
00027      * List all available feeds: GET /v2/feeds
00028      *
00029      * @param page Integer indicating which page of results you are requesting.
00030      * @param per_page Integer defining how many results to return per page (1 to 1000).
00031      * @param content String parameter ('full' or 'summary') describing whether we want full or summary results. Full results means all datastream values are returned, summary just returns the environment meta data for each feed.
00032      * @param q Full text search parameter. Should return any feeds matching this string.
00033      * @param tag Returns feeds containing datastreams tagged with the search query.
00034      * @param user Returns feeds created by the user specified.
00035      * @param units Returns feeds containing datastreams with units specified by the search query.
00036      * @param status Possible values ('live', 'frozen', or 'all'). Whether to search for only live feeds, only frozen feeds, or all feeds. Defaults to all.
00037      * @param order Order of returned feeds. Possible values ('created_at', 'retrieved_at', or 'relevance').
00038      */
00039     virtual int listAllAvailableFeeds(
00040         int page,
00041         int per_page,
00042         std::string content,
00043         std::string q,
00044         std::string tag,
00045         std::string user,
00046         std::string units,
00047         std::string status,
00048         std::string order,
00049         std::string &datatext) = 0;
00050 
00051     /**
00052      * Create new feed: POST /v2/feeds
00053      */
00054     virtual int createNewFeed(void) = 0;
00055 
00056     /**
00057      * Read feed: GET /v2/feeds/<feed_id>
00058      */
00059     virtual int readFeed(int feed_id, std::string &datatext) = 0;
00060 
00061     /**
00062      * Update feed: PUT /v2/feeds/<feed_id>
00063      */
00064     virtual int updateFeed(int feed_id) = 0;
00065 
00066     /**
00067      * Delete feed: DELETE /v2/feeds/<feed_id>
00068      */
00069     virtual int deleteFeed(int feed_id) = 0;
00070 
00071     /*
00072      * =================================================================
00073      *  Datastreams
00074      * =================================================================
00075      */
00076 
00077     /**
00078      * Create new datastream: POST /v2/feeds/<feed_id>/datastreams
00079      *
00080      * @param feed_id Feed ID.
00081      * @param stream_id Stream ID text.
00082      * @param value value.
00083      *
00084      * @return Return code from a web server.
00085      */
00086     virtual int createNewDataStream(int feed_id, std::string stream_id, std::string value) = 0;
00087 
00088     /**
00089      * Read datastream - GET /v2/feeds/<feed_id>/datastreams/<datastream_id>
00090      *
00091      * @param feed_id Feed ID.
00092      * @param stream_id Stream ID text.
00093      *
00094      * @return Return code from a web server.
00095      */
00096     virtual int readDataStream(int feed_id, std::string stream_id, std::string &datatext) = 0;
00097 
00098     /**
00099      * Update datastream: PUT /v2/feeds/<feed_id>/datastreams/<datastream_id>
00100      *
00101      * @param feed_id Feed ID.
00102      * @param stream_id Stream ID text.
00103      * @param value value.
00104      *
00105      * @return Return code from a web server.
00106      */
00107     virtual int updateDataStream(int feed_id, std::string stream_id, std::string value) = 0;
00108 
00109     /**
00110      * Delete datastream: DELETE /v2/feeds/<feed_id>/datastreams/<datastream_id>
00111      *
00112      * @param feed_id Feed ID.
00113      * @param stream_id Stream ID text.
00114      *
00115      * @return Return code from a web server.
00116      */
00117     virtual int deleteDataStream(int feed_id, std::string stream_id) = 0;
00118 
00119 protected:
00120     const std::string APIKEY;
00121     static const std::string REQUESTHEADER;
00122     static const std::string URLBASE_V2;
00123 };
00124 
00125 #endif
00126 
00127 /*
00128 Pachube v2 API Documentation
00129 http://api.pachube.com/v2/
00130 
00131 # Environments (feeds)
00132 
00133 o   * List all available feeds: GET /v2/feeds
00134 o   * Create new feed: POST /v2/feeds
00135 o   * Read feed: GET /v2/feeds/<feed_id>
00136 o   * Update feed: PUT /v2/feeds/<feed_id>
00137 o   * Delete feed: DELETE /v2/feeds/<feed_id>
00138 
00139 # Datastreams
00140 
00141 o   * Create new datastream: POST /v2/feeds/<feed_id>/datastreams
00142 o   * Read datastream - GET /v2/feeds/<feed_id>/datastreams/<datastream_id>
00143 o   * Update datastream: PUT /v2/feeds/<feed_id>/datastreams/<datastream_id>
00144 o   * Delete datastream: DELETE /v2/feeds/<feed_id>/datastreams/<datastream_id>
00145 
00146 # Datapoints
00147 
00148     * Create datapoint: POST /v2/feeds/<feed_id>/datastreams/<datastream_id>/datapoints
00149     * Read datapoint: GET /v2/feeds/<feed_id>/datastreams/<datastream_id>/datapoints/<timestamp>
00150     * Update datapoint: PUT /v2/feeds/<feed_id>/datastreams/<datastream_id>/datapoints/<timestamp>
00151     * Delete datapoint: DELETE /v2/feeds/<feed_id>/datastreams/<datastream_id>/datapoints/<timestamp>
00152 
00153 # Triggers
00154 
00155     * List triggers: GET /v2/triggers
00156     * Create trigger: POST /v2/triggers
00157     * Read trigger: GET /v2/triggers/<trigger_id>
00158     * Update trigger: PUT /v2/triggers/<trigger_id>
00159     * Delete trigger: DELETE /v2/triggers/<trigger_id>
00160 
00161 # Users
00162 
00163     * List all users: GET /v2/users
00164     * Create user: POST /v2/users
00165     * Read user: GET /v2/users/<user_id>
00166     * Update user: PUT /v2/users/<user_id>
00167     * Delete user: DELETE /v2/users/<user_id>
00168 */