Merge pull request #5 from Microsoft/v0.3

updated library to talk to v0.3 of server API
This commit is contained in:
Sharad Agarwal 2016-04-06 12:42:45 -07:00
Родитель 9275010ab7 13366e5e56
Коммит 8a5392f700
39 изменённых файлов: 4348 добавлений и 720 удалений

Просмотреть файл

@ -30,13 +30,23 @@ function Blobs(client) {
* If your blob is an image, use image APIs. For all other blob types, use
* this API.
*
* @param {string} authorization Authenication (must begin with string "Bearer
* ")
* @param {string} authorization Authentication (must begin with string
* "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {object} blob MIME encoded contents of the blob
*
* @param {object} [options] Optional Parameters.
*
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@ -62,11 +72,19 @@ Blobs.prototype.postBlob = function (authorization, blob, options, callback) {
if (!callback) {
throw new Error('callback cannot be null.');
}
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
throw new Error('appkey must be of type string.');
}
if (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
throw new Error('authorization cannot be null or undefined and it must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
if (blob === null || blob === undefined) {
throw new Error('blob cannot be null or undefined and it must be of type object.');
}
@ -76,7 +94,7 @@ Blobs.prototype.postBlob = function (authorization, blob, options, callback) {
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/blobs';
'//v0.3/blobs';
// trim all duplicate forward slashes in the url
var regex = /([^:]\/)\/+/gi;
requestUrl = requestUrl.replace(regex, '$1');
@ -87,9 +105,15 @@ Blobs.prototype.postBlob = function (authorization, blob, options, callback) {
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if (appkey !== undefined && appkey !== null) {
httpRequest.headers['appkey'] = appkey;
}
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {
@ -158,11 +182,21 @@ Blobs.prototype.postBlob = function (authorization, blob, options, callback) {
*
* @param {string} blobHandle Blob handle
*
* @param {string} authorization Authenication (must begin with string "Bearer
* ")
* @param {string} authorization Authentication (must begin with string
* "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {object} [options] Optional Parameters.
*
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@ -187,21 +221,29 @@ Blobs.prototype.getBlob = function (blobHandle, authorization, options, callback
if (!callback) {
throw new Error('callback cannot be null.');
}
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (blobHandle === null || blobHandle === undefined || typeof blobHandle.valueOf() !== 'string') {
throw new Error('blobHandle cannot be null or undefined and it must be of type string.');
}
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
throw new Error('appkey must be of type string.');
}
if (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
throw new Error('authorization cannot be null or undefined and it must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/blobs/{blobHandle}';
'//v0.3/blobs/{blobHandle}';
requestUrl = requestUrl.replace('{blobHandle}', encodeURIComponent(blobHandle));
// trim all duplicate forward slashes in the url
var regex = /([^:]\/)\/+/gi;
@ -213,9 +255,15 @@ Blobs.prototype.getBlob = function (blobHandle, authorization, options, callback
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if (appkey !== undefined && appkey !== null) {
httpRequest.headers['appkey'] = appkey;
}
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {

Просмотреть файл

@ -31,10 +31,18 @@ function Builds(client) {
*
* @param {object} [options] Optional Parameters.
*
* @param {string} [options.appkey] App Key Authentication
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.authorization] Authenication (must begin with
* string "Bearer ")
* @param {string} [options.authorization] Authentication (must begin with
* string "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
@ -63,6 +71,7 @@ Builds.prototype.getBuildsCurrent = function (options, callback) {
}
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var authorization = (options && options.authorization !== undefined) ? options.authorization : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
@ -71,13 +80,16 @@ Builds.prototype.getBuildsCurrent = function (options, callback) {
if (authorization !== null && authorization !== undefined && typeof authorization.valueOf() !== 'string') {
throw new Error('authorization must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/builds/current';
'//v0.3/builds/current';
// trim all duplicate forward slashes in the url
var regex = /([^:]\/)\/+/gi;
requestUrl = requestUrl.replace(regex, '$1');
@ -94,6 +106,9 @@ Builds.prototype.getBuildsCurrent = function (options, callback) {
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {

Просмотреть файл

@ -35,10 +35,18 @@ function CommentLikes(client) {
*
* @param {number} [options.limit] Number of items to return
*
* @param {string} [options.appkey] App Key Authentication
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.authorization] Authenication (must begin with
* string "Bearer ")
* @param {string} [options.authorization] Authentication (must begin with
* string "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
@ -70,6 +78,7 @@ CommentLikes.prototype.getLikes = function (commentHandle, options, callback) {
var limit = (options && options.limit !== undefined) ? options.limit : undefined;
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var authorization = (options && options.authorization !== undefined) ? options.authorization : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (commentHandle === null || commentHandle === undefined || typeof commentHandle.valueOf() !== 'string') {
@ -87,13 +96,16 @@ CommentLikes.prototype.getLikes = function (commentHandle, options, callback) {
if (authorization !== null && authorization !== undefined && typeof authorization.valueOf() !== 'string') {
throw new Error('authorization must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/comments/{commentHandle}/likes';
'//v0.3/comments/{commentHandle}/likes';
requestUrl = requestUrl.replace('{commentHandle}', encodeURIComponent(commentHandle));
var queryParameters = [];
if (cursor !== null && cursor !== undefined) {
@ -121,6 +133,9 @@ CommentLikes.prototype.getLikes = function (commentHandle, options, callback) {
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {
@ -187,11 +202,21 @@ CommentLikes.prototype.getLikes = function (commentHandle, options, callback) {
*
* @param {string} commentHandle Comment handle
*
* @param {string} authorization Authenication (must begin with string "Bearer
* ")
* @param {string} authorization Authentication (must begin with string
* "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {object} [options] Optional Parameters.
*
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@ -216,21 +241,29 @@ CommentLikes.prototype.postLike = function (commentHandle, authorization, option
if (!callback) {
throw new Error('callback cannot be null.');
}
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (commentHandle === null || commentHandle === undefined || typeof commentHandle.valueOf() !== 'string') {
throw new Error('commentHandle cannot be null or undefined and it must be of type string.');
}
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
throw new Error('appkey must be of type string.');
}
if (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
throw new Error('authorization cannot be null or undefined and it must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/comments/{commentHandle}/likes';
'//v0.3/comments/{commentHandle}/likes';
requestUrl = requestUrl.replace('{commentHandle}', encodeURIComponent(commentHandle));
// trim all duplicate forward slashes in the url
var regex = /([^:]\/)\/+/gi;
@ -242,9 +275,15 @@ CommentLikes.prototype.postLike = function (commentHandle, authorization, option
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if (appkey !== undefined && appkey !== null) {
httpRequest.headers['appkey'] = appkey;
}
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {
@ -317,11 +356,21 @@ CommentLikes.prototype.postLike = function (commentHandle, authorization, option
*
* @param {string} commentHandle Comment handle
*
* @param {string} authorization Authenication (must begin with string "Bearer
* ")
* @param {string} authorization Authentication (must begin with string
* "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {object} [options] Optional Parameters.
*
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@ -346,21 +395,29 @@ CommentLikes.prototype.deleteLike = function (commentHandle, authorization, opti
if (!callback) {
throw new Error('callback cannot be null.');
}
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (commentHandle === null || commentHandle === undefined || typeof commentHandle.valueOf() !== 'string') {
throw new Error('commentHandle cannot be null or undefined and it must be of type string.');
}
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
throw new Error('appkey must be of type string.');
}
if (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
throw new Error('authorization cannot be null or undefined and it must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/comments/{commentHandle}/likes/me';
'//v0.3/comments/{commentHandle}/likes/me';
requestUrl = requestUrl.replace('{commentHandle}', encodeURIComponent(commentHandle));
// trim all duplicate forward slashes in the url
var regex = /([^:]\/)\/+/gi;
@ -372,9 +429,15 @@ CommentLikes.prototype.deleteLike = function (commentHandle, authorization, opti
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if (appkey !== undefined && appkey !== null) {
httpRequest.headers['appkey'] = appkey;
}
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {

Просмотреть файл

@ -29,8 +29,12 @@ function CommentReplies(client) {
*
* @param {string} commentHandle Comment handle
*
* @param {string} authorization Authenication (must begin with string "Bearer
* ")
* @param {string} authorization Authentication (must begin with string
* "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {object} [options] Optional Parameters.
*
@ -38,6 +42,12 @@ function CommentReplies(client) {
*
* @param {number} [options.limit] Number of items to return
*
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@ -65,6 +75,8 @@ CommentReplies.prototype.getReplies = function (commentHandle, authorization, op
}
var cursor = (options && options.cursor !== undefined) ? options.cursor : undefined;
var limit = (options && options.limit !== undefined) ? options.limit : undefined;
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (commentHandle === null || commentHandle === undefined || typeof commentHandle.valueOf() !== 'string') {
@ -76,16 +88,22 @@ CommentReplies.prototype.getReplies = function (commentHandle, authorization, op
if (limit !== null && limit !== undefined && typeof limit !== 'number') {
throw new Error('limit must be of type number.');
}
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
throw new Error('appkey must be of type string.');
}
if (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
throw new Error('authorization cannot be null or undefined and it must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/comments/{commentHandle}/replies';
'//v0.3/comments/{commentHandle}/replies';
requestUrl = requestUrl.replace('{commentHandle}', encodeURIComponent(commentHandle));
var queryParameters = [];
if (cursor !== null && cursor !== undefined) {
@ -107,9 +125,15 @@ CommentReplies.prototype.getReplies = function (commentHandle, authorization, op
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if (appkey !== undefined && appkey !== null) {
httpRequest.headers['appkey'] = appkey;
}
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {
@ -182,11 +206,21 @@ CommentReplies.prototype.getReplies = function (commentHandle, authorization, op
*
* @param {string} [request.language] Gets or sets reply language
*
* @param {string} authorization Authenication (must begin with string "Bearer
* ")
* @param {string} authorization Authentication (must begin with string
* "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {object} [options] Optional Parameters.
*
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@ -212,6 +246,8 @@ CommentReplies.prototype.postReply = function (commentHandle, request, authoriza
if (!callback) {
throw new Error('callback cannot be null.');
}
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (commentHandle === null || commentHandle === undefined || typeof commentHandle.valueOf() !== 'string') {
@ -220,16 +256,22 @@ CommentReplies.prototype.postReply = function (commentHandle, request, authoriza
if (request === null || request === undefined) {
throw new Error('request cannot be null or undefined.');
}
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
throw new Error('appkey must be of type string.');
}
if (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
throw new Error('authorization cannot be null or undefined and it must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/comments/{commentHandle}/replies';
'//v0.3/comments/{commentHandle}/replies';
requestUrl = requestUrl.replace('{commentHandle}', encodeURIComponent(commentHandle));
// trim all duplicate forward slashes in the url
var regex = /([^:]\/)\/+/gi;
@ -241,9 +283,15 @@ CommentReplies.prototype.postReply = function (commentHandle, request, authoriza
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if (appkey !== undefined && appkey !== null) {
httpRequest.headers['appkey'] = appkey;
}
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {

Просмотреть файл

@ -35,11 +35,21 @@ function CommentReports(client) {
* Possible values include: 'Spam', 'Cyberbullying', 'ChildEndangerment',
* 'Offensive', 'ContentInfringement', 'Other'
*
* @param {string} authorization Authenication (must begin with string "Bearer
* ")
* @param {string} authorization Authentication (must begin with string
* "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {object} [options] Optional Parameters.
*
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@ -64,6 +74,8 @@ CommentReports.prototype.postReport = function (commentHandle, postReportRequest
if (!callback) {
throw new Error('callback cannot be null.');
}
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (commentHandle === null || commentHandle === undefined || typeof commentHandle.valueOf() !== 'string') {
@ -72,16 +84,22 @@ CommentReports.prototype.postReport = function (commentHandle, postReportRequest
if (postReportRequest === null || postReportRequest === undefined) {
throw new Error('postReportRequest cannot be null or undefined.');
}
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
throw new Error('appkey must be of type string.');
}
if (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
throw new Error('authorization cannot be null or undefined and it must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/comments/{commentHandle}/reports';
'//v0.3/comments/{commentHandle}/reports';
requestUrl = requestUrl.replace('{commentHandle}', encodeURIComponent(commentHandle));
// trim all duplicate forward slashes in the url
var regex = /([^:]\/)\/+/gi;
@ -93,9 +111,15 @@ CommentReports.prototype.postReport = function (commentHandle, postReportRequest
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if (appkey !== undefined && appkey !== null) {
httpRequest.headers['appkey'] = appkey;
}
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {

Просмотреть файл

@ -29,11 +29,21 @@ function Comments(client) {
*
* @param {string} commentHandle Comment handle
*
* @param {string} authorization Authenication (must begin with string "Bearer
* ")
* @param {string} authorization Authentication (must begin with string
* "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {object} [options] Optional Parameters.
*
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@ -59,21 +69,29 @@ Comments.prototype.getComment = function (commentHandle, authorization, options,
if (!callback) {
throw new Error('callback cannot be null.');
}
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (commentHandle === null || commentHandle === undefined || typeof commentHandle.valueOf() !== 'string') {
throw new Error('commentHandle cannot be null or undefined and it must be of type string.');
}
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
throw new Error('appkey must be of type string.');
}
if (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
throw new Error('authorization cannot be null or undefined and it must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/comments/{commentHandle}';
'//v0.3/comments/{commentHandle}';
requestUrl = requestUrl.replace('{commentHandle}', encodeURIComponent(commentHandle));
// trim all duplicate forward slashes in the url
var regex = /([^:]\/)\/+/gi;
@ -85,9 +103,15 @@ Comments.prototype.getComment = function (commentHandle, authorization, options,
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if (appkey !== undefined && appkey !== null) {
httpRequest.headers['appkey'] = appkey;
}
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {
@ -154,11 +178,21 @@ Comments.prototype.getComment = function (commentHandle, authorization, options,
*
* @param {string} commentHandle Comment handle
*
* @param {string} authorization Authenication (must begin with string "Bearer
* ")
* @param {string} authorization Authentication (must begin with string
* "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {object} [options] Optional Parameters.
*
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@ -183,21 +217,29 @@ Comments.prototype.deleteComment = function (commentHandle, authorization, optio
if (!callback) {
throw new Error('callback cannot be null.');
}
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (commentHandle === null || commentHandle === undefined || typeof commentHandle.valueOf() !== 'string') {
throw new Error('commentHandle cannot be null or undefined and it must be of type string.');
}
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
throw new Error('appkey must be of type string.');
}
if (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
throw new Error('authorization cannot be null or undefined and it must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/comments/{commentHandle}';
'//v0.3/comments/{commentHandle}';
requestUrl = requestUrl.replace('{commentHandle}', encodeURIComponent(commentHandle));
// trim all duplicate forward slashes in the url
var regex = /([^:]\/)\/+/gi;
@ -209,9 +251,15 @@ Comments.prototype.deleteComment = function (commentHandle, authorization, optio
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if (appkey !== undefined && appkey !== null) {
httpRequest.headers['appkey'] = appkey;
}
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {

Просмотреть файл

@ -29,10 +29,18 @@ function Hashtags(client) {
*
* @param {object} [options] Optional Parameters.
*
* @param {string} [options.appkey] App Key Authentication
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.authorization] Authenication (must begin with
* string "Bearer ")
* @param {string} [options.authorization] Authentication (must begin with
* string "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
@ -60,6 +68,7 @@ Hashtags.prototype.getTrendingHashtags = function (options, callback) {
}
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var authorization = (options && options.authorization !== undefined) ? options.authorization : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
@ -68,13 +77,16 @@ Hashtags.prototype.getTrendingHashtags = function (options, callback) {
if (authorization !== null && authorization !== undefined && typeof authorization.valueOf() !== 'string') {
throw new Error('authorization must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/hashtags/trending';
'//v0.3/hashtags/trending';
// trim all duplicate forward slashes in the url
var regex = /([^:]\/)\/+/gi;
requestUrl = requestUrl.replace(regex, '$1');
@ -91,6 +103,9 @@ Hashtags.prototype.getTrendingHashtags = function (options, callback) {
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {
@ -172,10 +187,18 @@ Hashtags.prototype.getTrendingHashtags = function (options, callback) {
*
* @param {object} [options] Optional Parameters.
*
* @param {string} [options.appkey] App Key Authentication
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.authorization] Authenication (must begin with
* string "Bearer ")
* @param {string} [options.authorization] Authentication (must begin with
* string "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
@ -203,6 +226,7 @@ Hashtags.prototype.getAutocompletedHashtags = function (query, options, callback
}
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var authorization = (options && options.authorization !== undefined) ? options.authorization : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (query === null || query === undefined || typeof query.valueOf() !== 'string') {
@ -214,13 +238,16 @@ Hashtags.prototype.getAutocompletedHashtags = function (query, options, callback
if (authorization !== null && authorization !== undefined && typeof authorization.valueOf() !== 'string') {
throw new Error('authorization must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/hashtags/autocomplete';
'//v0.3/hashtags/autocomplete';
var queryParameters = [];
queryParameters.push('query=' + encodeURIComponent(query));
if (queryParameters.length > 0) {
@ -242,6 +269,9 @@ Hashtags.prototype.getAutocompletedHashtags = function (query, options, callback
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {

Просмотреть файл

@ -44,13 +44,23 @@ function Images(client) {
* @param {string} imageType Image type. Possible values include: 'UserPhoto',
* 'ContentBlob', 'AppIcon'
*
* @param {string} authorization Authenication (must begin with string "Bearer
* ")
* @param {string} authorization Authentication (must begin with string
* "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {object} image MIME encoded contents of the image
*
* @param {object} [options] Optional Parameters.
*
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@ -76,6 +86,8 @@ Images.prototype.postImage = function (imageType, authorization, image, options,
if (!callback) {
throw new Error('callback cannot be null.');
}
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (imageType) {
@ -86,9 +98,15 @@ Images.prototype.postImage = function (imageType, authorization, image, options,
} else {
throw new Error('imageType cannot be null or undefined.');
}
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
throw new Error('appkey must be of type string.');
}
if (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
throw new Error('authorization cannot be null or undefined and it must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
if (image === null || image === undefined) {
throw new Error('image cannot be null or undefined and it must be of type object.');
}
@ -98,7 +116,7 @@ Images.prototype.postImage = function (imageType, authorization, image, options,
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/images/{imageType}';
'//v0.3/images/{imageType}';
requestUrl = requestUrl.replace('{imageType}', encodeURIComponent(imageType));
// trim all duplicate forward slashes in the url
var regex = /([^:]\/)\/+/gi;
@ -110,9 +128,15 @@ Images.prototype.postImage = function (imageType, authorization, image, options,
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if (appkey !== undefined && appkey !== null) {
httpRequest.headers['appkey'] = appkey;
}
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {
@ -183,10 +207,18 @@ Images.prototype.postImage = function (imageType, authorization, image, options,
*
* @param {object} [options] Optional Parameters.
*
* @param {string} [options.appkey] App Key Authentication
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.authorization] Authenication (must begin with
* string "Bearer ")
* @param {string} [options.authorization] Authentication (must begin with
* string "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
@ -214,6 +246,7 @@ Images.prototype.getImage = function (blobHandle, options, callback) {
}
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var authorization = (options && options.authorization !== undefined) ? options.authorization : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (blobHandle === null || blobHandle === undefined || typeof blobHandle.valueOf() !== 'string') {
@ -225,13 +258,16 @@ Images.prototype.getImage = function (blobHandle, options, callback) {
if (authorization !== null && authorization !== undefined && typeof authorization.valueOf() !== 'string') {
throw new Error('authorization must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/images/{blobHandle}';
'//v0.3/images/{blobHandle}';
requestUrl = requestUrl.replace('{blobHandle}', encodeURIComponent(blobHandle));
// trim all duplicate forward slashes in the url
var regex = /([^:]\/)\/+/gi;
@ -249,6 +285,9 @@ Images.prototype.getImage = function (blobHandle, options, callback) {
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {

1334
operations/index.d.ts поставляемый

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -30,13 +30,23 @@ function MyAppFollowing(client) {
*
* @param {string} appHandle App handle
*
* @param {string} authorization Authenication (must begin with string "Bearer
* ")
* @param {string} authorization Authentication (must begin with string
* "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {object} [options] Optional Parameters.
*
* @param {string} [options.cursor] Current read cursor
*
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@ -64,6 +74,8 @@ MyAppFollowing.prototype.getUsers = function (appHandle, authorization, options,
throw new Error('callback cannot be null.');
}
var cursor = (options && options.cursor !== undefined) ? options.cursor : undefined;
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (appHandle === null || appHandle === undefined || typeof appHandle.valueOf() !== 'string') {
@ -72,16 +84,22 @@ MyAppFollowing.prototype.getUsers = function (appHandle, authorization, options,
if (cursor !== null && cursor !== undefined && typeof cursor.valueOf() !== 'string') {
throw new Error('cursor must be of type string.');
}
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
throw new Error('appkey must be of type string.');
}
if (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
throw new Error('authorization cannot be null or undefined and it must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/users/me/apps/{appHandle}/following/difference';
'//v0.3/users/me/apps/{appHandle}/following/difference';
requestUrl = requestUrl.replace('{appHandle}', encodeURIComponent(appHandle));
var queryParameters = [];
if (cursor !== null && cursor !== undefined) {
@ -100,9 +118,15 @@ MyAppFollowing.prototype.getUsers = function (appHandle, authorization, options,
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if (appkey !== undefined && appkey !== null) {
httpRequest.headers['appkey'] = appkey;
}
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {

Просмотреть файл

@ -27,11 +27,21 @@ function MyApps(client) {
/**
* @summary Get my list of Social Plus apps
*
* @param {string} authorization Authenication (must begin with string "Bearer
* ")
* @param {string} authorization Authentication (must begin with string
* "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {object} [options] Optional Parameters.
*
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@ -56,18 +66,26 @@ MyApps.prototype.getApps = function (authorization, options, callback) {
if (!callback) {
throw new Error('callback cannot be null.');
}
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
throw new Error('appkey must be of type string.');
}
if (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
throw new Error('authorization cannot be null or undefined and it must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/users/me/apps';
'//v0.3/users/me/apps';
// trim all duplicate forward slashes in the url
var regex = /([^:]\/)\/+/gi;
requestUrl = requestUrl.replace(regex, '$1');
@ -78,9 +96,15 @@ MyApps.prototype.getApps = function (authorization, options, callback) {
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if (appkey !== undefined && appkey !== null) {
httpRequest.headers['appkey'] = appkey;
}
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {

Просмотреть файл

@ -27,8 +27,12 @@ function MyBlockedUsers(client) {
/**
* @summary Get my blocked users
*
* @param {string} authorization Authenication (must begin with string "Bearer
* ")
* @param {string} authorization Authentication (must begin with string
* "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {object} [options] Optional Parameters.
*
@ -36,6 +40,12 @@ function MyBlockedUsers(client) {
*
* @param {number} [options.limit] Number of items to return
*
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@ -64,6 +74,8 @@ MyBlockedUsers.prototype.getBlockedUsers = function (authorization, options, cal
}
var cursor = (options && options.cursor !== undefined) ? options.cursor : undefined;
var limit = (options && options.limit !== undefined) ? options.limit : undefined;
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (cursor !== null && cursor !== undefined && typeof cursor.valueOf() !== 'string') {
@ -72,16 +84,22 @@ MyBlockedUsers.prototype.getBlockedUsers = function (authorization, options, cal
if (limit !== null && limit !== undefined && typeof limit !== 'number') {
throw new Error('limit must be of type number.');
}
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
throw new Error('appkey must be of type string.');
}
if (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
throw new Error('authorization cannot be null or undefined and it must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/users/me/blocked_users';
'//v0.3/users/me/blocked_users';
var queryParameters = [];
if (cursor !== null && cursor !== undefined) {
queryParameters.push('cursor=' + encodeURIComponent(cursor));
@ -102,9 +120,15 @@ MyBlockedUsers.prototype.getBlockedUsers = function (authorization, options, cal
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if (appkey !== undefined && appkey !== null) {
httpRequest.headers['appkey'] = appkey;
}
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {
@ -173,11 +197,21 @@ MyBlockedUsers.prototype.getBlockedUsers = function (authorization, options, cal
*
* @param {string} [request.userHandle] Gets or sets user handle
*
* @param {string} authorization Authenication (must begin with string "Bearer
* ")
* @param {string} authorization Authentication (must begin with string
* "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {object} [options] Optional Parameters.
*
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@ -202,21 +236,29 @@ MyBlockedUsers.prototype.postBlockedUser = function (request, authorization, opt
if (!callback) {
throw new Error('callback cannot be null.');
}
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (request === null || request === undefined) {
throw new Error('request cannot be null or undefined.');
}
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
throw new Error('appkey must be of type string.');
}
if (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
throw new Error('authorization cannot be null or undefined and it must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/users/me/blocked_users';
'//v0.3/users/me/blocked_users';
// trim all duplicate forward slashes in the url
var regex = /([^:]\/)\/+/gi;
requestUrl = requestUrl.replace(regex, '$1');
@ -227,9 +269,15 @@ MyBlockedUsers.prototype.postBlockedUser = function (request, authorization, opt
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if (appkey !== undefined && appkey !== null) {
httpRequest.headers['appkey'] = appkey;
}
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {
@ -316,11 +364,21 @@ MyBlockedUsers.prototype.postBlockedUser = function (request, authorization, opt
*
* @param {string} userHandle User handle
*
* @param {string} authorization Authenication (must begin with string "Bearer
* ")
* @param {string} authorization Authentication (must begin with string
* "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {object} [options] Optional Parameters.
*
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.userHandle1] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@ -345,21 +403,29 @@ MyBlockedUsers.prototype.deleteBlockedUser = function (userHandle, authorization
if (!callback) {
throw new Error('callback cannot be null.');
}
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var userHandle1 = (options && options.userHandle1 !== undefined) ? options.userHandle1 : undefined;
// Validate
try {
if (userHandle === null || userHandle === undefined || typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle cannot be null or undefined and it must be of type string.');
}
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
throw new Error('appkey must be of type string.');
}
if (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
throw new Error('authorization cannot be null or undefined and it must be of type string.');
}
if (userHandle1 !== null && userHandle1 !== undefined && typeof userHandle1.valueOf() !== 'string') {
throw new Error('userHandle1 must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/users/me/blocked_users/{userHandle}';
'//v0.3/users/me/blocked_users/{userHandle}';
requestUrl = requestUrl.replace('{userHandle}', encodeURIComponent(userHandle));
// trim all duplicate forward slashes in the url
var regex = /([^:]\/)\/+/gi;
@ -371,9 +437,15 @@ MyBlockedUsers.prototype.deleteBlockedUser = function (userHandle, authorization
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if (appkey !== undefined && appkey !== null) {
httpRequest.headers['appkey'] = appkey;
}
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle1 !== undefined && userHandle1 !== null) {
httpRequest.headers['UserHandle'] = userHandle1;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {

Просмотреть файл

@ -27,8 +27,12 @@ function MyFollowers(client) {
/**
* @summary Get my followers
*
* @param {string} authorization Authenication (must begin with string "Bearer
* ")
* @param {string} authorization Authentication (must begin with string
* "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {object} [options] Optional Parameters.
*
@ -36,6 +40,12 @@ function MyFollowers(client) {
*
* @param {number} [options.limit] Number of items to return
*
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@ -64,6 +74,8 @@ MyFollowers.prototype.getFollowers = function (authorization, options, callback)
}
var cursor = (options && options.cursor !== undefined) ? options.cursor : undefined;
var limit = (options && options.limit !== undefined) ? options.limit : undefined;
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (cursor !== null && cursor !== undefined && typeof cursor.valueOf() !== 'string') {
@ -72,16 +84,22 @@ MyFollowers.prototype.getFollowers = function (authorization, options, callback)
if (limit !== null && limit !== undefined && typeof limit !== 'number') {
throw new Error('limit must be of type number.');
}
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
throw new Error('appkey must be of type string.');
}
if (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
throw new Error('authorization cannot be null or undefined and it must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/users/me/followers';
'//v0.3/users/me/followers';
var queryParameters = [];
if (cursor !== null && cursor !== undefined) {
queryParameters.push('cursor=' + encodeURIComponent(cursor));
@ -102,9 +120,15 @@ MyFollowers.prototype.getFollowers = function (authorization, options, callback)
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if (appkey !== undefined && appkey !== null) {
httpRequest.headers['appkey'] = appkey;
}
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {
@ -173,11 +197,21 @@ MyFollowers.prototype.getFollowers = function (authorization, options, callback)
*
* @param {string} [request.userHandle] Gets or sets user handle
*
* @param {string} authorization Authenication (must begin with string "Bearer
* ")
* @param {string} authorization Authentication (must begin with string
* "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {object} [options] Optional Parameters.
*
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@ -202,21 +236,29 @@ MyFollowers.prototype.postFollower = function (request, authorization, options,
if (!callback) {
throw new Error('callback cannot be null.');
}
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (request === null || request === undefined) {
throw new Error('request cannot be null or undefined.');
}
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
throw new Error('appkey must be of type string.');
}
if (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
throw new Error('authorization cannot be null or undefined and it must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/users/me/followers';
'//v0.3/users/me/followers';
// trim all duplicate forward slashes in the url
var regex = /([^:]\/)\/+/gi;
requestUrl = requestUrl.replace(regex, '$1');
@ -227,9 +269,15 @@ MyFollowers.prototype.postFollower = function (request, authorization, options,
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if (appkey !== undefined && appkey !== null) {
httpRequest.headers['appkey'] = appkey;
}
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {
@ -316,11 +364,21 @@ MyFollowers.prototype.postFollower = function (request, authorization, options,
*
* @param {string} userHandle User handle
*
* @param {string} authorization Authenication (must begin with string "Bearer
* ")
* @param {string} authorization Authentication (must begin with string
* "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {object} [options] Optional Parameters.
*
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.userHandle1] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@ -345,21 +403,29 @@ MyFollowers.prototype.deleteFollower = function (userHandle, authorization, opti
if (!callback) {
throw new Error('callback cannot be null.');
}
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var userHandle1 = (options && options.userHandle1 !== undefined) ? options.userHandle1 : undefined;
// Validate
try {
if (userHandle === null || userHandle === undefined || typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle cannot be null or undefined and it must be of type string.');
}
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
throw new Error('appkey must be of type string.');
}
if (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
throw new Error('authorization cannot be null or undefined and it must be of type string.');
}
if (userHandle1 !== null && userHandle1 !== undefined && typeof userHandle1.valueOf() !== 'string') {
throw new Error('userHandle1 must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/users/me/followers/{userHandle}';
'//v0.3/users/me/followers/{userHandle}';
requestUrl = requestUrl.replace('{userHandle}', encodeURIComponent(userHandle));
// trim all duplicate forward slashes in the url
var regex = /([^:]\/)\/+/gi;
@ -371,9 +437,15 @@ MyFollowers.prototype.deleteFollower = function (userHandle, authorization, opti
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if (appkey !== undefined && appkey !== null) {
httpRequest.headers['appkey'] = appkey;
}
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle1 !== undefined && userHandle1 !== null) {
httpRequest.headers['UserHandle'] = userHandle1;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {

Просмотреть файл

@ -27,8 +27,12 @@ function MyFollowing(client) {
/**
* @summary Get my following
*
* @param {string} authorization Authenication (must begin with string "Bearer
* ")
* @param {string} authorization Authentication (must begin with string
* "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {object} [options] Optional Parameters.
*
@ -36,6 +40,12 @@ function MyFollowing(client) {
*
* @param {number} [options.limit] Number of items to return
*
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@ -64,6 +74,8 @@ MyFollowing.prototype.getFollowing = function (authorization, options, callback)
}
var cursor = (options && options.cursor !== undefined) ? options.cursor : undefined;
var limit = (options && options.limit !== undefined) ? options.limit : undefined;
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (cursor !== null && cursor !== undefined && typeof cursor.valueOf() !== 'string') {
@ -72,16 +84,22 @@ MyFollowing.prototype.getFollowing = function (authorization, options, callback)
if (limit !== null && limit !== undefined && typeof limit !== 'number') {
throw new Error('limit must be of type number.');
}
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
throw new Error('appkey must be of type string.');
}
if (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
throw new Error('authorization cannot be null or undefined and it must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/users/me/following';
'//v0.3/users/me/following';
var queryParameters = [];
if (cursor !== null && cursor !== undefined) {
queryParameters.push('cursor=' + encodeURIComponent(cursor));
@ -102,9 +120,15 @@ MyFollowing.prototype.getFollowing = function (authorization, options, callback)
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if (appkey !== undefined && appkey !== null) {
httpRequest.headers['appkey'] = appkey;
}
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {
@ -173,11 +197,21 @@ MyFollowing.prototype.getFollowing = function (authorization, options, callback)
*
* @param {string} [request.userHandle] Gets or sets user handle
*
* @param {string} authorization Authenication (must begin with string "Bearer
* ")
* @param {string} authorization Authentication (must begin with string
* "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {object} [options] Optional Parameters.
*
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@ -202,21 +236,29 @@ MyFollowing.prototype.postFollowing = function (request, authorization, options,
if (!callback) {
throw new Error('callback cannot be null.');
}
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (request === null || request === undefined) {
throw new Error('request cannot be null or undefined.');
}
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
throw new Error('appkey must be of type string.');
}
if (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
throw new Error('authorization cannot be null or undefined and it must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/users/me/following';
'//v0.3/users/me/following';
// trim all duplicate forward slashes in the url
var regex = /([^:]\/)\/+/gi;
requestUrl = requestUrl.replace(regex, '$1');
@ -227,9 +269,15 @@ MyFollowing.prototype.postFollowing = function (request, authorization, options,
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if (appkey !== undefined && appkey !== null) {
httpRequest.headers['appkey'] = appkey;
}
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {
@ -316,11 +364,21 @@ MyFollowing.prototype.postFollowing = function (request, authorization, options,
*
* @param {string} userHandle User handle
*
* @param {string} authorization Authenication (must begin with string "Bearer
* ")
* @param {string} authorization Authentication (must begin with string
* "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {object} [options] Optional Parameters.
*
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.userHandle1] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@ -345,21 +403,29 @@ MyFollowing.prototype.deleteFollowing = function (userHandle, authorization, opt
if (!callback) {
throw new Error('callback cannot be null.');
}
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var userHandle1 = (options && options.userHandle1 !== undefined) ? options.userHandle1 : undefined;
// Validate
try {
if (userHandle === null || userHandle === undefined || typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle cannot be null or undefined and it must be of type string.');
}
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
throw new Error('appkey must be of type string.');
}
if (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
throw new Error('authorization cannot be null or undefined and it must be of type string.');
}
if (userHandle1 !== null && userHandle1 !== undefined && typeof userHandle1.valueOf() !== 'string') {
throw new Error('userHandle1 must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/users/me/following/{userHandle}';
'//v0.3/users/me/following/{userHandle}';
requestUrl = requestUrl.replace('{userHandle}', encodeURIComponent(userHandle));
// trim all duplicate forward slashes in the url
var regex = /([^:]\/)\/+/gi;
@ -371,9 +437,15 @@ MyFollowing.prototype.deleteFollowing = function (userHandle, authorization, opt
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if (appkey !== undefined && appkey !== null) {
httpRequest.headers['appkey'] = appkey;
}
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle1 !== undefined && userHandle1 !== null) {
httpRequest.headers['UserHandle'] = userHandle1;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {
@ -446,11 +518,21 @@ MyFollowing.prototype.deleteFollowing = function (userHandle, authorization, opt
*
* @param {string} topicHandle Topic handle
*
* @param {string} authorization Authenication (must begin with string "Bearer
* ")
* @param {string} authorization Authentication (must begin with string
* "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {object} [options] Optional Parameters.
*
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@ -475,21 +557,29 @@ MyFollowing.prototype.deleteTopic = function (topicHandle, authorization, option
if (!callback) {
throw new Error('callback cannot be null.');
}
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (topicHandle === null || topicHandle === undefined || typeof topicHandle.valueOf() !== 'string') {
throw new Error('topicHandle cannot be null or undefined and it must be of type string.');
}
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
throw new Error('appkey must be of type string.');
}
if (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
throw new Error('authorization cannot be null or undefined and it must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/users/me/following/topics/{topicHandle}';
'//v0.3/users/me/following/topics/{topicHandle}';
requestUrl = requestUrl.replace('{topicHandle}', encodeURIComponent(topicHandle));
// trim all duplicate forward slashes in the url
var regex = /([^:]\/)\/+/gi;
@ -501,9 +591,15 @@ MyFollowing.prototype.deleteTopic = function (topicHandle, authorization, option
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if (appkey !== undefined && appkey !== null) {
httpRequest.headers['appkey'] = appkey;
}
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {
@ -574,8 +670,12 @@ MyFollowing.prototype.deleteTopic = function (topicHandle, authorization, option
/**
* @summary Get my following topic feed
*
* @param {string} authorization Authenication (must begin with string "Bearer
* ")
* @param {string} authorization Authentication (must begin with string
* "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {object} [options] Optional Parameters.
*
@ -583,6 +683,12 @@ MyFollowing.prototype.deleteTopic = function (topicHandle, authorization, option
*
* @param {number} [options.limit] Number of items to return
*
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@ -610,6 +716,8 @@ MyFollowing.prototype.getTopics = function (authorization, options, callback) {
}
var cursor = (options && options.cursor !== undefined) ? options.cursor : undefined;
var limit = (options && options.limit !== undefined) ? options.limit : undefined;
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (cursor !== null && cursor !== undefined && typeof cursor.valueOf() !== 'string') {
@ -618,16 +726,22 @@ MyFollowing.prototype.getTopics = function (authorization, options, callback) {
if (limit !== null && limit !== undefined && typeof limit !== 'number') {
throw new Error('limit must be of type number.');
}
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
throw new Error('appkey must be of type string.');
}
if (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
throw new Error('authorization cannot be null or undefined and it must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/users/me/following/topics';
'//v0.3/users/me/following/topics';
var queryParameters = [];
if (cursor !== null && cursor !== undefined) {
queryParameters.push('cursor=' + encodeURIComponent(cursor));
@ -648,9 +762,15 @@ MyFollowing.prototype.getTopics = function (authorization, options, callback) {
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if (appkey !== undefined && appkey !== null) {
httpRequest.headers['appkey'] = appkey;
}
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {
@ -715,8 +835,12 @@ MyFollowing.prototype.getTopics = function (authorization, options, callback) {
/**
* @summary Get my following activity feed
*
* @param {string} authorization Authenication (must begin with string "Bearer
* ")
* @param {string} authorization Authentication (must begin with string
* "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {object} [options] Optional Parameters.
*
@ -724,6 +848,12 @@ MyFollowing.prototype.getTopics = function (authorization, options, callback) {
*
* @param {number} [options.limit] Number of items to return
*
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@ -752,6 +882,8 @@ MyFollowing.prototype.getActivities = function (authorization, options, callback
}
var cursor = (options && options.cursor !== undefined) ? options.cursor : undefined;
var limit = (options && options.limit !== undefined) ? options.limit : undefined;
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (cursor !== null && cursor !== undefined && typeof cursor.valueOf() !== 'string') {
@ -760,16 +892,22 @@ MyFollowing.prototype.getActivities = function (authorization, options, callback
if (limit !== null && limit !== undefined && typeof limit !== 'number') {
throw new Error('limit must be of type number.');
}
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
throw new Error('appkey must be of type string.');
}
if (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
throw new Error('authorization cannot be null or undefined and it must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/users/me/following/activities';
'//v0.3/users/me/following/activities';
var queryParameters = [];
if (cursor !== null && cursor !== undefined) {
queryParameters.push('cursor=' + encodeURIComponent(cursor));
@ -790,9 +928,15 @@ MyFollowing.prototype.getActivities = function (authorization, options, callback
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if (appkey !== undefined && appkey !== null) {
httpRequest.headers['appkey'] = appkey;
}
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {

Просмотреть файл

@ -27,8 +27,12 @@ function MyLikes(client) {
/**
* @summary Get my liked topics
*
* @param {string} authorization Authenication (must begin with string "Bearer
* ")
* @param {string} authorization Authentication (must begin with string
* "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {object} [options] Optional Parameters.
*
@ -36,6 +40,12 @@ function MyLikes(client) {
*
* @param {number} [options.limit] Number of items to return
*
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@ -63,6 +73,8 @@ MyLikes.prototype.getLikedTopics = function (authorization, options, callback) {
}
var cursor = (options && options.cursor !== undefined) ? options.cursor : undefined;
var limit = (options && options.limit !== undefined) ? options.limit : undefined;
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (cursor !== null && cursor !== undefined && typeof cursor.valueOf() !== 'string') {
@ -71,16 +83,22 @@ MyLikes.prototype.getLikedTopics = function (authorization, options, callback) {
if (limit !== null && limit !== undefined && typeof limit !== 'number') {
throw new Error('limit must be of type number.');
}
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
throw new Error('appkey must be of type string.');
}
if (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
throw new Error('authorization cannot be null or undefined and it must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/users/me/likes/topics';
'//v0.3/users/me/likes/topics';
var queryParameters = [];
if (cursor !== null && cursor !== undefined) {
queryParameters.push('cursor=' + encodeURIComponent(cursor));
@ -101,9 +119,15 @@ MyLikes.prototype.getLikedTopics = function (authorization, options, callback) {
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if (appkey !== undefined && appkey !== null) {
httpRequest.headers['appkey'] = appkey;
}
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {

Просмотреть файл

@ -27,11 +27,21 @@ function MyLinkedAccounts(client) {
/**
* @summary Get linked accounts
*
* @param {string} authorization Authenication (must begin with string "Bearer
* ")
* @param {string} authorization Authentication (must begin with string
* "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {object} [options] Optional Parameters.
*
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@ -56,18 +66,26 @@ MyLinkedAccounts.prototype.getLinkedAccounts = function (authorization, options,
if (!callback) {
throw new Error('callback cannot be null.');
}
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
throw new Error('appkey must be of type string.');
}
if (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
throw new Error('authorization cannot be null or undefined and it must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/users/me/linked_accounts';
'//v0.3/users/me/linked_accounts';
// trim all duplicate forward slashes in the url
var regex = /([^:]\/)\/+/gi;
requestUrl = requestUrl.replace(regex, '$1');
@ -78,9 +96,15 @@ MyLinkedAccounts.prototype.getLinkedAccounts = function (authorization, options,
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if (appkey !== undefined && appkey !== null) {
httpRequest.headers['appkey'] = appkey;
}
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {
@ -176,11 +200,21 @@ MyLinkedAccounts.prototype.getLinkedAccounts = function (authorization, options,
* but they issue request tokens
* and verifiers.
*
* @param {string} authorization Authenication (must begin with string "Bearer
* ")
* @param {string} authorization Authentication (must begin with string
* "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {object} [options] Optional Parameters.
*
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@ -205,21 +239,29 @@ MyLinkedAccounts.prototype.postLinkedAccount = function (request, authorization,
if (!callback) {
throw new Error('callback cannot be null.');
}
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (request === null || request === undefined) {
throw new Error('request cannot be null or undefined.');
}
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
throw new Error('appkey must be of type string.');
}
if (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
throw new Error('authorization cannot be null or undefined and it must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/users/me/linked_accounts';
'//v0.3/users/me/linked_accounts';
// trim all duplicate forward slashes in the url
var regex = /([^:]\/)\/+/gi;
requestUrl = requestUrl.replace(regex, '$1');
@ -230,9 +272,15 @@ MyLinkedAccounts.prototype.postLinkedAccount = function (request, authorization,
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if (appkey !== undefined && appkey !== null) {
httpRequest.headers['appkey'] = appkey;
}
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {
@ -320,11 +368,21 @@ MyLinkedAccounts.prototype.postLinkedAccount = function (request, authorization,
* @param {string} identityProvider Identity provider type. Possible values
* include: 'Facebook', 'Microsoft', 'Google', 'Twitter', 'Beihai'
*
* @param {string} authorization Authenication (must begin with string "Bearer
* ")
* @param {string} authorization Authentication (must begin with string
* "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {object} [options] Optional Parameters.
*
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@ -349,6 +407,8 @@ MyLinkedAccounts.prototype.deleteLinkedAccount = function (identityProvider, aut
if (!callback) {
throw new Error('callback cannot be null.');
}
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (identityProvider) {
@ -359,16 +419,22 @@ MyLinkedAccounts.prototype.deleteLinkedAccount = function (identityProvider, aut
} else {
throw new Error('identityProvider cannot be null or undefined.');
}
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
throw new Error('appkey must be of type string.');
}
if (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
throw new Error('authorization cannot be null or undefined and it must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/users/me/linked_accounts/{identityProvider}';
'//v0.3/users/me/linked_accounts/{identityProvider}';
requestUrl = requestUrl.replace('{identityProvider}', encodeURIComponent(identityProvider));
// trim all duplicate forward slashes in the url
var regex = /([^:]\/)\/+/gi;
@ -380,9 +446,15 @@ MyLinkedAccounts.prototype.deleteLinkedAccount = function (identityProvider, aut
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if (appkey !== undefined && appkey !== null) {
httpRequest.headers['appkey'] = appkey;
}
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {

Просмотреть файл

@ -32,11 +32,21 @@ function MyNotifications(client) {
* @param {string} [request.readActivityHandle] Gets or sets last read
* activity handle
*
* @param {string} authorization Authenication (must begin with string "Bearer
* ")
* @param {string} authorization Authentication (must begin with string
* "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {object} [options] Optional Parameters.
*
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@ -61,21 +71,29 @@ MyNotifications.prototype.putNotificationsStatus = function (request, authorizat
if (!callback) {
throw new Error('callback cannot be null.');
}
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (request === null || request === undefined) {
throw new Error('request cannot be null or undefined.');
}
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
throw new Error('appkey must be of type string.');
}
if (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
throw new Error('authorization cannot be null or undefined and it must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/users/me/notifications/status';
'//v0.3/users/me/notifications/status';
// trim all duplicate forward slashes in the url
var regex = /([^:]\/)\/+/gi;
requestUrl = requestUrl.replace(regex, '$1');
@ -86,9 +104,15 @@ MyNotifications.prototype.putNotificationsStatus = function (request, authorizat
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if (appkey !== undefined && appkey !== null) {
httpRequest.headers['appkey'] = appkey;
}
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {
@ -173,8 +197,12 @@ MyNotifications.prototype.putNotificationsStatus = function (request, authorizat
/**
* @summary Get notifications
*
* @param {string} authorization Authenication (must begin with string "Bearer
* ")
* @param {string} authorization Authentication (must begin with string
* "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {object} [options] Optional Parameters.
*
@ -182,6 +210,12 @@ MyNotifications.prototype.putNotificationsStatus = function (request, authorizat
*
* @param {number} [options.limit] Number of items to return
*
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@ -210,6 +244,8 @@ MyNotifications.prototype.getNotifications = function (authorization, options, c
}
var cursor = (options && options.cursor !== undefined) ? options.cursor : undefined;
var limit = (options && options.limit !== undefined) ? options.limit : undefined;
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (cursor !== null && cursor !== undefined && typeof cursor.valueOf() !== 'string') {
@ -218,16 +254,22 @@ MyNotifications.prototype.getNotifications = function (authorization, options, c
if (limit !== null && limit !== undefined && typeof limit !== 'number') {
throw new Error('limit must be of type number.');
}
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
throw new Error('appkey must be of type string.');
}
if (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
throw new Error('authorization cannot be null or undefined and it must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/users/me/notifications';
'//v0.3/users/me/notifications';
var queryParameters = [];
if (cursor !== null && cursor !== undefined) {
queryParameters.push('cursor=' + encodeURIComponent(cursor));
@ -248,9 +290,15 @@ MyNotifications.prototype.getNotifications = function (authorization, options, c
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if (appkey !== undefined && appkey !== null) {
httpRequest.headers['appkey'] = appkey;
}
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {
@ -315,11 +363,21 @@ MyNotifications.prototype.getNotifications = function (authorization, options, c
/**
* @summary Get unread notifications count
*
* @param {string} authorization Authenication (must begin with string "Bearer
* ")
* @param {string} authorization Authentication (must begin with string
* "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {object} [options] Optional Parameters.
*
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@ -345,18 +403,26 @@ MyNotifications.prototype.getNotificationsCount = function (authorization, optio
if (!callback) {
throw new Error('callback cannot be null.');
}
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
throw new Error('appkey must be of type string.');
}
if (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
throw new Error('authorization cannot be null or undefined and it must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/users/me/notifications/count';
'//v0.3/users/me/notifications/count';
// trim all duplicate forward slashes in the url
var regex = /([^:]\/)\/+/gi;
requestUrl = requestUrl.replace(regex, '$1');
@ -367,9 +433,15 @@ MyNotifications.prototype.getNotificationsCount = function (authorization, optio
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if (appkey !== undefined && appkey !== null) {
httpRequest.headers['appkey'] = appkey;
}
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {

Просмотреть файл

@ -29,11 +29,21 @@ function MyPendingUsers(client) {
*
* @param {string} userHandle User handle
*
* @param {string} authorization Authenication (must begin with string "Bearer
* ")
* @param {string} authorization Authentication (must begin with string
* "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {object} [options] Optional Parameters.
*
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.userHandle1] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@ -58,21 +68,29 @@ MyPendingUsers.prototype.deletePendingUser = function (userHandle, authorization
if (!callback) {
throw new Error('callback cannot be null.');
}
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var userHandle1 = (options && options.userHandle1 !== undefined) ? options.userHandle1 : undefined;
// Validate
try {
if (userHandle === null || userHandle === undefined || typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle cannot be null or undefined and it must be of type string.');
}
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
throw new Error('appkey must be of type string.');
}
if (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
throw new Error('authorization cannot be null or undefined and it must be of type string.');
}
if (userHandle1 !== null && userHandle1 !== undefined && typeof userHandle1.valueOf() !== 'string') {
throw new Error('userHandle1 must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/users/me/pending_users/{userHandle}';
'//v0.3/users/me/pending_users/{userHandle}';
requestUrl = requestUrl.replace('{userHandle}', encodeURIComponent(userHandle));
// trim all duplicate forward slashes in the url
var regex = /([^:]\/)\/+/gi;
@ -84,9 +102,15 @@ MyPendingUsers.prototype.deletePendingUser = function (userHandle, authorization
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if (appkey !== undefined && appkey !== null) {
httpRequest.headers['appkey'] = appkey;
}
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle1 !== undefined && userHandle1 !== null) {
httpRequest.headers['UserHandle'] = userHandle1;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {
@ -157,8 +181,12 @@ MyPendingUsers.prototype.deletePendingUser = function (userHandle, authorization
/**
* @summary Get my pending users
*
* @param {string} authorization Authenication (must begin with string "Bearer
* ")
* @param {string} authorization Authentication (must begin with string
* "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {object} [options] Optional Parameters.
*
@ -166,6 +194,12 @@ MyPendingUsers.prototype.deletePendingUser = function (userHandle, authorization
*
* @param {number} [options.limit] Number of items to return
*
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@ -194,6 +228,8 @@ MyPendingUsers.prototype.getPendingUsers = function (authorization, options, cal
}
var cursor = (options && options.cursor !== undefined) ? options.cursor : undefined;
var limit = (options && options.limit !== undefined) ? options.limit : undefined;
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (cursor !== null && cursor !== undefined && typeof cursor.valueOf() !== 'string') {
@ -202,16 +238,22 @@ MyPendingUsers.prototype.getPendingUsers = function (authorization, options, cal
if (limit !== null && limit !== undefined && typeof limit !== 'number') {
throw new Error('limit must be of type number.');
}
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
throw new Error('appkey must be of type string.');
}
if (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
throw new Error('authorization cannot be null or undefined and it must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/users/me/pending_users';
'//v0.3/users/me/pending_users';
var queryParameters = [];
if (cursor !== null && cursor !== undefined) {
queryParameters.push('cursor=' + encodeURIComponent(cursor));
@ -232,9 +274,15 @@ MyPendingUsers.prototype.getPendingUsers = function (authorization, options, cal
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if (appkey !== undefined && appkey !== null) {
httpRequest.headers['appkey'] = appkey;
}
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {
@ -299,11 +347,21 @@ MyPendingUsers.prototype.getPendingUsers = function (authorization, options, cal
/**
* @summary Get my pending users count
*
* @param {string} authorization Authenication (must begin with string "Bearer
* ")
* @param {string} authorization Authentication (must begin with string
* "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {object} [options] Optional Parameters.
*
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@ -329,18 +387,26 @@ MyPendingUsers.prototype.getPendingUsersCount = function (authorization, options
if (!callback) {
throw new Error('callback cannot be null.');
}
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
throw new Error('appkey must be of type string.');
}
if (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
throw new Error('authorization cannot be null or undefined and it must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/users/me/pending_users/count';
'//v0.3/users/me/pending_users/count';
// trim all duplicate forward slashes in the url
var regex = /([^:]\/)\/+/gi;
requestUrl = requestUrl.replace(regex, '$1');
@ -351,9 +417,15 @@ MyPendingUsers.prototype.getPendingUsersCount = function (authorization, options
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if (appkey !== undefined && appkey !== null) {
httpRequest.headers['appkey'] = appkey;
}
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {

Просмотреть файл

@ -27,8 +27,12 @@ function MyPins(client) {
/**
* @summary Get my pins
*
* @param {string} authorization Authenication (must begin with string "Bearer
* ")
* @param {string} authorization Authentication (must begin with string
* "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {object} [options] Optional Parameters.
*
@ -36,6 +40,12 @@ function MyPins(client) {
*
* @param {number} [options.limit] Number of items to return
*
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@ -63,6 +73,8 @@ MyPins.prototype.getPins = function (authorization, options, callback) {
}
var cursor = (options && options.cursor !== undefined) ? options.cursor : undefined;
var limit = (options && options.limit !== undefined) ? options.limit : undefined;
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (cursor !== null && cursor !== undefined && typeof cursor.valueOf() !== 'string') {
@ -71,16 +83,22 @@ MyPins.prototype.getPins = function (authorization, options, callback) {
if (limit !== null && limit !== undefined && typeof limit !== 'number') {
throw new Error('limit must be of type number.');
}
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
throw new Error('appkey must be of type string.');
}
if (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
throw new Error('authorization cannot be null or undefined and it must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/users/me/pins';
'//v0.3/users/me/pins';
var queryParameters = [];
if (cursor !== null && cursor !== undefined) {
queryParameters.push('cursor=' + encodeURIComponent(cursor));
@ -101,9 +119,15 @@ MyPins.prototype.getPins = function (authorization, options, callback) {
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if (appkey !== undefined && appkey !== null) {
httpRequest.headers['appkey'] = appkey;
}
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {
@ -172,11 +196,21 @@ MyPins.prototype.getPins = function (authorization, options, callback) {
*
* @param {string} [request.topicHandle] Gets or sets topic handle
*
* @param {string} authorization Authenication (must begin with string "Bearer
* ")
* @param {string} authorization Authentication (must begin with string
* "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {object} [options] Optional Parameters.
*
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@ -201,21 +235,29 @@ MyPins.prototype.postPin = function (request, authorization, options, callback)
if (!callback) {
throw new Error('callback cannot be null.');
}
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (request === null || request === undefined) {
throw new Error('request cannot be null or undefined.');
}
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
throw new Error('appkey must be of type string.');
}
if (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
throw new Error('authorization cannot be null or undefined and it must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/users/me/pins';
'//v0.3/users/me/pins';
// trim all duplicate forward slashes in the url
var regex = /([^:]\/)\/+/gi;
requestUrl = requestUrl.replace(regex, '$1');
@ -226,9 +268,15 @@ MyPins.prototype.postPin = function (request, authorization, options, callback)
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if (appkey !== undefined && appkey !== null) {
httpRequest.headers['appkey'] = appkey;
}
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {
@ -315,11 +363,21 @@ MyPins.prototype.postPin = function (request, authorization, options, callback)
*
* @param {string} topicHandle Topic handle
*
* @param {string} authorization Authenication (must begin with string "Bearer
* ")
* @param {string} authorization Authentication (must begin with string
* "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {object} [options] Optional Parameters.
*
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@ -344,21 +402,29 @@ MyPins.prototype.deletePin = function (topicHandle, authorization, options, call
if (!callback) {
throw new Error('callback cannot be null.');
}
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (topicHandle === null || topicHandle === undefined || typeof topicHandle.valueOf() !== 'string') {
throw new Error('topicHandle cannot be null or undefined and it must be of type string.');
}
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
throw new Error('appkey must be of type string.');
}
if (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
throw new Error('authorization cannot be null or undefined and it must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/users/me/pins/{topicHandle}';
'//v0.3/users/me/pins/{topicHandle}';
requestUrl = requestUrl.replace('{topicHandle}', encodeURIComponent(topicHandle));
// trim all duplicate forward slashes in the url
var regex = /([^:]\/)\/+/gi;
@ -370,9 +436,15 @@ MyPins.prototype.deletePin = function (topicHandle, authorization, options, call
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if (appkey !== undefined && appkey !== null) {
httpRequest.headers['appkey'] = appkey;
}
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {

Просмотреть файл

@ -30,8 +30,9 @@ function MyPushRegistrations(client) {
* @param {string} platform Platform type. Possible values include: 'Windows',
* 'Android', 'IOS'
*
* @param {string} registrationId Unique registration id provided by the
* @param {string} registrationId Unique registration ID provided by the
* mobile OS.
* You must URL encode the registration ID.
* For Android, this is the GCM registration ID.
* For Windows, this is the PushNotificationChannel URI.
* For iOS, this is the device token.
@ -45,11 +46,21 @@ function MyPushRegistrations(client) {
*
* @param {string} [request.language] Gets or sets language of the user
*
* @param {string} authorization Authenication (must begin with string "Bearer
* ")
* @param {string} authorization Authentication (must begin with string
* "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {object} [options] Optional Parameters.
*
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@ -74,6 +85,8 @@ MyPushRegistrations.prototype.putPushRegistration = function (platform, registra
if (!callback) {
throw new Error('callback cannot be null.');
}
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (platform) {
@ -90,16 +103,22 @@ MyPushRegistrations.prototype.putPushRegistration = function (platform, registra
if (request === null || request === undefined) {
throw new Error('request cannot be null or undefined.');
}
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
throw new Error('appkey must be of type string.');
}
if (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
throw new Error('authorization cannot be null or undefined and it must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/users/me/push_registrations/{platform}/{registrationId}';
'//v0.3/users/me/push_registrations/{platform}/{registrationId}';
requestUrl = requestUrl.replace('{platform}', encodeURIComponent(platform));
requestUrl = requestUrl.replace('{registrationId}', encodeURIComponent(registrationId));
// trim all duplicate forward slashes in the url
@ -112,9 +131,15 @@ MyPushRegistrations.prototype.putPushRegistration = function (platform, registra
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if (appkey !== undefined && appkey !== null) {
httpRequest.headers['appkey'] = appkey;
}
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {
@ -202,17 +227,28 @@ MyPushRegistrations.prototype.putPushRegistration = function (platform, registra
* @param {string} platform Platform type. Possible values include: 'Windows',
* 'Android', 'IOS'
*
* @param {string} registrationId Unique registration id provided by the
* @param {string} registrationId Unique registration ID provided by the
* mobile OS.
* You must URL encode the registration ID.
* For Android, this is the GCM registration ID.
* For Windows, this is the PushNotificationChannel URI.
* For iOS, this is the device token.
*
* @param {string} authorization Authenication (must begin with string "Bearer
* ")
* @param {string} authorization Authentication (must begin with string
* "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {object} [options] Optional Parameters.
*
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@ -237,6 +273,8 @@ MyPushRegistrations.prototype.deletePushRegistration = function (platform, regis
if (!callback) {
throw new Error('callback cannot be null.');
}
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (platform) {
@ -250,16 +288,22 @@ MyPushRegistrations.prototype.deletePushRegistration = function (platform, regis
if (registrationId === null || registrationId === undefined || typeof registrationId.valueOf() !== 'string') {
throw new Error('registrationId cannot be null or undefined and it must be of type string.');
}
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
throw new Error('appkey must be of type string.');
}
if (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
throw new Error('authorization cannot be null or undefined and it must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/users/me/push_registrations/{platform}/{registrationId}';
'//v0.3/users/me/push_registrations/{platform}/{registrationId}';
requestUrl = requestUrl.replace('{platform}', encodeURIComponent(platform));
requestUrl = requestUrl.replace('{registrationId}', encodeURIComponent(registrationId));
// trim all duplicate forward slashes in the url
@ -272,9 +316,15 @@ MyPushRegistrations.prototype.deletePushRegistration = function (platform, regis
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if (appkey !== undefined && appkey !== null) {
httpRequest.headers['appkey'] = appkey;
}
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {

Просмотреть файл

@ -27,8 +27,12 @@ function MyTopics(client) {
/**
* @summary Get my topics sorted by creation time
*
* @param {string} authorization Authenication (must begin with string "Bearer
* ")
* @param {string} authorization Authentication (must begin with string
* "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {object} [options] Optional Parameters.
*
@ -36,6 +40,12 @@ function MyTopics(client) {
*
* @param {number} [options.limit] Number of items to return
*
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@ -63,6 +73,8 @@ MyTopics.prototype.getTopics = function (authorization, options, callback) {
}
var cursor = (options && options.cursor !== undefined) ? options.cursor : undefined;
var limit = (options && options.limit !== undefined) ? options.limit : undefined;
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (cursor !== null && cursor !== undefined && typeof cursor.valueOf() !== 'string') {
@ -71,16 +83,22 @@ MyTopics.prototype.getTopics = function (authorization, options, callback) {
if (limit !== null && limit !== undefined && typeof limit !== 'number') {
throw new Error('limit must be of type number.');
}
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
throw new Error('appkey must be of type string.');
}
if (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
throw new Error('authorization cannot be null or undefined and it must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/users/me/topics';
'//v0.3/users/me/topics';
var queryParameters = [];
if (cursor !== null && cursor !== undefined) {
queryParameters.push('cursor=' + encodeURIComponent(cursor));
@ -101,9 +119,15 @@ MyTopics.prototype.getTopics = function (authorization, options, callback) {
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if (appkey !== undefined && appkey !== null) {
httpRequest.headers['appkey'] = appkey;
}
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {
@ -168,8 +192,12 @@ MyTopics.prototype.getTopics = function (authorization, options, callback) {
/**
* @summary Get my topics sorted by popularity
*
* @param {string} authorization Authenication (must begin with string "Bearer
* ")
* @param {string} authorization Authentication (must begin with string
* "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {object} [options] Optional Parameters.
*
@ -177,6 +205,12 @@ MyTopics.prototype.getTopics = function (authorization, options, callback) {
*
* @param {number} [options.limit] Number of items to return
*
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@ -204,6 +238,8 @@ MyTopics.prototype.getPopularTopics = function (authorization, options, callback
}
var cursor = (options && options.cursor !== undefined) ? options.cursor : undefined;
var limit = (options && options.limit !== undefined) ? options.limit : undefined;
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (cursor !== null && cursor !== undefined && typeof cursor !== 'number') {
@ -212,16 +248,22 @@ MyTopics.prototype.getPopularTopics = function (authorization, options, callback
if (limit !== null && limit !== undefined && typeof limit !== 'number') {
throw new Error('limit must be of type number.');
}
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
throw new Error('appkey must be of type string.');
}
if (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
throw new Error('authorization cannot be null or undefined and it must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/users/me/topics/popular';
'//v0.3/users/me/topics/popular';
var queryParameters = [];
if (cursor !== null && cursor !== undefined) {
queryParameters.push('cursor=' + encodeURIComponent(cursor.toString()));
@ -242,9 +284,15 @@ MyTopics.prototype.getPopularTopics = function (authorization, options, callback
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if (appkey !== undefined && appkey !== null) {
httpRequest.headers['appkey'] = appkey;
}
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {

Просмотреть файл

@ -29,11 +29,21 @@ function Replies(client) {
*
* @param {string} replyHandle Reply handle
*
* @param {string} authorization Authenication (must begin with string "Bearer
* ")
* @param {string} authorization Authentication (must begin with string
* "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {object} [options] Optional Parameters.
*
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@ -59,21 +69,29 @@ Replies.prototype.getReply = function (replyHandle, authorization, options, call
if (!callback) {
throw new Error('callback cannot be null.');
}
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (replyHandle === null || replyHandle === undefined || typeof replyHandle.valueOf() !== 'string') {
throw new Error('replyHandle cannot be null or undefined and it must be of type string.');
}
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
throw new Error('appkey must be of type string.');
}
if (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
throw new Error('authorization cannot be null or undefined and it must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/replies/{replyHandle}';
'//v0.3/replies/{replyHandle}';
requestUrl = requestUrl.replace('{replyHandle}', encodeURIComponent(replyHandle));
// trim all duplicate forward slashes in the url
var regex = /([^:]\/)\/+/gi;
@ -85,9 +103,15 @@ Replies.prototype.getReply = function (replyHandle, authorization, options, call
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if (appkey !== undefined && appkey !== null) {
httpRequest.headers['appkey'] = appkey;
}
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {
@ -154,11 +178,21 @@ Replies.prototype.getReply = function (replyHandle, authorization, options, call
*
* @param {string} replyHandle Reply handle
*
* @param {string} authorization Authenication (must begin with string "Bearer
* ")
* @param {string} authorization Authentication (must begin with string
* "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {object} [options] Optional Parameters.
*
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@ -183,21 +217,29 @@ Replies.prototype.deleteReply = function (replyHandle, authorization, options, c
if (!callback) {
throw new Error('callback cannot be null.');
}
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (replyHandle === null || replyHandle === undefined || typeof replyHandle.valueOf() !== 'string') {
throw new Error('replyHandle cannot be null or undefined and it must be of type string.');
}
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
throw new Error('appkey must be of type string.');
}
if (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
throw new Error('authorization cannot be null or undefined and it must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/replies/{replyHandle}';
'//v0.3/replies/{replyHandle}';
requestUrl = requestUrl.replace('{replyHandle}', encodeURIComponent(replyHandle));
// trim all duplicate forward slashes in the url
var regex = /([^:]\/)\/+/gi;
@ -209,9 +251,15 @@ Replies.prototype.deleteReply = function (replyHandle, authorization, options, c
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if (appkey !== undefined && appkey !== null) {
httpRequest.headers['appkey'] = appkey;
}
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {

Просмотреть файл

@ -35,10 +35,18 @@ function ReplyLikes(client) {
*
* @param {number} [options.limit] Number of items to return
*
* @param {string} [options.appkey] App Key Authentication
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.authorization] Authenication (must begin with
* string "Bearer ")
* @param {string} [options.authorization] Authentication (must begin with
* string "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
@ -70,6 +78,7 @@ ReplyLikes.prototype.getLikes = function (replyHandle, options, callback) {
var limit = (options && options.limit !== undefined) ? options.limit : undefined;
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var authorization = (options && options.authorization !== undefined) ? options.authorization : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (replyHandle === null || replyHandle === undefined || typeof replyHandle.valueOf() !== 'string') {
@ -87,13 +96,16 @@ ReplyLikes.prototype.getLikes = function (replyHandle, options, callback) {
if (authorization !== null && authorization !== undefined && typeof authorization.valueOf() !== 'string') {
throw new Error('authorization must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/replies/{replyHandle}/likes';
'//v0.3/replies/{replyHandle}/likes';
requestUrl = requestUrl.replace('{replyHandle}', encodeURIComponent(replyHandle));
var queryParameters = [];
if (cursor !== null && cursor !== undefined) {
@ -121,6 +133,9 @@ ReplyLikes.prototype.getLikes = function (replyHandle, options, callback) {
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {
@ -187,11 +202,21 @@ ReplyLikes.prototype.getLikes = function (replyHandle, options, callback) {
*
* @param {string} replyHandle Reply handle
*
* @param {string} authorization Authenication (must begin with string "Bearer
* ")
* @param {string} authorization Authentication (must begin with string
* "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {object} [options] Optional Parameters.
*
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@ -216,21 +241,29 @@ ReplyLikes.prototype.postLike = function (replyHandle, authorization, options, c
if (!callback) {
throw new Error('callback cannot be null.');
}
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (replyHandle === null || replyHandle === undefined || typeof replyHandle.valueOf() !== 'string') {
throw new Error('replyHandle cannot be null or undefined and it must be of type string.');
}
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
throw new Error('appkey must be of type string.');
}
if (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
throw new Error('authorization cannot be null or undefined and it must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/replies/{replyHandle}/likes';
'//v0.3/replies/{replyHandle}/likes';
requestUrl = requestUrl.replace('{replyHandle}', encodeURIComponent(replyHandle));
// trim all duplicate forward slashes in the url
var regex = /([^:]\/)\/+/gi;
@ -242,9 +275,15 @@ ReplyLikes.prototype.postLike = function (replyHandle, authorization, options, c
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if (appkey !== undefined && appkey !== null) {
httpRequest.headers['appkey'] = appkey;
}
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {
@ -317,11 +356,21 @@ ReplyLikes.prototype.postLike = function (replyHandle, authorization, options, c
*
* @param {string} replyHandle Reply handle
*
* @param {string} authorization Authenication (must begin with string "Bearer
* ")
* @param {string} authorization Authentication (must begin with string
* "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {object} [options] Optional Parameters.
*
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@ -346,21 +395,29 @@ ReplyLikes.prototype.deleteLike = function (replyHandle, authorization, options,
if (!callback) {
throw new Error('callback cannot be null.');
}
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (replyHandle === null || replyHandle === undefined || typeof replyHandle.valueOf() !== 'string') {
throw new Error('replyHandle cannot be null or undefined and it must be of type string.');
}
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
throw new Error('appkey must be of type string.');
}
if (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
throw new Error('authorization cannot be null or undefined and it must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/replies/{replyHandle}/likes/me';
'//v0.3/replies/{replyHandle}/likes/me';
requestUrl = requestUrl.replace('{replyHandle}', encodeURIComponent(replyHandle));
// trim all duplicate forward slashes in the url
var regex = /([^:]\/)\/+/gi;
@ -372,9 +429,15 @@ ReplyLikes.prototype.deleteLike = function (replyHandle, authorization, options,
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if (appkey !== undefined && appkey !== null) {
httpRequest.headers['appkey'] = appkey;
}
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {

Просмотреть файл

@ -35,11 +35,21 @@ function ReplyReports(client) {
* Possible values include: 'Spam', 'Cyberbullying', 'ChildEndangerment',
* 'Offensive', 'ContentInfringement', 'Other'
*
* @param {string} authorization Authenication (must begin with string "Bearer
* ")
* @param {string} authorization Authentication (must begin with string
* "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {object} [options] Optional Parameters.
*
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@ -64,6 +74,8 @@ ReplyReports.prototype.postReport = function (replyHandle, postReportRequest, au
if (!callback) {
throw new Error('callback cannot be null.');
}
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (replyHandle === null || replyHandle === undefined || typeof replyHandle.valueOf() !== 'string') {
@ -72,16 +84,22 @@ ReplyReports.prototype.postReport = function (replyHandle, postReportRequest, au
if (postReportRequest === null || postReportRequest === undefined) {
throw new Error('postReportRequest cannot be null or undefined.');
}
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
throw new Error('appkey must be of type string.');
}
if (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
throw new Error('authorization cannot be null or undefined and it must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/replies/{replyHandle}/reports';
'//v0.3/replies/{replyHandle}/reports';
requestUrl = requestUrl.replace('{replyHandle}', encodeURIComponent(replyHandle));
// trim all duplicate forward slashes in the url
var regex = /([^:]\/)\/+/gi;
@ -93,9 +111,15 @@ ReplyReports.prototype.postReport = function (replyHandle, postReportRequest, au
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if (appkey !== undefined && appkey !== null) {
httpRequest.headers['appkey'] = appkey;
}
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {

Просмотреть файл

@ -32,10 +32,18 @@ function RequestTokens(client) {
*
* @param {object} [options] Optional Parameters.
*
* @param {string} [options.appkey] App Key Authentication
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.authorization] Authenication (must begin with
* string "Bearer ")
* @param {string} [options.authorization] Authentication (must begin with
* string "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
@ -65,6 +73,7 @@ RequestTokens.prototype.getRequestToken = function (identityProvider, options, c
}
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var authorization = (options && options.authorization !== undefined) ? options.authorization : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (identityProvider) {
@ -81,13 +90,16 @@ RequestTokens.prototype.getRequestToken = function (identityProvider, options, c
if (authorization !== null && authorization !== undefined && typeof authorization.valueOf() !== 'string') {
throw new Error('authorization must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/request_tokens/{identityProvider}';
'//v0.3/request_tokens/{identityProvider}';
requestUrl = requestUrl.replace('{identityProvider}', encodeURIComponent(identityProvider));
// trim all duplicate forward slashes in the url
var regex = /([^:]\/)\/+/gi;
@ -105,6 +117,9 @@ RequestTokens.prototype.getRequestToken = function (identityProvider, options, c
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {

Просмотреть файл

@ -35,10 +35,18 @@ function Search(client) {
*
* @param {number} [options.limit] Number of items to return
*
* @param {string} [options.appkey] App Key Authentication
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.authorization] Authenication (must begin with
* string "Bearer ")
* @param {string} [options.authorization] Authentication (must begin with
* string "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
@ -69,6 +77,7 @@ Search.prototype.getTopics = function (query, options, callback) {
var limit = (options && options.limit !== undefined) ? options.limit : undefined;
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var authorization = (options && options.authorization !== undefined) ? options.authorization : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (query === null || query === undefined || typeof query.valueOf() !== 'string') {
@ -86,13 +95,16 @@ Search.prototype.getTopics = function (query, options, callback) {
if (authorization !== null && authorization !== undefined && typeof authorization.valueOf() !== 'string') {
throw new Error('authorization must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/search/topics';
'//v0.3/search/topics';
var queryParameters = [];
queryParameters.push('query=' + encodeURIComponent(query));
if (cursor !== null && cursor !== undefined) {
@ -120,6 +132,9 @@ Search.prototype.getTopics = function (query, options, callback) {
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {
@ -192,10 +207,18 @@ Search.prototype.getTopics = function (query, options, callback) {
*
* @param {number} [options.limit] Number of items to return
*
* @param {string} [options.appkey] App Key Authentication
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.authorization] Authenication (must begin with
* string "Bearer ")
* @param {string} [options.authorization] Authentication (must begin with
* string "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
@ -227,6 +250,7 @@ Search.prototype.getUsers = function (query, options, callback) {
var limit = (options && options.limit !== undefined) ? options.limit : undefined;
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var authorization = (options && options.authorization !== undefined) ? options.authorization : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (query === null || query === undefined || typeof query.valueOf() !== 'string') {
@ -244,13 +268,16 @@ Search.prototype.getUsers = function (query, options, callback) {
if (authorization !== null && authorization !== undefined && typeof authorization.valueOf() !== 'string') {
throw new Error('authorization must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/search/users';
'//v0.3/search/users';
var queryParameters = [];
queryParameters.push('query=' + encodeURIComponent(query));
if (cursor !== null && cursor !== undefined) {
@ -278,6 +305,9 @@ Search.prototype.getUsers = function (query, options, callback) {
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {

Просмотреть файл

@ -52,10 +52,18 @@ function Sessions(client) {
*
* @param {object} [options] Optional Parameters.
*
* @param {string} [options.appkey] App Key Authentication
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.authorization] Authenication (must begin with
* string "Bearer ")
* @param {string} [options.authorization] Authentication (must begin with
* string "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
@ -84,6 +92,7 @@ Sessions.prototype.postSession = function (request, options, callback) {
}
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var authorization = (options && options.authorization !== undefined) ? options.authorization : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (request === null || request === undefined) {
@ -95,13 +104,16 @@ Sessions.prototype.postSession = function (request, options, callback) {
if (authorization !== null && authorization !== undefined && typeof authorization.valueOf() !== 'string') {
throw new Error('authorization must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/sessions';
'//v0.3/sessions';
// trim all duplicate forward slashes in the url
var regex = /([^:]\/)\/+/gi;
requestUrl = requestUrl.replace(regex, '$1');
@ -118,6 +130,9 @@ Sessions.prototype.postSession = function (request, options, callback) {
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {
@ -196,11 +211,21 @@ Sessions.prototype.postSession = function (request, options, callback) {
/**
* @summary Delete the current session (sign out)
*
* @param {string} authorization Authenication (must begin with string "Bearer
* ")
* @param {string} authorization Authentication (must begin with string
* "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {object} [options] Optional Parameters.
*
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@ -225,18 +250,26 @@ Sessions.prototype.deleteSession = function (authorization, options, callback) {
if (!callback) {
throw new Error('callback cannot be null.');
}
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
throw new Error('appkey must be of type string.');
}
if (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
throw new Error('authorization cannot be null or undefined and it must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/sessions/current';
'//v0.3/sessions/current';
// trim all duplicate forward slashes in the url
var regex = /([^:]\/)\/+/gi;
requestUrl = requestUrl.replace(regex, '$1');
@ -247,9 +280,15 @@ Sessions.prototype.deleteSession = function (authorization, options, callback) {
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if (appkey !== undefined && appkey !== null) {
httpRequest.headers['appkey'] = appkey;
}
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {

Просмотреть файл

@ -29,8 +29,12 @@ function TopicComments(client) {
*
* @param {string} topicHandle Topic handle
*
* @param {string} authorization Authenication (must begin with string "Bearer
* ")
* @param {string} authorization Authentication (must begin with string
* "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {object} [options] Optional Parameters.
*
@ -38,6 +42,12 @@ function TopicComments(client) {
*
* @param {number} [options.limit] Number of items to return
*
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@ -66,6 +76,8 @@ TopicComments.prototype.getTopicComments = function (topicHandle, authorization,
}
var cursor = (options && options.cursor !== undefined) ? options.cursor : undefined;
var limit = (options && options.limit !== undefined) ? options.limit : undefined;
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (topicHandle === null || topicHandle === undefined || typeof topicHandle.valueOf() !== 'string') {
@ -77,16 +89,22 @@ TopicComments.prototype.getTopicComments = function (topicHandle, authorization,
if (limit !== null && limit !== undefined && typeof limit !== 'number') {
throw new Error('limit must be of type number.');
}
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
throw new Error('appkey must be of type string.');
}
if (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
throw new Error('authorization cannot be null or undefined and it must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/topics/{topicHandle}/comments';
'//v0.3/topics/{topicHandle}/comments';
requestUrl = requestUrl.replace('{topicHandle}', encodeURIComponent(topicHandle));
var queryParameters = [];
if (cursor !== null && cursor !== undefined) {
@ -108,9 +126,15 @@ TopicComments.prototype.getTopicComments = function (topicHandle, authorization,
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if (appkey !== undefined && appkey !== null) {
httpRequest.headers['appkey'] = appkey;
}
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {
@ -188,11 +212,21 @@ TopicComments.prototype.getTopicComments = function (topicHandle, authorization,
*
* @param {string} [request.language] Gets or sets comment language
*
* @param {string} authorization Authenication (must begin with string "Bearer
* ")
* @param {string} authorization Authentication (must begin with string
* "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {object} [options] Optional Parameters.
*
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@ -218,6 +252,8 @@ TopicComments.prototype.postComment = function (topicHandle, request, authorizat
if (!callback) {
throw new Error('callback cannot be null.');
}
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (topicHandle === null || topicHandle === undefined || typeof topicHandle.valueOf() !== 'string') {
@ -226,16 +262,22 @@ TopicComments.prototype.postComment = function (topicHandle, request, authorizat
if (request === null || request === undefined) {
throw new Error('request cannot be null or undefined.');
}
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
throw new Error('appkey must be of type string.');
}
if (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
throw new Error('authorization cannot be null or undefined and it must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/topics/{topicHandle}/comments';
'//v0.3/topics/{topicHandle}/comments';
requestUrl = requestUrl.replace('{topicHandle}', encodeURIComponent(topicHandle));
// trim all duplicate forward slashes in the url
var regex = /([^:]\/)\/+/gi;
@ -247,9 +289,15 @@ TopicComments.prototype.postComment = function (topicHandle, request, authorizat
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if (appkey !== undefined && appkey !== null) {
httpRequest.headers['appkey'] = appkey;
}
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {

Просмотреть файл

@ -35,10 +35,18 @@ function TopicLikes(client) {
*
* @param {number} [options.limit] Number of items to return
*
* @param {string} [options.appkey] App Key Authentication
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.authorization] Authenication (must begin with
* string "Bearer ")
* @param {string} [options.authorization] Authentication (must begin with
* string "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
@ -70,6 +78,7 @@ TopicLikes.prototype.getLikes = function (topicHandle, options, callback) {
var limit = (options && options.limit !== undefined) ? options.limit : undefined;
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var authorization = (options && options.authorization !== undefined) ? options.authorization : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (topicHandle === null || topicHandle === undefined || typeof topicHandle.valueOf() !== 'string') {
@ -87,13 +96,16 @@ TopicLikes.prototype.getLikes = function (topicHandle, options, callback) {
if (authorization !== null && authorization !== undefined && typeof authorization.valueOf() !== 'string') {
throw new Error('authorization must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/topics/{topicHandle}/likes';
'//v0.3/topics/{topicHandle}/likes';
requestUrl = requestUrl.replace('{topicHandle}', encodeURIComponent(topicHandle));
var queryParameters = [];
if (cursor !== null && cursor !== undefined) {
@ -121,6 +133,9 @@ TopicLikes.prototype.getLikes = function (topicHandle, options, callback) {
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {
@ -187,11 +202,21 @@ TopicLikes.prototype.getLikes = function (topicHandle, options, callback) {
*
* @param {string} topicHandle Topic handle
*
* @param {string} authorization Authenication (must begin with string "Bearer
* ")
* @param {string} authorization Authentication (must begin with string
* "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {object} [options] Optional Parameters.
*
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@ -216,21 +241,29 @@ TopicLikes.prototype.postLike = function (topicHandle, authorization, options, c
if (!callback) {
throw new Error('callback cannot be null.');
}
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (topicHandle === null || topicHandle === undefined || typeof topicHandle.valueOf() !== 'string') {
throw new Error('topicHandle cannot be null or undefined and it must be of type string.');
}
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
throw new Error('appkey must be of type string.');
}
if (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
throw new Error('authorization cannot be null or undefined and it must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/topics/{topicHandle}/likes';
'//v0.3/topics/{topicHandle}/likes';
requestUrl = requestUrl.replace('{topicHandle}', encodeURIComponent(topicHandle));
// trim all duplicate forward slashes in the url
var regex = /([^:]\/)\/+/gi;
@ -242,9 +275,15 @@ TopicLikes.prototype.postLike = function (topicHandle, authorization, options, c
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if (appkey !== undefined && appkey !== null) {
httpRequest.headers['appkey'] = appkey;
}
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {
@ -317,11 +356,21 @@ TopicLikes.prototype.postLike = function (topicHandle, authorization, options, c
*
* @param {string} topicHandle Topic handle
*
* @param {string} authorization Authenication (must begin with string "Bearer
* ")
* @param {string} authorization Authentication (must begin with string
* "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {object} [options] Optional Parameters.
*
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@ -346,21 +395,29 @@ TopicLikes.prototype.deleteLike = function (topicHandle, authorization, options,
if (!callback) {
throw new Error('callback cannot be null.');
}
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (topicHandle === null || topicHandle === undefined || typeof topicHandle.valueOf() !== 'string') {
throw new Error('topicHandle cannot be null or undefined and it must be of type string.');
}
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
throw new Error('appkey must be of type string.');
}
if (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
throw new Error('authorization cannot be null or undefined and it must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/topics/{topicHandle}/likes/me';
'//v0.3/topics/{topicHandle}/likes/me';
requestUrl = requestUrl.replace('{topicHandle}', encodeURIComponent(topicHandle));
// trim all duplicate forward slashes in the url
var regex = /([^:]\/)\/+/gi;
@ -372,9 +429,15 @@ TopicLikes.prototype.deleteLike = function (topicHandle, authorization, options,
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if (appkey !== undefined && appkey !== null) {
httpRequest.headers['appkey'] = appkey;
}
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {

Просмотреть файл

@ -35,11 +35,21 @@ function TopicReports(client) {
* Possible values include: 'Spam', 'Cyberbullying', 'ChildEndangerment',
* 'Offensive', 'ContentInfringement', 'Other'
*
* @param {string} authorization Authenication (must begin with string "Bearer
* ")
* @param {string} authorization Authentication (must begin with string
* "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {object} [options] Optional Parameters.
*
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@ -64,6 +74,8 @@ TopicReports.prototype.postReport = function (topicHandle, postReportRequest, au
if (!callback) {
throw new Error('callback cannot be null.');
}
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (topicHandle === null || topicHandle === undefined || typeof topicHandle.valueOf() !== 'string') {
@ -72,16 +84,22 @@ TopicReports.prototype.postReport = function (topicHandle, postReportRequest, au
if (postReportRequest === null || postReportRequest === undefined) {
throw new Error('postReportRequest cannot be null or undefined.');
}
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
throw new Error('appkey must be of type string.');
}
if (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
throw new Error('authorization cannot be null or undefined and it must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/topics/{topicHandle}/reports';
'//v0.3/topics/{topicHandle}/reports';
requestUrl = requestUrl.replace('{topicHandle}', encodeURIComponent(topicHandle));
// trim all duplicate forward slashes in the url
var regex = /([^:]\/)\/+/gi;
@ -93,9 +111,15 @@ TopicReports.prototype.postReport = function (topicHandle, postReportRequest, au
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if (appkey !== undefined && appkey !== null) {
httpRequest.headers['appkey'] = appkey;
}
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {

Просмотреть файл

@ -33,10 +33,18 @@ function Topics(client) {
*
* @param {number} [options.limit] Number of items to return
*
* @param {string} [options.appkey] App Key Authentication
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.authorization] Authenication (must begin with
* string "Bearer ")
* @param {string} [options.authorization] Authentication (must begin with
* string "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
@ -67,6 +75,7 @@ Topics.prototype.getTopics = function (options, callback) {
var limit = (options && options.limit !== undefined) ? options.limit : undefined;
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var authorization = (options && options.authorization !== undefined) ? options.authorization : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (cursor !== null && cursor !== undefined && typeof cursor.valueOf() !== 'string') {
@ -81,13 +90,16 @@ Topics.prototype.getTopics = function (options, callback) {
if (authorization !== null && authorization !== undefined && typeof authorization.valueOf() !== 'string') {
throw new Error('authorization must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/topics';
'//v0.3/topics';
var queryParameters = [];
if (cursor !== null && cursor !== undefined) {
queryParameters.push('cursor=' + encodeURIComponent(cursor));
@ -114,6 +126,9 @@ Topics.prototype.getTopics = function (options, callback) {
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {
@ -202,11 +217,21 @@ Topics.prototype.getTopics = function (options, callback) {
*
* @param {string} [request.group] Gets or sets topic group
*
* @param {string} authorization Authenication (must begin with string "Bearer
* ")
* @param {string} authorization Authentication (must begin with string
* "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {object} [options] Optional Parameters.
*
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@ -232,21 +257,29 @@ Topics.prototype.postTopic = function (request, authorization, options, callback
if (!callback) {
throw new Error('callback cannot be null.');
}
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (request === null || request === undefined) {
throw new Error('request cannot be null or undefined.');
}
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
throw new Error('appkey must be of type string.');
}
if (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
throw new Error('authorization cannot be null or undefined and it must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/topics';
'//v0.3/topics';
// trim all duplicate forward slashes in the url
var regex = /([^:]\/)\/+/gi;
requestUrl = requestUrl.replace(regex, '$1');
@ -257,9 +290,15 @@ Topics.prototype.postTopic = function (request, authorization, options, callback
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if (appkey !== undefined && appkey !== null) {
httpRequest.headers['appkey'] = appkey;
}
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {
@ -342,10 +381,18 @@ Topics.prototype.postTopic = function (request, authorization, options, callback
*
* @param {object} [options] Optional Parameters.
*
* @param {string} [options.appkey] App Key Authentication
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.authorization] Authenication (must begin with
* string "Bearer ")
* @param {string} [options.authorization] Authentication (must begin with
* string "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
@ -374,6 +421,7 @@ Topics.prototype.getTopic = function (topicHandle, options, callback) {
}
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var authorization = (options && options.authorization !== undefined) ? options.authorization : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (topicHandle === null || topicHandle === undefined || typeof topicHandle.valueOf() !== 'string') {
@ -385,13 +433,16 @@ Topics.prototype.getTopic = function (topicHandle, options, callback) {
if (authorization !== null && authorization !== undefined && typeof authorization.valueOf() !== 'string') {
throw new Error('authorization must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/topics/{topicHandle}';
'//v0.3/topics/{topicHandle}';
requestUrl = requestUrl.replace('{topicHandle}', encodeURIComponent(topicHandle));
// trim all duplicate forward slashes in the url
var regex = /([^:]\/)\/+/gi;
@ -409,6 +460,9 @@ Topics.prototype.getTopic = function (topicHandle, options, callback) {
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {
@ -483,11 +537,21 @@ Topics.prototype.getTopic = function (topicHandle, options, callback) {
*
* @param {string} [request.categories] Gets or sets topic categories
*
* @param {string} authorization Authenication (must begin with string "Bearer
* ")
* @param {string} authorization Authentication (must begin with string
* "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {object} [options] Optional Parameters.
*
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@ -512,6 +576,8 @@ Topics.prototype.putTopic = function (topicHandle, request, authorization, optio
if (!callback) {
throw new Error('callback cannot be null.');
}
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (topicHandle === null || topicHandle === undefined || typeof topicHandle.valueOf() !== 'string') {
@ -520,16 +586,22 @@ Topics.prototype.putTopic = function (topicHandle, request, authorization, optio
if (request === null || request === undefined) {
throw new Error('request cannot be null or undefined.');
}
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
throw new Error('appkey must be of type string.');
}
if (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
throw new Error('authorization cannot be null or undefined and it must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/topics/{topicHandle}';
'//v0.3/topics/{topicHandle}';
requestUrl = requestUrl.replace('{topicHandle}', encodeURIComponent(topicHandle));
// trim all duplicate forward slashes in the url
var regex = /([^:]\/)\/+/gi;
@ -541,9 +613,15 @@ Topics.prototype.putTopic = function (topicHandle, request, authorization, optio
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if (appkey !== undefined && appkey !== null) {
httpRequest.headers['appkey'] = appkey;
}
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {
@ -630,11 +708,21 @@ Topics.prototype.putTopic = function (topicHandle, request, authorization, optio
*
* @param {string} topicHandle Topic handle
*
* @param {string} authorization Authenication (must begin with string "Bearer
* ")
* @param {string} authorization Authentication (must begin with string
* "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {object} [options] Optional Parameters.
*
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@ -659,21 +747,29 @@ Topics.prototype.deleteTopic = function (topicHandle, authorization, options, ca
if (!callback) {
throw new Error('callback cannot be null.');
}
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (topicHandle === null || topicHandle === undefined || typeof topicHandle.valueOf() !== 'string') {
throw new Error('topicHandle cannot be null or undefined and it must be of type string.');
}
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
throw new Error('appkey must be of type string.');
}
if (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
throw new Error('authorization cannot be null or undefined and it must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/topics/{topicHandle}';
'//v0.3/topics/{topicHandle}';
requestUrl = requestUrl.replace('{topicHandle}', encodeURIComponent(topicHandle));
// trim all duplicate forward slashes in the url
var regex = /([^:]\/)\/+/gi;
@ -685,9 +781,15 @@ Topics.prototype.deleteTopic = function (topicHandle, authorization, options, ca
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if (appkey !== undefined && appkey !== null) {
httpRequest.headers['appkey'] = appkey;
}
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {
@ -767,10 +869,18 @@ Topics.prototype.deleteTopic = function (topicHandle, authorization, options, ca
*
* @param {number} [options.limit] Number of items to return
*
* @param {string} [options.appkey] App Key Authentication
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.authorization] Authenication (must begin with
* string "Bearer ")
* @param {string} [options.authorization] Authentication (must begin with
* string "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
@ -801,6 +911,7 @@ Topics.prototype.getPopularTopics = function (timeRange, options, callback) {
var limit = (options && options.limit !== undefined) ? options.limit : undefined;
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var authorization = (options && options.authorization !== undefined) ? options.authorization : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (timeRange) {
@ -823,13 +934,16 @@ Topics.prototype.getPopularTopics = function (timeRange, options, callback) {
if (authorization !== null && authorization !== undefined && typeof authorization.valueOf() !== 'string') {
throw new Error('authorization must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/topics/popular/{timeRange}';
'//v0.3/topics/popular/{timeRange}';
requestUrl = requestUrl.replace('{timeRange}', encodeURIComponent(timeRange));
var queryParameters = [];
if (cursor !== null && cursor !== undefined) {
@ -857,6 +971,9 @@ Topics.prototype.getPopularTopics = function (timeRange, options, callback) {
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {
@ -927,10 +1044,18 @@ Topics.prototype.getPopularTopics = function (timeRange, options, callback) {
*
* @param {number} [options.limit] Number of items to return
*
* @param {string} [options.appkey] App Key Authentication
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.authorization] Authenication (must begin with
* string "Bearer ")
* @param {string} [options.authorization] Authentication (must begin with
* string "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
@ -961,6 +1086,7 @@ Topics.prototype.getFeaturedTopics = function (options, callback) {
var limit = (options && options.limit !== undefined) ? options.limit : undefined;
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var authorization = (options && options.authorization !== undefined) ? options.authorization : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (cursor !== null && cursor !== undefined && typeof cursor.valueOf() !== 'string') {
@ -975,13 +1101,16 @@ Topics.prototype.getFeaturedTopics = function (options, callback) {
if (authorization !== null && authorization !== undefined && typeof authorization.valueOf() !== 'string') {
throw new Error('authorization must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/topics/featured';
'//v0.3/topics/featured';
var queryParameters = [];
if (cursor !== null && cursor !== undefined) {
queryParameters.push('cursor=' + encodeURIComponent(cursor));
@ -1008,6 +1137,9 @@ Topics.prototype.getFeaturedTopics = function (options, callback) {
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {

Просмотреть файл

@ -29,8 +29,12 @@ function UserFollowers(client) {
*
* @param {string} userHandle User handle
*
* @param {string} authorization Authenication (must begin with string "Bearer
* ")
* @param {string} authorization Authentication (must begin with string
* "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {object} [options] Optional Parameters.
*
@ -38,6 +42,12 @@ function UserFollowers(client) {
*
* @param {number} [options.limit] Number of items to return
*
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.userHandle1] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@ -66,6 +76,8 @@ UserFollowers.prototype.getFollowers = function (userHandle, authorization, opti
}
var cursor = (options && options.cursor !== undefined) ? options.cursor : undefined;
var limit = (options && options.limit !== undefined) ? options.limit : undefined;
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var userHandle1 = (options && options.userHandle1 !== undefined) ? options.userHandle1 : undefined;
// Validate
try {
if (userHandle === null || userHandle === undefined || typeof userHandle.valueOf() !== 'string') {
@ -77,16 +89,22 @@ UserFollowers.prototype.getFollowers = function (userHandle, authorization, opti
if (limit !== null && limit !== undefined && typeof limit !== 'number') {
throw new Error('limit must be of type number.');
}
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
throw new Error('appkey must be of type string.');
}
if (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
throw new Error('authorization cannot be null or undefined and it must be of type string.');
}
if (userHandle1 !== null && userHandle1 !== undefined && typeof userHandle1.valueOf() !== 'string') {
throw new Error('userHandle1 must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/users/{userHandle}/followers';
'//v0.3/users/{userHandle}/followers';
requestUrl = requestUrl.replace('{userHandle}', encodeURIComponent(userHandle));
var queryParameters = [];
if (cursor !== null && cursor !== undefined) {
@ -108,9 +126,15 @@ UserFollowers.prototype.getFollowers = function (userHandle, authorization, opti
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if (appkey !== undefined && appkey !== null) {
httpRequest.headers['appkey'] = appkey;
}
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle1 !== undefined && userHandle1 !== null) {
httpRequest.headers['UserHandle'] = userHandle1;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {

Просмотреть файл

@ -29,8 +29,12 @@ function UserFollowing(client) {
*
* @param {string} userHandle User handle
*
* @param {string} authorization Authenication (must begin with string "Bearer
* ")
* @param {string} authorization Authentication (must begin with string
* "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {object} [options] Optional Parameters.
*
@ -38,6 +42,12 @@ function UserFollowing(client) {
*
* @param {number} [options.limit] Number of items to return
*
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.userHandle1] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@ -66,6 +76,8 @@ UserFollowing.prototype.getFollowing = function (userHandle, authorization, opti
}
var cursor = (options && options.cursor !== undefined) ? options.cursor : undefined;
var limit = (options && options.limit !== undefined) ? options.limit : undefined;
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var userHandle1 = (options && options.userHandle1 !== undefined) ? options.userHandle1 : undefined;
// Validate
try {
if (userHandle === null || userHandle === undefined || typeof userHandle.valueOf() !== 'string') {
@ -77,16 +89,22 @@ UserFollowing.prototype.getFollowing = function (userHandle, authorization, opti
if (limit !== null && limit !== undefined && typeof limit !== 'number') {
throw new Error('limit must be of type number.');
}
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
throw new Error('appkey must be of type string.');
}
if (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
throw new Error('authorization cannot be null or undefined and it must be of type string.');
}
if (userHandle1 !== null && userHandle1 !== undefined && typeof userHandle1.valueOf() !== 'string') {
throw new Error('userHandle1 must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/users/{userHandle}/following';
'//v0.3/users/{userHandle}/following';
requestUrl = requestUrl.replace('{userHandle}', encodeURIComponent(userHandle));
var queryParameters = [];
if (cursor !== null && cursor !== undefined) {
@ -108,9 +126,15 @@ UserFollowing.prototype.getFollowing = function (userHandle, authorization, opti
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if (appkey !== undefined && appkey !== null) {
httpRequest.headers['appkey'] = appkey;
}
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle1 !== undefined && userHandle1 !== null) {
httpRequest.headers['UserHandle'] = userHandle1;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {

Просмотреть файл

@ -35,11 +35,21 @@ function UserReports(client) {
* Possible values include: 'Spam', 'Cyberbullying', 'ChildEndangerment',
* 'Offensive', 'ContentInfringement', 'Other'
*
* @param {string} authorization Authenication (must begin with string "Bearer
* ")
* @param {string} authorization Authentication (must begin with string
* "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {object} [options] Optional Parameters.
*
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.userHandle1] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@ -64,6 +74,8 @@ UserReports.prototype.postReport = function (userHandle, postReportRequest, auth
if (!callback) {
throw new Error('callback cannot be null.');
}
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var userHandle1 = (options && options.userHandle1 !== undefined) ? options.userHandle1 : undefined;
// Validate
try {
if (userHandle === null || userHandle === undefined || typeof userHandle.valueOf() !== 'string') {
@ -72,16 +84,22 @@ UserReports.prototype.postReport = function (userHandle, postReportRequest, auth
if (postReportRequest === null || postReportRequest === undefined) {
throw new Error('postReportRequest cannot be null or undefined.');
}
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
throw new Error('appkey must be of type string.');
}
if (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
throw new Error('authorization cannot be null or undefined and it must be of type string.');
}
if (userHandle1 !== null && userHandle1 !== undefined && typeof userHandle1.valueOf() !== 'string') {
throw new Error('userHandle1 must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/users/{userHandle}/reports';
'//v0.3/users/{userHandle}/reports';
requestUrl = requestUrl.replace('{userHandle}', encodeURIComponent(userHandle));
// trim all duplicate forward slashes in the url
var regex = /([^:]\/)\/+/gi;
@ -93,9 +111,15 @@ UserReports.prototype.postReport = function (userHandle, postReportRequest, auth
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if (appkey !== undefined && appkey !== null) {
httpRequest.headers['appkey'] = appkey;
}
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle1 !== undefined && userHandle1 !== null) {
httpRequest.headers['UserHandle'] = userHandle1;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {

Просмотреть файл

@ -35,10 +35,18 @@ function UserTopics(client) {
*
* @param {number} [options.limit] Number of items to return
*
* @param {string} [options.appkey] App Key Authentication
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.authorization] Authenication (must begin with
* string "Bearer ")
* @param {string} [options.authorization] Authentication (must begin with
* string "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {string} [options.userHandle1] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
@ -69,6 +77,7 @@ UserTopics.prototype.getTopics = function (userHandle, options, callback) {
var limit = (options && options.limit !== undefined) ? options.limit : undefined;
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var authorization = (options && options.authorization !== undefined) ? options.authorization : undefined;
var userHandle1 = (options && options.userHandle1 !== undefined) ? options.userHandle1 : undefined;
// Validate
try {
if (userHandle === null || userHandle === undefined || typeof userHandle.valueOf() !== 'string') {
@ -86,13 +95,16 @@ UserTopics.prototype.getTopics = function (userHandle, options, callback) {
if (authorization !== null && authorization !== undefined && typeof authorization.valueOf() !== 'string') {
throw new Error('authorization must be of type string.');
}
if (userHandle1 !== null && userHandle1 !== undefined && typeof userHandle1.valueOf() !== 'string') {
throw new Error('userHandle1 must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/users/{userHandle}/topics';
'//v0.3/users/{userHandle}/topics';
requestUrl = requestUrl.replace('{userHandle}', encodeURIComponent(userHandle));
var queryParameters = [];
if (cursor !== null && cursor !== undefined) {
@ -120,6 +132,9 @@ UserTopics.prototype.getTopics = function (userHandle, options, callback) {
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle1 !== undefined && userHandle1 !== null) {
httpRequest.headers['UserHandle'] = userHandle1;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {
@ -192,10 +207,18 @@ UserTopics.prototype.getTopics = function (userHandle, options, callback) {
*
* @param {number} [options.limit] Number of items to return
*
* @param {string} [options.appkey] App Key Authentication
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.authorization] Authenication (must begin with
* string "Bearer ")
* @param {string} [options.authorization] Authentication (must begin with
* string "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {string} [options.userHandle1] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
@ -226,6 +249,7 @@ UserTopics.prototype.getPopularTopics = function (userHandle, options, callback)
var limit = (options && options.limit !== undefined) ? options.limit : undefined;
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var authorization = (options && options.authorization !== undefined) ? options.authorization : undefined;
var userHandle1 = (options && options.userHandle1 !== undefined) ? options.userHandle1 : undefined;
// Validate
try {
if (userHandle === null || userHandle === undefined || typeof userHandle.valueOf() !== 'string') {
@ -243,13 +267,16 @@ UserTopics.prototype.getPopularTopics = function (userHandle, options, callback)
if (authorization !== null && authorization !== undefined && typeof authorization.valueOf() !== 'string') {
throw new Error('authorization must be of type string.');
}
if (userHandle1 !== null && userHandle1 !== undefined && typeof userHandle1.valueOf() !== 'string') {
throw new Error('userHandle1 must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/users/{userHandle}/topics/popular';
'//v0.3/users/{userHandle}/topics/popular';
requestUrl = requestUrl.replace('{userHandle}', encodeURIComponent(userHandle));
var queryParameters = [];
if (cursor !== null && cursor !== undefined) {
@ -277,6 +304,9 @@ UserTopics.prototype.getPopularTopics = function (userHandle, options, callback)
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle1 !== undefined && userHandle1 !== null) {
httpRequest.headers['UserHandle'] = userHandle1;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {

Просмотреть файл

@ -74,10 +74,18 @@ function Users(client) {
*
* @param {object} [options] Optional Parameters.
*
* @param {string} [options.appkey] App Key Authentication
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.authorization] Authenication (must begin with
* string "Bearer ")
* @param {string} [options.authorization] Authentication (must begin with
* string "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
@ -106,6 +114,7 @@ Users.prototype.postUser = function (request, options, callback) {
}
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var authorization = (options && options.authorization !== undefined) ? options.authorization : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (request === null || request === undefined) {
@ -117,13 +126,16 @@ Users.prototype.postUser = function (request, options, callback) {
if (authorization !== null && authorization !== undefined && typeof authorization.valueOf() !== 'string') {
throw new Error('authorization must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/users';
'//v0.3/users';
// trim all duplicate forward slashes in the url
var regex = /([^:]\/)\/+/gi;
requestUrl = requestUrl.replace(regex, '$1');
@ -140,6 +152,9 @@ Users.prototype.postUser = function (request, options, callback) {
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {
@ -218,11 +233,21 @@ Users.prototype.postUser = function (request, options, callback) {
/**
* @summary Get my profile
*
* @param {string} authorization Authenication (must begin with string "Bearer
* ")
* @param {string} authorization Authentication (must begin with string
* "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {object} [options] Optional Parameters.
*
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@ -248,18 +273,26 @@ Users.prototype.getMyProfile = function (authorization, options, callback) {
if (!callback) {
throw new Error('callback cannot be null.');
}
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
throw new Error('appkey must be of type string.');
}
if (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
throw new Error('authorization cannot be null or undefined and it must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/users/me';
'//v0.3/users/me';
// trim all duplicate forward slashes in the url
var regex = /([^:]\/)\/+/gi;
requestUrl = requestUrl.replace(regex, '$1');
@ -270,9 +303,15 @@ Users.prototype.getMyProfile = function (authorization, options, callback) {
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if (appkey !== undefined && appkey !== null) {
httpRequest.headers['appkey'] = appkey;
}
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {
@ -337,11 +376,21 @@ Users.prototype.getMyProfile = function (authorization, options, callback) {
/**
* @summary Delete user
*
* @param {string} authorization Authenication (must begin with string "Bearer
* ")
* @param {string} authorization Authentication (must begin with string
* "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {object} [options] Optional Parameters.
*
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@ -366,18 +415,26 @@ Users.prototype.deleteUser = function (authorization, options, callback) {
if (!callback) {
throw new Error('callback cannot be null.');
}
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
throw new Error('appkey must be of type string.');
}
if (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
throw new Error('authorization cannot be null or undefined and it must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/users/me';
'//v0.3/users/me';
// trim all duplicate forward slashes in the url
var regex = /([^:]\/)\/+/gi;
requestUrl = requestUrl.replace(regex, '$1');
@ -388,9 +445,15 @@ Users.prototype.deleteUser = function (authorization, options, callback) {
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if (appkey !== undefined && appkey !== null) {
httpRequest.headers['appkey'] = appkey;
}
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {
@ -469,11 +532,21 @@ Users.prototype.deleteUser = function (authorization, options, callback) {
*
* @param {string} [request.bio] Gets or sets short bio of the user
*
* @param {string} authorization Authenication (must begin with string "Bearer
* ")
* @param {string} authorization Authentication (must begin with string
* "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {object} [options] Optional Parameters.
*
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@ -498,21 +571,29 @@ Users.prototype.putUserInfo = function (request, authorization, options, callbac
if (!callback) {
throw new Error('callback cannot be null.');
}
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (request === null || request === undefined) {
throw new Error('request cannot be null or undefined.');
}
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
throw new Error('appkey must be of type string.');
}
if (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
throw new Error('authorization cannot be null or undefined and it must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/users/me/info';
'//v0.3/users/me/info';
// trim all duplicate forward slashes in the url
var regex = /([^:]\/)\/+/gi;
requestUrl = requestUrl.replace(regex, '$1');
@ -523,9 +604,15 @@ Users.prototype.putUserInfo = function (request, authorization, options, callbac
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if (appkey !== undefined && appkey !== null) {
httpRequest.headers['appkey'] = appkey;
}
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {
@ -614,11 +701,21 @@ Users.prototype.putUserInfo = function (request, authorization, options, callbac
*
* @param {string} [request.photoHandle] Gets or sets photo handle of the user
*
* @param {string} authorization Authenication (must begin with string "Bearer
* ")
* @param {string} authorization Authentication (must begin with string
* "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {object} [options] Optional Parameters.
*
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@ -643,21 +740,29 @@ Users.prototype.putUserPhoto = function (request, authorization, options, callba
if (!callback) {
throw new Error('callback cannot be null.');
}
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (request === null || request === undefined) {
throw new Error('request cannot be null or undefined.');
}
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
throw new Error('appkey must be of type string.');
}
if (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
throw new Error('authorization cannot be null or undefined and it must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/users/me/photo';
'//v0.3/users/me/photo';
// trim all duplicate forward slashes in the url
var regex = /([^:]\/)\/+/gi;
requestUrl = requestUrl.replace(regex, '$1');
@ -668,9 +773,15 @@ Users.prototype.putUserPhoto = function (request, authorization, options, callba
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if (appkey !== undefined && appkey !== null) {
httpRequest.headers['appkey'] = appkey;
}
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {
@ -760,11 +871,21 @@ Users.prototype.putUserPhoto = function (request, authorization, options, callba
* @param {string} [request.visibility] Gets or sets visibility of the user.
* Possible values include: 'Public', 'Private'
*
* @param {string} authorization Authenication (must begin with string "Bearer
* ")
* @param {string} authorization Authentication (must begin with string
* "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {object} [options] Optional Parameters.
*
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
@ -789,21 +910,29 @@ Users.prototype.putUserVisibility = function (request, authorization, options, c
if (!callback) {
throw new Error('callback cannot be null.');
}
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (request === null || request === undefined) {
throw new Error('request cannot be null or undefined.');
}
if (appkey !== null && appkey !== undefined && typeof appkey.valueOf() !== 'string') {
throw new Error('appkey must be of type string.');
}
if (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
throw new Error('authorization cannot be null or undefined and it must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/users/me/visibility';
'//v0.3/users/me/visibility';
// trim all duplicate forward slashes in the url
var regex = /([^:]\/)\/+/gi;
requestUrl = requestUrl.replace(regex, '$1');
@ -814,9 +943,15 @@ Users.prototype.putUserVisibility = function (request, authorization, options, c
httpRequest.headers = {};
httpRequest.url = requestUrl;
// Set Headers
if (appkey !== undefined && appkey !== null) {
httpRequest.headers['appkey'] = appkey;
}
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {
@ -905,10 +1040,18 @@ Users.prototype.putUserVisibility = function (request, authorization, options, c
*
* @param {object} [options] Optional Parameters.
*
* @param {string} [options.appkey] App Key Authentication
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.authorization] Authenication (must begin with
* string "Bearer ")
* @param {string} [options.authorization] Authentication (must begin with
* string "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {string} [options.userHandle1] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
@ -937,6 +1080,7 @@ Users.prototype.getUser = function (userHandle, options, callback) {
}
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var authorization = (options && options.authorization !== undefined) ? options.authorization : undefined;
var userHandle1 = (options && options.userHandle1 !== undefined) ? options.userHandle1 : undefined;
// Validate
try {
if (userHandle === null || userHandle === undefined || typeof userHandle.valueOf() !== 'string') {
@ -948,13 +1092,16 @@ Users.prototype.getUser = function (userHandle, options, callback) {
if (authorization !== null && authorization !== undefined && typeof authorization.valueOf() !== 'string') {
throw new Error('authorization must be of type string.');
}
if (userHandle1 !== null && userHandle1 !== undefined && typeof userHandle1.valueOf() !== 'string') {
throw new Error('userHandle1 must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/users/{userHandle}';
'//v0.3/users/{userHandle}';
requestUrl = requestUrl.replace('{userHandle}', encodeURIComponent(userHandle));
// trim all duplicate forward slashes in the url
var regex = /([^:]\/)\/+/gi;
@ -972,6 +1119,9 @@ Users.prototype.getUser = function (userHandle, options, callback) {
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle1 !== undefined && userHandle1 !== null) {
httpRequest.headers['UserHandle'] = userHandle1;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {
@ -1042,10 +1192,18 @@ Users.prototype.getUser = function (userHandle, options, callback) {
*
* @param {number} [options.limit] Number of items to return
*
* @param {string} [options.appkey] App Key Authentication
* @param {string} [options.appkey] App key must be filled in when using AAD
* tokens for Authentication.
*
* @param {string} [options.authorization] Authenication (must begin with
* string "Bearer ")
* @param {string} [options.authorization] Authentication (must begin with
* string "Bearer "). Possible values are:
*
* -sessionToken for client auth
*
* -AAD token for service auth
*
* @param {string} [options.userHandle] User handle must be filled when using
* AAD tokens for Authentication.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
@ -1077,6 +1235,7 @@ Users.prototype.getPopularUsers = function (options, callback) {
var limit = (options && options.limit !== undefined) ? options.limit : undefined;
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
var authorization = (options && options.authorization !== undefined) ? options.authorization : undefined;
var userHandle = (options && options.userHandle !== undefined) ? options.userHandle : undefined;
// Validate
try {
if (cursor !== null && cursor !== undefined && typeof cursor !== 'number') {
@ -1091,13 +1250,16 @@ Users.prototype.getPopularUsers = function (options, callback) {
if (authorization !== null && authorization !== undefined && typeof authorization.valueOf() !== 'string') {
throw new Error('authorization must be of type string.');
}
if (userHandle !== null && userHandle !== undefined && typeof userHandle.valueOf() !== 'string') {
throw new Error('userHandle must be of type string.');
}
} catch (error) {
return callback(error);
}
// Construct URL
var requestUrl = this.client.baseUri +
'//v0.2/users/popular';
'//v0.3/users/popular';
var queryParameters = [];
if (cursor !== null && cursor !== undefined) {
queryParameters.push('cursor=' + encodeURIComponent(cursor.toString()));
@ -1124,6 +1286,9 @@ Users.prototype.getPopularUsers = function (options, callback) {
if (authorization !== undefined && authorization !== null) {
httpRequest.headers['Authorization'] = authorization;
}
if (userHandle !== undefined && userHandle !== null) {
httpRequest.headers['UserHandle'] = userHandle;
}
if(options) {
for(var headerName in options['customHeaders']) {
if (options['customHeaders'].hasOwnProperty(headerName)) {

Просмотреть файл

@ -41,7 +41,7 @@ function SocialPlusClient(baseUri, options) {
SocialPlusClient['super_'].call(this, null, options);
this.baseUri = baseUri;
if (!this.baseUri) {
this.baseUri = 'http://localhost:1324';
this.baseUri = 'http://sp-ppe.cloudapp.net';
}
this.blobs = new operations.Blobs(this);

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Разница между файлами не показана из-за своего большого размера Загрузить разницу