-
Notifications
You must be signed in to change notification settings - Fork 0
HubotSDK Adapters
In order to make the inbox accessible to message publishers, the JSDK provide a set of adapters responsible to provide a remote API to the inbox. These adapters provide also the set of transports required to pass the content of the outboxes to their final destinations.
Here is the adapters already provided :
This Adapter is always used and don't need to be explicitly declared.
Populates the inbox with messages addressed explicitely to the hubot
Sends the content of an outbox to a target entity.
Populates the inbox with hmessages received from a suscribed hchannel. This Adapter automaticaly subscribe to the channel
Publish the content of an outbox (HMessage/HCommand) to a hchannel.
{
"properties" : {
"chid" : "#hchannelName"
}
}
Where :
- chid : the name of the hchannel where we will publish/receive message
Populates the inbox with hmessages of type HHttpData.
{
"properties" : {
"host" : "0.0.0.0",
"port" : "80",
"path" : ""
}
}
Where :
- host : Hostname or ipadress of the http server. Will only be listening to this host. Default value: "0.0.0.0" (any host).
- port : Port of the http server. Default value : 80.
- path : Prefix of the watched path. (ie : login?user=hubi). Default value : "".
public class HHttpData implements HJsonObj {
public Map<String, HHttpAttachement> getAttachments();
public void setAttachments(Map<String, HHttpAttachement> attachments);
public byte[] getRawBody();
public void setRawBody(byte[] rawBody);
public String getMethod();
public void setMethod(String method);
public String getQueryArgs();
public void setQueryArgs(String queryArgs);
public String getQueryPath();
public void setQueryPath(String queryPath);
public String getServerName();
public void setServerName(String serverName);
public Integer getServerPort();
public void setServerPort(Integer serverPort);
}
Where :
- attachements : Post attachements send with the query.
- rawBody : Body content as raw bytes encoded in Base64 for json.
- method : Define the method of the data. Possible values : get, post, put, delete. Mandatory.
- queryArgs : Parameters applied to the URI. (eg : "?a=2").
- queryPath : Path to the resource. (eg : "/path").
- serverName : Hostname used to do the query. (eg : "localhost"). Mandatory.
- serverPort : Port used to do the query. Mandatory.
public class HHttpAttachement implements HJsonObj {
public String getName();
public void setName(String name);
public byte[] getData();
public void setData(byte[] data);
public String getContentType();
public void setContentType(String contentType);
}
Where :
- name : Name of the attachment.
- data : Data raw bytes encoded in Base64 for json.
- contentType : Type of content. (eg : application/Octet-stream).
Populates the inbox with hmessages of type HTweet.
{
"properties" : {
"consumerKey" : "",
"consumerSecret" : "",
"twitterAccessToken" : "",
"twitterAccessTokenSecret" : "",
"tags" : "",
"lang" : ""
}
}
Where :
- consumerKey: Domain identifying the third-party web application, and Key for acces to the twitter api .
- consumerSecret: Domain identifying the third-party web application, and password for acces to the twitter api.
- twitterAccessToken: .
- twitterAccessTokenSecret: .
- tags: Specified hashtag used for finding Tweets. ie : "tag1#tag2#tag3"
- lang: Applying langage filter for finding Tweets. ie : "fr"
public class HTweet implements HJsonObj {
public String getText();
public void setText(String tweetText);
public long getId();
public void setId(long id);
public String getSource();
public void setSource(String source);
public Calendar getPublish();
public void setPublish(Calendar publish);
}
Where :
- id : Id of the status.
- Text : Text of the status.
- source : The Application source.
- publish: The date of tweet creation.
public class HAuthorTweet implements HJsonObj {
public String getAuthorName();
public void setAuthorName(String author) ;
public int getStatus();
public void setStatus(int status);
public int getFollowers();
public void setFollowerst(int followers);
public String getName();
public void setName(String name);
public int getFriends();
public void setFriends(int friends);
public String getLocation();
public void setLocation(String location);
public String getDescription();
public void setDescription(String description);
public String getProfileImg();
public void setProfileImg(String profileImg);
public String getURL();
public void setUrl(URL url);
public Calendar getCreatedAt();
public void setCreatedAt(Calendar createdAt);
public String getLang();
public void setLang(String lang);
public boolean getGeo();
public void setGeo(boolean geo);
public boolean getVerified()
public void setVerified(boolean verified);
public int getListeds();
public void setListeds(int listeds);
}
Where :
- author: Author Name.
- status: Count of Status on user timeline.
- followers: Count of followers on user profile.
- name: Complete Name Of author.
- friends: Count of friends on user profile.
- location: Location of user.
- description: Description on user profile.
- profileImg: Picture on user profile.
- url: url on user profile.
- createdAt : Date of creation of the profile.
- lang : language on user profile.
- geo : see if the geolocation if active on user profile.
- verif: see if the user profile is verified.
- listeds: Listed Count of user.