node-red-node-web-nodes
Version:
A collection of Node-RED nodes for popular web services.
157 lines (149 loc) • 8.32 kB
HTML
<!--
Copyright 2015 IBM Corp.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-template-name="google plus">
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name">
</div>
<div class="form-row">
<label for="node-input-google"><i class="fa fa-user"></i> Google Credentials</label>
<input type="text" id="node-input-google">
</div>
<br />
<div class="form-row">
<label for="node-input-reqType"><i class="fa fa-tasks"></i> Request Type </label>
<select type="text" id="node-input-reqType" style="width:72%;">
<option value="people">People</option>
<option value="activities">Activities</option>
<option value="comments">Comments</option>
</select>
</div>
<div class="form-row">
<label for="node-input-action"><i class="fa fa-check"></i> Action</label>
<select type="text" id="node-input-action" style="width:72%;">
<option class="hideable people activities comments" value="get">Get</option>
<option class="hideable people activities" value="search">Search</option>
<option class="hideable people activities comments" value="list">List</option>
</select>
</div>
<br />
<div class="form-row hideable peopleSearch activitiesSearch">
<label for="node-input-query"><i class="fa fa-question"></i> Query</label>
<input type="text" id="node-input-query">
</div>
<div class="form-row hideable peopleList activitiesList">
<label for="node-input-collection"><i class="fa fa-database"></i> Collection</label>
<input type="text" id="node-input-collection">
</div>
<div class="form-row hideable peopleGet peopleList activitiesList">
<label for="node-input-userId"><i class="fa fa-at"></i> User Id</label>
<input type="text" id="node-input-userId">
</div>
<div class="form-row hideable activitiesGet commentsList">
<label for="node-input-activityId"><i class="fa fa-plane"></i> Activity Id</label>
<input type="text" id="node-input-activityId">
</div>
<div class="form-row hideable commentsGet">
<label for="node-input-commentId"><i class="fa fa-comment"></i> Comment Id</label>
<input type="text" id="node-input-commentId">
</div>
<div class="form-row hideable peopleSearch activitiesSearch">
<label for="node-input-language"><i class="fa fa-language"></i> Language</label>
<input type="text" id="node-input-language">
</div>
<div class="form-row hideable peopleSearch peopleList activitiesList activitiesSearch commentsList">
<label for="node-input-maxResults"><i class="fa fa-list"></i> Max Results</label>
<input type="text" id="node-input-maxResults">
</div>
<div class="form-row hideable peopleList activitiesSearch">
<label for="node-input-orderBy"><i class="fa fa-sort"></i> Order by</label>
<select type="text" id="node-input-orderBy" style="width:72%;">
<option value="alphabetical">Alphabetical</option>
<option value="best">Best</option>
</select>
</div>
<div class="form-row hideable commentsList">
<label for="node-input-sortOrder"><i class="fa fa-sort"></i> Sort Order</label>
<select type="text" id="node-input-sortOrder" style="width:72%;">
<option value="ascending">Ascending</option>
<option value="descending">Descending</option>
</select>
</div>
<div class="form-row hideable peopleSearch activitiesList activitiesSearch commentsList">
<label for="node-input-pageToken"><i class="fa fa-file-text"></i> Page Token</label>
<input type="text" id="node-input-pageToken">
</div>
</script>
<script type="text/x-red" data-help-name="google plus">
<p>Interact with the Google+ API to get information about people, activities, and comments.</p>
<p>Request Types:</p>
<p><b>People</b> - Allows you to interact with Google+ profiles. You are able to <i>get</i> a particular profile, <i>search</i> for a profile, or gather a <i>list</i> of people that have +1'd or reshared an activity.</p>
<p><b>Activities</b> - Allows you to interact with Google+ activities. You are able to <i>get</i> a particular activity, <i>search</i> for an activitiy, or gather a <i>list</i> of activities directly related to a person.</p>
<p><b>Comments</b> - Allows you to interact with Google+ comments. You are able to <i>get</i> a particular comment, or gather a <i>list</i> of comments attached to an activity.</p>
<br>
<p>Inputs:</p>
<p><b>User Id</b> - The ID of the person to get the profile for. The special value "me" can be used to indicate the authenticated user.</p>
<p><b>Activity Id</b> - The ID of the activity to get.</p>
<p><b>Comment Id</b> - The ID of the comment to get.</p>
<p><b>Collection</b> - The collection of activities to list. Acceptable values are: <i>public</i>: All public activities created by the specified user.</p>
<p><b>Language</b> - Specify the preferred language to search with. See <a href="https://developers.google.com/+/api/search.html#available-languages">search language codes</a> for available values.</p>
<p><b>Max Results</b> - The maximum number of activities to include in the response, which is used for paging.</p>
<p><b>Sort Order</b> - The order in which to sort the list of comments. Acceptable values are: <i>ascending</i>: Sort oldest comments first. (default); <i>descending</i>: Sort newest comments first.</p>
<p><b>Order by</b> - Specifies how to order search results. Acceptable values are: <i>best</i>: Sort activities by relevance to the user, most relevant first; <i>recent</i>: Sort activities by published date, most recent first. (default)</p>
<p><b>Page Token</b> - The continuation token, which is used to page through large result sets. To get the next page of results, set this parameter to the value of "nextPageToken" from the previous response.</p>
</script>
<script type="text/javascript">
RED.nodes.registerType('google plus',{
category: 'social',
color:"#ff9999",
defaults: {
google: {type:"google-credentials", required:false},
name: {value:""},
reqType: {value:"people"},
action: {value:"get"},
userId: {value:""},
activityId: {value:""},
commentId: {value:""},
query: {value:""},
collection: {value:""},
language: {value:""},
maxResults: {value:""},
sortOrder: {value:""},
orderBy: {value:""},
pageToken: {value:""}
},
inputs:1,
outputs:1,
icon: "logo_plus.png",
label: function() {
return this.name||"Google Plus";
},
oneditprepare: function() {
$("#node-input-reqType").change(function() {
if($(this).val() == 'comments' && $("#node-input-action").val() == 'search'){
$("#node-input-action").val('get');
}
swapInputs($(this).val(), $("#node-input-action").val());
});
$("#node-input-action").change(function() {
swapInputs($("#node-input-reqType").val(), $(this).val());
});
swapInputs($("#node-input-reqType").val(), $("#node-input-action").val());
function swapInputs( reqType, action ) {
$(".hideable").hide();
$("." + reqType + action.substring(0,1).toUpperCase() + action.substring(1)).show();
$("." + reqType).show();
}
},
});
</script>