first version of Node.JS library
This commit is contained in:
Родитель
810c84ba63
Коммит
396e9f97de
|
@ -0,0 +1,203 @@
|
|||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
|
||||
# User-specific files
|
||||
*.suo
|
||||
*.user
|
||||
*.sln.docstates
|
||||
BuildInfoCommitHash.txt
|
||||
BuildInfoHostname.txt
|
||||
BuildInfoDirtyFiles.txt
|
||||
BuildInfoDate.txt
|
||||
.ntvs_analysis.dat
|
||||
.vs/
|
||||
.idea/
|
||||
*.licenseheader
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
x64/
|
||||
build/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
|
||||
# Roslyn cache directories
|
||||
*.ide/
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
#NUNIT
|
||||
*.VisualState.xml
|
||||
TestResult.xml
|
||||
|
||||
# Build Results of an ATL Project
|
||||
[Dd]ebugPS/
|
||||
[Rr]eleasePS/
|
||||
dlldata.c
|
||||
|
||||
*_i.c
|
||||
*_p.c
|
||||
*_i.h
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*.log
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.svclog
|
||||
*.scc
|
||||
|
||||
# Chutzpah Test files
|
||||
_Chutzpah*
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
|
||||
# TFS 2012 Local Workspace
|
||||
$tf/
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
*.DotSettings.user
|
||||
|
||||
# JustCode is a .NET coding addin-in
|
||||
.JustCode
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# NCrunch
|
||||
_NCrunch_*
|
||||
.*crunch*.local.xml
|
||||
|
||||
# MightyMoose
|
||||
*.mm.*
|
||||
AutoTest.Net/
|
||||
|
||||
# Web workbench (sass)
|
||||
.sass-cache/
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.[Pp]ublish.xml
|
||||
#*.azurePubxml
|
||||
## TODO: Comment the next line if you want to checkin your
|
||||
## web deploy settings but do note that will include unencrypted
|
||||
## passwords
|
||||
#*.pubxml
|
||||
|
||||
# NuGet Packages
|
||||
*.nupkg
|
||||
# NuGet Packages Directory
|
||||
**/packages/*
|
||||
## TODO: If the tool you use requires repositories.config
|
||||
## uncomment the next line
|
||||
#!packages/repositories.config
|
||||
|
||||
# Enable "build/" folder in the NuGet Packages folder since
|
||||
# NuGet packages use it for MSBuild targets.
|
||||
# This line needs to be after the ignore of the build folder
|
||||
# (and the packages folder if the line above has been uncommented)
|
||||
!**/packages/build/
|
||||
|
||||
# Windows Azure Build Output
|
||||
csx/
|
||||
rcf/
|
||||
ecf/
|
||||
*.build.csdef
|
||||
|
||||
# Windows Store app package directory
|
||||
AppPackages/
|
||||
|
||||
# Others
|
||||
sql/
|
||||
*.Cache
|
||||
ClientBin/
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.dbproj.schemaview
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
node_modules/
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file
|
||||
# to a newer Visual Studio version. Backup files are not needed,
|
||||
# because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
|
||||
# SQL Server files
|
||||
*.mdf
|
||||
*.ldf
|
||||
|
||||
# Business Intelligence projects
|
||||
*.rdl.data
|
||||
*.bim.layout
|
||||
*.bim_*.settings
|
||||
|
||||
# Microsoft Fakes
|
||||
FakesAssemblies/
|
||||
|
||||
# LightSwitch generated files
|
||||
GeneratedArtifacts/
|
||||
_Pvt_Extensions/
|
||||
ModelManifest.xml
|
||||
|
||||
# FreshPaint autogenerated file
|
||||
code/Client/Windows/FreshPaint_W8.1_SocialPlus/CoreEngine/PaintSurfaceMediaSink_h.h
|
|
@ -0,0 +1,44 @@
|
|||
# Developer Code of Conduct for Embedded Social
|
||||
|
||||
Thanks for incorporating the features of Embedded Social into your application.
|
||||
We ask for your help in protecting the users of your Embedded Social-enabled application by doing the following:
|
||||
|
||||
### Privacy
|
||||
You must adhere to all applicable privacy regulations. For example, collecting personal information from children triggers obligations under privacy laws that exceed those applicable to collecting information from adults.
|
||||
|
||||
Your application needs to have a privacy statement. This statement should cover what data you are collecting, what you will be doing with that data, and who you'll be sharing it with. Your privacy statement needs to be prominently linked off a main menu in your application.
|
||||
|
||||
You need to include the following in your privacy statement:
|
||||
|
||||
If you choose to use Embedded Social features in this application, understand that
|
||||
- your content may be accessed by Microsoft for product improvement purposes. For more information about Microsoft privacy policies please see their privacy statement here: http://go.microsoft.com/fwlink/?LinkId=521839
|
||||
- anonymized data from your Embedded Social activity may be shared with <insert name of your app company> for product improvement purposes.
|
||||
To report abuse of Embedded Social to Microsoft, please select the abusive content or user, select the report option and follow the subsequent screens.
|
||||
|
||||
You need to include the following notice & consent in the Embedded Social First Run Experience (a.k.a. “Signup UI”) for the user when they create an Embedded Social account:
|
||||
|
||||
By creating an Embedded Social account, I agree to the Microsoft
|
||||
- Privacy policy
|
||||
- Terms of Use
|
||||
The application you are using may have additional terms.
|
||||
where the Privacylink above needs to point to http://go.microsoft.com/fwlink/?LinkId=521839, and the Terms of Use link needs to point to http://go.microsoft.com/fwlink/?LinkID=206977.
|
||||
|
||||
### Reporting abuse & requests to access or delete personal information:
|
||||
Your application must provide a way for users to report abuse and delete content that they have authored. We ask that you use the mechanism we provide in Embedded Social for reporting abuse and deleting content.
|
||||
|
||||
### Don’t build apps with the following intent:
|
||||
- To invade anyone's privacy by attempting to discover, harvest, collect, store, or publish private or personally identifiable information without their knowledge and consent;
|
||||
- To harm or exploit minors in any way; or
|
||||
- To defame, abuse, harass, stalk, threaten, or otherwise violate the legal rights of others.
|
||||
See the [Microsoft Terms of Use](http://go.microsoft.com/fwlink/?LinkID=206977) for more details on prohibited uses of Embedded Social.
|
||||
|
||||
### Code of Conduct for Applications
|
||||
If there is conduct you would like to prohibit in your application, that is not already covered by the [Terms of Use](http://go.microsoft.com/fwlink/?LinkID=206977) then you will need to include it in your application’s own Code of Conduct that you create. That Code of Conduct should be prominently linked off a main menu in your application.
|
||||
|
||||
### Termination
|
||||
If this Developer Code of Conduct is not followed, Microsoft reserves the right, at its sole discretion and without any obligation to do so, to review and remove content and to terminate your application’s access to the Embedded Social features.
|
||||
|
||||
### Further Information
|
||||
- [Embedded Social webpage]()
|
||||
- [Microsoft Privacy Statement](http://go.microsoft.com/fwlink/?LinkId=521839)
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 Microsoft
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@ -1,2 +1,5 @@
|
|||
# MSR-SocialPlus-NodeJS-API-Library
|
||||
Library for accessing the "Microsoft Research Embedded Social Plus Software Development Kit" API in your Node.JS code.
|
||||
# Microsoft Research Embedded Social Software Development Kit
|
||||
## Node.JS Library for Server API
|
||||
This is a library for accessing the "Microsoft Research Embedded Social Plus Software Development Kit" API in your Node.JS code.
|
||||
|
||||
By using this code, you agree to the [Developer Code of Conduct](DeveloperCodeOfConduct.md), and the [License Terms](LICENSE).
|
|
@ -0,0 +1,154 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{57144b52-38fb-449b-881a-c4e24f27977e}</ProjectGuid>
|
||||
<ProjectHome />
|
||||
<ProjectView>ShowAllFiles</ProjectView>
|
||||
<StartupFile>socialPlusClient.js</StartupFile>
|
||||
<WorkingDirectory>.</WorkingDirectory>
|
||||
<OutputPath>.</OutputPath>
|
||||
<ProjectTypeGuids>{3AF33F2E-1136-4D97-BBB7-1795711AC8B8};{349c5851-65df-11da-9384-00065b846f21};{9092AA53-FB77-4645-B42D-1CCCA6BD08BD}</ProjectTypeGuids>
|
||||
<TypeScriptSourceMap>true</TypeScriptSourceMap>
|
||||
<TypeScriptModuleKind>CommonJS</TypeScriptModuleKind>
|
||||
<EnableTypeScript>true</EnableTypeScript>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">11.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)' == 'Debug'" />
|
||||
<PropertyGroup Condition="'$(Configuration)' == 'Release'" />
|
||||
<ItemGroup>
|
||||
<Content Include="Microsoft.licenseheader" />
|
||||
<Content Include="swagger.json" />
|
||||
<TypeScriptCompile Include="socialPlusClient.d.ts" />
|
||||
<Compile Include="socialPlusClient.js" />
|
||||
<TypeScriptCompile Include="models\index.d.ts" />
|
||||
<Compile Include="models\activityView.js" />
|
||||
<Compile Include="models\appCompactView.js" />
|
||||
<Compile Include="models\buildsCurrentResponse.js" />
|
||||
<Compile Include="models\commentView.js" />
|
||||
<Compile Include="models\contentCompactView.js" />
|
||||
<Compile Include="models\countResponse.js" />
|
||||
<Compile Include="models\feedResponseActivityView.js" />
|
||||
<Compile Include="models\feedResponseCommentView.js" />
|
||||
<Compile Include="models\feedResponseReplyView.js" />
|
||||
<Compile Include="models\feedResponseTopicView.js" />
|
||||
<Compile Include="models\feedResponseUserCompactView.js" />
|
||||
<Compile Include="models\feedResponseUserProfileView.js" />
|
||||
<Compile Include="models\getRequestTokenResponse.js" />
|
||||
<Compile Include="models\index.js" />
|
||||
<Compile Include="models\linkedAccountView.js" />
|
||||
<Compile Include="models\postBlobResponse.js" />
|
||||
<Compile Include="models\postBlockedUserRequest.js" />
|
||||
<Compile Include="models\postCommentRequest.js" />
|
||||
<Compile Include="models\postCommentResponse.js" />
|
||||
<Compile Include="models\postFollowerRequest.js" />
|
||||
<Compile Include="models\postFollowingRequest.js" />
|
||||
<Compile Include="models\postImageResponse.js" />
|
||||
<Compile Include="models\postLinkedAccountRequest.js" />
|
||||
<Compile Include="models\postPinRequest.js" />
|
||||
<Compile Include="models\postReplyRequest.js" />
|
||||
<Compile Include="models\postReplyResponse.js" />
|
||||
<Compile Include="models\postReportRequest.js" />
|
||||
<Compile Include="models\postSessionRequest.js" />
|
||||
<Compile Include="models\postSessionResponse.js" />
|
||||
<Compile Include="models\postTopicRequest.js" />
|
||||
<Compile Include="models\postTopicResponse.js" />
|
||||
<Compile Include="models\postUserRequest.js" />
|
||||
<Compile Include="models\postUserResponse.js" />
|
||||
<Compile Include="models\putNotificationsStatusRequest.js" />
|
||||
<Compile Include="models\putPushRegistrationRequest.js" />
|
||||
<Compile Include="models\putTopicRequest.js" />
|
||||
<Compile Include="models\putUserInfoRequest.js" />
|
||||
<Compile Include="models\putUserPhotoRequest.js" />
|
||||
<Compile Include="models\putUserVisibilityRequest.js" />
|
||||
<Compile Include="models\replyView.js" />
|
||||
<Compile Include="models\topicView.js" />
|
||||
<Compile Include="models\userCompactView.js" />
|
||||
<Compile Include="models\userProfileView.js" />
|
||||
<TypeScriptCompile Include="operations\index.d.ts" />
|
||||
<Compile Include="operations\blobs.js" />
|
||||
<Compile Include="operations\builds.js" />
|
||||
<Compile Include="operations\commentLikes.js" />
|
||||
<Compile Include="operations\commentReplies.js" />
|
||||
<Compile Include="operations\commentReports.js" />
|
||||
<Compile Include="operations\comments.js" />
|
||||
<Compile Include="operations\hashtags.js" />
|
||||
<Compile Include="operations\images.js" />
|
||||
<Compile Include="operations\index.js" />
|
||||
<Compile Include="operations\myAppFollowing.js" />
|
||||
<Compile Include="operations\myApps.js" />
|
||||
<Compile Include="operations\myBlockedUsers.js" />
|
||||
<Compile Include="operations\myFollowers.js" />
|
||||
<Compile Include="operations\myFollowing.js" />
|
||||
<Compile Include="operations\myLikes.js" />
|
||||
<Compile Include="operations\myLinkedAccounts.js" />
|
||||
<Compile Include="operations\myNotifications.js" />
|
||||
<Compile Include="operations\myPendingUsers.js" />
|
||||
<Compile Include="operations\myPins.js" />
|
||||
<Compile Include="operations\myPushRegistrations.js" />
|
||||
<Compile Include="operations\myTopics.js" />
|
||||
<Compile Include="operations\replies.js" />
|
||||
<Compile Include="operations\replyLikes.js" />
|
||||
<Compile Include="operations\replyReports.js" />
|
||||
<Compile Include="operations\requestTokens.js" />
|
||||
<Compile Include="operations\search.js" />
|
||||
<Compile Include="operations\sessions.js" />
|
||||
<Compile Include="operations\topicComments.js" />
|
||||
<Compile Include="operations\topicLikes.js" />
|
||||
<Compile Include="operations\topicReports.js" />
|
||||
<Compile Include="operations\topics.js" />
|
||||
<Compile Include="operations\userFollowers.js" />
|
||||
<Compile Include="operations\userFollowing.js" />
|
||||
<Compile Include="operations\userReports.js" />
|
||||
<Compile Include="operations\users.js" />
|
||||
<Compile Include="operations\userTopics.js" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="models" />
|
||||
<Folder Include="operations" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.Common.targets" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<!--Do not delete the following Import Project. While this appears to do nothing it is a marker for setting TypeScript properties before our import that depends on them.-->
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets" Condition="False" />
|
||||
<Import Project="$(VSToolsPath)\Node.js Tools\Microsoft.NodejsTools.targets" />
|
||||
<ProjectExtensions>
|
||||
<VisualStudio>
|
||||
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
|
||||
<WebProjectProperties>
|
||||
<UseIIS>False</UseIIS>
|
||||
<AutoAssignPort>True</AutoAssignPort>
|
||||
<DevelopmentServerPort>0</DevelopmentServerPort>
|
||||
<DevelopmentServerVPath>/</DevelopmentServerVPath>
|
||||
<IISUrl>http://localhost:48022/</IISUrl>
|
||||
<NTLMAuthentication>False</NTLMAuthentication>
|
||||
<UseCustomServer>True</UseCustomServer>
|
||||
<CustomServerUrl>http://localhost:1337</CustomServerUrl>
|
||||
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
|
||||
</WebProjectProperties>
|
||||
</FlavorProperties>
|
||||
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}" User="">
|
||||
<WebProjectProperties>
|
||||
<StartPageUrl>
|
||||
</StartPageUrl>
|
||||
<StartAction>CurrentPage</StartAction>
|
||||
<AspNetDebugging>True</AspNetDebugging>
|
||||
<SilverlightDebugging>False</SilverlightDebugging>
|
||||
<NativeDebugging>False</NativeDebugging>
|
||||
<SQLDebugging>False</SQLDebugging>
|
||||
<ExternalProgram>
|
||||
</ExternalProgram>
|
||||
<StartExternalURL>
|
||||
</StartExternalURL>
|
||||
<StartCmdLineArguments>
|
||||
</StartCmdLineArguments>
|
||||
<StartWorkingDirectory>
|
||||
</StartWorkingDirectory>
|
||||
<EnableENC>False</EnableENC>
|
||||
<AlwaysStartWebServerOnDebug>False</AlwaysStartWebServerOnDebug>
|
||||
</WebProjectProperties>
|
||||
</FlavorProperties>
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
</Project>
|
|
@ -0,0 +1,22 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.24720.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9092AA53-FB77-4645-B42D-1CCCA6BD08BD}") = "SocialPlus.Client", "SocialPlus.Client.njsproj", "{57144B52-38FB-449B-881A-C4E24F27977E}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{57144B52-38FB-449B-881A-C4E24F27977E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{57144B52-38FB-449B-881A-C4E24F27977E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{57144B52-38FB-449B-881A-C4E24F27977E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{57144B52-38FB-449B-881A-C4E24F27977E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -0,0 +1,196 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var models = require('./index');
|
||||
|
||||
var util = require('util');
|
||||
|
||||
/**
|
||||
* @class
|
||||
* Initializes a new instance of the ActivityView class.
|
||||
* @constructor
|
||||
* Activity view
|
||||
* @member {string} activityHandle Gets or sets activity handle
|
||||
*
|
||||
* @member {date} createdTime Gets or sets created time
|
||||
*
|
||||
* @member {string} activityType Gets or sets activity type. Possible values
|
||||
* for this property include: 'Like', 'Comment', 'Reply', 'CommentPeer',
|
||||
* 'ReplyPeer', 'Following', 'FollowRequest', 'FollowAccept'.
|
||||
*
|
||||
* @member {array} actorUsers Gets or sets actor users
|
||||
*
|
||||
* @member {object} [actedOnUser] Gets or sets acted on user
|
||||
*
|
||||
* @member {string} [actedOnUser.userHandle] Gets or sets user handle
|
||||
*
|
||||
* @member {string} [actedOnUser.firstName] Gets or sets first name of the user
|
||||
*
|
||||
* @member {string} [actedOnUser.lastName] Gets or sets last name of the user
|
||||
*
|
||||
* @member {string} [actedOnUser.photoHandle] Gets or sets photo handle of the
|
||||
* user
|
||||
*
|
||||
* @member {string} [actedOnUser.photoUrl] Gets or sets photo url of the user
|
||||
*
|
||||
* @member {string} [actedOnUser.visibility] Gets or sets visibility of the
|
||||
* user. Possible values for this property include: 'Public', 'Private'.
|
||||
*
|
||||
* @member {string} [actedOnUser.followerStatus] Gets or sets follower
|
||||
* relationship status of the querying user. Possible values for this
|
||||
* property include: 'None', 'Follow', 'Pending', 'Blocked'.
|
||||
*
|
||||
* @member {object} [actedOnContent] Gets or sets acted on content
|
||||
*
|
||||
* @member {string} [actedOnContent.contentType] Gets or sets content type.
|
||||
* Possible values for this property include: 'Unknown', 'Topic', 'Comment',
|
||||
* 'Reply'.
|
||||
*
|
||||
* @member {string} [actedOnContent.contentHandle] Gets or sets content handle
|
||||
*
|
||||
* @member {string} [actedOnContent.parentHandle] Gets or sets parent handle
|
||||
*
|
||||
* @member {string} [actedOnContent.rootHandle] Gets or sets root handle
|
||||
*
|
||||
* @member {string} [actedOnContent.text] Gets or sets content text
|
||||
*
|
||||
* @member {string} [actedOnContent.blobType] Gets or sets content blob type.
|
||||
* Possible values for this property include: 'Unknown', 'Image', 'Video',
|
||||
* 'Custom'.
|
||||
*
|
||||
* @member {string} [actedOnContent.blobHandle] Gets or sets content blob
|
||||
* handle
|
||||
*
|
||||
* @member {string} [actedOnContent.blobUrl] Gets or sets content blob url
|
||||
*
|
||||
* @member {number} totalActions Gets or sets total actions
|
||||
*
|
||||
* @member {boolean} unread Gets or sets a value indicating whether the
|
||||
* activity was read
|
||||
*
|
||||
* @member {object} [app] Gets or sets the containing app
|
||||
*
|
||||
* @member {string} [app.appHandle] Gets or sets app handle
|
||||
*
|
||||
* @member {string} [app.name] Gets or sets app name
|
||||
*
|
||||
* @member {string} [app.iconHandle] Gets or sets app icon handle
|
||||
*
|
||||
* @member {string} [app.iconUrl] Gets or sets app icon url
|
||||
*
|
||||
* @member {string} [app.platformType] Gets or sets platform type. Possible
|
||||
* values for this property include: 'Windows', 'Android', 'IOS'.
|
||||
*
|
||||
* @member {string} [app.deepLink] Gets or sets app deep link
|
||||
*
|
||||
* @member {string} [app.storeLink] Gets or sets app store link
|
||||
*
|
||||
*/
|
||||
function ActivityView() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the metadata of ActivityView
|
||||
*
|
||||
* @returns {object} metadata of ActivityView
|
||||
*
|
||||
*/
|
||||
ActivityView.prototype.mapper = function () {
|
||||
return {
|
||||
required: false,
|
||||
serializedName: 'ActivityView',
|
||||
type: {
|
||||
name: 'Composite',
|
||||
className: 'ActivityView',
|
||||
modelProperties: {
|
||||
activityHandle: {
|
||||
required: true,
|
||||
serializedName: 'activityHandle',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
createdTime: {
|
||||
required: true,
|
||||
serializedName: 'createdTime',
|
||||
type: {
|
||||
name: 'DateTime'
|
||||
}
|
||||
},
|
||||
activityType: {
|
||||
required: true,
|
||||
serializedName: 'activityType',
|
||||
type: {
|
||||
name: 'Enum',
|
||||
allowedValues: [ 'Like', 'Comment', 'Reply', 'CommentPeer', 'ReplyPeer', 'Following', 'FollowRequest', 'FollowAccept' ]
|
||||
}
|
||||
},
|
||||
actorUsers: {
|
||||
required: true,
|
||||
serializedName: 'actorUsers',
|
||||
type: {
|
||||
name: 'Sequence',
|
||||
element: {
|
||||
required: false,
|
||||
serializedName: 'UserCompactViewElementType',
|
||||
type: {
|
||||
name: 'Composite',
|
||||
className: 'UserCompactView'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
actedOnUser: {
|
||||
required: false,
|
||||
serializedName: 'actedOnUser',
|
||||
type: {
|
||||
name: 'Composite',
|
||||
className: 'UserCompactView'
|
||||
}
|
||||
},
|
||||
actedOnContent: {
|
||||
required: false,
|
||||
serializedName: 'actedOnContent',
|
||||
type: {
|
||||
name: 'Composite',
|
||||
className: 'ContentCompactView'
|
||||
}
|
||||
},
|
||||
totalActions: {
|
||||
required: true,
|
||||
serializedName: 'totalActions',
|
||||
type: {
|
||||
name: 'Number'
|
||||
}
|
||||
},
|
||||
unread: {
|
||||
required: true,
|
||||
serializedName: 'unread',
|
||||
type: {
|
||||
name: 'Boolean'
|
||||
}
|
||||
},
|
||||
app: {
|
||||
required: false,
|
||||
serializedName: 'app',
|
||||
type: {
|
||||
name: 'Composite',
|
||||
className: 'AppCompactView'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = ActivityView;
|
|
@ -0,0 +1,107 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @class
|
||||
* Initializes a new instance of the AppCompactView class.
|
||||
* @constructor
|
||||
* App compact view
|
||||
* @member {string} appHandle Gets or sets app handle
|
||||
*
|
||||
* @member {string} name Gets or sets app name
|
||||
*
|
||||
* @member {string} [iconHandle] Gets or sets app icon handle
|
||||
*
|
||||
* @member {string} [iconUrl] Gets or sets app icon url
|
||||
*
|
||||
* @member {string} platformType Gets or sets platform type. Possible values
|
||||
* for this property include: 'Windows', 'Android', 'IOS'.
|
||||
*
|
||||
* @member {string} [deepLink] Gets or sets app deep link
|
||||
*
|
||||
* @member {string} [storeLink] Gets or sets app store link
|
||||
*
|
||||
*/
|
||||
function AppCompactView() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the metadata of AppCompactView
|
||||
*
|
||||
* @returns {object} metadata of AppCompactView
|
||||
*
|
||||
*/
|
||||
AppCompactView.prototype.mapper = function () {
|
||||
return {
|
||||
required: false,
|
||||
serializedName: 'AppCompactView',
|
||||
type: {
|
||||
name: 'Composite',
|
||||
className: 'AppCompactView',
|
||||
modelProperties: {
|
||||
appHandle: {
|
||||
required: true,
|
||||
serializedName: 'appHandle',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
name: {
|
||||
required: true,
|
||||
serializedName: 'name',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
iconHandle: {
|
||||
required: false,
|
||||
serializedName: 'iconHandle',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
iconUrl: {
|
||||
required: false,
|
||||
serializedName: 'iconUrl',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
platformType: {
|
||||
required: true,
|
||||
serializedName: 'platformType',
|
||||
type: {
|
||||
name: 'Enum',
|
||||
allowedValues: [ 'Windows', 'Android', 'IOS' ]
|
||||
}
|
||||
},
|
||||
deepLink: {
|
||||
required: false,
|
||||
serializedName: 'deepLink',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
storeLink: {
|
||||
required: false,
|
||||
serializedName: 'storeLink',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = AppCompactView;
|
|
@ -0,0 +1,100 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var util = require('util');
|
||||
|
||||
/**
|
||||
* @class
|
||||
* Initializes a new instance of the BuildsCurrentResponse class.
|
||||
* @constructor
|
||||
* Response from get builds current
|
||||
* @member {string} [dateAndTime] Gets or sets the date and time of the
|
||||
* current build
|
||||
*
|
||||
* @member {string} [commitHash] Gets or sets the Git commit hash that
|
||||
* represents the current checkout
|
||||
*
|
||||
* @member {string} [hostname] Gets or sets the hostname that this code was
|
||||
* built on
|
||||
*
|
||||
* @member {string} [serviceApiVersion] Gets or sets service api version number
|
||||
*
|
||||
* @member {array} [dirtyFiles] Gets or sets the list of files that were not
|
||||
* committed at build time
|
||||
*
|
||||
*/
|
||||
function BuildsCurrentResponse() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the metadata of BuildsCurrentResponse
|
||||
*
|
||||
* @returns {object} metadata of BuildsCurrentResponse
|
||||
*
|
||||
*/
|
||||
BuildsCurrentResponse.prototype.mapper = function () {
|
||||
return {
|
||||
required: false,
|
||||
serializedName: 'BuildsCurrentResponse',
|
||||
type: {
|
||||
name: 'Composite',
|
||||
className: 'BuildsCurrentResponse',
|
||||
modelProperties: {
|
||||
dateAndTime: {
|
||||
required: false,
|
||||
serializedName: 'dateAndTime',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
commitHash: {
|
||||
required: false,
|
||||
serializedName: 'commitHash',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
hostname: {
|
||||
required: false,
|
||||
serializedName: 'hostname',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
serviceApiVersion: {
|
||||
required: false,
|
||||
serializedName: 'serviceApiVersion',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
dirtyFiles: {
|
||||
required: false,
|
||||
serializedName: 'dirtyFiles',
|
||||
type: {
|
||||
name: 'Sequence',
|
||||
element: {
|
||||
required: false,
|
||||
serializedName: 'StringElementType',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = BuildsCurrentResponse;
|
|
@ -0,0 +1,184 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var models = require('./index');
|
||||
|
||||
/**
|
||||
* @class
|
||||
* Initializes a new instance of the CommentView class.
|
||||
* @constructor
|
||||
* Comment view
|
||||
* @member {string} commentHandle Gets or sets comment handle
|
||||
*
|
||||
* @member {string} topicHandle Gets or sets parent topic handle
|
||||
*
|
||||
* @member {date} createdTime Gets or sets created time
|
||||
*
|
||||
* @member {object} user Gets or sets owner of the comment
|
||||
*
|
||||
* @member {string} [user.userHandle] Gets or sets user handle
|
||||
*
|
||||
* @member {string} [user.firstName] Gets or sets first name of the user
|
||||
*
|
||||
* @member {string} [user.lastName] Gets or sets last name of the user
|
||||
*
|
||||
* @member {string} [user.photoHandle] Gets or sets photo handle of the user
|
||||
*
|
||||
* @member {string} [user.photoUrl] Gets or sets photo url of the user
|
||||
*
|
||||
* @member {string} [user.visibility] Gets or sets visibility of the user.
|
||||
* Possible values for this property include: 'Public', 'Private'.
|
||||
*
|
||||
* @member {string} [user.followerStatus] Gets or sets follower relationship
|
||||
* status of the querying user. Possible values for this property include:
|
||||
* 'None', 'Follow', 'Pending', 'Blocked'.
|
||||
*
|
||||
* @member {string} text Gets or sets comment text
|
||||
*
|
||||
* @member {string} [blobType] Gets or sets comment blob type. Possible values
|
||||
* for this property include: 'Unknown', 'Image', 'Video', 'Custom'.
|
||||
*
|
||||
* @member {string} [blobHandle] Gets or sets comment blob handle
|
||||
*
|
||||
* @member {string} [blobUrl] Gets or sets comment blob url
|
||||
*
|
||||
* @member {string} [language] Gets or sets comment language
|
||||
*
|
||||
* @member {number} totalLikes Gets or sets total likes for the comment
|
||||
*
|
||||
* @member {number} totalReplies Gets or sets total replies for the comment
|
||||
*
|
||||
* @member {boolean} liked Gets or sets a value indicating whether the
|
||||
* querying user has liked the comment
|
||||
*
|
||||
* @member {string} [contentStatus] Gets or sets content status. Possible
|
||||
* values for this property include: 'Active', 'Banned'.
|
||||
*
|
||||
*/
|
||||
function CommentView() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the metadata of CommentView
|
||||
*
|
||||
* @returns {object} metadata of CommentView
|
||||
*
|
||||
*/
|
||||
CommentView.prototype.mapper = function () {
|
||||
return {
|
||||
required: false,
|
||||
serializedName: 'CommentView',
|
||||
type: {
|
||||
name: 'Composite',
|
||||
className: 'CommentView',
|
||||
modelProperties: {
|
||||
commentHandle: {
|
||||
required: true,
|
||||
serializedName: 'commentHandle',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
topicHandle: {
|
||||
required: true,
|
||||
serializedName: 'topicHandle',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
createdTime: {
|
||||
required: true,
|
||||
serializedName: 'createdTime',
|
||||
type: {
|
||||
name: 'DateTime'
|
||||
}
|
||||
},
|
||||
user: {
|
||||
required: true,
|
||||
serializedName: 'user',
|
||||
type: {
|
||||
name: 'Composite',
|
||||
className: 'UserCompactView'
|
||||
}
|
||||
},
|
||||
text: {
|
||||
required: true,
|
||||
serializedName: 'text',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
blobType: {
|
||||
required: false,
|
||||
serializedName: 'blobType',
|
||||
type: {
|
||||
name: 'Enum',
|
||||
allowedValues: [ 'Unknown', 'Image', 'Video', 'Custom' ]
|
||||
}
|
||||
},
|
||||
blobHandle: {
|
||||
required: false,
|
||||
serializedName: 'blobHandle',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
blobUrl: {
|
||||
required: false,
|
||||
serializedName: 'blobUrl',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
language: {
|
||||
required: false,
|
||||
serializedName: 'language',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
totalLikes: {
|
||||
required: true,
|
||||
serializedName: 'totalLikes',
|
||||
type: {
|
||||
name: 'Number'
|
||||
}
|
||||
},
|
||||
totalReplies: {
|
||||
required: true,
|
||||
serializedName: 'totalReplies',
|
||||
type: {
|
||||
name: 'Number'
|
||||
}
|
||||
},
|
||||
liked: {
|
||||
required: true,
|
||||
serializedName: 'liked',
|
||||
type: {
|
||||
name: 'Boolean'
|
||||
}
|
||||
},
|
||||
contentStatus: {
|
||||
required: false,
|
||||
serializedName: 'contentStatus',
|
||||
type: {
|
||||
name: 'Enum',
|
||||
allowedValues: [ 'Active', 'Banned' ]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = CommentView;
|
|
@ -0,0 +1,118 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @class
|
||||
* Initializes a new instance of the ContentCompactView class.
|
||||
* @constructor
|
||||
* Content compact view
|
||||
* @member {string} contentType Gets or sets content type. Possible values for
|
||||
* this property include: 'Unknown', 'Topic', 'Comment', 'Reply'.
|
||||
*
|
||||
* @member {string} contentHandle Gets or sets content handle
|
||||
*
|
||||
* @member {string} [parentHandle] Gets or sets parent handle
|
||||
*
|
||||
* @member {string} [rootHandle] Gets or sets root handle
|
||||
*
|
||||
* @member {string} text Gets or sets content text
|
||||
*
|
||||
* @member {string} [blobType] Gets or sets content blob type. Possible values
|
||||
* for this property include: 'Unknown', 'Image', 'Video', 'Custom'.
|
||||
*
|
||||
* @member {string} [blobHandle] Gets or sets content blob handle
|
||||
*
|
||||
* @member {string} [blobUrl] Gets or sets content blob url
|
||||
*
|
||||
*/
|
||||
function ContentCompactView() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the metadata of ContentCompactView
|
||||
*
|
||||
* @returns {object} metadata of ContentCompactView
|
||||
*
|
||||
*/
|
||||
ContentCompactView.prototype.mapper = function () {
|
||||
return {
|
||||
required: false,
|
||||
serializedName: 'ContentCompactView',
|
||||
type: {
|
||||
name: 'Composite',
|
||||
className: 'ContentCompactView',
|
||||
modelProperties: {
|
||||
contentType: {
|
||||
required: true,
|
||||
serializedName: 'contentType',
|
||||
type: {
|
||||
name: 'Enum',
|
||||
allowedValues: [ 'Unknown', 'Topic', 'Comment', 'Reply' ]
|
||||
}
|
||||
},
|
||||
contentHandle: {
|
||||
required: true,
|
||||
serializedName: 'contentHandle',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
parentHandle: {
|
||||
required: false,
|
||||
serializedName: 'parentHandle',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
rootHandle: {
|
||||
required: false,
|
||||
serializedName: 'rootHandle',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
text: {
|
||||
required: true,
|
||||
serializedName: 'text',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
blobType: {
|
||||
required: false,
|
||||
serializedName: 'blobType',
|
||||
type: {
|
||||
name: 'Enum',
|
||||
allowedValues: [ 'Unknown', 'Image', 'Video', 'Custom' ]
|
||||
}
|
||||
},
|
||||
blobHandle: {
|
||||
required: false,
|
||||
serializedName: 'blobHandle',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
blobUrl: {
|
||||
required: false,
|
||||
serializedName: 'blobUrl',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = ContentCompactView;
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @class
|
||||
* Initializes a new instance of the CountResponse class.
|
||||
* @constructor
|
||||
* Count response
|
||||
* @member {number} count Gets or sets count
|
||||
*
|
||||
*/
|
||||
function CountResponse() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the metadata of CountResponse
|
||||
*
|
||||
* @returns {object} metadata of CountResponse
|
||||
*
|
||||
*/
|
||||
CountResponse.prototype.mapper = function () {
|
||||
return {
|
||||
required: false,
|
||||
serializedName: 'CountResponse',
|
||||
type: {
|
||||
name: 'Composite',
|
||||
className: 'CountResponse',
|
||||
modelProperties: {
|
||||
count: {
|
||||
required: true,
|
||||
serializedName: 'count',
|
||||
type: {
|
||||
name: 'Number'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = CountResponse;
|
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var models = require('./index');
|
||||
|
||||
var util = require('util');
|
||||
|
||||
/**
|
||||
* @class
|
||||
* Initializes a new instance of the FeedResponseActivityView class.
|
||||
* @constructor
|
||||
* Feed response
|
||||
* @member {array} data Gets or sets feed data
|
||||
*
|
||||
* @member {string} cursor Gets or sets feed cursor
|
||||
*
|
||||
*/
|
||||
function FeedResponseActivityView() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the metadata of FeedResponseActivityView
|
||||
*
|
||||
* @returns {object} metadata of FeedResponseActivityView
|
||||
*
|
||||
*/
|
||||
FeedResponseActivityView.prototype.mapper = function () {
|
||||
return {
|
||||
required: false,
|
||||
serializedName: 'FeedResponse[ActivityView]',
|
||||
type: {
|
||||
name: 'Composite',
|
||||
className: 'FeedResponseActivityView',
|
||||
modelProperties: {
|
||||
data: {
|
||||
required: true,
|
||||
serializedName: 'data',
|
||||
type: {
|
||||
name: 'Sequence',
|
||||
element: {
|
||||
required: false,
|
||||
serializedName: 'ActivityViewElementType',
|
||||
type: {
|
||||
name: 'Composite',
|
||||
className: 'ActivityView'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
cursor: {
|
||||
required: true,
|
||||
serializedName: 'cursor',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = FeedResponseActivityView;
|
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var models = require('./index');
|
||||
|
||||
var util = require('util');
|
||||
|
||||
/**
|
||||
* @class
|
||||
* Initializes a new instance of the FeedResponseCommentView class.
|
||||
* @constructor
|
||||
* Feed response
|
||||
* @member {array} data Gets or sets feed data
|
||||
*
|
||||
* @member {string} cursor Gets or sets feed cursor
|
||||
*
|
||||
*/
|
||||
function FeedResponseCommentView() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the metadata of FeedResponseCommentView
|
||||
*
|
||||
* @returns {object} metadata of FeedResponseCommentView
|
||||
*
|
||||
*/
|
||||
FeedResponseCommentView.prototype.mapper = function () {
|
||||
return {
|
||||
required: false,
|
||||
serializedName: 'FeedResponse[CommentView]',
|
||||
type: {
|
||||
name: 'Composite',
|
||||
className: 'FeedResponseCommentView',
|
||||
modelProperties: {
|
||||
data: {
|
||||
required: true,
|
||||
serializedName: 'data',
|
||||
type: {
|
||||
name: 'Sequence',
|
||||
element: {
|
||||
required: false,
|
||||
serializedName: 'CommentViewElementType',
|
||||
type: {
|
||||
name: 'Composite',
|
||||
className: 'CommentView'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
cursor: {
|
||||
required: true,
|
||||
serializedName: 'cursor',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = FeedResponseCommentView;
|
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var models = require('./index');
|
||||
|
||||
var util = require('util');
|
||||
|
||||
/**
|
||||
* @class
|
||||
* Initializes a new instance of the FeedResponseReplyView class.
|
||||
* @constructor
|
||||
* Feed response
|
||||
* @member {array} data Gets or sets feed data
|
||||
*
|
||||
* @member {string} cursor Gets or sets feed cursor
|
||||
*
|
||||
*/
|
||||
function FeedResponseReplyView() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the metadata of FeedResponseReplyView
|
||||
*
|
||||
* @returns {object} metadata of FeedResponseReplyView
|
||||
*
|
||||
*/
|
||||
FeedResponseReplyView.prototype.mapper = function () {
|
||||
return {
|
||||
required: false,
|
||||
serializedName: 'FeedResponse[ReplyView]',
|
||||
type: {
|
||||
name: 'Composite',
|
||||
className: 'FeedResponseReplyView',
|
||||
modelProperties: {
|
||||
data: {
|
||||
required: true,
|
||||
serializedName: 'data',
|
||||
type: {
|
||||
name: 'Sequence',
|
||||
element: {
|
||||
required: false,
|
||||
serializedName: 'ReplyViewElementType',
|
||||
type: {
|
||||
name: 'Composite',
|
||||
className: 'ReplyView'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
cursor: {
|
||||
required: true,
|
||||
serializedName: 'cursor',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = FeedResponseReplyView;
|
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var models = require('./index');
|
||||
|
||||
var util = require('util');
|
||||
|
||||
/**
|
||||
* @class
|
||||
* Initializes a new instance of the FeedResponseTopicView class.
|
||||
* @constructor
|
||||
* Feed response
|
||||
* @member {array} data Gets or sets feed data
|
||||
*
|
||||
* @member {string} cursor Gets or sets feed cursor
|
||||
*
|
||||
*/
|
||||
function FeedResponseTopicView() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the metadata of FeedResponseTopicView
|
||||
*
|
||||
* @returns {object} metadata of FeedResponseTopicView
|
||||
*
|
||||
*/
|
||||
FeedResponseTopicView.prototype.mapper = function () {
|
||||
return {
|
||||
required: false,
|
||||
serializedName: 'FeedResponse[TopicView]',
|
||||
type: {
|
||||
name: 'Composite',
|
||||
className: 'FeedResponseTopicView',
|
||||
modelProperties: {
|
||||
data: {
|
||||
required: true,
|
||||
serializedName: 'data',
|
||||
type: {
|
||||
name: 'Sequence',
|
||||
element: {
|
||||
required: false,
|
||||
serializedName: 'TopicViewElementType',
|
||||
type: {
|
||||
name: 'Composite',
|
||||
className: 'TopicView'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
cursor: {
|
||||
required: true,
|
||||
serializedName: 'cursor',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = FeedResponseTopicView;
|
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var models = require('./index');
|
||||
|
||||
var util = require('util');
|
||||
|
||||
/**
|
||||
* @class
|
||||
* Initializes a new instance of the FeedResponseUserCompactView class.
|
||||
* @constructor
|
||||
* Feed response
|
||||
* @member {array} data Gets or sets feed data
|
||||
*
|
||||
* @member {string} cursor Gets or sets feed cursor
|
||||
*
|
||||
*/
|
||||
function FeedResponseUserCompactView() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the metadata of FeedResponseUserCompactView
|
||||
*
|
||||
* @returns {object} metadata of FeedResponseUserCompactView
|
||||
*
|
||||
*/
|
||||
FeedResponseUserCompactView.prototype.mapper = function () {
|
||||
return {
|
||||
required: false,
|
||||
serializedName: 'FeedResponse[UserCompactView]',
|
||||
type: {
|
||||
name: 'Composite',
|
||||
className: 'FeedResponseUserCompactView',
|
||||
modelProperties: {
|
||||
data: {
|
||||
required: true,
|
||||
serializedName: 'data',
|
||||
type: {
|
||||
name: 'Sequence',
|
||||
element: {
|
||||
required: false,
|
||||
serializedName: 'UserCompactViewElementType',
|
||||
type: {
|
||||
name: 'Composite',
|
||||
className: 'UserCompactView'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
cursor: {
|
||||
required: true,
|
||||
serializedName: 'cursor',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = FeedResponseUserCompactView;
|
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var models = require('./index');
|
||||
|
||||
var util = require('util');
|
||||
|
||||
/**
|
||||
* @class
|
||||
* Initializes a new instance of the FeedResponseUserProfileView class.
|
||||
* @constructor
|
||||
* Feed response
|
||||
* @member {array} data Gets or sets feed data
|
||||
*
|
||||
* @member {string} cursor Gets or sets feed cursor
|
||||
*
|
||||
*/
|
||||
function FeedResponseUserProfileView() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the metadata of FeedResponseUserProfileView
|
||||
*
|
||||
* @returns {object} metadata of FeedResponseUserProfileView
|
||||
*
|
||||
*/
|
||||
FeedResponseUserProfileView.prototype.mapper = function () {
|
||||
return {
|
||||
required: false,
|
||||
serializedName: 'FeedResponse[UserProfileView]',
|
||||
type: {
|
||||
name: 'Composite',
|
||||
className: 'FeedResponseUserProfileView',
|
||||
modelProperties: {
|
||||
data: {
|
||||
required: true,
|
||||
serializedName: 'data',
|
||||
type: {
|
||||
name: 'Sequence',
|
||||
element: {
|
||||
required: false,
|
||||
serializedName: 'UserProfileViewElementType',
|
||||
type: {
|
||||
name: 'Composite',
|
||||
className: 'UserProfileView'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
cursor: {
|
||||
required: true,
|
||||
serializedName: 'cursor',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = FeedResponseUserProfileView;
|
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @class
|
||||
* Initializes a new instance of the GetRequestTokenResponse class.
|
||||
* @constructor
|
||||
* Response from get request token response
|
||||
* @member {string} requestToken Gets or sets request token from identity
|
||||
* provider
|
||||
*
|
||||
*/
|
||||
function GetRequestTokenResponse() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the metadata of GetRequestTokenResponse
|
||||
*
|
||||
* @returns {object} metadata of GetRequestTokenResponse
|
||||
*
|
||||
*/
|
||||
GetRequestTokenResponse.prototype.mapper = function () {
|
||||
return {
|
||||
required: false,
|
||||
serializedName: 'GetRequestTokenResponse',
|
||||
type: {
|
||||
name: 'Composite',
|
||||
className: 'GetRequestTokenResponse',
|
||||
modelProperties: {
|
||||
requestToken: {
|
||||
required: true,
|
||||
serializedName: 'requestToken',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = GetRequestTokenResponse;
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
/* jshint latedef:false */
|
||||
/* jshint forin:false */
|
||||
/* jshint noempty:false */
|
||||
|
||||
'use strict';
|
||||
|
||||
exports.PostBlobResponse = require('./postBlobResponse');
|
||||
exports.BuildsCurrentResponse = require('./buildsCurrentResponse');
|
||||
exports.CommentView = require('./commentView');
|
||||
exports.UserCompactView = require('./userCompactView');
|
||||
exports.PostCommentRequest = require('./postCommentRequest');
|
||||
exports.PostCommentResponse = require('./postCommentResponse');
|
||||
exports.FeedResponseCommentView = require('./feedResponseCommentView');
|
||||
exports.PostImageResponse = require('./postImageResponse');
|
||||
exports.FeedResponseUserCompactView = require('./feedResponseUserCompactView');
|
||||
exports.PutNotificationsStatusRequest = require('./putNotificationsStatusRequest');
|
||||
exports.FeedResponseActivityView = require('./feedResponseActivityView');
|
||||
exports.ActivityView = require('./activityView');
|
||||
exports.ContentCompactView = require('./contentCompactView');
|
||||
exports.AppCompactView = require('./appCompactView');
|
||||
exports.CountResponse = require('./countResponse');
|
||||
exports.PostPinRequest = require('./postPinRequest');
|
||||
exports.FeedResponseTopicView = require('./feedResponseTopicView');
|
||||
exports.TopicView = require('./topicView');
|
||||
exports.PutPushRegistrationRequest = require('./putPushRegistrationRequest');
|
||||
exports.ReplyView = require('./replyView');
|
||||
exports.PostReplyRequest = require('./postReplyRequest');
|
||||
exports.PostReplyResponse = require('./postReplyResponse');
|
||||
exports.FeedResponseReplyView = require('./feedResponseReplyView');
|
||||
exports.PostReportRequest = require('./postReportRequest');
|
||||
exports.PostSessionRequest = require('./postSessionRequest');
|
||||
exports.PostSessionResponse = require('./postSessionResponse');
|
||||
exports.GetRequestTokenResponse = require('./getRequestTokenResponse');
|
||||
exports.PostFollowerRequest = require('./postFollowerRequest');
|
||||
exports.PostFollowingRequest = require('./postFollowingRequest');
|
||||
exports.PostBlockedUserRequest = require('./postBlockedUserRequest');
|
||||
exports.PostTopicRequest = require('./postTopicRequest');
|
||||
exports.PostTopicResponse = require('./postTopicResponse');
|
||||
exports.PutTopicRequest = require('./putTopicRequest');
|
||||
exports.PostLinkedAccountRequest = require('./postLinkedAccountRequest');
|
||||
exports.LinkedAccountView = require('./linkedAccountView');
|
||||
exports.PostUserRequest = require('./postUserRequest');
|
||||
exports.PostUserResponse = require('./postUserResponse');
|
||||
exports.UserProfileView = require('./userProfileView');
|
||||
exports.PutUserInfoRequest = require('./putUserInfoRequest');
|
||||
exports.PutUserPhotoRequest = require('./putUserPhotoRequest');
|
||||
exports.PutUserVisibilityRequest = require('./putUserVisibilityRequest');
|
||||
exports.FeedResponseUserProfileView = require('./feedResponseUserProfileView');
|
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @class
|
||||
* Initializes a new instance of the LinkedAccountView class.
|
||||
* @constructor
|
||||
* Linked account view
|
||||
* @member {string} identityProvider Gets or sets identity provider type.
|
||||
* Possible values for this property include: 'Facebook', 'Microsoft',
|
||||
* 'Google', 'Twitter'.
|
||||
*
|
||||
* @member {string} accountId Gets or sets third party account id -- Unique
|
||||
* user id provided by the third-party identity provider
|
||||
*
|
||||
*/
|
||||
function LinkedAccountView() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the metadata of LinkedAccountView
|
||||
*
|
||||
* @returns {object} metadata of LinkedAccountView
|
||||
*
|
||||
*/
|
||||
LinkedAccountView.prototype.mapper = function () {
|
||||
return {
|
||||
required: false,
|
||||
serializedName: 'LinkedAccountView',
|
||||
type: {
|
||||
name: 'Composite',
|
||||
className: 'LinkedAccountView',
|
||||
modelProperties: {
|
||||
identityProvider: {
|
||||
required: true,
|
||||
serializedName: 'identityProvider',
|
||||
type: {
|
||||
name: 'Enum',
|
||||
allowedValues: [ 'Facebook', 'Microsoft', 'Google', 'Twitter' ]
|
||||
}
|
||||
},
|
||||
accountId: {
|
||||
required: true,
|
||||
serializedName: 'accountId',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = LinkedAccountView;
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @class
|
||||
* Initializes a new instance of the PostBlobResponse class.
|
||||
* @constructor
|
||||
* Response from post (create) blob
|
||||
* @member {string} blobHandle Gets or sets blob handle
|
||||
*
|
||||
*/
|
||||
function PostBlobResponse() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the metadata of PostBlobResponse
|
||||
*
|
||||
* @returns {object} metadata of PostBlobResponse
|
||||
*
|
||||
*/
|
||||
PostBlobResponse.prototype.mapper = function () {
|
||||
return {
|
||||
required: false,
|
||||
serializedName: 'PostBlobResponse',
|
||||
type: {
|
||||
name: 'Composite',
|
||||
className: 'PostBlobResponse',
|
||||
modelProperties: {
|
||||
blobHandle: {
|
||||
required: true,
|
||||
serializedName: 'blobHandle',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = PostBlobResponse;
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @class
|
||||
* Initializes a new instance of the PostBlockedUserRequest class.
|
||||
* @constructor
|
||||
* Request to post a blocked user (block user)
|
||||
* @member {string} userHandle Gets or sets user handle
|
||||
*
|
||||
*/
|
||||
function PostBlockedUserRequest() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the metadata of PostBlockedUserRequest
|
||||
*
|
||||
* @returns {object} metadata of PostBlockedUserRequest
|
||||
*
|
||||
*/
|
||||
PostBlockedUserRequest.prototype.mapper = function () {
|
||||
return {
|
||||
required: false,
|
||||
serializedName: 'PostBlockedUserRequest',
|
||||
type: {
|
||||
name: 'Composite',
|
||||
className: 'PostBlockedUserRequest',
|
||||
modelProperties: {
|
||||
userHandle: {
|
||||
required: true,
|
||||
serializedName: 'userHandle',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = PostBlockedUserRequest;
|
|
@ -0,0 +1,80 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @class
|
||||
* Initializes a new instance of the PostCommentRequest class.
|
||||
* @constructor
|
||||
* Request to post (create) comment
|
||||
* @member {string} text Gets or sets comment text
|
||||
*
|
||||
* @member {string} [blobType] Gets or sets comment blob type. Possible values
|
||||
* for this property include: 'Unknown', 'Image', 'Video', 'Custom'.
|
||||
*
|
||||
* @member {string} [blobHandle] Gets or sets comment blob handle
|
||||
*
|
||||
* @member {string} [language] Gets or sets comment language
|
||||
*
|
||||
*/
|
||||
function PostCommentRequest() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the metadata of PostCommentRequest
|
||||
*
|
||||
* @returns {object} metadata of PostCommentRequest
|
||||
*
|
||||
*/
|
||||
PostCommentRequest.prototype.mapper = function () {
|
||||
return {
|
||||
required: false,
|
||||
serializedName: 'PostCommentRequest',
|
||||
type: {
|
||||
name: 'Composite',
|
||||
className: 'PostCommentRequest',
|
||||
modelProperties: {
|
||||
text: {
|
||||
required: true,
|
||||
serializedName: 'text',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
blobType: {
|
||||
required: false,
|
||||
serializedName: 'blobType',
|
||||
type: {
|
||||
name: 'Enum',
|
||||
allowedValues: [ 'Unknown', 'Image', 'Video', 'Custom' ]
|
||||
}
|
||||
},
|
||||
blobHandle: {
|
||||
required: false,
|
||||
serializedName: 'blobHandle',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
language: {
|
||||
required: false,
|
||||
serializedName: 'language',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = PostCommentRequest;
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @class
|
||||
* Initializes a new instance of the PostCommentResponse class.
|
||||
* @constructor
|
||||
* Response from post (create) comment
|
||||
* @member {string} commentHandle Gets or sets comment handle of the comment
|
||||
*
|
||||
*/
|
||||
function PostCommentResponse() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the metadata of PostCommentResponse
|
||||
*
|
||||
* @returns {object} metadata of PostCommentResponse
|
||||
*
|
||||
*/
|
||||
PostCommentResponse.prototype.mapper = function () {
|
||||
return {
|
||||
required: false,
|
||||
serializedName: 'PostCommentResponse',
|
||||
type: {
|
||||
name: 'Composite',
|
||||
className: 'PostCommentResponse',
|
||||
modelProperties: {
|
||||
commentHandle: {
|
||||
required: true,
|
||||
serializedName: 'commentHandle',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = PostCommentResponse;
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @class
|
||||
* Initializes a new instance of the PostFollowerRequest class.
|
||||
* @constructor
|
||||
* Request to post (accept) a follower
|
||||
* @member {string} userHandle Gets or sets user handle
|
||||
*
|
||||
*/
|
||||
function PostFollowerRequest() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the metadata of PostFollowerRequest
|
||||
*
|
||||
* @returns {object} metadata of PostFollowerRequest
|
||||
*
|
||||
*/
|
||||
PostFollowerRequest.prototype.mapper = function () {
|
||||
return {
|
||||
required: false,
|
||||
serializedName: 'PostFollowerRequest',
|
||||
type: {
|
||||
name: 'Composite',
|
||||
className: 'PostFollowerRequest',
|
||||
modelProperties: {
|
||||
userHandle: {
|
||||
required: true,
|
||||
serializedName: 'userHandle',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = PostFollowerRequest;
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @class
|
||||
* Initializes a new instance of the PostFollowingRequest class.
|
||||
* @constructor
|
||||
* Request to post a following (follow user)
|
||||
* @member {string} userHandle Gets or sets user handle
|
||||
*
|
||||
*/
|
||||
function PostFollowingRequest() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the metadata of PostFollowingRequest
|
||||
*
|
||||
* @returns {object} metadata of PostFollowingRequest
|
||||
*
|
||||
*/
|
||||
PostFollowingRequest.prototype.mapper = function () {
|
||||
return {
|
||||
required: false,
|
||||
serializedName: 'PostFollowingRequest',
|
||||
type: {
|
||||
name: 'Composite',
|
||||
className: 'PostFollowingRequest',
|
||||
modelProperties: {
|
||||
userHandle: {
|
||||
required: true,
|
||||
serializedName: 'userHandle',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = PostFollowingRequest;
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @class
|
||||
* Initializes a new instance of the PostImageResponse class.
|
||||
* @constructor
|
||||
* Response from post (create) image
|
||||
* @member {string} blobHandle Gets or sets blob handle
|
||||
*
|
||||
*/
|
||||
function PostImageResponse() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the metadata of PostImageResponse
|
||||
*
|
||||
* @returns {object} metadata of PostImageResponse
|
||||
*
|
||||
*/
|
||||
PostImageResponse.prototype.mapper = function () {
|
||||
return {
|
||||
required: false,
|
||||
serializedName: 'PostImageResponse',
|
||||
type: {
|
||||
name: 'Composite',
|
||||
className: 'PostImageResponse',
|
||||
modelProperties: {
|
||||
blobHandle: {
|
||||
required: true,
|
||||
serializedName: 'blobHandle',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = PostImageResponse;
|
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @class
|
||||
* Initializes a new instance of the PostLinkedAccountRequest class.
|
||||
* @constructor
|
||||
* Request to post (create) linked account
|
||||
* @member {string} identityProvider Gets or sets identity provider type.
|
||||
* Possible values for this property include: 'Facebook', 'Microsoft',
|
||||
* 'Google', 'Twitter'.
|
||||
*
|
||||
* @member {string} [accessToken] Gets or sets access or authentication token,
|
||||
* user code, or verifier obtained from third-party provider.
|
||||
* The server contacts the third-party provider to use the token
|
||||
* (or user code, or verifier) for discover the user's identity.
|
||||
*
|
||||
* @member {string} [requestToken] Gets or sets request token obtained from
|
||||
* third-party provider.
|
||||
* Some providers do not issue authentication or access tokens,
|
||||
* but they issue request tokens
|
||||
* and verifiers.
|
||||
*
|
||||
*/
|
||||
function PostLinkedAccountRequest() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the metadata of PostLinkedAccountRequest
|
||||
*
|
||||
* @returns {object} metadata of PostLinkedAccountRequest
|
||||
*
|
||||
*/
|
||||
PostLinkedAccountRequest.prototype.mapper = function () {
|
||||
return {
|
||||
required: false,
|
||||
serializedName: 'PostLinkedAccountRequest',
|
||||
type: {
|
||||
name: 'Composite',
|
||||
className: 'PostLinkedAccountRequest',
|
||||
modelProperties: {
|
||||
identityProvider: {
|
||||
required: true,
|
||||
serializedName: 'identityProvider',
|
||||
type: {
|
||||
name: 'Enum',
|
||||
allowedValues: [ 'Facebook', 'Microsoft', 'Google', 'Twitter' ]
|
||||
}
|
||||
},
|
||||
accessToken: {
|
||||
required: false,
|
||||
serializedName: 'accessToken',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
requestToken: {
|
||||
required: false,
|
||||
serializedName: 'requestToken',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = PostLinkedAccountRequest;
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @class
|
||||
* Initializes a new instance of the PostPinRequest class.
|
||||
* @constructor
|
||||
* Request to post (create) a pin
|
||||
* @member {string} topicHandle Gets or sets topic handle
|
||||
*
|
||||
*/
|
||||
function PostPinRequest() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the metadata of PostPinRequest
|
||||
*
|
||||
* @returns {object} metadata of PostPinRequest
|
||||
*
|
||||
*/
|
||||
PostPinRequest.prototype.mapper = function () {
|
||||
return {
|
||||
required: false,
|
||||
serializedName: 'PostPinRequest',
|
||||
type: {
|
||||
name: 'Composite',
|
||||
className: 'PostPinRequest',
|
||||
modelProperties: {
|
||||
topicHandle: {
|
||||
required: true,
|
||||
serializedName: 'topicHandle',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = PostPinRequest;
|
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @class
|
||||
* Initializes a new instance of the PostReplyRequest class.
|
||||
* @constructor
|
||||
* Request to post (create) reply
|
||||
* @member {string} text Gets or sets reply text
|
||||
*
|
||||
* @member {string} [language] Gets or sets reply language
|
||||
*
|
||||
*/
|
||||
function PostReplyRequest() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the metadata of PostReplyRequest
|
||||
*
|
||||
* @returns {object} metadata of PostReplyRequest
|
||||
*
|
||||
*/
|
||||
PostReplyRequest.prototype.mapper = function () {
|
||||
return {
|
||||
required: false,
|
||||
serializedName: 'PostReplyRequest',
|
||||
type: {
|
||||
name: 'Composite',
|
||||
className: 'PostReplyRequest',
|
||||
modelProperties: {
|
||||
text: {
|
||||
required: true,
|
||||
serializedName: 'text',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
language: {
|
||||
required: false,
|
||||
serializedName: 'language',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = PostReplyRequest;
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @class
|
||||
* Initializes a new instance of the PostReplyResponse class.
|
||||
* @constructor
|
||||
* Response from post (create) reply
|
||||
* @member {string} replyHandle Gets or sets reply handle of the reply
|
||||
*
|
||||
*/
|
||||
function PostReplyResponse() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the metadata of PostReplyResponse
|
||||
*
|
||||
* @returns {object} metadata of PostReplyResponse
|
||||
*
|
||||
*/
|
||||
PostReplyResponse.prototype.mapper = function () {
|
||||
return {
|
||||
required: false,
|
||||
serializedName: 'PostReplyResponse',
|
||||
type: {
|
||||
name: 'Composite',
|
||||
className: 'PostReplyResponse',
|
||||
modelProperties: {
|
||||
replyHandle: {
|
||||
required: true,
|
||||
serializedName: 'replyHandle',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = PostReplyResponse;
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @class
|
||||
* Initializes a new instance of the PostReportRequest class.
|
||||
* @constructor
|
||||
* Request to post (create) a report for user or content
|
||||
* @member {string} reason Gets or sets report reason. Possible values for
|
||||
* this property include: 'Spam', 'Cyberbullying', 'ChildEndangerment',
|
||||
* 'Offensive', 'ContentInfringement', 'Other'.
|
||||
*
|
||||
*/
|
||||
function PostReportRequest() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the metadata of PostReportRequest
|
||||
*
|
||||
* @returns {object} metadata of PostReportRequest
|
||||
*
|
||||
*/
|
||||
PostReportRequest.prototype.mapper = function () {
|
||||
return {
|
||||
required: false,
|
||||
serializedName: 'PostReportRequest',
|
||||
type: {
|
||||
name: 'Composite',
|
||||
className: 'PostReportRequest',
|
||||
modelProperties: {
|
||||
reason: {
|
||||
required: true,
|
||||
serializedName: 'reason',
|
||||
type: {
|
||||
name: 'Enum',
|
||||
allowedValues: [ 'Spam', 'Cyberbullying', 'ChildEndangerment', 'Offensive', 'ContentInfringement', 'Other' ]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = PostReportRequest;
|
|
@ -0,0 +1,99 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @class
|
||||
* Initializes a new instance of the PostSessionRequest class.
|
||||
* @constructor
|
||||
* Request to post (create) session
|
||||
* @member {string} identityProvider Gets or sets identity provider type.
|
||||
* Possible values for this property include: 'Facebook', 'Microsoft',
|
||||
* 'Google', 'Twitter'.
|
||||
*
|
||||
* @member {string} [accessToken] Gets or sets access or authentication token,
|
||||
* user code, or verifier obtained from third-party provider.
|
||||
* The server contacts the third-party provider to use the token
|
||||
* (or user code, or verifier) for discover the user's identity.
|
||||
*
|
||||
* @member {string} [requestToken] Gets or sets request token obtained from
|
||||
* third-party provider.
|
||||
* Some providers do not issue authentication or access tokens,
|
||||
* but they issue request tokens
|
||||
* and verifiers.
|
||||
*
|
||||
* @member {string} instanceId Gets or sets instance id -- Unique installation
|
||||
* id of the app
|
||||
*
|
||||
* @member {boolean} [createUser] Gets or sets a value indicating whether we
|
||||
* should create a new user if the user doesn't exist
|
||||
*
|
||||
*/
|
||||
function PostSessionRequest() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the metadata of PostSessionRequest
|
||||
*
|
||||
* @returns {object} metadata of PostSessionRequest
|
||||
*
|
||||
*/
|
||||
PostSessionRequest.prototype.mapper = function () {
|
||||
return {
|
||||
required: false,
|
||||
serializedName: 'PostSessionRequest',
|
||||
type: {
|
||||
name: 'Composite',
|
||||
className: 'PostSessionRequest',
|
||||
modelProperties: {
|
||||
identityProvider: {
|
||||
required: true,
|
||||
serializedName: 'identityProvider',
|
||||
type: {
|
||||
name: 'Enum',
|
||||
allowedValues: [ 'Facebook', 'Microsoft', 'Google', 'Twitter' ]
|
||||
}
|
||||
},
|
||||
accessToken: {
|
||||
required: false,
|
||||
serializedName: 'accessToken',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
requestToken: {
|
||||
required: false,
|
||||
serializedName: 'requestToken',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
instanceId: {
|
||||
required: true,
|
||||
serializedName: 'instanceId',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
createUser: {
|
||||
required: false,
|
||||
serializedName: 'createUser',
|
||||
type: {
|
||||
name: 'Boolean'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = PostSessionRequest;
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @class
|
||||
* Initializes a new instance of the PostSessionResponse class.
|
||||
* @constructor
|
||||
* Response from post (create) session
|
||||
* @member {string} userHandle Gets or sets user handle
|
||||
*
|
||||
* @member {string} sessionToken Gets or sets session token generated by our
|
||||
* server.
|
||||
* The client saves the session token and sends it with every
|
||||
* request
|
||||
*
|
||||
*/
|
||||
function PostSessionResponse() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the metadata of PostSessionResponse
|
||||
*
|
||||
* @returns {object} metadata of PostSessionResponse
|
||||
*
|
||||
*/
|
||||
PostSessionResponse.prototype.mapper = function () {
|
||||
return {
|
||||
required: false,
|
||||
serializedName: 'PostSessionResponse',
|
||||
type: {
|
||||
name: 'Composite',
|
||||
className: 'PostSessionResponse',
|
||||
modelProperties: {
|
||||
userHandle: {
|
||||
required: true,
|
||||
serializedName: 'userHandle',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
sessionToken: {
|
||||
required: true,
|
||||
serializedName: 'sessionToken',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = PostSessionResponse;
|
|
@ -0,0 +1,136 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @class
|
||||
* Initializes a new instance of the PostTopicRequest class.
|
||||
* @constructor
|
||||
* Request to post (create) topic
|
||||
* @member {string} publisherType Gets or sets publisher type. Possible values
|
||||
* for this property include: 'User', 'App'.
|
||||
*
|
||||
* @member {string} [title] Gets or sets topic title
|
||||
*
|
||||
* @member {string} text Gets or sets topic text
|
||||
*
|
||||
* @member {string} [blobType] Gets or sets topic blob type. Possible values
|
||||
* for this property include: 'Unknown', 'Image', 'Video', 'Custom'.
|
||||
*
|
||||
* @member {string} [blobHandle] Gets or sets topic blob handle
|
||||
*
|
||||
* @member {string} [categories] Gets or sets topic categories
|
||||
*
|
||||
* @member {string} [language] Gets or sets topic language
|
||||
*
|
||||
* @member {string} [deepLink] Gets or sets topic deep link
|
||||
*
|
||||
* @member {string} [friendlyName] Gets or sets topic friendly name
|
||||
*
|
||||
* @member {string} [group] Gets or sets topic group
|
||||
*
|
||||
*/
|
||||
function PostTopicRequest() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the metadata of PostTopicRequest
|
||||
*
|
||||
* @returns {object} metadata of PostTopicRequest
|
||||
*
|
||||
*/
|
||||
PostTopicRequest.prototype.mapper = function () {
|
||||
return {
|
||||
required: false,
|
||||
serializedName: 'PostTopicRequest',
|
||||
type: {
|
||||
name: 'Composite',
|
||||
className: 'PostTopicRequest',
|
||||
modelProperties: {
|
||||
publisherType: {
|
||||
required: true,
|
||||
serializedName: 'publisherType',
|
||||
type: {
|
||||
name: 'Enum',
|
||||
allowedValues: [ 'User', 'App' ]
|
||||
}
|
||||
},
|
||||
title: {
|
||||
required: false,
|
||||
serializedName: 'title',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
text: {
|
||||
required: true,
|
||||
serializedName: 'text',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
blobType: {
|
||||
required: false,
|
||||
serializedName: 'blobType',
|
||||
type: {
|
||||
name: 'Enum',
|
||||
allowedValues: [ 'Unknown', 'Image', 'Video', 'Custom' ]
|
||||
}
|
||||
},
|
||||
blobHandle: {
|
||||
required: false,
|
||||
serializedName: 'blobHandle',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
categories: {
|
||||
required: false,
|
||||
serializedName: 'categories',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
language: {
|
||||
required: false,
|
||||
serializedName: 'language',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
deepLink: {
|
||||
required: false,
|
||||
serializedName: 'deepLink',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
friendlyName: {
|
||||
required: false,
|
||||
serializedName: 'friendlyName',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
group: {
|
||||
required: false,
|
||||
serializedName: 'group',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = PostTopicRequest;
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @class
|
||||
* Initializes a new instance of the PostTopicResponse class.
|
||||
* @constructor
|
||||
* Response from post (create) topic
|
||||
* @member {string} topicHandle Gets or sets topic handle of the topic
|
||||
*
|
||||
*/
|
||||
function PostTopicResponse() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the metadata of PostTopicResponse
|
||||
*
|
||||
* @returns {object} metadata of PostTopicResponse
|
||||
*
|
||||
*/
|
||||
PostTopicResponse.prototype.mapper = function () {
|
||||
return {
|
||||
required: false,
|
||||
serializedName: 'PostTopicResponse',
|
||||
type: {
|
||||
name: 'Composite',
|
||||
className: 'PostTopicResponse',
|
||||
modelProperties: {
|
||||
topicHandle: {
|
||||
required: true,
|
||||
serializedName: 'topicHandle',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = PostTopicResponse;
|
|
@ -0,0 +1,125 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @class
|
||||
* Initializes a new instance of the PostUserRequest class.
|
||||
* @constructor
|
||||
* Request to post (create) user
|
||||
* @member {string} identityProvider Gets or sets identity provider type.
|
||||
* Possible values for this property include: 'Facebook', 'Microsoft',
|
||||
* 'Google', 'Twitter'.
|
||||
*
|
||||
* @member {string} [accessToken] Gets or sets access or authentication token
|
||||
* obtained from third-party provider.
|
||||
* The server contacts the third-party provider to validate the
|
||||
* token
|
||||
*
|
||||
* @member {string} [requestToken] Gets or sets request token obtained from
|
||||
* third-party provider.
|
||||
* Some providers do not issue authentication or access tokens,
|
||||
* but they issue request tokens
|
||||
* and verifiers.
|
||||
*
|
||||
* @member {string} instanceId Gets or sets instance id -- Unique installation
|
||||
* id of the app
|
||||
*
|
||||
* @member {string} firstName Gets or sets first name of the user
|
||||
*
|
||||
* @member {string} lastName Gets or sets last name of the user
|
||||
*
|
||||
* @member {string} [bio] Gets or sets short bio of the user
|
||||
*
|
||||
* @member {string} [photoHandle] Gets or sets photo handle of the user
|
||||
*
|
||||
*/
|
||||
function PostUserRequest() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the metadata of PostUserRequest
|
||||
*
|
||||
* @returns {object} metadata of PostUserRequest
|
||||
*
|
||||
*/
|
||||
PostUserRequest.prototype.mapper = function () {
|
||||
return {
|
||||
required: false,
|
||||
serializedName: 'PostUserRequest',
|
||||
type: {
|
||||
name: 'Composite',
|
||||
className: 'PostUserRequest',
|
||||
modelProperties: {
|
||||
identityProvider: {
|
||||
required: true,
|
||||
serializedName: 'identityProvider',
|
||||
type: {
|
||||
name: 'Enum',
|
||||
allowedValues: [ 'Facebook', 'Microsoft', 'Google', 'Twitter' ]
|
||||
}
|
||||
},
|
||||
accessToken: {
|
||||
required: false,
|
||||
serializedName: 'accessToken',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
requestToken: {
|
||||
required: false,
|
||||
serializedName: 'requestToken',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
instanceId: {
|
||||
required: true,
|
||||
serializedName: 'instanceId',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
firstName: {
|
||||
required: true,
|
||||
serializedName: 'firstName',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
lastName: {
|
||||
required: true,
|
||||
serializedName: 'lastName',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
bio: {
|
||||
required: false,
|
||||
serializedName: 'bio',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
photoHandle: {
|
||||
required: false,
|
||||
serializedName: 'photoHandle',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = PostUserRequest;
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @class
|
||||
* Initializes a new instance of the PostUserResponse class.
|
||||
* @constructor
|
||||
* Response from post (create) user
|
||||
* @member {string} userHandle Gets or sets user handle
|
||||
*
|
||||
* @member {string} sessionToken Gets or sets the session token generated by
|
||||
* our server.
|
||||
* The client saves the session token and sends it with every
|
||||
* request
|
||||
*
|
||||
*/
|
||||
function PostUserResponse() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the metadata of PostUserResponse
|
||||
*
|
||||
* @returns {object} metadata of PostUserResponse
|
||||
*
|
||||
*/
|
||||
PostUserResponse.prototype.mapper = function () {
|
||||
return {
|
||||
required: false,
|
||||
serializedName: 'PostUserResponse',
|
||||
type: {
|
||||
name: 'Composite',
|
||||
className: 'PostUserResponse',
|
||||
modelProperties: {
|
||||
userHandle: {
|
||||
required: true,
|
||||
serializedName: 'userHandle',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
sessionToken: {
|
||||
required: true,
|
||||
serializedName: 'sessionToken',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = PostUserResponse;
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @class
|
||||
* Initializes a new instance of the PutNotificationsStatusRequest class.
|
||||
* @constructor
|
||||
* Request to put (update) notifications status
|
||||
* @member {string} [readActivityHandle] Gets or sets last read activity handle
|
||||
*
|
||||
*/
|
||||
function PutNotificationsStatusRequest() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the metadata of PutNotificationsStatusRequest
|
||||
*
|
||||
* @returns {object} metadata of PutNotificationsStatusRequest
|
||||
*
|
||||
*/
|
||||
PutNotificationsStatusRequest.prototype.mapper = function () {
|
||||
return {
|
||||
required: false,
|
||||
serializedName: 'PutNotificationsStatusRequest',
|
||||
type: {
|
||||
name: 'Composite',
|
||||
className: 'PutNotificationsStatusRequest',
|
||||
modelProperties: {
|
||||
readActivityHandle: {
|
||||
required: false,
|
||||
serializedName: 'readActivityHandle',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = PutNotificationsStatusRequest;
|
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @class
|
||||
* Initializes a new instance of the PutPushRegistrationRequest class.
|
||||
* @constructor
|
||||
* Request to put push registration (register or update)
|
||||
* @member {date} lastUpdatedTime Gets or sets last updated time from the OS
|
||||
* This is used to expire out registrations that have not been
|
||||
* updated every 30 days.
|
||||
*
|
||||
* @member {string} language Gets or sets language of the user
|
||||
*
|
||||
*/
|
||||
function PutPushRegistrationRequest() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the metadata of PutPushRegistrationRequest
|
||||
*
|
||||
* @returns {object} metadata of PutPushRegistrationRequest
|
||||
*
|
||||
*/
|
||||
PutPushRegistrationRequest.prototype.mapper = function () {
|
||||
return {
|
||||
required: false,
|
||||
serializedName: 'PutPushRegistrationRequest',
|
||||
type: {
|
||||
name: 'Composite',
|
||||
className: 'PutPushRegistrationRequest',
|
||||
modelProperties: {
|
||||
lastUpdatedTime: {
|
||||
required: true,
|
||||
serializedName: 'lastUpdatedTime',
|
||||
type: {
|
||||
name: 'DateTime'
|
||||
}
|
||||
},
|
||||
language: {
|
||||
required: true,
|
||||
serializedName: 'language',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = PutPushRegistrationRequest;
|
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @class
|
||||
* Initializes a new instance of the PutTopicRequest class.
|
||||
* @constructor
|
||||
* Request to put (update) topic
|
||||
* @member {string} [title] Gets or sets topic title
|
||||
*
|
||||
* @member {string} text Gets or sets topic text
|
||||
*
|
||||
* @member {string} [categories] Gets or sets topic categories
|
||||
*
|
||||
*/
|
||||
function PutTopicRequest() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the metadata of PutTopicRequest
|
||||
*
|
||||
* @returns {object} metadata of PutTopicRequest
|
||||
*
|
||||
*/
|
||||
PutTopicRequest.prototype.mapper = function () {
|
||||
return {
|
||||
required: false,
|
||||
serializedName: 'PutTopicRequest',
|
||||
type: {
|
||||
name: 'Composite',
|
||||
className: 'PutTopicRequest',
|
||||
modelProperties: {
|
||||
title: {
|
||||
required: false,
|
||||
serializedName: 'title',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
text: {
|
||||
required: true,
|
||||
serializedName: 'text',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
categories: {
|
||||
required: false,
|
||||
serializedName: 'categories',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = PutTopicRequest;
|
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @class
|
||||
* Initializes a new instance of the PutUserInfoRequest class.
|
||||
* @constructor
|
||||
* Request to put (update) user info
|
||||
* @member {string} firstName Gets or sets first name of the user
|
||||
*
|
||||
* @member {string} lastName Gets or sets last name of the user
|
||||
*
|
||||
* @member {string} [bio] Gets or sets short bio of the user
|
||||
*
|
||||
*/
|
||||
function PutUserInfoRequest() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the metadata of PutUserInfoRequest
|
||||
*
|
||||
* @returns {object} metadata of PutUserInfoRequest
|
||||
*
|
||||
*/
|
||||
PutUserInfoRequest.prototype.mapper = function () {
|
||||
return {
|
||||
required: false,
|
||||
serializedName: 'PutUserInfoRequest',
|
||||
type: {
|
||||
name: 'Composite',
|
||||
className: 'PutUserInfoRequest',
|
||||
modelProperties: {
|
||||
firstName: {
|
||||
required: true,
|
||||
serializedName: 'firstName',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
lastName: {
|
||||
required: true,
|
||||
serializedName: 'lastName',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
bio: {
|
||||
required: false,
|
||||
serializedName: 'bio',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = PutUserInfoRequest;
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @class
|
||||
* Initializes a new instance of the PutUserPhotoRequest class.
|
||||
* @constructor
|
||||
* Request to put (update) user photo
|
||||
* @member {string} [photoHandle] Gets or sets photo handle of the user
|
||||
*
|
||||
*/
|
||||
function PutUserPhotoRequest() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the metadata of PutUserPhotoRequest
|
||||
*
|
||||
* @returns {object} metadata of PutUserPhotoRequest
|
||||
*
|
||||
*/
|
||||
PutUserPhotoRequest.prototype.mapper = function () {
|
||||
return {
|
||||
required: false,
|
||||
serializedName: 'PutUserPhotoRequest',
|
||||
type: {
|
||||
name: 'Composite',
|
||||
className: 'PutUserPhotoRequest',
|
||||
modelProperties: {
|
||||
photoHandle: {
|
||||
required: false,
|
||||
serializedName: 'photoHandle',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = PutUserPhotoRequest;
|
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @class
|
||||
* Initializes a new instance of the PutUserVisibilityRequest class.
|
||||
* @constructor
|
||||
* Request to put (update) user visibility
|
||||
* @member {string} visibility Gets or sets visibility of the user. Possible
|
||||
* values for this property include: 'Public', 'Private'.
|
||||
*
|
||||
*/
|
||||
function PutUserVisibilityRequest() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the metadata of PutUserVisibilityRequest
|
||||
*
|
||||
* @returns {object} metadata of PutUserVisibilityRequest
|
||||
*
|
||||
*/
|
||||
PutUserVisibilityRequest.prototype.mapper = function () {
|
||||
return {
|
||||
required: false,
|
||||
serializedName: 'PutUserVisibilityRequest',
|
||||
type: {
|
||||
name: 'Composite',
|
||||
className: 'PutUserVisibilityRequest',
|
||||
modelProperties: {
|
||||
visibility: {
|
||||
required: true,
|
||||
serializedName: 'visibility',
|
||||
type: {
|
||||
name: 'Enum',
|
||||
allowedValues: [ 'Public', 'Private' ]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = PutUserVisibilityRequest;
|
|
@ -0,0 +1,155 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var models = require('./index');
|
||||
|
||||
/**
|
||||
* @class
|
||||
* Initializes a new instance of the ReplyView class.
|
||||
* @constructor
|
||||
* Reply view
|
||||
* @member {string} replyHandle Gets or sets reply handle
|
||||
*
|
||||
* @member {string} commentHandle Gets or sets parent comment handle
|
||||
*
|
||||
* @member {string} topicHandle Gets or sets root topic handle
|
||||
*
|
||||
* @member {date} createdTime Gets or sets created time
|
||||
*
|
||||
* @member {object} user Gets or sets owner of the reply
|
||||
*
|
||||
* @member {string} [user.userHandle] Gets or sets user handle
|
||||
*
|
||||
* @member {string} [user.firstName] Gets or sets first name of the user
|
||||
*
|
||||
* @member {string} [user.lastName] Gets or sets last name of the user
|
||||
*
|
||||
* @member {string} [user.photoHandle] Gets or sets photo handle of the user
|
||||
*
|
||||
* @member {string} [user.photoUrl] Gets or sets photo url of the user
|
||||
*
|
||||
* @member {string} [user.visibility] Gets or sets visibility of the user.
|
||||
* Possible values for this property include: 'Public', 'Private'.
|
||||
*
|
||||
* @member {string} [user.followerStatus] Gets or sets follower relationship
|
||||
* status of the querying user. Possible values for this property include:
|
||||
* 'None', 'Follow', 'Pending', 'Blocked'.
|
||||
*
|
||||
* @member {string} text Gets or sets reply text
|
||||
*
|
||||
* @member {string} [language] Gets or sets reply language
|
||||
*
|
||||
* @member {number} totalLikes Gets or sets total likes for the reply
|
||||
*
|
||||
* @member {boolean} liked Gets or sets a value indicating whether the
|
||||
* querying user has liked the reply
|
||||
*
|
||||
* @member {string} [contentStatus] Gets or sets content status. Possible
|
||||
* values for this property include: 'Active', 'Banned'.
|
||||
*
|
||||
*/
|
||||
function ReplyView() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the metadata of ReplyView
|
||||
*
|
||||
* @returns {object} metadata of ReplyView
|
||||
*
|
||||
*/
|
||||
ReplyView.prototype.mapper = function () {
|
||||
return {
|
||||
required: false,
|
||||
serializedName: 'ReplyView',
|
||||
type: {
|
||||
name: 'Composite',
|
||||
className: 'ReplyView',
|
||||
modelProperties: {
|
||||
replyHandle: {
|
||||
required: true,
|
||||
serializedName: 'replyHandle',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
commentHandle: {
|
||||
required: true,
|
||||
serializedName: 'commentHandle',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
topicHandle: {
|
||||
required: true,
|
||||
serializedName: 'topicHandle',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
createdTime: {
|
||||
required: true,
|
||||
serializedName: 'createdTime',
|
||||
type: {
|
||||
name: 'DateTime'
|
||||
}
|
||||
},
|
||||
user: {
|
||||
required: true,
|
||||
serializedName: 'user',
|
||||
type: {
|
||||
name: 'Composite',
|
||||
className: 'UserCompactView'
|
||||
}
|
||||
},
|
||||
text: {
|
||||
required: true,
|
||||
serializedName: 'text',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
language: {
|
||||
required: false,
|
||||
serializedName: 'language',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
totalLikes: {
|
||||
required: true,
|
||||
serializedName: 'totalLikes',
|
||||
type: {
|
||||
name: 'Number'
|
||||
}
|
||||
},
|
||||
liked: {
|
||||
required: true,
|
||||
serializedName: 'liked',
|
||||
type: {
|
||||
name: 'Boolean'
|
||||
}
|
||||
},
|
||||
contentStatus: {
|
||||
required: false,
|
||||
serializedName: 'contentStatus',
|
||||
type: {
|
||||
name: 'Enum',
|
||||
allowedValues: [ 'Active', 'Banned' ]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = ReplyView;
|
|
@ -0,0 +1,275 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var models = require('./index');
|
||||
|
||||
/**
|
||||
* @class
|
||||
* Initializes a new instance of the TopicView class.
|
||||
* @constructor
|
||||
* Topic view
|
||||
* @member {string} topicHandle Gets or sets topic handle
|
||||
*
|
||||
* @member {date} createdTime Gets or sets created time
|
||||
*
|
||||
* @member {date} lastUpdatedTime Gets or sets last updated time
|
||||
*
|
||||
* @member {string} publisherType Gets or sets publisher type. Possible values
|
||||
* for this property include: 'User', 'App'.
|
||||
*
|
||||
* @member {object} user Gets or sets owner of the topic
|
||||
*
|
||||
* @member {string} [user.userHandle] Gets or sets user handle
|
||||
*
|
||||
* @member {string} [user.firstName] Gets or sets first name of the user
|
||||
*
|
||||
* @member {string} [user.lastName] Gets or sets last name of the user
|
||||
*
|
||||
* @member {string} [user.photoHandle] Gets or sets photo handle of the user
|
||||
*
|
||||
* @member {string} [user.photoUrl] Gets or sets photo url of the user
|
||||
*
|
||||
* @member {string} [user.visibility] Gets or sets visibility of the user.
|
||||
* Possible values for this property include: 'Public', 'Private'.
|
||||
*
|
||||
* @member {string} [user.followerStatus] Gets or sets follower relationship
|
||||
* status of the querying user. Possible values for this property include:
|
||||
* 'None', 'Follow', 'Pending', 'Blocked'.
|
||||
*
|
||||
* @member {string} [title] Gets or sets topic title
|
||||
*
|
||||
* @member {string} text Gets or sets topic text
|
||||
*
|
||||
* @member {string} [blobType] Gets or sets topic blob type. Possible values
|
||||
* for this property include: 'Unknown', 'Image', 'Video', 'Custom'.
|
||||
*
|
||||
* @member {string} [blobHandle] Gets or sets topic blob handle
|
||||
*
|
||||
* @member {string} [blobUrl] Gets or sets topic blob url
|
||||
*
|
||||
* @member {string} [categories] Gets or sets topic categories
|
||||
*
|
||||
* @member {string} [language] Gets or sets topic language
|
||||
*
|
||||
* @member {string} [group] Gets or sets topic group
|
||||
*
|
||||
* @member {string} [deepLink] Gets or sets topic deep link
|
||||
*
|
||||
* @member {string} [friendlyName] Gets or sets topic friendly name
|
||||
*
|
||||
* @member {number} totalLikes Gets or sets total likes for the topic
|
||||
*
|
||||
* @member {number} totalComments Gets or sets total comments for the topic
|
||||
*
|
||||
* @member {boolean} liked Gets or sets a value indicating whether the
|
||||
* querying user has liked the topic
|
||||
*
|
||||
* @member {boolean} [pinned] Gets or sets a value indicating whether the
|
||||
* querying user has pinned the topic
|
||||
*
|
||||
* @member {string} [contentStatus] Gets or sets content status. Possible
|
||||
* values for this property include: 'Active', 'Banned'.
|
||||
*
|
||||
* @member {object} [app] Gets or sets the containing app
|
||||
*
|
||||
* @member {string} [app.appHandle] Gets or sets app handle
|
||||
*
|
||||
* @member {string} [app.name] Gets or sets app name
|
||||
*
|
||||
* @member {string} [app.iconHandle] Gets or sets app icon handle
|
||||
*
|
||||
* @member {string} [app.iconUrl] Gets or sets app icon url
|
||||
*
|
||||
* @member {string} [app.platformType] Gets or sets platform type. Possible
|
||||
* values for this property include: 'Windows', 'Android', 'IOS'.
|
||||
*
|
||||
* @member {string} [app.deepLink] Gets or sets app deep link
|
||||
*
|
||||
* @member {string} [app.storeLink] Gets or sets app store link
|
||||
*
|
||||
*/
|
||||
function TopicView() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the metadata of TopicView
|
||||
*
|
||||
* @returns {object} metadata of TopicView
|
||||
*
|
||||
*/
|
||||
TopicView.prototype.mapper = function () {
|
||||
return {
|
||||
required: false,
|
||||
serializedName: 'TopicView',
|
||||
type: {
|
||||
name: 'Composite',
|
||||
className: 'TopicView',
|
||||
modelProperties: {
|
||||
topicHandle: {
|
||||
required: true,
|
||||
serializedName: 'topicHandle',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
createdTime: {
|
||||
required: true,
|
||||
serializedName: 'createdTime',
|
||||
type: {
|
||||
name: 'DateTime'
|
||||
}
|
||||
},
|
||||
lastUpdatedTime: {
|
||||
required: true,
|
||||
serializedName: 'lastUpdatedTime',
|
||||
type: {
|
||||
name: 'DateTime'
|
||||
}
|
||||
},
|
||||
publisherType: {
|
||||
required: true,
|
||||
serializedName: 'publisherType',
|
||||
type: {
|
||||
name: 'Enum',
|
||||
allowedValues: [ 'User', 'App' ]
|
||||
}
|
||||
},
|
||||
user: {
|
||||
required: true,
|
||||
serializedName: 'user',
|
||||
type: {
|
||||
name: 'Composite',
|
||||
className: 'UserCompactView'
|
||||
}
|
||||
},
|
||||
title: {
|
||||
required: false,
|
||||
serializedName: 'title',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
text: {
|
||||
required: true,
|
||||
serializedName: 'text',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
blobType: {
|
||||
required: false,
|
||||
serializedName: 'blobType',
|
||||
type: {
|
||||
name: 'Enum',
|
||||
allowedValues: [ 'Unknown', 'Image', 'Video', 'Custom' ]
|
||||
}
|
||||
},
|
||||
blobHandle: {
|
||||
required: false,
|
||||
serializedName: 'blobHandle',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
blobUrl: {
|
||||
required: false,
|
||||
serializedName: 'blobUrl',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
categories: {
|
||||
required: false,
|
||||
serializedName: 'categories',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
language: {
|
||||
required: false,
|
||||
serializedName: 'language',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
group: {
|
||||
required: false,
|
||||
serializedName: 'group',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
deepLink: {
|
||||
required: false,
|
||||
serializedName: 'deepLink',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
friendlyName: {
|
||||
required: false,
|
||||
serializedName: 'friendlyName',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
totalLikes: {
|
||||
required: true,
|
||||
serializedName: 'totalLikes',
|
||||
type: {
|
||||
name: 'Number'
|
||||
}
|
||||
},
|
||||
totalComments: {
|
||||
required: true,
|
||||
serializedName: 'totalComments',
|
||||
type: {
|
||||
name: 'Number'
|
||||
}
|
||||
},
|
||||
liked: {
|
||||
required: true,
|
||||
serializedName: 'liked',
|
||||
type: {
|
||||
name: 'Boolean'
|
||||
}
|
||||
},
|
||||
pinned: {
|
||||
required: false,
|
||||
serializedName: 'pinned',
|
||||
type: {
|
||||
name: 'Boolean'
|
||||
}
|
||||
},
|
||||
contentStatus: {
|
||||
required: false,
|
||||
serializedName: 'contentStatus',
|
||||
type: {
|
||||
name: 'Enum',
|
||||
allowedValues: [ 'Active', 'Banned' ]
|
||||
}
|
||||
},
|
||||
app: {
|
||||
required: false,
|
||||
serializedName: 'app',
|
||||
type: {
|
||||
name: 'Composite',
|
||||
className: 'AppCompactView'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = TopicView;
|
|
@ -0,0 +1,110 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @class
|
||||
* Initializes a new instance of the UserCompactView class.
|
||||
* @constructor
|
||||
* User compact view
|
||||
* @member {string} userHandle Gets or sets user handle
|
||||
*
|
||||
* @member {string} firstName Gets or sets first name of the user
|
||||
*
|
||||
* @member {string} lastName Gets or sets last name of the user
|
||||
*
|
||||
* @member {string} [photoHandle] Gets or sets photo handle of the user
|
||||
*
|
||||
* @member {string} [photoUrl] Gets or sets photo url of the user
|
||||
*
|
||||
* @member {string} visibility Gets or sets visibility of the user. Possible
|
||||
* values for this property include: 'Public', 'Private'.
|
||||
*
|
||||
* @member {string} followerStatus Gets or sets follower relationship status
|
||||
* of the querying user. Possible values for this property include: 'None',
|
||||
* 'Follow', 'Pending', 'Blocked'.
|
||||
*
|
||||
*/
|
||||
function UserCompactView() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the metadata of UserCompactView
|
||||
*
|
||||
* @returns {object} metadata of UserCompactView
|
||||
*
|
||||
*/
|
||||
UserCompactView.prototype.mapper = function () {
|
||||
return {
|
||||
required: false,
|
||||
serializedName: 'UserCompactView',
|
||||
type: {
|
||||
name: 'Composite',
|
||||
className: 'UserCompactView',
|
||||
modelProperties: {
|
||||
userHandle: {
|
||||
required: true,
|
||||
serializedName: 'userHandle',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
firstName: {
|
||||
required: true,
|
||||
serializedName: 'firstName',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
lastName: {
|
||||
required: true,
|
||||
serializedName: 'lastName',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
photoHandle: {
|
||||
required: false,
|
||||
serializedName: 'photoHandle',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
photoUrl: {
|
||||
required: false,
|
||||
serializedName: 'photoUrl',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
visibility: {
|
||||
required: true,
|
||||
serializedName: 'visibility',
|
||||
type: {
|
||||
name: 'Enum',
|
||||
allowedValues: [ 'Public', 'Private' ]
|
||||
}
|
||||
},
|
||||
followerStatus: {
|
||||
required: true,
|
||||
serializedName: 'followerStatus',
|
||||
type: {
|
||||
name: 'Enum',
|
||||
allowedValues: [ 'None', 'Follow', 'Pending', 'Blocked' ]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = UserCompactView;
|
|
@ -0,0 +1,178 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @class
|
||||
* Initializes a new instance of the UserProfileView class.
|
||||
* @constructor
|
||||
* User profile view
|
||||
* @member {string} userHandle Gets or sets user handle
|
||||
*
|
||||
* @member {string} appHandle Gets or sets app handle
|
||||
*
|
||||
* @member {string} firstName Gets or sets first name of the user
|
||||
*
|
||||
* @member {string} lastName Gets or sets last name of the user
|
||||
*
|
||||
* @member {string} bio Gets or sets short bio of the user
|
||||
*
|
||||
* @member {string} photoHandle Gets or sets photo handle of the user
|
||||
*
|
||||
* @member {string} photoUrl Gets or sets photo url of the user
|
||||
*
|
||||
* @member {string} visibility Gets or sets visibility of the user. Possible
|
||||
* values for this property include: 'Public', 'Private'.
|
||||
*
|
||||
* @member {number} totalTopics Gets or sets total topics posted by user
|
||||
*
|
||||
* @member {number} totalFollowers Gets or sets total followers for the user
|
||||
*
|
||||
* @member {number} totalFollowing Gets or sets total following users
|
||||
*
|
||||
* @member {string} followerStatus Gets or sets follower relationship status
|
||||
* of the querying user. Possible values for this property include: 'None',
|
||||
* 'Follow', 'Pending', 'Blocked'.
|
||||
*
|
||||
* @member {string} followingStatus Gets or sets following relationship status
|
||||
* of the querying user. Possible values for this property include: 'None',
|
||||
* 'Follow', 'Pending', 'Blocked'.
|
||||
*
|
||||
* @member {string} profileStatus Gets or sets user profile status. Possible
|
||||
* values for this property include: 'Active', 'Banned'.
|
||||
*
|
||||
*/
|
||||
function UserProfileView() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the metadata of UserProfileView
|
||||
*
|
||||
* @returns {object} metadata of UserProfileView
|
||||
*
|
||||
*/
|
||||
UserProfileView.prototype.mapper = function () {
|
||||
return {
|
||||
required: false,
|
||||
serializedName: 'UserProfileView',
|
||||
type: {
|
||||
name: 'Composite',
|
||||
className: 'UserProfileView',
|
||||
modelProperties: {
|
||||
userHandle: {
|
||||
required: true,
|
||||
serializedName: 'userHandle',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
appHandle: {
|
||||
required: true,
|
||||
serializedName: 'appHandle',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
firstName: {
|
||||
required: true,
|
||||
serializedName: 'firstName',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
lastName: {
|
||||
required: true,
|
||||
serializedName: 'lastName',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
bio: {
|
||||
required: true,
|
||||
serializedName: 'bio',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
photoHandle: {
|
||||
required: true,
|
||||
serializedName: 'photoHandle',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
photoUrl: {
|
||||
required: true,
|
||||
serializedName: 'photoUrl',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
},
|
||||
visibility: {
|
||||
required: true,
|
||||
serializedName: 'visibility',
|
||||
type: {
|
||||
name: 'Enum',
|
||||
allowedValues: [ 'Public', 'Private' ]
|
||||
}
|
||||
},
|
||||
totalTopics: {
|
||||
required: true,
|
||||
serializedName: 'totalTopics',
|
||||
type: {
|
||||
name: 'Number'
|
||||
}
|
||||
},
|
||||
totalFollowers: {
|
||||
required: true,
|
||||
serializedName: 'totalFollowers',
|
||||
type: {
|
||||
name: 'Number'
|
||||
}
|
||||
},
|
||||
totalFollowing: {
|
||||
required: true,
|
||||
serializedName: 'totalFollowing',
|
||||
type: {
|
||||
name: 'Number'
|
||||
}
|
||||
},
|
||||
followerStatus: {
|
||||
required: true,
|
||||
serializedName: 'followerStatus',
|
||||
type: {
|
||||
name: 'Enum',
|
||||
allowedValues: [ 'None', 'Follow', 'Pending', 'Blocked' ]
|
||||
}
|
||||
},
|
||||
followingStatus: {
|
||||
required: true,
|
||||
serializedName: 'followingStatus',
|
||||
type: {
|
||||
name: 'Enum',
|
||||
allowedValues: [ 'None', 'Follow', 'Pending', 'Blocked' ]
|
||||
}
|
||||
},
|
||||
profileStatus: {
|
||||
required: true,
|
||||
serializedName: 'profileStatus',
|
||||
type: {
|
||||
name: 'Enum',
|
||||
allowedValues: [ 'Active', 'Banned' ]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = UserProfileView;
|
|
@ -0,0 +1,287 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var util = require('util');
|
||||
var msRest = require('ms-rest');
|
||||
var WebResource = msRest.WebResource;
|
||||
|
||||
/**
|
||||
* @class
|
||||
* Blobs
|
||||
* __NOTE__: An instance of this class is automatically created for an
|
||||
* instance of the SocialPlusClient.
|
||||
* Initializes a new instance of the Blobs class.
|
||||
* @constructor
|
||||
*
|
||||
* @param {SocialPlusClient} client Reference to the service client.
|
||||
*/
|
||||
function Blobs(client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary Upload a blob
|
||||
*
|
||||
* 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 {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {object} [result] - The deserialized result object.
|
||||
* See {@link PostBlobResponse} for more information.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
Blobs.prototype.postBlob = function (authorization, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
// Validate
|
||||
try {
|
||||
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.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/blobs';
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'POST';
|
||||
httpRequest.headers = {};
|
||||
httpRequest.url = requestUrl;
|
||||
// Set Headers
|
||||
if (authorization !== undefined && authorization !== null) {
|
||||
httpRequest.headers['Authorization'] = authorization;
|
||||
}
|
||||
if(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
httpRequest.body = null;
|
||||
httpRequest.headers['Content-Length'] = 0;
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 201 && statusCode !== 400 && statusCode !== 401 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 201) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = new client.models['PostBlobResponse']().mapper();
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @summary Get blob
|
||||
*
|
||||
* @param {string} blobHandle Blob handle
|
||||
*
|
||||
* @param {string} authorization Authenication (must begin with string "Bearer
|
||||
* ")
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {object} [result] - The deserialized result object.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
Blobs.prototype.getBlob = function (blobHandle, authorization, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
// 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 (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
|
||||
throw new Error('authorization cannot be null or undefined and it must be of type string.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/blobs/{blobHandle}';
|
||||
requestUrl = requestUrl.replace('{blobHandle}', encodeURIComponent(blobHandle));
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'GET';
|
||||
httpRequest.headers = {};
|
||||
httpRequest.url = requestUrl;
|
||||
// Set Headers
|
||||
if (authorization !== undefined && authorization !== null) {
|
||||
httpRequest.headers['Authorization'] = authorization;
|
||||
}
|
||||
if(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
httpRequest.body = null;
|
||||
httpRequest.headers['Content-Length'] = 0;
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 200 && statusCode !== 400 && statusCode !== 401 && statusCode !== 404 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 200) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = {
|
||||
required: false,
|
||||
serializedName: 'parsedResponse',
|
||||
type: {
|
||||
name: 'Object'
|
||||
}
|
||||
};
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
module.exports = Blobs;
|
|
@ -0,0 +1,165 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var util = require('util');
|
||||
var msRest = require('ms-rest');
|
||||
var WebResource = msRest.WebResource;
|
||||
|
||||
/**
|
||||
* @class
|
||||
* Builds
|
||||
* __NOTE__: An instance of this class is automatically created for an
|
||||
* instance of the SocialPlusClient.
|
||||
* Initializes a new instance of the Builds class.
|
||||
* @constructor
|
||||
*
|
||||
* @param {SocialPlusClient} client Reference to the service client.
|
||||
*/
|
||||
function Builds(client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary The build information for this service
|
||||
*
|
||||
* This API is meant to be called by humans for debugging
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {string} [options.appkey] App Key Authentication
|
||||
*
|
||||
* @param {string} [options.authorization] Authenication (must begin with
|
||||
* string "Bearer ")
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {object} [result] - The deserialized result object.
|
||||
* See {@link BuildsCurrentResponse} for more information.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
Builds.prototype.getBuildsCurrent = function (options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
|
||||
var authorization = (options && options.authorization !== undefined) ? options.authorization : 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 must be of type string.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/builds/current';
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'GET';
|
||||
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(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
httpRequest.body = null;
|
||||
httpRequest.headers['Content-Length'] = 0;
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 200) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 200) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = new client.models['BuildsCurrentResponse']().mapper();
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
module.exports = Builds;
|
|
@ -0,0 +1,454 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var util = require('util');
|
||||
var msRest = require('ms-rest');
|
||||
var WebResource = msRest.WebResource;
|
||||
|
||||
/**
|
||||
* @class
|
||||
* CommentLikes
|
||||
* __NOTE__: An instance of this class is automatically created for an
|
||||
* instance of the SocialPlusClient.
|
||||
* Initializes a new instance of the CommentLikes class.
|
||||
* @constructor
|
||||
*
|
||||
* @param {SocialPlusClient} client Reference to the service client.
|
||||
*/
|
||||
function CommentLikes(client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary Get likes for comment
|
||||
*
|
||||
* @param {string} commentHandle Comment handle
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {string} [options.cursor] Current read cursor
|
||||
*
|
||||
* @param {number} [options.limit] Number of items to return
|
||||
*
|
||||
* @param {string} [options.appkey] App Key Authentication
|
||||
*
|
||||
* @param {string} [options.authorization] Authenication (must begin with
|
||||
* string "Bearer ")
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {object} [result] - The deserialized result object.
|
||||
* See {@link FeedResponseUserCompactView} for more
|
||||
* information.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
CommentLikes.prototype.getLikes = function (commentHandle, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
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 authorization = (options && options.authorization !== undefined) ? options.authorization : 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 (cursor !== null && cursor !== undefined && typeof cursor.valueOf() !== 'string') {
|
||||
throw new Error('cursor must be of type string.');
|
||||
}
|
||||
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 must be of type string.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/comments/{commentHandle}/likes';
|
||||
requestUrl = requestUrl.replace('{commentHandle}', encodeURIComponent(commentHandle));
|
||||
var queryParameters = [];
|
||||
if (cursor !== null && cursor !== undefined) {
|
||||
queryParameters.push('cursor=' + encodeURIComponent(cursor));
|
||||
}
|
||||
if (limit !== null && limit !== undefined) {
|
||||
queryParameters.push('limit=' + encodeURIComponent(limit.toString()));
|
||||
}
|
||||
if (queryParameters.length > 0) {
|
||||
requestUrl += '?' + queryParameters.join('&');
|
||||
}
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'GET';
|
||||
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(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
httpRequest.body = null;
|
||||
httpRequest.headers['Content-Length'] = 0;
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 200 && statusCode !== 400 && statusCode !== 401 && statusCode !== 404 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 200) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = new client.models['FeedResponseUserCompactView']().mapper();
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @summary Add like to comment
|
||||
*
|
||||
* @param {string} commentHandle Comment handle
|
||||
*
|
||||
* @param {string} authorization Authenication (must begin with string "Bearer
|
||||
* ")
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {object} [result] - The deserialized result object.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
CommentLikes.prototype.postLike = function (commentHandle, authorization, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
// 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 (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
|
||||
throw new Error('authorization cannot be null or undefined and it must be of type string.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/comments/{commentHandle}/likes';
|
||||
requestUrl = requestUrl.replace('{commentHandle}', encodeURIComponent(commentHandle));
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'POST';
|
||||
httpRequest.headers = {};
|
||||
httpRequest.url = requestUrl;
|
||||
// Set Headers
|
||||
if (authorization !== undefined && authorization !== null) {
|
||||
httpRequest.headers['Authorization'] = authorization;
|
||||
}
|
||||
if(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
httpRequest.body = null;
|
||||
httpRequest.headers['Content-Length'] = 0;
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 204 && statusCode !== 400 && statusCode !== 401 && statusCode !== 404 && statusCode !== 409 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 204) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = {
|
||||
required: false,
|
||||
serializedName: 'parsedResponse',
|
||||
type: {
|
||||
name: 'Object'
|
||||
}
|
||||
};
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @summary Remove like from comment
|
||||
*
|
||||
* @param {string} commentHandle Comment handle
|
||||
*
|
||||
* @param {string} authorization Authenication (must begin with string "Bearer
|
||||
* ")
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {object} [result] - The deserialized result object.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
CommentLikes.prototype.deleteLike = function (commentHandle, authorization, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
// 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 (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
|
||||
throw new Error('authorization cannot be null or undefined and it must be of type string.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/comments/{commentHandle}/likes/me';
|
||||
requestUrl = requestUrl.replace('{commentHandle}', encodeURIComponent(commentHandle));
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'DELETE';
|
||||
httpRequest.headers = {};
|
||||
httpRequest.url = requestUrl;
|
||||
// Set Headers
|
||||
if (authorization !== undefined && authorization !== null) {
|
||||
httpRequest.headers['Authorization'] = authorization;
|
||||
}
|
||||
if(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
httpRequest.body = null;
|
||||
httpRequest.headers['Content-Length'] = 0;
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 204 && statusCode !== 400 && statusCode !== 401 && statusCode !== 404 && statusCode !== 409 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 204) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = {
|
||||
required: false,
|
||||
serializedName: 'parsedResponse',
|
||||
type: {
|
||||
name: 'Object'
|
||||
}
|
||||
};
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
module.exports = CommentLikes;
|
|
@ -0,0 +1,332 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var util = require('util');
|
||||
var msRest = require('ms-rest');
|
||||
var WebResource = msRest.WebResource;
|
||||
|
||||
/**
|
||||
* @class
|
||||
* CommentReplies
|
||||
* __NOTE__: An instance of this class is automatically created for an
|
||||
* instance of the SocialPlusClient.
|
||||
* Initializes a new instance of the CommentReplies class.
|
||||
* @constructor
|
||||
*
|
||||
* @param {SocialPlusClient} client Reference to the service client.
|
||||
*/
|
||||
function CommentReplies(client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary Get replies for a comment
|
||||
*
|
||||
* @param {string} commentHandle Comment handle
|
||||
*
|
||||
* @param {string} authorization Authenication (must begin with string "Bearer
|
||||
* ")
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {string} [options.cursor] Current read cursor
|
||||
*
|
||||
* @param {number} [options.limit] Number of items to return
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {object} [result] - The deserialized result object.
|
||||
* See {@link FeedResponseReplyView} for more information.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
CommentReplies.prototype.getReplies = function (commentHandle, authorization, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
var cursor = (options && options.cursor !== undefined) ? options.cursor : undefined;
|
||||
var limit = (options && options.limit !== undefined) ? options.limit : 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 (cursor !== null && cursor !== undefined && typeof cursor.valueOf() !== 'string') {
|
||||
throw new Error('cursor must be of type string.');
|
||||
}
|
||||
if (limit !== null && limit !== undefined && typeof limit !== 'number') {
|
||||
throw new Error('limit must be of type number.');
|
||||
}
|
||||
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.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/comments/{commentHandle}/replies';
|
||||
requestUrl = requestUrl.replace('{commentHandle}', encodeURIComponent(commentHandle));
|
||||
var queryParameters = [];
|
||||
if (cursor !== null && cursor !== undefined) {
|
||||
queryParameters.push('cursor=' + encodeURIComponent(cursor));
|
||||
}
|
||||
if (limit !== null && limit !== undefined) {
|
||||
queryParameters.push('limit=' + encodeURIComponent(limit.toString()));
|
||||
}
|
||||
if (queryParameters.length > 0) {
|
||||
requestUrl += '?' + queryParameters.join('&');
|
||||
}
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'GET';
|
||||
httpRequest.headers = {};
|
||||
httpRequest.url = requestUrl;
|
||||
// Set Headers
|
||||
if (authorization !== undefined && authorization !== null) {
|
||||
httpRequest.headers['Authorization'] = authorization;
|
||||
}
|
||||
if(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
httpRequest.body = null;
|
||||
httpRequest.headers['Content-Length'] = 0;
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 200 && statusCode !== 400 && statusCode !== 401 && statusCode !== 404 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 200) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = new client.models['FeedResponseReplyView']().mapper();
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @summary Create a new reply
|
||||
*
|
||||
* @param {string} commentHandle Comment handle
|
||||
*
|
||||
* @param {object} request Post reply request
|
||||
*
|
||||
* @param {string} [request.text] Gets or sets reply text
|
||||
*
|
||||
* @param {string} [request.language] Gets or sets reply language
|
||||
*
|
||||
* @param {string} authorization Authenication (must begin with string "Bearer
|
||||
* ")
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {object} [result] - The deserialized result object.
|
||||
* See {@link PostReplyResponse} for more information.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
CommentReplies.prototype.postReply = function (commentHandle, request, authorization, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
// 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 (request === null || request === undefined) {
|
||||
throw new Error('request cannot be null or undefined.');
|
||||
}
|
||||
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.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/comments/{commentHandle}/replies';
|
||||
requestUrl = requestUrl.replace('{commentHandle}', encodeURIComponent(commentHandle));
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'POST';
|
||||
httpRequest.headers = {};
|
||||
httpRequest.url = requestUrl;
|
||||
// Set Headers
|
||||
if (authorization !== undefined && authorization !== null) {
|
||||
httpRequest.headers['Authorization'] = authorization;
|
||||
}
|
||||
if(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
// Serialize Request
|
||||
var requestContent = null;
|
||||
var requestModel = null;
|
||||
try {
|
||||
if (request !== null && request !== undefined) {
|
||||
var requestModelMapper = new client.models['PostReplyRequest']().mapper();
|
||||
requestModel = client.serialize(requestModelMapper, request, 'request');
|
||||
}
|
||||
requestContent = JSON.stringify(requestModel);
|
||||
} catch (error) {
|
||||
var serializationError = new Error(util.format('Error "%s" occurred in serializing the ' +
|
||||
'payload - "%s"', error.message, util.inspect(request, {depth: null})));
|
||||
return callback(serializationError);
|
||||
}
|
||||
httpRequest.body = requestContent;
|
||||
httpRequest.headers['Content-Length'] = Buffer.isBuffer(requestContent) ?
|
||||
requestContent.length :
|
||||
Buffer.byteLength(requestContent, 'UTF8');
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 201 && statusCode !== 400 && statusCode !== 401 && statusCode !== 404 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 201) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = new client.models['PostReplyResponse']().mapper();
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
module.exports = CommentReplies;
|
|
@ -0,0 +1,189 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var util = require('util');
|
||||
var msRest = require('ms-rest');
|
||||
var WebResource = msRest.WebResource;
|
||||
|
||||
/**
|
||||
* @class
|
||||
* CommentReports
|
||||
* __NOTE__: An instance of this class is automatically created for an
|
||||
* instance of the SocialPlusClient.
|
||||
* Initializes a new instance of the CommentReports class.
|
||||
* @constructor
|
||||
*
|
||||
* @param {SocialPlusClient} client Reference to the service client.
|
||||
*/
|
||||
function CommentReports(client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary Report comment
|
||||
*
|
||||
* @param {string} commentHandle Comment handle
|
||||
*
|
||||
* @param {object} postReportRequest Post report request
|
||||
*
|
||||
* @param {string} [postReportRequest.reason] Gets or sets report reason.
|
||||
* Possible values for this property include: 'Spam', 'Cyberbullying',
|
||||
* 'ChildEndangerment', 'Offensive', 'ContentInfringement', 'Other'.
|
||||
*
|
||||
* @param {string} authorization Authenication (must begin with string "Bearer
|
||||
* ")
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {object} [result] - The deserialized result object.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
CommentReports.prototype.postReport = function (commentHandle, postReportRequest, authorization, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
// 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 (postReportRequest === null || postReportRequest === undefined) {
|
||||
throw new Error('postReportRequest cannot be null or undefined.');
|
||||
}
|
||||
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.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/comments/{commentHandle}/reports';
|
||||
requestUrl = requestUrl.replace('{commentHandle}', encodeURIComponent(commentHandle));
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'POST';
|
||||
httpRequest.headers = {};
|
||||
httpRequest.url = requestUrl;
|
||||
// Set Headers
|
||||
if (authorization !== undefined && authorization !== null) {
|
||||
httpRequest.headers['Authorization'] = authorization;
|
||||
}
|
||||
if(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
// Serialize Request
|
||||
var requestContent = null;
|
||||
var requestModel = null;
|
||||
try {
|
||||
if (postReportRequest !== null && postReportRequest !== undefined) {
|
||||
var requestModelMapper = new client.models['PostReportRequest']().mapper();
|
||||
requestModel = client.serialize(requestModelMapper, postReportRequest, 'postReportRequest');
|
||||
}
|
||||
requestContent = JSON.stringify(requestModel);
|
||||
} catch (error) {
|
||||
var serializationError = new Error(util.format('Error "%s" occurred in serializing the ' +
|
||||
'payload - "%s"', error.message, util.inspect(postReportRequest, {depth: null})));
|
||||
return callback(serializationError);
|
||||
}
|
||||
httpRequest.body = requestContent;
|
||||
httpRequest.headers['Content-Length'] = Buffer.isBuffer(requestContent) ?
|
||||
requestContent.length :
|
||||
Buffer.byteLength(requestContent, 'UTF8');
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 204 && statusCode !== 400 && statusCode !== 401 && statusCode !== 404 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 204) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = {
|
||||
required: false,
|
||||
serializedName: 'parsedResponse',
|
||||
type: {
|
||||
name: 'Object'
|
||||
}
|
||||
};
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
module.exports = CommentReports;
|
|
@ -0,0 +1,290 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var util = require('util');
|
||||
var msRest = require('ms-rest');
|
||||
var WebResource = msRest.WebResource;
|
||||
|
||||
/**
|
||||
* @class
|
||||
* Comments
|
||||
* __NOTE__: An instance of this class is automatically created for an
|
||||
* instance of the SocialPlusClient.
|
||||
* Initializes a new instance of the Comments class.
|
||||
* @constructor
|
||||
*
|
||||
* @param {SocialPlusClient} client Reference to the service client.
|
||||
*/
|
||||
function Comments(client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary Get comment
|
||||
*
|
||||
* @param {string} commentHandle Comment handle
|
||||
*
|
||||
* @param {string} authorization Authenication (must begin with string "Bearer
|
||||
* ")
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {object} [result] - The deserialized result object.
|
||||
* See {@link CommentView} for more information.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
Comments.prototype.getComment = function (commentHandle, authorization, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
// 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 (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
|
||||
throw new Error('authorization cannot be null or undefined and it must be of type string.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/comments/{commentHandle}';
|
||||
requestUrl = requestUrl.replace('{commentHandle}', encodeURIComponent(commentHandle));
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'GET';
|
||||
httpRequest.headers = {};
|
||||
httpRequest.url = requestUrl;
|
||||
// Set Headers
|
||||
if (authorization !== undefined && authorization !== null) {
|
||||
httpRequest.headers['Authorization'] = authorization;
|
||||
}
|
||||
if(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
httpRequest.body = null;
|
||||
httpRequest.headers['Content-Length'] = 0;
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 200 && statusCode !== 400 && statusCode !== 401 && statusCode !== 404 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 200) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = new client.models['CommentView']().mapper();
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @summary Delete comment
|
||||
*
|
||||
* @param {string} commentHandle Comment handle
|
||||
*
|
||||
* @param {string} authorization Authenication (must begin with string "Bearer
|
||||
* ")
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {object} [result] - The deserialized result object.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
Comments.prototype.deleteComment = function (commentHandle, authorization, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
// 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 (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
|
||||
throw new Error('authorization cannot be null or undefined and it must be of type string.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/comments/{commentHandle}';
|
||||
requestUrl = requestUrl.replace('{commentHandle}', encodeURIComponent(commentHandle));
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'DELETE';
|
||||
httpRequest.headers = {};
|
||||
httpRequest.url = requestUrl;
|
||||
// Set Headers
|
||||
if (authorization !== undefined && authorization !== null) {
|
||||
httpRequest.headers['Authorization'] = authorization;
|
||||
}
|
||||
if(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
httpRequest.body = null;
|
||||
httpRequest.headers['Content-Length'] = 0;
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 204 && statusCode !== 400 && statusCode !== 401 && statusCode !== 404 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 204) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = {
|
||||
required: false,
|
||||
serializedName: 'parsedResponse',
|
||||
type: {
|
||||
name: 'Object'
|
||||
}
|
||||
};
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
module.exports = Comments;
|
|
@ -0,0 +1,327 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var util = require('util');
|
||||
var msRest = require('ms-rest');
|
||||
var WebResource = msRest.WebResource;
|
||||
|
||||
/**
|
||||
* @class
|
||||
* Hashtags
|
||||
* __NOTE__: An instance of this class is automatically created for an
|
||||
* instance of the SocialPlusClient.
|
||||
* Initializes a new instance of the Hashtags class.
|
||||
* @constructor
|
||||
*
|
||||
* @param {SocialPlusClient} client Reference to the service client.
|
||||
*/
|
||||
function Hashtags(client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary Get trending hashtags
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {string} [options.appkey] App Key Authentication
|
||||
*
|
||||
* @param {string} [options.authorization] Authenication (must begin with
|
||||
* string "Bearer ")
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {array} [result] - The deserialized result object.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
Hashtags.prototype.getTrendingHashtags = function (options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
|
||||
var authorization = (options && options.authorization !== undefined) ? options.authorization : 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 must be of type string.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/hashtags/trending';
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'GET';
|
||||
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(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
httpRequest.body = null;
|
||||
httpRequest.headers['Content-Length'] = 0;
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 200 && statusCode !== 400 && statusCode !== 401 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 200) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = {
|
||||
required: false,
|
||||
serializedName: 'parsedResponse',
|
||||
type: {
|
||||
name: 'Sequence',
|
||||
element: {
|
||||
required: false,
|
||||
serializedName: 'StringElementType',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @summary Get autocompleted hashtags
|
||||
*
|
||||
* @param {string} query Search query
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {string} [options.appkey] App Key Authentication
|
||||
*
|
||||
* @param {string} [options.authorization] Authenication (must begin with
|
||||
* string "Bearer ")
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {array} [result] - The deserialized result object.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
Hashtags.prototype.getAutocompletedHashtags = function (query, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
|
||||
var authorization = (options && options.authorization !== undefined) ? options.authorization : undefined;
|
||||
// Validate
|
||||
try {
|
||||
if (query === null || query === undefined || typeof query.valueOf() !== 'string') {
|
||||
throw new Error('query 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 must be of type string.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/hashtags/autocomplete';
|
||||
var queryParameters = [];
|
||||
queryParameters.push('query=' + encodeURIComponent(query));
|
||||
if (queryParameters.length > 0) {
|
||||
requestUrl += '?' + queryParameters.join('&');
|
||||
}
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'GET';
|
||||
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(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
httpRequest.body = null;
|
||||
httpRequest.headers['Content-Length'] = 0;
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 200 && statusCode !== 400 && statusCode !== 401 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 200) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = {
|
||||
required: false,
|
||||
serializedName: 'parsedResponse',
|
||||
type: {
|
||||
name: 'Sequence',
|
||||
element: {
|
||||
required: false,
|
||||
serializedName: 'StringElementType',
|
||||
type: {
|
||||
name: 'String'
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
module.exports = Hashtags;
|
|
@ -0,0 +1,315 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var util = require('util');
|
||||
var msRest = require('ms-rest');
|
||||
var WebResource = msRest.WebResource;
|
||||
|
||||
/**
|
||||
* @class
|
||||
* Images
|
||||
* __NOTE__: An instance of this class is automatically created for an
|
||||
* instance of the SocialPlusClient.
|
||||
* Initializes a new instance of the Images class.
|
||||
* @constructor
|
||||
*
|
||||
* @param {SocialPlusClient} client Reference to the service client.
|
||||
*/
|
||||
function Images(client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary Upload a new image
|
||||
*
|
||||
* <para>Images will be resized. To access a resized image, append the 1
|
||||
* character size identifier to the blobHandle that is returned.</para>
|
||||
* <para>d = 25 pixels wide</para>
|
||||
* <para>h = 50 pixels wide</para>
|
||||
* <para>l = 100 pixels wide</para>
|
||||
* <para>p = 250 pixels wide</para>
|
||||
* <para>t = 500 pixels wide</para>
|
||||
* <para>x = 1000 pixels wide</para>
|
||||
* <para>ImageType.UserPhoto supports d,h,l,p,t,x</para>
|
||||
* <para>ImageType.ContentBlob supports d,h,l,p,t,x</para>
|
||||
* <para>ImageType.AppIcon supports l</para>
|
||||
* <para>All resized images will maintain their aspect ratio. Any orientation
|
||||
* specified in the EXIF headers will be honored.</para>
|
||||
*
|
||||
* @param {string} imageType Image type. Possible values for this parameter
|
||||
* include: 'UserPhoto', 'ContentBlob', 'AppIcon'
|
||||
*
|
||||
* @param {string} authorization Authenication (must begin with string "Bearer
|
||||
* ")
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {object} [result] - The deserialized result object.
|
||||
* See {@link PostImageResponse} for more information.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
Images.prototype.postImage = function (imageType, authorization, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
// Validate
|
||||
try {
|
||||
if (imageType === null || imageType === undefined || typeof imageType.valueOf() !== 'string') {
|
||||
throw new Error('imageType cannot be null or undefined and it 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.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/images/{imageType}';
|
||||
requestUrl = requestUrl.replace('{imageType}', encodeURIComponent(imageType));
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'POST';
|
||||
httpRequest.headers = {};
|
||||
httpRequest.url = requestUrl;
|
||||
// Set Headers
|
||||
if (authorization !== undefined && authorization !== null) {
|
||||
httpRequest.headers['Authorization'] = authorization;
|
||||
}
|
||||
if(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
httpRequest.body = null;
|
||||
httpRequest.headers['Content-Length'] = 0;
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 201 && statusCode !== 400 && statusCode !== 401 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 201) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = new client.models['PostImageResponse']().mapper();
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @summary Get image
|
||||
*
|
||||
* @param {string} blobHandle Blob handle
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {string} [options.appkey] App Key Authentication
|
||||
*
|
||||
* @param {string} [options.authorization] Authenication (must begin with
|
||||
* string "Bearer ")
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {object} [result] - The deserialized result object.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
Images.prototype.getImage = function (blobHandle, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
|
||||
var authorization = (options && options.authorization !== undefined) ? options.authorization : 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 must be of type string.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/images/{blobHandle}';
|
||||
requestUrl = requestUrl.replace('{blobHandle}', encodeURIComponent(blobHandle));
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'GET';
|
||||
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(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
httpRequest.body = null;
|
||||
httpRequest.headers['Content-Length'] = 0;
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 200 && statusCode !== 400 && statusCode !== 401 && statusCode !== 404 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 200) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = {
|
||||
required: false,
|
||||
serializedName: 'parsedResponse',
|
||||
type: {
|
||||
name: 'Object'
|
||||
}
|
||||
};
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
module.exports = Images;
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
/* jshint latedef:false */
|
||||
/* jshint forin:false */
|
||||
/* jshint noempty:false */
|
||||
|
||||
'use strict';
|
||||
|
||||
exports.Blobs = require('./blobs');
|
||||
exports.Builds = require('./builds');
|
||||
exports.Comments = require('./comments');
|
||||
exports.TopicComments = require('./topicComments');
|
||||
exports.Hashtags = require('./hashtags');
|
||||
exports.Images = require('./images');
|
||||
exports.TopicLikes = require('./topicLikes');
|
||||
exports.ReplyLikes = require('./replyLikes');
|
||||
exports.CommentLikes = require('./commentLikes');
|
||||
exports.MyNotifications = require('./myNotifications');
|
||||
exports.MyPins = require('./myPins');
|
||||
exports.MyPushRegistrations = require('./myPushRegistrations');
|
||||
exports.Replies = require('./replies');
|
||||
exports.CommentReplies = require('./commentReplies');
|
||||
exports.UserReports = require('./userReports');
|
||||
exports.TopicReports = require('./topicReports');
|
||||
exports.ReplyReports = require('./replyReports');
|
||||
exports.CommentReports = require('./commentReports');
|
||||
exports.Search = require('./search');
|
||||
exports.Sessions = require('./sessions');
|
||||
exports.RequestTokens = require('./requestTokens');
|
||||
exports.UserFollowers = require('./userFollowers');
|
||||
exports.MyPendingUsers = require('./myPendingUsers');
|
||||
exports.MyFollowers = require('./myFollowers');
|
||||
exports.MyFollowing = require('./myFollowing');
|
||||
exports.MyBlockedUsers = require('./myBlockedUsers');
|
||||
exports.UserFollowing = require('./userFollowing');
|
||||
exports.Topics = require('./topics');
|
||||
exports.MyTopics = require('./myTopics');
|
||||
exports.MyAppFollowing = require('./myAppFollowing');
|
||||
exports.MyApps = require('./myApps');
|
||||
exports.MyLikes = require('./myLikes');
|
||||
exports.MyLinkedAccounts = require('./myLinkedAccounts');
|
||||
exports.Users = require('./users');
|
||||
exports.UserTopics = require('./userTopics');
|
|
@ -0,0 +1,174 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var util = require('util');
|
||||
var msRest = require('ms-rest');
|
||||
var WebResource = msRest.WebResource;
|
||||
|
||||
/**
|
||||
* @class
|
||||
* MyAppFollowing
|
||||
* __NOTE__: An instance of this class is automatically created for an
|
||||
* instance of the SocialPlusClient.
|
||||
* Initializes a new instance of the MyAppFollowing class.
|
||||
* @constructor
|
||||
*
|
||||
* @param {SocialPlusClient} client Reference to the service client.
|
||||
*/
|
||||
function MyAppFollowing(client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary Find users the current user is following in another app but not in
|
||||
* the current app
|
||||
*
|
||||
* @param {string} appHandle App handle
|
||||
*
|
||||
* @param {string} authorization Authenication (must begin with string "Bearer
|
||||
* ")
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {string} [options.cursor] Current read cursor
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {object} [result] - The deserialized result object.
|
||||
* See {@link FeedResponseUserCompactView} for more
|
||||
* information.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
MyAppFollowing.prototype.getUsers = function (appHandle, authorization, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
var cursor = (options && options.cursor !== undefined) ? options.cursor : undefined;
|
||||
// Validate
|
||||
try {
|
||||
if (appHandle === null || appHandle === undefined || typeof appHandle.valueOf() !== 'string') {
|
||||
throw new Error('appHandle cannot be null or undefined and it must be of type string.');
|
||||
}
|
||||
if (cursor !== null && cursor !== undefined && typeof cursor.valueOf() !== 'string') {
|
||||
throw new Error('cursor 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.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/users/me/apps/{appHandle}/following/difference';
|
||||
requestUrl = requestUrl.replace('{appHandle}', encodeURIComponent(appHandle));
|
||||
var queryParameters = [];
|
||||
if (cursor !== null && cursor !== undefined) {
|
||||
queryParameters.push('cursor=' + encodeURIComponent(cursor));
|
||||
}
|
||||
if (queryParameters.length > 0) {
|
||||
requestUrl += '?' + queryParameters.join('&');
|
||||
}
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'GET';
|
||||
httpRequest.headers = {};
|
||||
httpRequest.url = requestUrl;
|
||||
// Set Headers
|
||||
if (authorization !== undefined && authorization !== null) {
|
||||
httpRequest.headers['Authorization'] = authorization;
|
||||
}
|
||||
if(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
httpRequest.body = null;
|
||||
httpRequest.headers['Content-Length'] = 0;
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 200 && statusCode !== 400 && statusCode !== 401 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 200) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = new client.models['FeedResponseUserCompactView']().mapper();
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
module.exports = MyAppFollowing;
|
|
@ -0,0 +1,166 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var util = require('util');
|
||||
var msRest = require('ms-rest');
|
||||
var WebResource = msRest.WebResource;
|
||||
|
||||
/**
|
||||
* @class
|
||||
* MyApps
|
||||
* __NOTE__: An instance of this class is automatically created for an
|
||||
* instance of the SocialPlusClient.
|
||||
* Initializes a new instance of the MyApps class.
|
||||
* @constructor
|
||||
*
|
||||
* @param {SocialPlusClient} client Reference to the service client.
|
||||
*/
|
||||
function MyApps(client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary Get my list of Social Plus apps
|
||||
*
|
||||
* @param {string} authorization Authenication (must begin with string "Bearer
|
||||
* ")
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {array} [result] - The deserialized result object.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
MyApps.prototype.getApps = function (authorization, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
// Validate
|
||||
try {
|
||||
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.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/users/me/apps';
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'GET';
|
||||
httpRequest.headers = {};
|
||||
httpRequest.url = requestUrl;
|
||||
// Set Headers
|
||||
if (authorization !== undefined && authorization !== null) {
|
||||
httpRequest.headers['Authorization'] = authorization;
|
||||
}
|
||||
if(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
httpRequest.body = null;
|
||||
httpRequest.headers['Content-Length'] = 0;
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 200 && statusCode !== 400 && statusCode !== 401 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 200) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = {
|
||||
required: false,
|
||||
serializedName: 'parsedResponse',
|
||||
type: {
|
||||
name: 'Sequence',
|
||||
element: {
|
||||
required: false,
|
||||
serializedName: 'AppCompactViewElementType',
|
||||
type: {
|
||||
name: 'Composite',
|
||||
className: 'AppCompactView'
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
module.exports = MyApps;
|
|
@ -0,0 +1,455 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var util = require('util');
|
||||
var msRest = require('ms-rest');
|
||||
var WebResource = msRest.WebResource;
|
||||
|
||||
/**
|
||||
* @class
|
||||
* MyBlockedUsers
|
||||
* __NOTE__: An instance of this class is automatically created for an
|
||||
* instance of the SocialPlusClient.
|
||||
* Initializes a new instance of the MyBlockedUsers class.
|
||||
* @constructor
|
||||
*
|
||||
* @param {SocialPlusClient} client Reference to the service client.
|
||||
*/
|
||||
function MyBlockedUsers(client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary Get my blocked users
|
||||
*
|
||||
* @param {string} authorization Authenication (must begin with string "Bearer
|
||||
* ")
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {string} [options.cursor] Current read cursor
|
||||
*
|
||||
* @param {number} [options.limit] Number of items to return
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {object} [result] - The deserialized result object.
|
||||
* See {@link FeedResponseUserCompactView} for more
|
||||
* information.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
MyBlockedUsers.prototype.getBlockedUsers = function (authorization, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
var cursor = (options && options.cursor !== undefined) ? options.cursor : undefined;
|
||||
var limit = (options && options.limit !== undefined) ? options.limit : undefined;
|
||||
// Validate
|
||||
try {
|
||||
if (cursor !== null && cursor !== undefined && typeof cursor.valueOf() !== 'string') {
|
||||
throw new Error('cursor must be of type string.');
|
||||
}
|
||||
if (limit !== null && limit !== undefined && typeof limit !== 'number') {
|
||||
throw new Error('limit must be of type number.');
|
||||
}
|
||||
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.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/users/me/blocked_users';
|
||||
var queryParameters = [];
|
||||
if (cursor !== null && cursor !== undefined) {
|
||||
queryParameters.push('cursor=' + encodeURIComponent(cursor));
|
||||
}
|
||||
if (limit !== null && limit !== undefined) {
|
||||
queryParameters.push('limit=' + encodeURIComponent(limit.toString()));
|
||||
}
|
||||
if (queryParameters.length > 0) {
|
||||
requestUrl += '?' + queryParameters.join('&');
|
||||
}
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'GET';
|
||||
httpRequest.headers = {};
|
||||
httpRequest.url = requestUrl;
|
||||
// Set Headers
|
||||
if (authorization !== undefined && authorization !== null) {
|
||||
httpRequest.headers['Authorization'] = authorization;
|
||||
}
|
||||
if(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
httpRequest.body = null;
|
||||
httpRequest.headers['Content-Length'] = 0;
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 200 && statusCode !== 400 && statusCode !== 401 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 200) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = new client.models['FeedResponseUserCompactView']().mapper();
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @summary Block user
|
||||
*
|
||||
* @param {object} request Post blocked user request
|
||||
*
|
||||
* @param {string} [request.userHandle] Gets or sets user handle
|
||||
*
|
||||
* @param {string} authorization Authenication (must begin with string "Bearer
|
||||
* ")
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {object} [result] - The deserialized result object.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
MyBlockedUsers.prototype.postBlockedUser = function (request, authorization, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
// Validate
|
||||
try {
|
||||
if (request === null || request === undefined) {
|
||||
throw new Error('request cannot be null or undefined.');
|
||||
}
|
||||
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.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/users/me/blocked_users';
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'POST';
|
||||
httpRequest.headers = {};
|
||||
httpRequest.url = requestUrl;
|
||||
// Set Headers
|
||||
if (authorization !== undefined && authorization !== null) {
|
||||
httpRequest.headers['Authorization'] = authorization;
|
||||
}
|
||||
if(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
// Serialize Request
|
||||
var requestContent = null;
|
||||
var requestModel = null;
|
||||
try {
|
||||
if (request !== null && request !== undefined) {
|
||||
var requestModelMapper = new client.models['PostBlockedUserRequest']().mapper();
|
||||
requestModel = client.serialize(requestModelMapper, request, 'request');
|
||||
}
|
||||
requestContent = JSON.stringify(requestModel);
|
||||
} catch (error) {
|
||||
var serializationError = new Error(util.format('Error "%s" occurred in serializing the ' +
|
||||
'payload - "%s"', error.message, util.inspect(request, {depth: null})));
|
||||
return callback(serializationError);
|
||||
}
|
||||
httpRequest.body = requestContent;
|
||||
httpRequest.headers['Content-Length'] = Buffer.isBuffer(requestContent) ?
|
||||
requestContent.length :
|
||||
Buffer.byteLength(requestContent, 'UTF8');
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 204 && statusCode !== 400 && statusCode !== 401 && statusCode !== 404 && statusCode !== 409 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 204) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = {
|
||||
required: false,
|
||||
serializedName: 'parsedResponse',
|
||||
type: {
|
||||
name: 'Object'
|
||||
}
|
||||
};
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @summary Unblock user
|
||||
*
|
||||
* @param {string} userHandle User handle
|
||||
*
|
||||
* @param {string} authorization Authenication (must begin with string "Bearer
|
||||
* ")
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {object} [result] - The deserialized result object.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
MyBlockedUsers.prototype.deleteBlockedUser = function (userHandle, authorization, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
// 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 (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
|
||||
throw new Error('authorization cannot be null or undefined and it must be of type string.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/users/me/blocked_users/{userHandle}';
|
||||
requestUrl = requestUrl.replace('{userHandle}', encodeURIComponent(userHandle));
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'DELETE';
|
||||
httpRequest.headers = {};
|
||||
httpRequest.url = requestUrl;
|
||||
// Set Headers
|
||||
if (authorization !== undefined && authorization !== null) {
|
||||
httpRequest.headers['Authorization'] = authorization;
|
||||
}
|
||||
if(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
httpRequest.body = null;
|
||||
httpRequest.headers['Content-Length'] = 0;
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 204 && statusCode !== 400 && statusCode !== 401 && statusCode !== 404 && statusCode !== 409 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 204) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = {
|
||||
required: false,
|
||||
serializedName: 'parsedResponse',
|
||||
type: {
|
||||
name: 'Object'
|
||||
}
|
||||
};
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
module.exports = MyBlockedUsers;
|
|
@ -0,0 +1,455 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var util = require('util');
|
||||
var msRest = require('ms-rest');
|
||||
var WebResource = msRest.WebResource;
|
||||
|
||||
/**
|
||||
* @class
|
||||
* MyFollowers
|
||||
* __NOTE__: An instance of this class is automatically created for an
|
||||
* instance of the SocialPlusClient.
|
||||
* Initializes a new instance of the MyFollowers class.
|
||||
* @constructor
|
||||
*
|
||||
* @param {SocialPlusClient} client Reference to the service client.
|
||||
*/
|
||||
function MyFollowers(client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary Get my followers
|
||||
*
|
||||
* @param {string} authorization Authenication (must begin with string "Bearer
|
||||
* ")
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {string} [options.cursor] Current read cursor
|
||||
*
|
||||
* @param {number} [options.limit] Number of items to return
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {object} [result] - The deserialized result object.
|
||||
* See {@link FeedResponseUserCompactView} for more
|
||||
* information.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
MyFollowers.prototype.getFollowers = function (authorization, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
var cursor = (options && options.cursor !== undefined) ? options.cursor : undefined;
|
||||
var limit = (options && options.limit !== undefined) ? options.limit : undefined;
|
||||
// Validate
|
||||
try {
|
||||
if (cursor !== null && cursor !== undefined && typeof cursor.valueOf() !== 'string') {
|
||||
throw new Error('cursor must be of type string.');
|
||||
}
|
||||
if (limit !== null && limit !== undefined && typeof limit !== 'number') {
|
||||
throw new Error('limit must be of type number.');
|
||||
}
|
||||
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.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/users/me/followers';
|
||||
var queryParameters = [];
|
||||
if (cursor !== null && cursor !== undefined) {
|
||||
queryParameters.push('cursor=' + encodeURIComponent(cursor));
|
||||
}
|
||||
if (limit !== null && limit !== undefined) {
|
||||
queryParameters.push('limit=' + encodeURIComponent(limit.toString()));
|
||||
}
|
||||
if (queryParameters.length > 0) {
|
||||
requestUrl += '?' + queryParameters.join('&');
|
||||
}
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'GET';
|
||||
httpRequest.headers = {};
|
||||
httpRequest.url = requestUrl;
|
||||
// Set Headers
|
||||
if (authorization !== undefined && authorization !== null) {
|
||||
httpRequest.headers['Authorization'] = authorization;
|
||||
}
|
||||
if(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
httpRequest.body = null;
|
||||
httpRequest.headers['Content-Length'] = 0;
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 200 && statusCode !== 400 && statusCode !== 401 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 200) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = new client.models['FeedResponseUserCompactView']().mapper();
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @summary Accept follower request
|
||||
*
|
||||
* @param {object} request Post follower request
|
||||
*
|
||||
* @param {string} [request.userHandle] Gets or sets user handle
|
||||
*
|
||||
* @param {string} authorization Authenication (must begin with string "Bearer
|
||||
* ")
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {object} [result] - The deserialized result object.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
MyFollowers.prototype.postFollower = function (request, authorization, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
// Validate
|
||||
try {
|
||||
if (request === null || request === undefined) {
|
||||
throw new Error('request cannot be null or undefined.');
|
||||
}
|
||||
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.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/users/me/followers';
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'POST';
|
||||
httpRequest.headers = {};
|
||||
httpRequest.url = requestUrl;
|
||||
// Set Headers
|
||||
if (authorization !== undefined && authorization !== null) {
|
||||
httpRequest.headers['Authorization'] = authorization;
|
||||
}
|
||||
if(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
// Serialize Request
|
||||
var requestContent = null;
|
||||
var requestModel = null;
|
||||
try {
|
||||
if (request !== null && request !== undefined) {
|
||||
var requestModelMapper = new client.models['PostFollowerRequest']().mapper();
|
||||
requestModel = client.serialize(requestModelMapper, request, 'request');
|
||||
}
|
||||
requestContent = JSON.stringify(requestModel);
|
||||
} catch (error) {
|
||||
var serializationError = new Error(util.format('Error "%s" occurred in serializing the ' +
|
||||
'payload - "%s"', error.message, util.inspect(request, {depth: null})));
|
||||
return callback(serializationError);
|
||||
}
|
||||
httpRequest.body = requestContent;
|
||||
httpRequest.headers['Content-Length'] = Buffer.isBuffer(requestContent) ?
|
||||
requestContent.length :
|
||||
Buffer.byteLength(requestContent, 'UTF8');
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 204 && statusCode !== 400 && statusCode !== 401 && statusCode !== 403 && statusCode !== 404 && statusCode !== 409 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 204) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = {
|
||||
required: false,
|
||||
serializedName: 'parsedResponse',
|
||||
type: {
|
||||
name: 'Object'
|
||||
}
|
||||
};
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @summary Remove follower
|
||||
*
|
||||
* @param {string} userHandle User handle
|
||||
*
|
||||
* @param {string} authorization Authenication (must begin with string "Bearer
|
||||
* ")
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {object} [result] - The deserialized result object.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
MyFollowers.prototype.deleteFollower = function (userHandle, authorization, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
// 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 (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
|
||||
throw new Error('authorization cannot be null or undefined and it must be of type string.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/users/me/followers/{userHandle}';
|
||||
requestUrl = requestUrl.replace('{userHandle}', encodeURIComponent(userHandle));
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'DELETE';
|
||||
httpRequest.headers = {};
|
||||
httpRequest.url = requestUrl;
|
||||
// Set Headers
|
||||
if (authorization !== undefined && authorization !== null) {
|
||||
httpRequest.headers['Authorization'] = authorization;
|
||||
}
|
||||
if(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
httpRequest.body = null;
|
||||
httpRequest.headers['Content-Length'] = 0;
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 204 && statusCode !== 400 && statusCode !== 401 && statusCode !== 404 && statusCode !== 409 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 204) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = {
|
||||
required: false,
|
||||
serializedName: 'parsedResponse',
|
||||
type: {
|
||||
name: 'Object'
|
||||
}
|
||||
};
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
module.exports = MyFollowers;
|
|
@ -0,0 +1,871 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var util = require('util');
|
||||
var msRest = require('ms-rest');
|
||||
var WebResource = msRest.WebResource;
|
||||
|
||||
/**
|
||||
* @class
|
||||
* MyFollowing
|
||||
* __NOTE__: An instance of this class is automatically created for an
|
||||
* instance of the SocialPlusClient.
|
||||
* Initializes a new instance of the MyFollowing class.
|
||||
* @constructor
|
||||
*
|
||||
* @param {SocialPlusClient} client Reference to the service client.
|
||||
*/
|
||||
function MyFollowing(client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary Get my following
|
||||
*
|
||||
* @param {string} authorization Authenication (must begin with string "Bearer
|
||||
* ")
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {string} [options.cursor] Current read cursor
|
||||
*
|
||||
* @param {number} [options.limit] Number of items to return
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {object} [result] - The deserialized result object.
|
||||
* See {@link FeedResponseUserCompactView} for more
|
||||
* information.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
MyFollowing.prototype.getFollowing = function (authorization, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
var cursor = (options && options.cursor !== undefined) ? options.cursor : undefined;
|
||||
var limit = (options && options.limit !== undefined) ? options.limit : undefined;
|
||||
// Validate
|
||||
try {
|
||||
if (cursor !== null && cursor !== undefined && typeof cursor.valueOf() !== 'string') {
|
||||
throw new Error('cursor must be of type string.');
|
||||
}
|
||||
if (limit !== null && limit !== undefined && typeof limit !== 'number') {
|
||||
throw new Error('limit must be of type number.');
|
||||
}
|
||||
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.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/users/me/following';
|
||||
var queryParameters = [];
|
||||
if (cursor !== null && cursor !== undefined) {
|
||||
queryParameters.push('cursor=' + encodeURIComponent(cursor));
|
||||
}
|
||||
if (limit !== null && limit !== undefined) {
|
||||
queryParameters.push('limit=' + encodeURIComponent(limit.toString()));
|
||||
}
|
||||
if (queryParameters.length > 0) {
|
||||
requestUrl += '?' + queryParameters.join('&');
|
||||
}
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'GET';
|
||||
httpRequest.headers = {};
|
||||
httpRequest.url = requestUrl;
|
||||
// Set Headers
|
||||
if (authorization !== undefined && authorization !== null) {
|
||||
httpRequest.headers['Authorization'] = authorization;
|
||||
}
|
||||
if(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
httpRequest.body = null;
|
||||
httpRequest.headers['Content-Length'] = 0;
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 200 && statusCode !== 400 && statusCode !== 401 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 200) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = new client.models['FeedResponseUserCompactView']().mapper();
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @summary Follow user
|
||||
*
|
||||
* @param {object} request Post following request
|
||||
*
|
||||
* @param {string} [request.userHandle] Gets or sets user handle
|
||||
*
|
||||
* @param {string} authorization Authenication (must begin with string "Bearer
|
||||
* ")
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {object} [result] - The deserialized result object.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
MyFollowing.prototype.postFollowing = function (request, authorization, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
// Validate
|
||||
try {
|
||||
if (request === null || request === undefined) {
|
||||
throw new Error('request cannot be null or undefined.');
|
||||
}
|
||||
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.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/users/me/following';
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'POST';
|
||||
httpRequest.headers = {};
|
||||
httpRequest.url = requestUrl;
|
||||
// Set Headers
|
||||
if (authorization !== undefined && authorization !== null) {
|
||||
httpRequest.headers['Authorization'] = authorization;
|
||||
}
|
||||
if(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
// Serialize Request
|
||||
var requestContent = null;
|
||||
var requestModel = null;
|
||||
try {
|
||||
if (request !== null && request !== undefined) {
|
||||
var requestModelMapper = new client.models['PostFollowingRequest']().mapper();
|
||||
requestModel = client.serialize(requestModelMapper, request, 'request');
|
||||
}
|
||||
requestContent = JSON.stringify(requestModel);
|
||||
} catch (error) {
|
||||
var serializationError = new Error(util.format('Error "%s" occurred in serializing the ' +
|
||||
'payload - "%s"', error.message, util.inspect(request, {depth: null})));
|
||||
return callback(serializationError);
|
||||
}
|
||||
httpRequest.body = requestContent;
|
||||
httpRequest.headers['Content-Length'] = Buffer.isBuffer(requestContent) ?
|
||||
requestContent.length :
|
||||
Buffer.byteLength(requestContent, 'UTF8');
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 204 && statusCode !== 400 && statusCode !== 401 && statusCode !== 404 && statusCode !== 409 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 204) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = {
|
||||
required: false,
|
||||
serializedName: 'parsedResponse',
|
||||
type: {
|
||||
name: 'Object'
|
||||
}
|
||||
};
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @summary Unfollow user
|
||||
*
|
||||
* @param {string} userHandle User handle
|
||||
*
|
||||
* @param {string} authorization Authenication (must begin with string "Bearer
|
||||
* ")
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {object} [result] - The deserialized result object.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
MyFollowing.prototype.deleteFollowing = function (userHandle, authorization, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
// 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 (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
|
||||
throw new Error('authorization cannot be null or undefined and it must be of type string.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/users/me/following/{userHandle}';
|
||||
requestUrl = requestUrl.replace('{userHandle}', encodeURIComponent(userHandle));
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'DELETE';
|
||||
httpRequest.headers = {};
|
||||
httpRequest.url = requestUrl;
|
||||
// Set Headers
|
||||
if (authorization !== undefined && authorization !== null) {
|
||||
httpRequest.headers['Authorization'] = authorization;
|
||||
}
|
||||
if(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
httpRequest.body = null;
|
||||
httpRequest.headers['Content-Length'] = 0;
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 204 && statusCode !== 400 && statusCode !== 401 && statusCode !== 404 && statusCode !== 409 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 204) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = {
|
||||
required: false,
|
||||
serializedName: 'parsedResponse',
|
||||
type: {
|
||||
name: 'Object'
|
||||
}
|
||||
};
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @summary Hide topic from my following topics
|
||||
*
|
||||
* @param {string} topicHandle Topic handle
|
||||
*
|
||||
* @param {string} authorization Authenication (must begin with string "Bearer
|
||||
* ")
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {object} [result] - The deserialized result object.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
MyFollowing.prototype.deleteTopic = function (topicHandle, authorization, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
// 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 (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
|
||||
throw new Error('authorization cannot be null or undefined and it must be of type string.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/users/me/following/topics/{topicHandle}';
|
||||
requestUrl = requestUrl.replace('{topicHandle}', encodeURIComponent(topicHandle));
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'DELETE';
|
||||
httpRequest.headers = {};
|
||||
httpRequest.url = requestUrl;
|
||||
// Set Headers
|
||||
if (authorization !== undefined && authorization !== null) {
|
||||
httpRequest.headers['Authorization'] = authorization;
|
||||
}
|
||||
if(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
httpRequest.body = null;
|
||||
httpRequest.headers['Content-Length'] = 0;
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 204 && statusCode !== 400 && statusCode !== 401 && statusCode !== 404 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 204) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = {
|
||||
required: false,
|
||||
serializedName: 'parsedResponse',
|
||||
type: {
|
||||
name: 'Object'
|
||||
}
|
||||
};
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @summary Get my following topic feed
|
||||
*
|
||||
* @param {string} authorization Authenication (must begin with string "Bearer
|
||||
* ")
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {string} [options.cursor] Current read cursor
|
||||
*
|
||||
* @param {number} [options.limit] Number of items to return
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {object} [result] - The deserialized result object.
|
||||
* See {@link FeedResponseTopicView} for more information.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
MyFollowing.prototype.getTopics = function (authorization, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
var cursor = (options && options.cursor !== undefined) ? options.cursor : undefined;
|
||||
var limit = (options && options.limit !== undefined) ? options.limit : undefined;
|
||||
// Validate
|
||||
try {
|
||||
if (cursor !== null && cursor !== undefined && typeof cursor.valueOf() !== 'string') {
|
||||
throw new Error('cursor must be of type string.');
|
||||
}
|
||||
if (limit !== null && limit !== undefined && typeof limit !== 'number') {
|
||||
throw new Error('limit must be of type number.');
|
||||
}
|
||||
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.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/users/me/following/topics';
|
||||
var queryParameters = [];
|
||||
if (cursor !== null && cursor !== undefined) {
|
||||
queryParameters.push('cursor=' + encodeURIComponent(cursor));
|
||||
}
|
||||
if (limit !== null && limit !== undefined) {
|
||||
queryParameters.push('limit=' + encodeURIComponent(limit.toString()));
|
||||
}
|
||||
if (queryParameters.length > 0) {
|
||||
requestUrl += '?' + queryParameters.join('&');
|
||||
}
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'GET';
|
||||
httpRequest.headers = {};
|
||||
httpRequest.url = requestUrl;
|
||||
// Set Headers
|
||||
if (authorization !== undefined && authorization !== null) {
|
||||
httpRequest.headers['Authorization'] = authorization;
|
||||
}
|
||||
if(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
httpRequest.body = null;
|
||||
httpRequest.headers['Content-Length'] = 0;
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 200 && statusCode !== 400 && statusCode !== 401 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 200) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = new client.models['FeedResponseTopicView']().mapper();
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @summary Get my following activity feed
|
||||
*
|
||||
* @param {string} authorization Authenication (must begin with string "Bearer
|
||||
* ")
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {string} [options.cursor] Current read cursor
|
||||
*
|
||||
* @param {number} [options.limit] Number of items to return
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {object} [result] - The deserialized result object.
|
||||
* See {@link FeedResponseActivityView} for more
|
||||
* information.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
MyFollowing.prototype.getActivities = function (authorization, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
var cursor = (options && options.cursor !== undefined) ? options.cursor : undefined;
|
||||
var limit = (options && options.limit !== undefined) ? options.limit : undefined;
|
||||
// Validate
|
||||
try {
|
||||
if (cursor !== null && cursor !== undefined && typeof cursor.valueOf() !== 'string') {
|
||||
throw new Error('cursor must be of type string.');
|
||||
}
|
||||
if (limit !== null && limit !== undefined && typeof limit !== 'number') {
|
||||
throw new Error('limit must be of type number.');
|
||||
}
|
||||
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.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/users/me/following/activities';
|
||||
var queryParameters = [];
|
||||
if (cursor !== null && cursor !== undefined) {
|
||||
queryParameters.push('cursor=' + encodeURIComponent(cursor));
|
||||
}
|
||||
if (limit !== null && limit !== undefined) {
|
||||
queryParameters.push('limit=' + encodeURIComponent(limit.toString()));
|
||||
}
|
||||
if (queryParameters.length > 0) {
|
||||
requestUrl += '?' + queryParameters.join('&');
|
||||
}
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'GET';
|
||||
httpRequest.headers = {};
|
||||
httpRequest.url = requestUrl;
|
||||
// Set Headers
|
||||
if (authorization !== undefined && authorization !== null) {
|
||||
httpRequest.headers['Authorization'] = authorization;
|
||||
}
|
||||
if(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
httpRequest.body = null;
|
||||
httpRequest.headers['Content-Length'] = 0;
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 200 && statusCode !== 400 && statusCode !== 401 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 200) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = new client.models['FeedResponseActivityView']().mapper();
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
module.exports = MyFollowing;
|
|
@ -0,0 +1,175 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var util = require('util');
|
||||
var msRest = require('ms-rest');
|
||||
var WebResource = msRest.WebResource;
|
||||
|
||||
/**
|
||||
* @class
|
||||
* MyLikes
|
||||
* __NOTE__: An instance of this class is automatically created for an
|
||||
* instance of the SocialPlusClient.
|
||||
* Initializes a new instance of the MyLikes class.
|
||||
* @constructor
|
||||
*
|
||||
* @param {SocialPlusClient} client Reference to the service client.
|
||||
*/
|
||||
function MyLikes(client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary Get my liked topics
|
||||
*
|
||||
* @param {string} authorization Authenication (must begin with string "Bearer
|
||||
* ")
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {string} [options.cursor] Current read cursor
|
||||
*
|
||||
* @param {number} [options.limit] Number of items to return
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {object} [result] - The deserialized result object.
|
||||
* See {@link FeedResponseTopicView} for more information.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
MyLikes.prototype.getLikedTopics = function (authorization, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
var cursor = (options && options.cursor !== undefined) ? options.cursor : undefined;
|
||||
var limit = (options && options.limit !== undefined) ? options.limit : undefined;
|
||||
// Validate
|
||||
try {
|
||||
if (cursor !== null && cursor !== undefined && typeof cursor.valueOf() !== 'string') {
|
||||
throw new Error('cursor must be of type string.');
|
||||
}
|
||||
if (limit !== null && limit !== undefined && typeof limit !== 'number') {
|
||||
throw new Error('limit must be of type number.');
|
||||
}
|
||||
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.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/users/me/likes/topics';
|
||||
var queryParameters = [];
|
||||
if (cursor !== null && cursor !== undefined) {
|
||||
queryParameters.push('cursor=' + encodeURIComponent(cursor));
|
||||
}
|
||||
if (limit !== null && limit !== undefined) {
|
||||
queryParameters.push('limit=' + encodeURIComponent(limit.toString()));
|
||||
}
|
||||
if (queryParameters.length > 0) {
|
||||
requestUrl += '?' + queryParameters.join('&');
|
||||
}
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'GET';
|
||||
httpRequest.headers = {};
|
||||
httpRequest.url = requestUrl;
|
||||
// Set Headers
|
||||
if (authorization !== undefined && authorization !== null) {
|
||||
httpRequest.headers['Authorization'] = authorization;
|
||||
}
|
||||
if(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
httpRequest.body = null;
|
||||
httpRequest.headers['Content-Length'] = 0;
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 200 && statusCode !== 400 && statusCode !== 401 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 200) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = new client.models['FeedResponseTopicView']().mapper();
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
module.exports = MyLikes;
|
|
@ -0,0 +1,459 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var util = require('util');
|
||||
var msRest = require('ms-rest');
|
||||
var WebResource = msRest.WebResource;
|
||||
|
||||
/**
|
||||
* @class
|
||||
* MyLinkedAccounts
|
||||
* __NOTE__: An instance of this class is automatically created for an
|
||||
* instance of the SocialPlusClient.
|
||||
* Initializes a new instance of the MyLinkedAccounts class.
|
||||
* @constructor
|
||||
*
|
||||
* @param {SocialPlusClient} client Reference to the service client.
|
||||
*/
|
||||
function MyLinkedAccounts(client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary Get linked accounts
|
||||
*
|
||||
* @param {string} authorization Authenication (must begin with string "Bearer
|
||||
* ")
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {array} [result] - The deserialized result object.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
MyLinkedAccounts.prototype.getLinkedAccounts = function (authorization, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
// Validate
|
||||
try {
|
||||
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.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/users/me/linked_accounts';
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'GET';
|
||||
httpRequest.headers = {};
|
||||
httpRequest.url = requestUrl;
|
||||
// Set Headers
|
||||
if (authorization !== undefined && authorization !== null) {
|
||||
httpRequest.headers['Authorization'] = authorization;
|
||||
}
|
||||
if(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
httpRequest.body = null;
|
||||
httpRequest.headers['Content-Length'] = 0;
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 200 && statusCode !== 400 && statusCode !== 401 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 200) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = {
|
||||
required: false,
|
||||
serializedName: 'parsedResponse',
|
||||
type: {
|
||||
name: 'Sequence',
|
||||
element: {
|
||||
required: false,
|
||||
serializedName: 'LinkedAccountViewElementType',
|
||||
type: {
|
||||
name: 'Composite',
|
||||
className: 'LinkedAccountView'
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @summary Create a new linked account
|
||||
*
|
||||
* @param {object} request Post linked account request
|
||||
*
|
||||
* @param {string} [request.identityProvider] Gets or sets identity provider
|
||||
* type. Possible values for this property include: 'Facebook', 'Microsoft',
|
||||
* 'Google', 'Twitter'.
|
||||
*
|
||||
* @param {string} [request.accessToken] Gets or sets access or authentication
|
||||
* token, user code, or verifier obtained from third-party provider.
|
||||
* The server contacts the third-party provider to use the token
|
||||
* (or user code, or verifier) for discover the user's identity.
|
||||
*
|
||||
* @param {string} [request.requestToken] Gets or sets request token obtained
|
||||
* from third-party provider.
|
||||
* Some providers do not issue authentication or access tokens,
|
||||
* but they issue request tokens
|
||||
* and verifiers.
|
||||
*
|
||||
* @param {string} authorization Authenication (must begin with string "Bearer
|
||||
* ")
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {object} [result] - The deserialized result object.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
MyLinkedAccounts.prototype.postLinkedAccount = function (request, authorization, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
// Validate
|
||||
try {
|
||||
if (request === null || request === undefined) {
|
||||
throw new Error('request cannot be null or undefined.');
|
||||
}
|
||||
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.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/users/me/linked_accounts';
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'POST';
|
||||
httpRequest.headers = {};
|
||||
httpRequest.url = requestUrl;
|
||||
// Set Headers
|
||||
if (authorization !== undefined && authorization !== null) {
|
||||
httpRequest.headers['Authorization'] = authorization;
|
||||
}
|
||||
if(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
// Serialize Request
|
||||
var requestContent = null;
|
||||
var requestModel = null;
|
||||
try {
|
||||
if (request !== null && request !== undefined) {
|
||||
var requestModelMapper = new client.models['PostLinkedAccountRequest']().mapper();
|
||||
requestModel = client.serialize(requestModelMapper, request, 'request');
|
||||
}
|
||||
requestContent = JSON.stringify(requestModel);
|
||||
} catch (error) {
|
||||
var serializationError = new Error(util.format('Error "%s" occurred in serializing the ' +
|
||||
'payload - "%s"', error.message, util.inspect(request, {depth: null})));
|
||||
return callback(serializationError);
|
||||
}
|
||||
httpRequest.body = requestContent;
|
||||
httpRequest.headers['Content-Length'] = Buffer.isBuffer(requestContent) ?
|
||||
requestContent.length :
|
||||
Buffer.byteLength(requestContent, 'UTF8');
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 204 && statusCode !== 400 && statusCode !== 401 && statusCode !== 409 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 204) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = {
|
||||
required: false,
|
||||
serializedName: 'parsedResponse',
|
||||
type: {
|
||||
name: 'Object'
|
||||
}
|
||||
};
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @summary Delete linked account
|
||||
*
|
||||
* @param {string} identityProvider Identity provider type. Possible values
|
||||
* for this parameter include: 'Facebook', 'Microsoft', 'Google', 'Twitter'
|
||||
*
|
||||
* @param {string} authorization Authenication (must begin with string "Bearer
|
||||
* ")
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {object} [result] - The deserialized result object.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
MyLinkedAccounts.prototype.deleteLinkedAccount = function (identityProvider, authorization, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
// Validate
|
||||
try {
|
||||
if (identityProvider === null || identityProvider === undefined || typeof identityProvider.valueOf() !== 'string') {
|
||||
throw new Error('identityProvider cannot be null or undefined and it 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.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/users/me/linked_accounts/{identityProvider}';
|
||||
requestUrl = requestUrl.replace('{identityProvider}', encodeURIComponent(identityProvider));
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'DELETE';
|
||||
httpRequest.headers = {};
|
||||
httpRequest.url = requestUrl;
|
||||
// Set Headers
|
||||
if (authorization !== undefined && authorization !== null) {
|
||||
httpRequest.headers['Authorization'] = authorization;
|
||||
}
|
||||
if(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
httpRequest.body = null;
|
||||
httpRequest.headers['Content-Length'] = 0;
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 204 && statusCode !== 400 && statusCode !== 401 && statusCode !== 403 && statusCode !== 404 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 204) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = {
|
||||
required: false,
|
||||
serializedName: 'parsedResponse',
|
||||
type: {
|
||||
name: 'Object'
|
||||
}
|
||||
};
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
module.exports = MyLinkedAccounts;
|
|
@ -0,0 +1,445 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var util = require('util');
|
||||
var msRest = require('ms-rest');
|
||||
var WebResource = msRest.WebResource;
|
||||
|
||||
/**
|
||||
* @class
|
||||
* MyNotifications
|
||||
* __NOTE__: An instance of this class is automatically created for an
|
||||
* instance of the SocialPlusClient.
|
||||
* Initializes a new instance of the MyNotifications class.
|
||||
* @constructor
|
||||
*
|
||||
* @param {SocialPlusClient} client Reference to the service client.
|
||||
*/
|
||||
function MyNotifications(client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary Update notifications status
|
||||
*
|
||||
* @param {object} request Put notifications status request
|
||||
*
|
||||
* @param {string} [request.readActivityHandle] Gets or sets last read
|
||||
* activity handle
|
||||
*
|
||||
* @param {string} authorization Authenication (must begin with string "Bearer
|
||||
* ")
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {object} [result] - The deserialized result object.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
MyNotifications.prototype.putNotificationsStatus = function (request, authorization, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
// Validate
|
||||
try {
|
||||
if (request === null || request === undefined) {
|
||||
throw new Error('request cannot be null or undefined.');
|
||||
}
|
||||
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.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/users/me/notifications/status';
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'PUT';
|
||||
httpRequest.headers = {};
|
||||
httpRequest.url = requestUrl;
|
||||
// Set Headers
|
||||
if (authorization !== undefined && authorization !== null) {
|
||||
httpRequest.headers['Authorization'] = authorization;
|
||||
}
|
||||
if(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
// Serialize Request
|
||||
var requestContent = null;
|
||||
var requestModel = null;
|
||||
try {
|
||||
if (request !== null && request !== undefined) {
|
||||
var requestModelMapper = new client.models['PutNotificationsStatusRequest']().mapper();
|
||||
requestModel = client.serialize(requestModelMapper, request, 'request');
|
||||
}
|
||||
requestContent = JSON.stringify(requestModel);
|
||||
} catch (error) {
|
||||
var serializationError = new Error(util.format('Error "%s" occurred in serializing the ' +
|
||||
'payload - "%s"', error.message, util.inspect(request, {depth: null})));
|
||||
return callback(serializationError);
|
||||
}
|
||||
httpRequest.body = requestContent;
|
||||
httpRequest.headers['Content-Length'] = Buffer.isBuffer(requestContent) ?
|
||||
requestContent.length :
|
||||
Buffer.byteLength(requestContent, 'UTF8');
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 204 && statusCode !== 400 && statusCode !== 401 && statusCode !== 409 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 204) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = {
|
||||
required: false,
|
||||
serializedName: 'parsedResponse',
|
||||
type: {
|
||||
name: 'Object'
|
||||
}
|
||||
};
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @summary Get notifications
|
||||
*
|
||||
* @param {string} authorization Authenication (must begin with string "Bearer
|
||||
* ")
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {string} [options.cursor] Current read cursor
|
||||
*
|
||||
* @param {number} [options.limit] Number of items to return
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {object} [result] - The deserialized result object.
|
||||
* See {@link FeedResponseActivityView} for more
|
||||
* information.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
MyNotifications.prototype.getNotifications = function (authorization, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
var cursor = (options && options.cursor !== undefined) ? options.cursor : undefined;
|
||||
var limit = (options && options.limit !== undefined) ? options.limit : undefined;
|
||||
// Validate
|
||||
try {
|
||||
if (cursor !== null && cursor !== undefined && typeof cursor.valueOf() !== 'string') {
|
||||
throw new Error('cursor must be of type string.');
|
||||
}
|
||||
if (limit !== null && limit !== undefined && typeof limit !== 'number') {
|
||||
throw new Error('limit must be of type number.');
|
||||
}
|
||||
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.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/users/me/notifications';
|
||||
var queryParameters = [];
|
||||
if (cursor !== null && cursor !== undefined) {
|
||||
queryParameters.push('cursor=' + encodeURIComponent(cursor));
|
||||
}
|
||||
if (limit !== null && limit !== undefined) {
|
||||
queryParameters.push('limit=' + encodeURIComponent(limit.toString()));
|
||||
}
|
||||
if (queryParameters.length > 0) {
|
||||
requestUrl += '?' + queryParameters.join('&');
|
||||
}
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'GET';
|
||||
httpRequest.headers = {};
|
||||
httpRequest.url = requestUrl;
|
||||
// Set Headers
|
||||
if (authorization !== undefined && authorization !== null) {
|
||||
httpRequest.headers['Authorization'] = authorization;
|
||||
}
|
||||
if(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
httpRequest.body = null;
|
||||
httpRequest.headers['Content-Length'] = 0;
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 200 && statusCode !== 400 && statusCode !== 401 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 200) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = new client.models['FeedResponseActivityView']().mapper();
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @summary Get unread notifications count
|
||||
*
|
||||
* @param {string} authorization Authenication (must begin with string "Bearer
|
||||
* ")
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {object} [result] - The deserialized result object.
|
||||
* See {@link CountResponse} for more information.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
MyNotifications.prototype.getNotificationsCount = function (authorization, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
// Validate
|
||||
try {
|
||||
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.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/users/me/notifications/count';
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'GET';
|
||||
httpRequest.headers = {};
|
||||
httpRequest.url = requestUrl;
|
||||
// Set Headers
|
||||
if (authorization !== undefined && authorization !== null) {
|
||||
httpRequest.headers['Authorization'] = authorization;
|
||||
}
|
||||
if(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
httpRequest.body = null;
|
||||
httpRequest.headers['Content-Length'] = 0;
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 200 && statusCode !== 400 && statusCode !== 401 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 200) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = new client.models['CountResponse']().mapper();
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
module.exports = MyNotifications;
|
|
@ -0,0 +1,427 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var util = require('util');
|
||||
var msRest = require('ms-rest');
|
||||
var WebResource = msRest.WebResource;
|
||||
|
||||
/**
|
||||
* @class
|
||||
* MyPendingUsers
|
||||
* __NOTE__: An instance of this class is automatically created for an
|
||||
* instance of the SocialPlusClient.
|
||||
* Initializes a new instance of the MyPendingUsers class.
|
||||
* @constructor
|
||||
*
|
||||
* @param {SocialPlusClient} client Reference to the service client.
|
||||
*/
|
||||
function MyPendingUsers(client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary Reject follower request
|
||||
*
|
||||
* @param {string} userHandle User handle
|
||||
*
|
||||
* @param {string} authorization Authenication (must begin with string "Bearer
|
||||
* ")
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {object} [result] - The deserialized result object.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
MyPendingUsers.prototype.deletePendingUser = function (userHandle, authorization, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
// 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 (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
|
||||
throw new Error('authorization cannot be null or undefined and it must be of type string.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/users/me/pending_users/{userHandle}';
|
||||
requestUrl = requestUrl.replace('{userHandle}', encodeURIComponent(userHandle));
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'DELETE';
|
||||
httpRequest.headers = {};
|
||||
httpRequest.url = requestUrl;
|
||||
// Set Headers
|
||||
if (authorization !== undefined && authorization !== null) {
|
||||
httpRequest.headers['Authorization'] = authorization;
|
||||
}
|
||||
if(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
httpRequest.body = null;
|
||||
httpRequest.headers['Content-Length'] = 0;
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 204 && statusCode !== 400 && statusCode !== 401 && statusCode !== 404 && statusCode !== 409 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 204) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = {
|
||||
required: false,
|
||||
serializedName: 'parsedResponse',
|
||||
type: {
|
||||
name: 'Object'
|
||||
}
|
||||
};
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @summary Get my pending users
|
||||
*
|
||||
* @param {string} authorization Authenication (must begin with string "Bearer
|
||||
* ")
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {string} [options.cursor] Current read cursor
|
||||
*
|
||||
* @param {number} [options.limit] Number of items to return
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {object} [result] - The deserialized result object.
|
||||
* See {@link FeedResponseUserCompactView} for more
|
||||
* information.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
MyPendingUsers.prototype.getPendingUsers = function (authorization, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
var cursor = (options && options.cursor !== undefined) ? options.cursor : undefined;
|
||||
var limit = (options && options.limit !== undefined) ? options.limit : undefined;
|
||||
// Validate
|
||||
try {
|
||||
if (cursor !== null && cursor !== undefined && typeof cursor.valueOf() !== 'string') {
|
||||
throw new Error('cursor must be of type string.');
|
||||
}
|
||||
if (limit !== null && limit !== undefined && typeof limit !== 'number') {
|
||||
throw new Error('limit must be of type number.');
|
||||
}
|
||||
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.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/users/me/pending_users';
|
||||
var queryParameters = [];
|
||||
if (cursor !== null && cursor !== undefined) {
|
||||
queryParameters.push('cursor=' + encodeURIComponent(cursor));
|
||||
}
|
||||
if (limit !== null && limit !== undefined) {
|
||||
queryParameters.push('limit=' + encodeURIComponent(limit.toString()));
|
||||
}
|
||||
if (queryParameters.length > 0) {
|
||||
requestUrl += '?' + queryParameters.join('&');
|
||||
}
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'GET';
|
||||
httpRequest.headers = {};
|
||||
httpRequest.url = requestUrl;
|
||||
// Set Headers
|
||||
if (authorization !== undefined && authorization !== null) {
|
||||
httpRequest.headers['Authorization'] = authorization;
|
||||
}
|
||||
if(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
httpRequest.body = null;
|
||||
httpRequest.headers['Content-Length'] = 0;
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 200 && statusCode !== 400 && statusCode !== 401 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 200) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = new client.models['FeedResponseUserCompactView']().mapper();
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @summary Get my pending users count
|
||||
*
|
||||
* @param {string} authorization Authenication (must begin with string "Bearer
|
||||
* ")
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {object} [result] - The deserialized result object.
|
||||
* See {@link CountResponse} for more information.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
MyPendingUsers.prototype.getPendingUsersCount = function (authorization, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
// Validate
|
||||
try {
|
||||
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.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/users/me/pending_users/count';
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'GET';
|
||||
httpRequest.headers = {};
|
||||
httpRequest.url = requestUrl;
|
||||
// Set Headers
|
||||
if (authorization !== undefined && authorization !== null) {
|
||||
httpRequest.headers['Authorization'] = authorization;
|
||||
}
|
||||
if(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
httpRequest.body = null;
|
||||
httpRequest.headers['Content-Length'] = 0;
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 200 && statusCode !== 400 && statusCode !== 401 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 200) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = new client.models['CountResponse']().mapper();
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
module.exports = MyPendingUsers;
|
|
@ -0,0 +1,454 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var util = require('util');
|
||||
var msRest = require('ms-rest');
|
||||
var WebResource = msRest.WebResource;
|
||||
|
||||
/**
|
||||
* @class
|
||||
* MyPins
|
||||
* __NOTE__: An instance of this class is automatically created for an
|
||||
* instance of the SocialPlusClient.
|
||||
* Initializes a new instance of the MyPins class.
|
||||
* @constructor
|
||||
*
|
||||
* @param {SocialPlusClient} client Reference to the service client.
|
||||
*/
|
||||
function MyPins(client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary Get my pins
|
||||
*
|
||||
* @param {string} authorization Authenication (must begin with string "Bearer
|
||||
* ")
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {string} [options.cursor] Current read cursor
|
||||
*
|
||||
* @param {number} [options.limit] Number of items to return
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {object} [result] - The deserialized result object.
|
||||
* See {@link FeedResponseTopicView} for more information.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
MyPins.prototype.getPins = function (authorization, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
var cursor = (options && options.cursor !== undefined) ? options.cursor : undefined;
|
||||
var limit = (options && options.limit !== undefined) ? options.limit : undefined;
|
||||
// Validate
|
||||
try {
|
||||
if (cursor !== null && cursor !== undefined && typeof cursor.valueOf() !== 'string') {
|
||||
throw new Error('cursor must be of type string.');
|
||||
}
|
||||
if (limit !== null && limit !== undefined && typeof limit !== 'number') {
|
||||
throw new Error('limit must be of type number.');
|
||||
}
|
||||
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.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/users/me/pins';
|
||||
var queryParameters = [];
|
||||
if (cursor !== null && cursor !== undefined) {
|
||||
queryParameters.push('cursor=' + encodeURIComponent(cursor));
|
||||
}
|
||||
if (limit !== null && limit !== undefined) {
|
||||
queryParameters.push('limit=' + encodeURIComponent(limit.toString()));
|
||||
}
|
||||
if (queryParameters.length > 0) {
|
||||
requestUrl += '?' + queryParameters.join('&');
|
||||
}
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'GET';
|
||||
httpRequest.headers = {};
|
||||
httpRequest.url = requestUrl;
|
||||
// Set Headers
|
||||
if (authorization !== undefined && authorization !== null) {
|
||||
httpRequest.headers['Authorization'] = authorization;
|
||||
}
|
||||
if(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
httpRequest.body = null;
|
||||
httpRequest.headers['Content-Length'] = 0;
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 200 && statusCode !== 400 && statusCode !== 401 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 200) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = new client.models['FeedResponseTopicView']().mapper();
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @summary Pin a topic
|
||||
*
|
||||
* @param {object} request Post pin request
|
||||
*
|
||||
* @param {string} [request.topicHandle] Gets or sets topic handle
|
||||
*
|
||||
* @param {string} authorization Authenication (must begin with string "Bearer
|
||||
* ")
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {object} [result] - The deserialized result object.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
MyPins.prototype.postPin = function (request, authorization, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
// Validate
|
||||
try {
|
||||
if (request === null || request === undefined) {
|
||||
throw new Error('request cannot be null or undefined.');
|
||||
}
|
||||
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.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/users/me/pins';
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'POST';
|
||||
httpRequest.headers = {};
|
||||
httpRequest.url = requestUrl;
|
||||
// Set Headers
|
||||
if (authorization !== undefined && authorization !== null) {
|
||||
httpRequest.headers['Authorization'] = authorization;
|
||||
}
|
||||
if(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
// Serialize Request
|
||||
var requestContent = null;
|
||||
var requestModel = null;
|
||||
try {
|
||||
if (request !== null && request !== undefined) {
|
||||
var requestModelMapper = new client.models['PostPinRequest']().mapper();
|
||||
requestModel = client.serialize(requestModelMapper, request, 'request');
|
||||
}
|
||||
requestContent = JSON.stringify(requestModel);
|
||||
} catch (error) {
|
||||
var serializationError = new Error(util.format('Error "%s" occurred in serializing the ' +
|
||||
'payload - "%s"', error.message, util.inspect(request, {depth: null})));
|
||||
return callback(serializationError);
|
||||
}
|
||||
httpRequest.body = requestContent;
|
||||
httpRequest.headers['Content-Length'] = Buffer.isBuffer(requestContent) ?
|
||||
requestContent.length :
|
||||
Buffer.byteLength(requestContent, 'UTF8');
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 204 && statusCode !== 400 && statusCode !== 401 && statusCode !== 404 && statusCode !== 409 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 204) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = {
|
||||
required: false,
|
||||
serializedName: 'parsedResponse',
|
||||
type: {
|
||||
name: 'Object'
|
||||
}
|
||||
};
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @summary Unpin a topic
|
||||
*
|
||||
* @param {string} topicHandle Topic handle
|
||||
*
|
||||
* @param {string} authorization Authenication (must begin with string "Bearer
|
||||
* ")
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {object} [result] - The deserialized result object.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
MyPins.prototype.deletePin = function (topicHandle, authorization, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
// 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 (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
|
||||
throw new Error('authorization cannot be null or undefined and it must be of type string.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/users/me/pins/{topicHandle}';
|
||||
requestUrl = requestUrl.replace('{topicHandle}', encodeURIComponent(topicHandle));
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'DELETE';
|
||||
httpRequest.headers = {};
|
||||
httpRequest.url = requestUrl;
|
||||
// Set Headers
|
||||
if (authorization !== undefined && authorization !== null) {
|
||||
httpRequest.headers['Authorization'] = authorization;
|
||||
}
|
||||
if(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
httpRequest.body = null;
|
||||
httpRequest.headers['Content-Length'] = 0;
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 204 && statusCode !== 400 && statusCode !== 401 && statusCode !== 404 && statusCode !== 409 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 204) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = {
|
||||
required: false,
|
||||
serializedName: 'parsedResponse',
|
||||
type: {
|
||||
name: 'Object'
|
||||
}
|
||||
};
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
module.exports = MyPins;
|
|
@ -0,0 +1,345 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var util = require('util');
|
||||
var msRest = require('ms-rest');
|
||||
var WebResource = msRest.WebResource;
|
||||
|
||||
/**
|
||||
* @class
|
||||
* MyPushRegistrations
|
||||
* __NOTE__: An instance of this class is automatically created for an
|
||||
* instance of the SocialPlusClient.
|
||||
* Initializes a new instance of the MyPushRegistrations class.
|
||||
* @constructor
|
||||
*
|
||||
* @param {SocialPlusClient} client Reference to the service client.
|
||||
*/
|
||||
function MyPushRegistrations(client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary Register for push notifications or update existing registration
|
||||
*
|
||||
* @param {string} platform Platform type. Possible values for this parameter
|
||||
* include: 'Windows', 'Android', 'IOS'
|
||||
*
|
||||
* @param {string} registrationId Unique registration id provided by the
|
||||
* mobile OS.
|
||||
* For Android, this is the GCM registration ID.
|
||||
* For Windows, this is the PushNotificationChannel URI.
|
||||
* For iOS, this is the device token.
|
||||
*
|
||||
* @param {object} request Put push registration request
|
||||
*
|
||||
* @param {date} [request.lastUpdatedTime] Gets or sets last updated time from
|
||||
* the OS
|
||||
* This is used to expire out registrations that have not been
|
||||
* updated every 30 days.
|
||||
*
|
||||
* @param {string} [request.language] Gets or sets language of the user
|
||||
*
|
||||
* @param {string} authorization Authenication (must begin with string "Bearer
|
||||
* ")
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {object} [result] - The deserialized result object.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
MyPushRegistrations.prototype.putPushRegistration = function (platform, registrationId, request, authorization, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
// Validate
|
||||
try {
|
||||
if (platform === null || platform === undefined || typeof platform.valueOf() !== 'string') {
|
||||
throw new Error('platform cannot be null or undefined and it must be of type string.');
|
||||
}
|
||||
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 (request === null || request === undefined) {
|
||||
throw new Error('request cannot be null or undefined.');
|
||||
}
|
||||
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.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/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
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'PUT';
|
||||
httpRequest.headers = {};
|
||||
httpRequest.url = requestUrl;
|
||||
// Set Headers
|
||||
if (authorization !== undefined && authorization !== null) {
|
||||
httpRequest.headers['Authorization'] = authorization;
|
||||
}
|
||||
if(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
// Serialize Request
|
||||
var requestContent = null;
|
||||
var requestModel = null;
|
||||
try {
|
||||
if (request !== null && request !== undefined) {
|
||||
var requestModelMapper = new client.models['PutPushRegistrationRequest']().mapper();
|
||||
requestModel = client.serialize(requestModelMapper, request, 'request');
|
||||
}
|
||||
requestContent = JSON.stringify(requestModel);
|
||||
} catch (error) {
|
||||
var serializationError = new Error(util.format('Error "%s" occurred in serializing the ' +
|
||||
'payload - "%s"', error.message, util.inspect(request, {depth: null})));
|
||||
return callback(serializationError);
|
||||
}
|
||||
httpRequest.body = requestContent;
|
||||
httpRequest.headers['Content-Length'] = Buffer.isBuffer(requestContent) ?
|
||||
requestContent.length :
|
||||
Buffer.byteLength(requestContent, 'UTF8');
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 204 && statusCode !== 401 && statusCode !== 409 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 204) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = {
|
||||
required: false,
|
||||
serializedName: 'parsedResponse',
|
||||
type: {
|
||||
name: 'Object'
|
||||
}
|
||||
};
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @summary Unregister from push notifications
|
||||
*
|
||||
* @param {string} platform Platform type. Possible values for this parameter
|
||||
* include: 'Windows', 'Android', 'IOS'
|
||||
*
|
||||
* @param {string} registrationId Unique registration id provided by the
|
||||
* mobile OS.
|
||||
* 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 {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {object} [result] - The deserialized result object.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
MyPushRegistrations.prototype.deletePushRegistration = function (platform, registrationId, authorization, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
// Validate
|
||||
try {
|
||||
if (platform === null || platform === undefined || typeof platform.valueOf() !== 'string') {
|
||||
throw new Error('platform cannot be null or undefined and it must be of type string.');
|
||||
}
|
||||
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 (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
|
||||
throw new Error('authorization cannot be null or undefined and it 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}';
|
||||
requestUrl = requestUrl.replace('{platform}', encodeURIComponent(platform));
|
||||
requestUrl = requestUrl.replace('{registrationId}', encodeURIComponent(registrationId));
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'DELETE';
|
||||
httpRequest.headers = {};
|
||||
httpRequest.url = requestUrl;
|
||||
// Set Headers
|
||||
if (authorization !== undefined && authorization !== null) {
|
||||
httpRequest.headers['Authorization'] = authorization;
|
||||
}
|
||||
if(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
httpRequest.body = null;
|
||||
httpRequest.headers['Content-Length'] = 0;
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 204 && statusCode !== 401 && statusCode !== 404 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 204) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = {
|
||||
required: false,
|
||||
serializedName: 'parsedResponse',
|
||||
type: {
|
||||
name: 'Object'
|
||||
}
|
||||
};
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
module.exports = MyPushRegistrations;
|
|
@ -0,0 +1,317 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var util = require('util');
|
||||
var msRest = require('ms-rest');
|
||||
var WebResource = msRest.WebResource;
|
||||
|
||||
/**
|
||||
* @class
|
||||
* MyTopics
|
||||
* __NOTE__: An instance of this class is automatically created for an
|
||||
* instance of the SocialPlusClient.
|
||||
* Initializes a new instance of the MyTopics class.
|
||||
* @constructor
|
||||
*
|
||||
* @param {SocialPlusClient} client Reference to the service client.
|
||||
*/
|
||||
function MyTopics(client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary Get my topics sorted by creation time
|
||||
*
|
||||
* @param {string} authorization Authenication (must begin with string "Bearer
|
||||
* ")
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {string} [options.cursor] Current read cursor
|
||||
*
|
||||
* @param {number} [options.limit] Number of items to return
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {object} [result] - The deserialized result object.
|
||||
* See {@link FeedResponseTopicView} for more information.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
MyTopics.prototype.getTopics = function (authorization, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
var cursor = (options && options.cursor !== undefined) ? options.cursor : undefined;
|
||||
var limit = (options && options.limit !== undefined) ? options.limit : undefined;
|
||||
// Validate
|
||||
try {
|
||||
if (cursor !== null && cursor !== undefined && typeof cursor.valueOf() !== 'string') {
|
||||
throw new Error('cursor must be of type string.');
|
||||
}
|
||||
if (limit !== null && limit !== undefined && typeof limit !== 'number') {
|
||||
throw new Error('limit must be of type number.');
|
||||
}
|
||||
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.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/users/me/topics';
|
||||
var queryParameters = [];
|
||||
if (cursor !== null && cursor !== undefined) {
|
||||
queryParameters.push('cursor=' + encodeURIComponent(cursor));
|
||||
}
|
||||
if (limit !== null && limit !== undefined) {
|
||||
queryParameters.push('limit=' + encodeURIComponent(limit.toString()));
|
||||
}
|
||||
if (queryParameters.length > 0) {
|
||||
requestUrl += '?' + queryParameters.join('&');
|
||||
}
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'GET';
|
||||
httpRequest.headers = {};
|
||||
httpRequest.url = requestUrl;
|
||||
// Set Headers
|
||||
if (authorization !== undefined && authorization !== null) {
|
||||
httpRequest.headers['Authorization'] = authorization;
|
||||
}
|
||||
if(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
httpRequest.body = null;
|
||||
httpRequest.headers['Content-Length'] = 0;
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 200 && statusCode !== 400 && statusCode !== 401 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 200) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = new client.models['FeedResponseTopicView']().mapper();
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @summary Get my topics sorted by popularity
|
||||
*
|
||||
* @param {string} authorization Authenication (must begin with string "Bearer
|
||||
* ")
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {number} [options.cursor] Current read cursor
|
||||
*
|
||||
* @param {number} [options.limit] Number of items to return
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {object} [result] - The deserialized result object.
|
||||
* See {@link FeedResponseTopicView} for more information.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
MyTopics.prototype.getPopularTopics = function (authorization, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
var cursor = (options && options.cursor !== undefined) ? options.cursor : undefined;
|
||||
var limit = (options && options.limit !== undefined) ? options.limit : undefined;
|
||||
// Validate
|
||||
try {
|
||||
if (cursor !== null && cursor !== undefined && typeof cursor !== 'number') {
|
||||
throw new Error('cursor must be of type number.');
|
||||
}
|
||||
if (limit !== null && limit !== undefined && typeof limit !== 'number') {
|
||||
throw new Error('limit must be of type number.');
|
||||
}
|
||||
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.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/users/me/topics/popular';
|
||||
var queryParameters = [];
|
||||
if (cursor !== null && cursor !== undefined) {
|
||||
queryParameters.push('cursor=' + encodeURIComponent(cursor.toString()));
|
||||
}
|
||||
if (limit !== null && limit !== undefined) {
|
||||
queryParameters.push('limit=' + encodeURIComponent(limit.toString()));
|
||||
}
|
||||
if (queryParameters.length > 0) {
|
||||
requestUrl += '?' + queryParameters.join('&');
|
||||
}
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'GET';
|
||||
httpRequest.headers = {};
|
||||
httpRequest.url = requestUrl;
|
||||
// Set Headers
|
||||
if (authorization !== undefined && authorization !== null) {
|
||||
httpRequest.headers['Authorization'] = authorization;
|
||||
}
|
||||
if(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
httpRequest.body = null;
|
||||
httpRequest.headers['Content-Length'] = 0;
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 200 && statusCode !== 400 && statusCode !== 401 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 200) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = new client.models['FeedResponseTopicView']().mapper();
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
module.exports = MyTopics;
|
|
@ -0,0 +1,290 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var util = require('util');
|
||||
var msRest = require('ms-rest');
|
||||
var WebResource = msRest.WebResource;
|
||||
|
||||
/**
|
||||
* @class
|
||||
* Replies
|
||||
* __NOTE__: An instance of this class is automatically created for an
|
||||
* instance of the SocialPlusClient.
|
||||
* Initializes a new instance of the Replies class.
|
||||
* @constructor
|
||||
*
|
||||
* @param {SocialPlusClient} client Reference to the service client.
|
||||
*/
|
||||
function Replies(client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary Get reply
|
||||
*
|
||||
* @param {string} replyHandle Reply handle
|
||||
*
|
||||
* @param {string} authorization Authenication (must begin with string "Bearer
|
||||
* ")
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {object} [result] - The deserialized result object.
|
||||
* See {@link ReplyView} for more information.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
Replies.prototype.getReply = function (replyHandle, authorization, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
// 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 (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
|
||||
throw new Error('authorization cannot be null or undefined and it must be of type string.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/replies/{replyHandle}';
|
||||
requestUrl = requestUrl.replace('{replyHandle}', encodeURIComponent(replyHandle));
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'GET';
|
||||
httpRequest.headers = {};
|
||||
httpRequest.url = requestUrl;
|
||||
// Set Headers
|
||||
if (authorization !== undefined && authorization !== null) {
|
||||
httpRequest.headers['Authorization'] = authorization;
|
||||
}
|
||||
if(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
httpRequest.body = null;
|
||||
httpRequest.headers['Content-Length'] = 0;
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 200 && statusCode !== 400 && statusCode !== 401 && statusCode !== 404 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 200) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = new client.models['ReplyView']().mapper();
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @summary Delete reply
|
||||
*
|
||||
* @param {string} replyHandle Reply handle
|
||||
*
|
||||
* @param {string} authorization Authenication (must begin with string "Bearer
|
||||
* ")
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {object} [result] - The deserialized result object.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
Replies.prototype.deleteReply = function (replyHandle, authorization, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
// 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 (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
|
||||
throw new Error('authorization cannot be null or undefined and it must be of type string.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/replies/{replyHandle}';
|
||||
requestUrl = requestUrl.replace('{replyHandle}', encodeURIComponent(replyHandle));
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'DELETE';
|
||||
httpRequest.headers = {};
|
||||
httpRequest.url = requestUrl;
|
||||
// Set Headers
|
||||
if (authorization !== undefined && authorization !== null) {
|
||||
httpRequest.headers['Authorization'] = authorization;
|
||||
}
|
||||
if(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
httpRequest.body = null;
|
||||
httpRequest.headers['Content-Length'] = 0;
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 204 && statusCode !== 400 && statusCode !== 401 && statusCode !== 404 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 204) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = {
|
||||
required: false,
|
||||
serializedName: 'parsedResponse',
|
||||
type: {
|
||||
name: 'Object'
|
||||
}
|
||||
};
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
module.exports = Replies;
|
|
@ -0,0 +1,454 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var util = require('util');
|
||||
var msRest = require('ms-rest');
|
||||
var WebResource = msRest.WebResource;
|
||||
|
||||
/**
|
||||
* @class
|
||||
* ReplyLikes
|
||||
* __NOTE__: An instance of this class is automatically created for an
|
||||
* instance of the SocialPlusClient.
|
||||
* Initializes a new instance of the ReplyLikes class.
|
||||
* @constructor
|
||||
*
|
||||
* @param {SocialPlusClient} client Reference to the service client.
|
||||
*/
|
||||
function ReplyLikes(client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary Get likes for reply
|
||||
*
|
||||
* @param {string} replyHandle Reply handle
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {string} [options.cursor] Current read cursor
|
||||
*
|
||||
* @param {number} [options.limit] Number of items to return
|
||||
*
|
||||
* @param {string} [options.appkey] App Key Authentication
|
||||
*
|
||||
* @param {string} [options.authorization] Authenication (must begin with
|
||||
* string "Bearer ")
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {object} [result] - The deserialized result object.
|
||||
* See {@link FeedResponseUserCompactView} for more
|
||||
* information.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
ReplyLikes.prototype.getLikes = function (replyHandle, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
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 authorization = (options && options.authorization !== undefined) ? options.authorization : 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 (cursor !== null && cursor !== undefined && typeof cursor.valueOf() !== 'string') {
|
||||
throw new Error('cursor must be of type string.');
|
||||
}
|
||||
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 must be of type string.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/replies/{replyHandle}/likes';
|
||||
requestUrl = requestUrl.replace('{replyHandle}', encodeURIComponent(replyHandle));
|
||||
var queryParameters = [];
|
||||
if (cursor !== null && cursor !== undefined) {
|
||||
queryParameters.push('cursor=' + encodeURIComponent(cursor));
|
||||
}
|
||||
if (limit !== null && limit !== undefined) {
|
||||
queryParameters.push('limit=' + encodeURIComponent(limit.toString()));
|
||||
}
|
||||
if (queryParameters.length > 0) {
|
||||
requestUrl += '?' + queryParameters.join('&');
|
||||
}
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'GET';
|
||||
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(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
httpRequest.body = null;
|
||||
httpRequest.headers['Content-Length'] = 0;
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 200 && statusCode !== 400 && statusCode !== 401 && statusCode !== 404 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 200) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = new client.models['FeedResponseUserCompactView']().mapper();
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @summary Add like to reply
|
||||
*
|
||||
* @param {string} replyHandle Reply handle
|
||||
*
|
||||
* @param {string} authorization Authenication (must begin with string "Bearer
|
||||
* ")
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {object} [result] - The deserialized result object.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
ReplyLikes.prototype.postLike = function (replyHandle, authorization, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
// 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 (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
|
||||
throw new Error('authorization cannot be null or undefined and it must be of type string.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/replies/{replyHandle}/likes';
|
||||
requestUrl = requestUrl.replace('{replyHandle}', encodeURIComponent(replyHandle));
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'POST';
|
||||
httpRequest.headers = {};
|
||||
httpRequest.url = requestUrl;
|
||||
// Set Headers
|
||||
if (authorization !== undefined && authorization !== null) {
|
||||
httpRequest.headers['Authorization'] = authorization;
|
||||
}
|
||||
if(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
httpRequest.body = null;
|
||||
httpRequest.headers['Content-Length'] = 0;
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 204 && statusCode !== 400 && statusCode !== 401 && statusCode !== 404 && statusCode !== 409 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 204) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = {
|
||||
required: false,
|
||||
serializedName: 'parsedResponse',
|
||||
type: {
|
||||
name: 'Object'
|
||||
}
|
||||
};
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @summary Remove like from reply
|
||||
*
|
||||
* @param {string} replyHandle Reply handle
|
||||
*
|
||||
* @param {string} authorization Authenication (must begin with string "Bearer
|
||||
* ")
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {object} [result] - The deserialized result object.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
ReplyLikes.prototype.deleteLike = function (replyHandle, authorization, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
// 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 (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
|
||||
throw new Error('authorization cannot be null or undefined and it must be of type string.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/replies/{replyHandle}/likes/me';
|
||||
requestUrl = requestUrl.replace('{replyHandle}', encodeURIComponent(replyHandle));
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'DELETE';
|
||||
httpRequest.headers = {};
|
||||
httpRequest.url = requestUrl;
|
||||
// Set Headers
|
||||
if (authorization !== undefined && authorization !== null) {
|
||||
httpRequest.headers['Authorization'] = authorization;
|
||||
}
|
||||
if(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
httpRequest.body = null;
|
||||
httpRequest.headers['Content-Length'] = 0;
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 204 && statusCode !== 400 && statusCode !== 401 && statusCode !== 404 && statusCode !== 409 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 204) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = {
|
||||
required: false,
|
||||
serializedName: 'parsedResponse',
|
||||
type: {
|
||||
name: 'Object'
|
||||
}
|
||||
};
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
module.exports = ReplyLikes;
|
|
@ -0,0 +1,189 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var util = require('util');
|
||||
var msRest = require('ms-rest');
|
||||
var WebResource = msRest.WebResource;
|
||||
|
||||
/**
|
||||
* @class
|
||||
* ReplyReports
|
||||
* __NOTE__: An instance of this class is automatically created for an
|
||||
* instance of the SocialPlusClient.
|
||||
* Initializes a new instance of the ReplyReports class.
|
||||
* @constructor
|
||||
*
|
||||
* @param {SocialPlusClient} client Reference to the service client.
|
||||
*/
|
||||
function ReplyReports(client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary Report reply
|
||||
*
|
||||
* @param {string} replyHandle Reply handle
|
||||
*
|
||||
* @param {object} postReportRequest Post report request
|
||||
*
|
||||
* @param {string} [postReportRequest.reason] Gets or sets report reason.
|
||||
* Possible values for this property include: 'Spam', 'Cyberbullying',
|
||||
* 'ChildEndangerment', 'Offensive', 'ContentInfringement', 'Other'.
|
||||
*
|
||||
* @param {string} authorization Authenication (must begin with string "Bearer
|
||||
* ")
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {object} [result] - The deserialized result object.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
ReplyReports.prototype.postReport = function (replyHandle, postReportRequest, authorization, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
// 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 (postReportRequest === null || postReportRequest === undefined) {
|
||||
throw new Error('postReportRequest cannot be null or undefined.');
|
||||
}
|
||||
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.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/replies/{replyHandle}/reports';
|
||||
requestUrl = requestUrl.replace('{replyHandle}', encodeURIComponent(replyHandle));
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'POST';
|
||||
httpRequest.headers = {};
|
||||
httpRequest.url = requestUrl;
|
||||
// Set Headers
|
||||
if (authorization !== undefined && authorization !== null) {
|
||||
httpRequest.headers['Authorization'] = authorization;
|
||||
}
|
||||
if(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
// Serialize Request
|
||||
var requestContent = null;
|
||||
var requestModel = null;
|
||||
try {
|
||||
if (postReportRequest !== null && postReportRequest !== undefined) {
|
||||
var requestModelMapper = new client.models['PostReportRequest']().mapper();
|
||||
requestModel = client.serialize(requestModelMapper, postReportRequest, 'postReportRequest');
|
||||
}
|
||||
requestContent = JSON.stringify(requestModel);
|
||||
} catch (error) {
|
||||
var serializationError = new Error(util.format('Error "%s" occurred in serializing the ' +
|
||||
'payload - "%s"', error.message, util.inspect(postReportRequest, {depth: null})));
|
||||
return callback(serializationError);
|
||||
}
|
||||
httpRequest.body = requestContent;
|
||||
httpRequest.headers['Content-Length'] = Buffer.isBuffer(requestContent) ?
|
||||
requestContent.length :
|
||||
Buffer.byteLength(requestContent, 'UTF8');
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 204 && statusCode !== 400 && statusCode !== 401 && statusCode !== 404 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 204) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = {
|
||||
required: false,
|
||||
serializedName: 'parsedResponse',
|
||||
type: {
|
||||
name: 'Object'
|
||||
}
|
||||
};
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
module.exports = ReplyReports;
|
|
@ -0,0 +1,171 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var util = require('util');
|
||||
var msRest = require('ms-rest');
|
||||
var WebResource = msRest.WebResource;
|
||||
|
||||
/**
|
||||
* @class
|
||||
* RequestTokens
|
||||
* __NOTE__: An instance of this class is automatically created for an
|
||||
* instance of the SocialPlusClient.
|
||||
* Initializes a new instance of the RequestTokens class.
|
||||
* @constructor
|
||||
*
|
||||
* @param {SocialPlusClient} client Reference to the service client.
|
||||
*/
|
||||
function RequestTokens(client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary Get request token
|
||||
*
|
||||
* @param {string} identityProvider Identity provider type. Possible values
|
||||
* for this parameter include: 'Facebook', 'Microsoft', 'Google', 'Twitter'
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {string} [options.appkey] App Key Authentication
|
||||
*
|
||||
* @param {string} [options.authorization] Authenication (must begin with
|
||||
* string "Bearer ")
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {object} [result] - The deserialized result object.
|
||||
* See {@link GetRequestTokenResponse} for more
|
||||
* information.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
RequestTokens.prototype.getRequestToken = function (identityProvider, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
|
||||
var authorization = (options && options.authorization !== undefined) ? options.authorization : undefined;
|
||||
// Validate
|
||||
try {
|
||||
if (identityProvider === null || identityProvider === undefined || typeof identityProvider.valueOf() !== 'string') {
|
||||
throw new Error('identityProvider 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 must be of type string.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/request_tokens/{identityProvider}';
|
||||
requestUrl = requestUrl.replace('{identityProvider}', encodeURIComponent(identityProvider));
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'GET';
|
||||
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(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
httpRequest.body = null;
|
||||
httpRequest.headers['Content-Length'] = 0;
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 200 && statusCode !== 400 && statusCode !== 401 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 200) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = new client.models['GetRequestTokenResponse']().mapper();
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
module.exports = RequestTokens;
|
|
@ -0,0 +1,350 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var util = require('util');
|
||||
var msRest = require('ms-rest');
|
||||
var WebResource = msRest.WebResource;
|
||||
|
||||
/**
|
||||
* @class
|
||||
* Search
|
||||
* __NOTE__: An instance of this class is automatically created for an
|
||||
* instance of the SocialPlusClient.
|
||||
* Initializes a new instance of the Search class.
|
||||
* @constructor
|
||||
*
|
||||
* @param {SocialPlusClient} client Reference to the service client.
|
||||
*/
|
||||
function Search(client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary Search topics with a query
|
||||
*
|
||||
* @param {string} query Search query
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {number} [options.cursor] Current read cursor
|
||||
*
|
||||
* @param {number} [options.limit] Number of items to return
|
||||
*
|
||||
* @param {string} [options.appkey] App Key Authentication
|
||||
*
|
||||
* @param {string} [options.authorization] Authenication (must begin with
|
||||
* string "Bearer ")
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {object} [result] - The deserialized result object.
|
||||
* See {@link FeedResponseTopicView} for more information.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
Search.prototype.getTopics = function (query, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
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 authorization = (options && options.authorization !== undefined) ? options.authorization : undefined;
|
||||
// Validate
|
||||
try {
|
||||
if (query === null || query === undefined || typeof query.valueOf() !== 'string') {
|
||||
throw new Error('query cannot be null or undefined and it must be of type string.');
|
||||
}
|
||||
if (cursor !== null && cursor !== undefined && typeof cursor !== 'number') {
|
||||
throw new Error('cursor must be of type number.');
|
||||
}
|
||||
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 must be of type string.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/search/topics';
|
||||
var queryParameters = [];
|
||||
queryParameters.push('query=' + encodeURIComponent(query));
|
||||
if (cursor !== null && cursor !== undefined) {
|
||||
queryParameters.push('cursor=' + encodeURIComponent(cursor.toString()));
|
||||
}
|
||||
if (limit !== null && limit !== undefined) {
|
||||
queryParameters.push('limit=' + encodeURIComponent(limit.toString()));
|
||||
}
|
||||
if (queryParameters.length > 0) {
|
||||
requestUrl += '?' + queryParameters.join('&');
|
||||
}
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'GET';
|
||||
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(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
httpRequest.body = null;
|
||||
httpRequest.headers['Content-Length'] = 0;
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 200 && statusCode !== 400 && statusCode !== 401 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 200) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = new client.models['FeedResponseTopicView']().mapper();
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @summary Search users with a query
|
||||
*
|
||||
* @param {string} query Search query
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {number} [options.cursor] Current read cursor
|
||||
*
|
||||
* @param {number} [options.limit] Number of items to return
|
||||
*
|
||||
* @param {string} [options.appkey] App Key Authentication
|
||||
*
|
||||
* @param {string} [options.authorization] Authenication (must begin with
|
||||
* string "Bearer ")
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {object} [result] - The deserialized result object.
|
||||
* See {@link FeedResponseUserCompactView} for more
|
||||
* information.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
Search.prototype.getUsers = function (query, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
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 authorization = (options && options.authorization !== undefined) ? options.authorization : undefined;
|
||||
// Validate
|
||||
try {
|
||||
if (query === null || query === undefined || typeof query.valueOf() !== 'string') {
|
||||
throw new Error('query cannot be null or undefined and it must be of type string.');
|
||||
}
|
||||
if (cursor !== null && cursor !== undefined && typeof cursor !== 'number') {
|
||||
throw new Error('cursor must be of type number.');
|
||||
}
|
||||
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 must be of type string.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/search/users';
|
||||
var queryParameters = [];
|
||||
queryParameters.push('query=' + encodeURIComponent(query));
|
||||
if (cursor !== null && cursor !== undefined) {
|
||||
queryParameters.push('cursor=' + encodeURIComponent(cursor.toString()));
|
||||
}
|
||||
if (limit !== null && limit !== undefined) {
|
||||
queryParameters.push('limit=' + encodeURIComponent(limit.toString()));
|
||||
}
|
||||
if (queryParameters.length > 0) {
|
||||
requestUrl += '?' + queryParameters.join('&');
|
||||
}
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'GET';
|
||||
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(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
httpRequest.body = null;
|
||||
httpRequest.headers['Content-Length'] = 0;
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 200 && statusCode !== 400 && statusCode !== 401 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 200) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = new client.models['FeedResponseUserCompactView']().mapper();
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
module.exports = Search;
|
|
@ -0,0 +1,330 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var util = require('util');
|
||||
var msRest = require('ms-rest');
|
||||
var WebResource = msRest.WebResource;
|
||||
|
||||
/**
|
||||
* @class
|
||||
* Sessions
|
||||
* __NOTE__: An instance of this class is automatically created for an
|
||||
* instance of the SocialPlusClient.
|
||||
* Initializes a new instance of the Sessions class.
|
||||
* @constructor
|
||||
*
|
||||
* @param {SocialPlusClient} client Reference to the service client.
|
||||
*/
|
||||
function Sessions(client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary Create a new session (sign in)
|
||||
*
|
||||
* @param {object} request Post session request
|
||||
*
|
||||
* @param {string} [request.identityProvider] Gets or sets identity provider
|
||||
* type. Possible values for this property include: 'Facebook', 'Microsoft',
|
||||
* 'Google', 'Twitter'.
|
||||
*
|
||||
* @param {string} [request.accessToken] Gets or sets access or authentication
|
||||
* token, user code, or verifier obtained from third-party provider.
|
||||
* The server contacts the third-party provider to use the token
|
||||
* (or user code, or verifier) for discover the user's identity.
|
||||
*
|
||||
* @param {string} [request.requestToken] Gets or sets request token obtained
|
||||
* from third-party provider.
|
||||
* Some providers do not issue authentication or access tokens,
|
||||
* but they issue request tokens
|
||||
* and verifiers.
|
||||
*
|
||||
* @param {string} [request.instanceId] Gets or sets instance id -- Unique
|
||||
* installation id of the app
|
||||
*
|
||||
* @param {boolean} [request.createUser] Gets or sets a value indicating
|
||||
* whether we should create a new user if the user doesn't exist
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {string} [options.appkey] App Key Authentication
|
||||
*
|
||||
* @param {string} [options.authorization] Authenication (must begin with
|
||||
* string "Bearer ")
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {object} [result] - The deserialized result object.
|
||||
* See {@link PostSessionResponse} for more information.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
Sessions.prototype.postSession = function (request, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
var appkey = (options && options.appkey !== undefined) ? options.appkey : undefined;
|
||||
var authorization = (options && options.authorization !== undefined) ? options.authorization : 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 must be of type string.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/sessions';
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'POST';
|
||||
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(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
// Serialize Request
|
||||
var requestContent = null;
|
||||
var requestModel = null;
|
||||
try {
|
||||
if (request !== null && request !== undefined) {
|
||||
var requestModelMapper = new client.models['PostSessionRequest']().mapper();
|
||||
requestModel = client.serialize(requestModelMapper, request, 'request');
|
||||
}
|
||||
requestContent = JSON.stringify(requestModel);
|
||||
} catch (error) {
|
||||
var serializationError = new Error(util.format('Error "%s" occurred in serializing the ' +
|
||||
'payload - "%s"', error.message, util.inspect(request, {depth: null})));
|
||||
return callback(serializationError);
|
||||
}
|
||||
httpRequest.body = requestContent;
|
||||
httpRequest.headers['Content-Length'] = Buffer.isBuffer(requestContent) ?
|
||||
requestContent.length :
|
||||
Buffer.byteLength(requestContent, 'UTF8');
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 201 && statusCode !== 400 && statusCode !== 401 && statusCode !== 404 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 201) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = new client.models['PostSessionResponse']().mapper();
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @summary Delete the current session (sign out)
|
||||
*
|
||||
* @param {string} authorization Authenication (must begin with string "Bearer
|
||||
* ")
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {object} [result] - The deserialized result object.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
Sessions.prototype.deleteSession = function (authorization, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
// Validate
|
||||
try {
|
||||
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.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/sessions/current';
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'DELETE';
|
||||
httpRequest.headers = {};
|
||||
httpRequest.url = requestUrl;
|
||||
// Set Headers
|
||||
if (authorization !== undefined && authorization !== null) {
|
||||
httpRequest.headers['Authorization'] = authorization;
|
||||
}
|
||||
if(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
httpRequest.body = null;
|
||||
httpRequest.headers['Content-Length'] = 0;
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 204 && statusCode !== 400 && statusCode !== 401 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 204) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = {
|
||||
required: false,
|
||||
serializedName: 'parsedResponse',
|
||||
type: {
|
||||
name: 'Object'
|
||||
}
|
||||
};
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
module.exports = Sessions;
|
|
@ -0,0 +1,338 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var util = require('util');
|
||||
var msRest = require('ms-rest');
|
||||
var WebResource = msRest.WebResource;
|
||||
|
||||
/**
|
||||
* @class
|
||||
* TopicComments
|
||||
* __NOTE__: An instance of this class is automatically created for an
|
||||
* instance of the SocialPlusClient.
|
||||
* Initializes a new instance of the TopicComments class.
|
||||
* @constructor
|
||||
*
|
||||
* @param {SocialPlusClient} client Reference to the service client.
|
||||
*/
|
||||
function TopicComments(client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary Get comments for a topic
|
||||
*
|
||||
* @param {string} topicHandle Topic handle
|
||||
*
|
||||
* @param {string} authorization Authenication (must begin with string "Bearer
|
||||
* ")
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {string} [options.cursor] Current read cursor
|
||||
*
|
||||
* @param {number} [options.limit] Number of items to return
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {object} [result] - The deserialized result object.
|
||||
* See {@link FeedResponseCommentView} for more
|
||||
* information.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
TopicComments.prototype.getTopicComments = function (topicHandle, authorization, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
var cursor = (options && options.cursor !== undefined) ? options.cursor : undefined;
|
||||
var limit = (options && options.limit !== undefined) ? options.limit : 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 (cursor !== null && cursor !== undefined && typeof cursor.valueOf() !== 'string') {
|
||||
throw new Error('cursor must be of type string.');
|
||||
}
|
||||
if (limit !== null && limit !== undefined && typeof limit !== 'number') {
|
||||
throw new Error('limit must be of type number.');
|
||||
}
|
||||
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.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/topics/{topicHandle}/comments';
|
||||
requestUrl = requestUrl.replace('{topicHandle}', encodeURIComponent(topicHandle));
|
||||
var queryParameters = [];
|
||||
if (cursor !== null && cursor !== undefined) {
|
||||
queryParameters.push('cursor=' + encodeURIComponent(cursor));
|
||||
}
|
||||
if (limit !== null && limit !== undefined) {
|
||||
queryParameters.push('limit=' + encodeURIComponent(limit.toString()));
|
||||
}
|
||||
if (queryParameters.length > 0) {
|
||||
requestUrl += '?' + queryParameters.join('&');
|
||||
}
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'GET';
|
||||
httpRequest.headers = {};
|
||||
httpRequest.url = requestUrl;
|
||||
// Set Headers
|
||||
if (authorization !== undefined && authorization !== null) {
|
||||
httpRequest.headers['Authorization'] = authorization;
|
||||
}
|
||||
if(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
httpRequest.body = null;
|
||||
httpRequest.headers['Content-Length'] = 0;
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 200 && statusCode !== 400 && statusCode !== 401 && statusCode !== 404 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 200) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = new client.models['FeedResponseCommentView']().mapper();
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @summary Create a new comment
|
||||
*
|
||||
* @param {string} topicHandle Topic handle
|
||||
*
|
||||
* @param {object} request Post comment request
|
||||
*
|
||||
* @param {string} [request.text] Gets or sets comment text
|
||||
*
|
||||
* @param {string} [request.blobType] Gets or sets comment blob type. Possible
|
||||
* values for this property include: 'Unknown', 'Image', 'Video', 'Custom'.
|
||||
*
|
||||
* @param {string} [request.blobHandle] Gets or sets comment blob handle
|
||||
*
|
||||
* @param {string} [request.language] Gets or sets comment language
|
||||
*
|
||||
* @param {string} authorization Authenication (must begin with string "Bearer
|
||||
* ")
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {object} [result] - The deserialized result object.
|
||||
* See {@link PostCommentResponse} for more information.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
TopicComments.prototype.postComment = function (topicHandle, request, authorization, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
// 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 (request === null || request === undefined) {
|
||||
throw new Error('request cannot be null or undefined.');
|
||||
}
|
||||
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.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/topics/{topicHandle}/comments';
|
||||
requestUrl = requestUrl.replace('{topicHandle}', encodeURIComponent(topicHandle));
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'POST';
|
||||
httpRequest.headers = {};
|
||||
httpRequest.url = requestUrl;
|
||||
// Set Headers
|
||||
if (authorization !== undefined && authorization !== null) {
|
||||
httpRequest.headers['Authorization'] = authorization;
|
||||
}
|
||||
if(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
// Serialize Request
|
||||
var requestContent = null;
|
||||
var requestModel = null;
|
||||
try {
|
||||
if (request !== null && request !== undefined) {
|
||||
var requestModelMapper = new client.models['PostCommentRequest']().mapper();
|
||||
requestModel = client.serialize(requestModelMapper, request, 'request');
|
||||
}
|
||||
requestContent = JSON.stringify(requestModel);
|
||||
} catch (error) {
|
||||
var serializationError = new Error(util.format('Error "%s" occurred in serializing the ' +
|
||||
'payload - "%s"', error.message, util.inspect(request, {depth: null})));
|
||||
return callback(serializationError);
|
||||
}
|
||||
httpRequest.body = requestContent;
|
||||
httpRequest.headers['Content-Length'] = Buffer.isBuffer(requestContent) ?
|
||||
requestContent.length :
|
||||
Buffer.byteLength(requestContent, 'UTF8');
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 201 && statusCode !== 400 && statusCode !== 401 && statusCode !== 404 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 201) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = new client.models['PostCommentResponse']().mapper();
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
module.exports = TopicComments;
|
|
@ -0,0 +1,454 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var util = require('util');
|
||||
var msRest = require('ms-rest');
|
||||
var WebResource = msRest.WebResource;
|
||||
|
||||
/**
|
||||
* @class
|
||||
* TopicLikes
|
||||
* __NOTE__: An instance of this class is automatically created for an
|
||||
* instance of the SocialPlusClient.
|
||||
* Initializes a new instance of the TopicLikes class.
|
||||
* @constructor
|
||||
*
|
||||
* @param {SocialPlusClient} client Reference to the service client.
|
||||
*/
|
||||
function TopicLikes(client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary Get likes for topic
|
||||
*
|
||||
* @param {string} topicHandle Topic handle
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {string} [options.cursor] Current read cursor
|
||||
*
|
||||
* @param {number} [options.limit] Number of items to return
|
||||
*
|
||||
* @param {string} [options.appkey] App Key Authentication
|
||||
*
|
||||
* @param {string} [options.authorization] Authenication (must begin with
|
||||
* string "Bearer ")
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {object} [result] - The deserialized result object.
|
||||
* See {@link FeedResponseUserCompactView} for more
|
||||
* information.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
TopicLikes.prototype.getLikes = function (topicHandle, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
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 authorization = (options && options.authorization !== undefined) ? options.authorization : 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 (cursor !== null && cursor !== undefined && typeof cursor.valueOf() !== 'string') {
|
||||
throw new Error('cursor must be of type string.');
|
||||
}
|
||||
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 must be of type string.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/topics/{topicHandle}/likes';
|
||||
requestUrl = requestUrl.replace('{topicHandle}', encodeURIComponent(topicHandle));
|
||||
var queryParameters = [];
|
||||
if (cursor !== null && cursor !== undefined) {
|
||||
queryParameters.push('cursor=' + encodeURIComponent(cursor));
|
||||
}
|
||||
if (limit !== null && limit !== undefined) {
|
||||
queryParameters.push('limit=' + encodeURIComponent(limit.toString()));
|
||||
}
|
||||
if (queryParameters.length > 0) {
|
||||
requestUrl += '?' + queryParameters.join('&');
|
||||
}
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'GET';
|
||||
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(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
httpRequest.body = null;
|
||||
httpRequest.headers['Content-Length'] = 0;
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 200 && statusCode !== 400 && statusCode !== 401 && statusCode !== 404 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 200) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = new client.models['FeedResponseUserCompactView']().mapper();
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @summary Add like to topic
|
||||
*
|
||||
* @param {string} topicHandle Topic handle
|
||||
*
|
||||
* @param {string} authorization Authenication (must begin with string "Bearer
|
||||
* ")
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {object} [result] - The deserialized result object.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
TopicLikes.prototype.postLike = function (topicHandle, authorization, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
// 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 (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
|
||||
throw new Error('authorization cannot be null or undefined and it must be of type string.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/topics/{topicHandle}/likes';
|
||||
requestUrl = requestUrl.replace('{topicHandle}', encodeURIComponent(topicHandle));
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'POST';
|
||||
httpRequest.headers = {};
|
||||
httpRequest.url = requestUrl;
|
||||
// Set Headers
|
||||
if (authorization !== undefined && authorization !== null) {
|
||||
httpRequest.headers['Authorization'] = authorization;
|
||||
}
|
||||
if(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
httpRequest.body = null;
|
||||
httpRequest.headers['Content-Length'] = 0;
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 204 && statusCode !== 400 && statusCode !== 401 && statusCode !== 404 && statusCode !== 409 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 204) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = {
|
||||
required: false,
|
||||
serializedName: 'parsedResponse',
|
||||
type: {
|
||||
name: 'Object'
|
||||
}
|
||||
};
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @summary Remove like from topic
|
||||
*
|
||||
* @param {string} topicHandle Topic handle
|
||||
*
|
||||
* @param {string} authorization Authenication (must begin with string "Bearer
|
||||
* ")
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {object} [result] - The deserialized result object.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
TopicLikes.prototype.deleteLike = function (topicHandle, authorization, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
// 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 (authorization === null || authorization === undefined || typeof authorization.valueOf() !== 'string') {
|
||||
throw new Error('authorization cannot be null or undefined and it must be of type string.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/topics/{topicHandle}/likes/me';
|
||||
requestUrl = requestUrl.replace('{topicHandle}', encodeURIComponent(topicHandle));
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'DELETE';
|
||||
httpRequest.headers = {};
|
||||
httpRequest.url = requestUrl;
|
||||
// Set Headers
|
||||
if (authorization !== undefined && authorization !== null) {
|
||||
httpRequest.headers['Authorization'] = authorization;
|
||||
}
|
||||
if(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
httpRequest.body = null;
|
||||
httpRequest.headers['Content-Length'] = 0;
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 204 && statusCode !== 400 && statusCode !== 401 && statusCode !== 404 && statusCode !== 409 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 204) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = {
|
||||
required: false,
|
||||
serializedName: 'parsedResponse',
|
||||
type: {
|
||||
name: 'Object'
|
||||
}
|
||||
};
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
module.exports = TopicLikes;
|
|
@ -0,0 +1,189 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var util = require('util');
|
||||
var msRest = require('ms-rest');
|
||||
var WebResource = msRest.WebResource;
|
||||
|
||||
/**
|
||||
* @class
|
||||
* TopicReports
|
||||
* __NOTE__: An instance of this class is automatically created for an
|
||||
* instance of the SocialPlusClient.
|
||||
* Initializes a new instance of the TopicReports class.
|
||||
* @constructor
|
||||
*
|
||||
* @param {SocialPlusClient} client Reference to the service client.
|
||||
*/
|
||||
function TopicReports(client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary Report topic
|
||||
*
|
||||
* @param {string} topicHandle Topic handle
|
||||
*
|
||||
* @param {object} postReportRequest Post report request
|
||||
*
|
||||
* @param {string} [postReportRequest.reason] Gets or sets report reason.
|
||||
* Possible values for this property include: 'Spam', 'Cyberbullying',
|
||||
* 'ChildEndangerment', 'Offensive', 'ContentInfringement', 'Other'.
|
||||
*
|
||||
* @param {string} authorization Authenication (must begin with string "Bearer
|
||||
* ")
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {object} [result] - The deserialized result object.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
TopicReports.prototype.postReport = function (topicHandle, postReportRequest, authorization, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
// 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 (postReportRequest === null || postReportRequest === undefined) {
|
||||
throw new Error('postReportRequest cannot be null or undefined.');
|
||||
}
|
||||
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.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/topics/{topicHandle}/reports';
|
||||
requestUrl = requestUrl.replace('{topicHandle}', encodeURIComponent(topicHandle));
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'POST';
|
||||
httpRequest.headers = {};
|
||||
httpRequest.url = requestUrl;
|
||||
// Set Headers
|
||||
if (authorization !== undefined && authorization !== null) {
|
||||
httpRequest.headers['Authorization'] = authorization;
|
||||
}
|
||||
if(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
// Serialize Request
|
||||
var requestContent = null;
|
||||
var requestModel = null;
|
||||
try {
|
||||
if (postReportRequest !== null && postReportRequest !== undefined) {
|
||||
var requestModelMapper = new client.models['PostReportRequest']().mapper();
|
||||
requestModel = client.serialize(requestModelMapper, postReportRequest, 'postReportRequest');
|
||||
}
|
||||
requestContent = JSON.stringify(requestModel);
|
||||
} catch (error) {
|
||||
var serializationError = new Error(util.format('Error "%s" occurred in serializing the ' +
|
||||
'payload - "%s"', error.message, util.inspect(postReportRequest, {depth: null})));
|
||||
return callback(serializationError);
|
||||
}
|
||||
httpRequest.body = requestContent;
|
||||
httpRequest.headers['Content-Length'] = Buffer.isBuffer(requestContent) ?
|
||||
requestContent.length :
|
||||
Buffer.byteLength(requestContent, 'UTF8');
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 204 && statusCode !== 400 && statusCode !== 401 && statusCode !== 404 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 204) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = {
|
||||
required: false,
|
||||
serializedName: 'parsedResponse',
|
||||
type: {
|
||||
name: 'Object'
|
||||
}
|
||||
};
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
module.exports = TopicReports;
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,182 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var util = require('util');
|
||||
var msRest = require('ms-rest');
|
||||
var WebResource = msRest.WebResource;
|
||||
|
||||
/**
|
||||
* @class
|
||||
* UserFollowers
|
||||
* __NOTE__: An instance of this class is automatically created for an
|
||||
* instance of the SocialPlusClient.
|
||||
* Initializes a new instance of the UserFollowers class.
|
||||
* @constructor
|
||||
*
|
||||
* @param {SocialPlusClient} client Reference to the service client.
|
||||
*/
|
||||
function UserFollowers(client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary Get followers of a user
|
||||
*
|
||||
* @param {string} userHandle User handle
|
||||
*
|
||||
* @param {string} authorization Authenication (must begin with string "Bearer
|
||||
* ")
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {string} [options.cursor] Current read cursor
|
||||
*
|
||||
* @param {number} [options.limit] Number of items to return
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {object} [result] - The deserialized result object.
|
||||
* See {@link FeedResponseUserCompactView} for more
|
||||
* information.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
UserFollowers.prototype.getFollowers = function (userHandle, authorization, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
var cursor = (options && options.cursor !== undefined) ? options.cursor : undefined;
|
||||
var limit = (options && options.limit !== undefined) ? options.limit : 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 (cursor !== null && cursor !== undefined && typeof cursor.valueOf() !== 'string') {
|
||||
throw new Error('cursor must be of type string.');
|
||||
}
|
||||
if (limit !== null && limit !== undefined && typeof limit !== 'number') {
|
||||
throw new Error('limit must be of type number.');
|
||||
}
|
||||
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.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/users/{userHandle}/followers';
|
||||
requestUrl = requestUrl.replace('{userHandle}', encodeURIComponent(userHandle));
|
||||
var queryParameters = [];
|
||||
if (cursor !== null && cursor !== undefined) {
|
||||
queryParameters.push('cursor=' + encodeURIComponent(cursor));
|
||||
}
|
||||
if (limit !== null && limit !== undefined) {
|
||||
queryParameters.push('limit=' + encodeURIComponent(limit.toString()));
|
||||
}
|
||||
if (queryParameters.length > 0) {
|
||||
requestUrl += '?' + queryParameters.join('&');
|
||||
}
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'GET';
|
||||
httpRequest.headers = {};
|
||||
httpRequest.url = requestUrl;
|
||||
// Set Headers
|
||||
if (authorization !== undefined && authorization !== null) {
|
||||
httpRequest.headers['Authorization'] = authorization;
|
||||
}
|
||||
if(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
httpRequest.body = null;
|
||||
httpRequest.headers['Content-Length'] = 0;
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 200 && statusCode !== 400 && statusCode !== 401 && statusCode !== 404 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 200) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = new client.models['FeedResponseUserCompactView']().mapper();
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
module.exports = UserFollowers;
|
|
@ -0,0 +1,182 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var util = require('util');
|
||||
var msRest = require('ms-rest');
|
||||
var WebResource = msRest.WebResource;
|
||||
|
||||
/**
|
||||
* @class
|
||||
* UserFollowing
|
||||
* __NOTE__: An instance of this class is automatically created for an
|
||||
* instance of the SocialPlusClient.
|
||||
* Initializes a new instance of the UserFollowing class.
|
||||
* @constructor
|
||||
*
|
||||
* @param {SocialPlusClient} client Reference to the service client.
|
||||
*/
|
||||
function UserFollowing(client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary Get following users of a user
|
||||
*
|
||||
* @param {string} userHandle User handle
|
||||
*
|
||||
* @param {string} authorization Authenication (must begin with string "Bearer
|
||||
* ")
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {string} [options.cursor] Current read cursor
|
||||
*
|
||||
* @param {number} [options.limit] Number of items to return
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {object} [result] - The deserialized result object.
|
||||
* See {@link FeedResponseUserCompactView} for more
|
||||
* information.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
UserFollowing.prototype.getFollowing = function (userHandle, authorization, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
var cursor = (options && options.cursor !== undefined) ? options.cursor : undefined;
|
||||
var limit = (options && options.limit !== undefined) ? options.limit : 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 (cursor !== null && cursor !== undefined && typeof cursor.valueOf() !== 'string') {
|
||||
throw new Error('cursor must be of type string.');
|
||||
}
|
||||
if (limit !== null && limit !== undefined && typeof limit !== 'number') {
|
||||
throw new Error('limit must be of type number.');
|
||||
}
|
||||
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.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/users/{userHandle}/following';
|
||||
requestUrl = requestUrl.replace('{userHandle}', encodeURIComponent(userHandle));
|
||||
var queryParameters = [];
|
||||
if (cursor !== null && cursor !== undefined) {
|
||||
queryParameters.push('cursor=' + encodeURIComponent(cursor));
|
||||
}
|
||||
if (limit !== null && limit !== undefined) {
|
||||
queryParameters.push('limit=' + encodeURIComponent(limit.toString()));
|
||||
}
|
||||
if (queryParameters.length > 0) {
|
||||
requestUrl += '?' + queryParameters.join('&');
|
||||
}
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'GET';
|
||||
httpRequest.headers = {};
|
||||
httpRequest.url = requestUrl;
|
||||
// Set Headers
|
||||
if (authorization !== undefined && authorization !== null) {
|
||||
httpRequest.headers['Authorization'] = authorization;
|
||||
}
|
||||
if(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
httpRequest.body = null;
|
||||
httpRequest.headers['Content-Length'] = 0;
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 200 && statusCode !== 400 && statusCode !== 401 && statusCode !== 404 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 200) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = new client.models['FeedResponseUserCompactView']().mapper();
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
module.exports = UserFollowing;
|
|
@ -0,0 +1,189 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var util = require('util');
|
||||
var msRest = require('ms-rest');
|
||||
var WebResource = msRest.WebResource;
|
||||
|
||||
/**
|
||||
* @class
|
||||
* UserReports
|
||||
* __NOTE__: An instance of this class is automatically created for an
|
||||
* instance of the SocialPlusClient.
|
||||
* Initializes a new instance of the UserReports class.
|
||||
* @constructor
|
||||
*
|
||||
* @param {SocialPlusClient} client Reference to the service client.
|
||||
*/
|
||||
function UserReports(client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary Report user
|
||||
*
|
||||
* @param {string} userHandle User handle
|
||||
*
|
||||
* @param {object} postReportRequest Post report request
|
||||
*
|
||||
* @param {string} [postReportRequest.reason] Gets or sets report reason.
|
||||
* Possible values for this property include: 'Spam', 'Cyberbullying',
|
||||
* 'ChildEndangerment', 'Offensive', 'ContentInfringement', 'Other'.
|
||||
*
|
||||
* @param {string} authorization Authenication (must begin with string "Bearer
|
||||
* ")
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {object} [result] - The deserialized result object.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
UserReports.prototype.postReport = function (userHandle, postReportRequest, authorization, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
// 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 (postReportRequest === null || postReportRequest === undefined) {
|
||||
throw new Error('postReportRequest cannot be null or undefined.');
|
||||
}
|
||||
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.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/users/{userHandle}/reports';
|
||||
requestUrl = requestUrl.replace('{userHandle}', encodeURIComponent(userHandle));
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'POST';
|
||||
httpRequest.headers = {};
|
||||
httpRequest.url = requestUrl;
|
||||
// Set Headers
|
||||
if (authorization !== undefined && authorization !== null) {
|
||||
httpRequest.headers['Authorization'] = authorization;
|
||||
}
|
||||
if(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
// Serialize Request
|
||||
var requestContent = null;
|
||||
var requestModel = null;
|
||||
try {
|
||||
if (postReportRequest !== null && postReportRequest !== undefined) {
|
||||
var requestModelMapper = new client.models['PostReportRequest']().mapper();
|
||||
requestModel = client.serialize(requestModelMapper, postReportRequest, 'postReportRequest');
|
||||
}
|
||||
requestContent = JSON.stringify(requestModel);
|
||||
} catch (error) {
|
||||
var serializationError = new Error(util.format('Error "%s" occurred in serializing the ' +
|
||||
'payload - "%s"', error.message, util.inspect(postReportRequest, {depth: null})));
|
||||
return callback(serializationError);
|
||||
}
|
||||
httpRequest.body = requestContent;
|
||||
httpRequest.headers['Content-Length'] = Buffer.isBuffer(requestContent) ?
|
||||
requestContent.length :
|
||||
Buffer.byteLength(requestContent, 'UTF8');
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 204 && statusCode !== 400 && statusCode !== 401 && statusCode !== 404 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 204) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = {
|
||||
required: false,
|
||||
serializedName: 'parsedResponse',
|
||||
type: {
|
||||
name: 'Object'
|
||||
}
|
||||
};
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
module.exports = UserReports;
|
|
@ -0,0 +1,349 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var util = require('util');
|
||||
var msRest = require('ms-rest');
|
||||
var WebResource = msRest.WebResource;
|
||||
|
||||
/**
|
||||
* @class
|
||||
* UserTopics
|
||||
* __NOTE__: An instance of this class is automatically created for an
|
||||
* instance of the SocialPlusClient.
|
||||
* Initializes a new instance of the UserTopics class.
|
||||
* @constructor
|
||||
*
|
||||
* @param {SocialPlusClient} client Reference to the service client.
|
||||
*/
|
||||
function UserTopics(client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary Get user topics sorted by creation time
|
||||
*
|
||||
* @param {string} userHandle User handle
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {string} [options.cursor] Current read cursor
|
||||
*
|
||||
* @param {number} [options.limit] Number of items to return
|
||||
*
|
||||
* @param {string} [options.appkey] App Key Authentication
|
||||
*
|
||||
* @param {string} [options.authorization] Authenication (must begin with
|
||||
* string "Bearer ")
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {object} [result] - The deserialized result object.
|
||||
* See {@link FeedResponseTopicView} for more information.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
UserTopics.prototype.getTopics = function (userHandle, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
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 authorization = (options && options.authorization !== undefined) ? options.authorization : 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 (cursor !== null && cursor !== undefined && typeof cursor.valueOf() !== 'string') {
|
||||
throw new Error('cursor must be of type string.');
|
||||
}
|
||||
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 must be of type string.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/users/{userHandle}/topics';
|
||||
requestUrl = requestUrl.replace('{userHandle}', encodeURIComponent(userHandle));
|
||||
var queryParameters = [];
|
||||
if (cursor !== null && cursor !== undefined) {
|
||||
queryParameters.push('cursor=' + encodeURIComponent(cursor));
|
||||
}
|
||||
if (limit !== null && limit !== undefined) {
|
||||
queryParameters.push('limit=' + encodeURIComponent(limit.toString()));
|
||||
}
|
||||
if (queryParameters.length > 0) {
|
||||
requestUrl += '?' + queryParameters.join('&');
|
||||
}
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'GET';
|
||||
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(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
httpRequest.body = null;
|
||||
httpRequest.headers['Content-Length'] = 0;
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 200 && statusCode !== 400 && statusCode !== 401 && statusCode !== 404 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 200) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = new client.models['FeedResponseTopicView']().mapper();
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @summary Get user topics sorted by popularity
|
||||
*
|
||||
* @param {string} userHandle User handle
|
||||
*
|
||||
* @param {object} [options] Optional Parameters.
|
||||
*
|
||||
* @param {number} [options.cursor] Current read cursor
|
||||
*
|
||||
* @param {number} [options.limit] Number of items to return
|
||||
*
|
||||
* @param {string} [options.appkey] App Key Authentication
|
||||
*
|
||||
* @param {string} [options.authorization] Authenication (must begin with
|
||||
* string "Bearer ")
|
||||
*
|
||||
* @param {object} [options.customHeaders] Headers that will be added to the
|
||||
* request
|
||||
*
|
||||
* @param {function} callback
|
||||
*
|
||||
* @returns {function} callback(err, result, request, response)
|
||||
*
|
||||
* {Error} err - The Error object if an error occurred, null otherwise.
|
||||
*
|
||||
* {object} [result] - The deserialized result object.
|
||||
* See {@link FeedResponseTopicView} for more information.
|
||||
*
|
||||
* {object} [request] - The HTTP Request object if an error did not occur.
|
||||
*
|
||||
* {stream} [response] - The HTTP Response stream if an error did not occur.
|
||||
*/
|
||||
UserTopics.prototype.getPopularTopics = function (userHandle, options, callback) {
|
||||
var client = this.client;
|
||||
if(!callback && typeof options === 'function') {
|
||||
callback = options;
|
||||
options = null;
|
||||
}
|
||||
if (!callback) {
|
||||
throw new Error('callback cannot be null.');
|
||||
}
|
||||
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 authorization = (options && options.authorization !== undefined) ? options.authorization : 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 (cursor !== null && cursor !== undefined && typeof cursor !== 'number') {
|
||||
throw new Error('cursor must be of type number.');
|
||||
}
|
||||
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 must be of type string.');
|
||||
}
|
||||
} catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
|
||||
// Construct URL
|
||||
var requestUrl = this.client.baseUri +
|
||||
'//v0.2/users/{userHandle}/topics/popular';
|
||||
requestUrl = requestUrl.replace('{userHandle}', encodeURIComponent(userHandle));
|
||||
var queryParameters = [];
|
||||
if (cursor !== null && cursor !== undefined) {
|
||||
queryParameters.push('cursor=' + encodeURIComponent(cursor.toString()));
|
||||
}
|
||||
if (limit !== null && limit !== undefined) {
|
||||
queryParameters.push('limit=' + encodeURIComponent(limit.toString()));
|
||||
}
|
||||
if (queryParameters.length > 0) {
|
||||
requestUrl += '?' + queryParameters.join('&');
|
||||
}
|
||||
// trim all duplicate forward slashes in the url
|
||||
var regex = /([^:]\/)\/+/gi;
|
||||
requestUrl = requestUrl.replace(regex, '$1');
|
||||
|
||||
// Create HTTP transport objects
|
||||
var httpRequest = new WebResource();
|
||||
httpRequest.method = 'GET';
|
||||
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(options) {
|
||||
for(var headerName in options['customHeaders']) {
|
||||
if (options['customHeaders'].hasOwnProperty(headerName)) {
|
||||
httpRequest.headers[headerName] = options['customHeaders'][headerName];
|
||||
}
|
||||
}
|
||||
}
|
||||
httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8';
|
||||
httpRequest.body = null;
|
||||
httpRequest.headers['Content-Length'] = 0;
|
||||
// Send Request
|
||||
return client.pipeline(httpRequest, function (err, response, responseBody) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var statusCode = response.statusCode;
|
||||
if (statusCode !== 200 && statusCode !== 400 && statusCode !== 401 && statusCode !== 404 && statusCode !== 500) {
|
||||
var error = new Error(responseBody);
|
||||
error.statusCode = response.statusCode;
|
||||
error.request = msRest.stripRequest(httpRequest);
|
||||
error.response = msRest.stripResponse(response);
|
||||
if (responseBody === '') responseBody = null;
|
||||
var parsedErrorResponse;
|
||||
try {
|
||||
parsedErrorResponse = JSON.parse(responseBody);
|
||||
if (parsedErrorResponse) {
|
||||
if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error;
|
||||
if (parsedErrorResponse.code) error.code = parsedErrorResponse.code;
|
||||
if (parsedErrorResponse.message) error.message = parsedErrorResponse.message;
|
||||
}
|
||||
} catch (defaultError) {
|
||||
error.message = util.format('Error "%s" occurred in deserializing the responseBody ' +
|
||||
'- "%s" for the default response.', defaultError.message, responseBody);
|
||||
return callback(error);
|
||||
}
|
||||
return callback(error);
|
||||
}
|
||||
// Create Result
|
||||
var result = null;
|
||||
if (responseBody === '') responseBody = null;
|
||||
// Deserialize Response
|
||||
if (statusCode === 200) {
|
||||
var parsedResponse = null;
|
||||
try {
|
||||
parsedResponse = JSON.parse(responseBody);
|
||||
result = JSON.parse(responseBody);
|
||||
if (parsedResponse !== null && parsedResponse !== undefined) {
|
||||
var resultMapper = new client.models['FeedResponseTopicView']().mapper();
|
||||
result = client.deserialize(resultMapper, parsedResponse, 'result');
|
||||
}
|
||||
} catch (error) {
|
||||
var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody));
|
||||
deserializationError.request = msRest.stripRequest(httpRequest);
|
||||
deserializationError.response = msRest.stripResponse(response);
|
||||
return callback(deserializationError);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(null, result, httpRequest, response);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
module.exports = UserTopics;
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"name": "SocialPlus.Client",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "socialPlusClient.js",
|
||||
"dependencies": {
|
||||
"ms-rest": "^1.9.0"
|
||||
},
|
||||
"devDependencies": {},
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC"
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
import { ServiceClientOptions, RequestOptions, ServiceCallback } from 'ms-rest';
|
||||
import * as operations from "./operations";
|
||||
|
||||
declare class SocialPlusClient {
|
||||
/**
|
||||
* @class
|
||||
* Initializes a new instance of the SocialPlusClient class.
|
||||
* @constructor
|
||||
*
|
||||
* @param {string} [baseUri] - The base URI of the service.
|
||||
*
|
||||
* @param {object} [options] - The parameter options
|
||||
*
|
||||
* @param {Array} [options.filters] - Filters to be added to the request pipeline
|
||||
*
|
||||
* @param {object} [options.requestOptions] - Options for the underlying request object
|
||||
* {@link https://github.com/request/request#requestoptions-callback Options doc}
|
||||
*
|
||||
* @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy
|
||||
*
|
||||
*/
|
||||
constructor(baseUri: string, options: ServiceClientOptions);
|
||||
|
||||
// Operation groups
|
||||
blobs: operations.Blobs;
|
||||
builds: operations.Builds;
|
||||
comments: operations.Comments;
|
||||
topicComments: operations.TopicComments;
|
||||
hashtags: operations.Hashtags;
|
||||
images: operations.Images;
|
||||
topicLikes: operations.TopicLikes;
|
||||
replyLikes: operations.ReplyLikes;
|
||||
commentLikes: operations.CommentLikes;
|
||||
myNotifications: operations.MyNotifications;
|
||||
myPins: operations.MyPins;
|
||||
myPushRegistrations: operations.MyPushRegistrations;
|
||||
replies: operations.Replies;
|
||||
commentReplies: operations.CommentReplies;
|
||||
userReports: operations.UserReports;
|
||||
topicReports: operations.TopicReports;
|
||||
replyReports: operations.ReplyReports;
|
||||
commentReports: operations.CommentReports;
|
||||
search: operations.Search;
|
||||
sessions: operations.Sessions;
|
||||
requestTokens: operations.RequestTokens;
|
||||
userFollowers: operations.UserFollowers;
|
||||
myPendingUsers: operations.MyPendingUsers;
|
||||
myFollowers: operations.MyFollowers;
|
||||
myFollowing: operations.MyFollowing;
|
||||
myBlockedUsers: operations.MyBlockedUsers;
|
||||
userFollowing: operations.UserFollowing;
|
||||
topics: operations.Topics;
|
||||
myTopics: operations.MyTopics;
|
||||
myAppFollowing: operations.MyAppFollowing;
|
||||
myApps: operations.MyApps;
|
||||
myLikes: operations.MyLikes;
|
||||
myLinkedAccounts: operations.MyLinkedAccounts;
|
||||
users: operations.Users;
|
||||
userTopics: operations.UserTopics;
|
||||
}
|
||||
|
||||
export = SocialPlusClient;
|
|
@ -0,0 +1,93 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
|
||||
/* jshint latedef:false */
|
||||
/* jshint forin:false */
|
||||
/* jshint noempty:false */
|
||||
|
||||
'use strict';
|
||||
|
||||
var util = require('util');
|
||||
var msRest = require('ms-rest');
|
||||
var ServiceClient = msRest.ServiceClient;
|
||||
|
||||
var models = require('./models');
|
||||
var operations = require('./operations');
|
||||
|
||||
/**
|
||||
* @class
|
||||
* Initializes a new instance of the SocialPlusClient class.
|
||||
* @constructor
|
||||
*
|
||||
* @param {string} [baseUri] - The base URI of the service.
|
||||
*
|
||||
* @param {object} [options] - The parameter options
|
||||
*
|
||||
* @param {Array} [options.filters] - Filters to be added to the request pipeline
|
||||
*
|
||||
* @param {object} [options.requestOptions] - Options for the underlying request object
|
||||
* {@link https://github.com/request/request#requestoptions-callback Options doc}
|
||||
*
|
||||
* @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy
|
||||
*
|
||||
*/
|
||||
function SocialPlusClient(baseUri, options) {
|
||||
|
||||
if (!options) options = {};
|
||||
|
||||
SocialPlusClient['super_'].call(this, null, options);
|
||||
this.baseUri = baseUri;
|
||||
if (!this.baseUri) {
|
||||
this.baseUri = 'http://sp-dev-restapi.cloudapp.net';
|
||||
}
|
||||
|
||||
this.blobs = new operations.Blobs(this);
|
||||
this.builds = new operations.Builds(this);
|
||||
this.comments = new operations.Comments(this);
|
||||
this.topicComments = new operations.TopicComments(this);
|
||||
this.hashtags = new operations.Hashtags(this);
|
||||
this.images = new operations.Images(this);
|
||||
this.topicLikes = new operations.TopicLikes(this);
|
||||
this.replyLikes = new operations.ReplyLikes(this);
|
||||
this.commentLikes = new operations.CommentLikes(this);
|
||||
this.myNotifications = new operations.MyNotifications(this);
|
||||
this.myPins = new operations.MyPins(this);
|
||||
this.myPushRegistrations = new operations.MyPushRegistrations(this);
|
||||
this.replies = new operations.Replies(this);
|
||||
this.commentReplies = new operations.CommentReplies(this);
|
||||
this.userReports = new operations.UserReports(this);
|
||||
this.topicReports = new operations.TopicReports(this);
|
||||
this.replyReports = new operations.ReplyReports(this);
|
||||
this.commentReports = new operations.CommentReports(this);
|
||||
this.search = new operations.Search(this);
|
||||
this.sessions = new operations.Sessions(this);
|
||||
this.requestTokens = new operations.RequestTokens(this);
|
||||
this.userFollowers = new operations.UserFollowers(this);
|
||||
this.myPendingUsers = new operations.MyPendingUsers(this);
|
||||
this.myFollowers = new operations.MyFollowers(this);
|
||||
this.myFollowing = new operations.MyFollowing(this);
|
||||
this.myBlockedUsers = new operations.MyBlockedUsers(this);
|
||||
this.userFollowing = new operations.UserFollowing(this);
|
||||
this.topics = new operations.Topics(this);
|
||||
this.myTopics = new operations.MyTopics(this);
|
||||
this.myAppFollowing = new operations.MyAppFollowing(this);
|
||||
this.myApps = new operations.MyApps(this);
|
||||
this.myLikes = new operations.MyLikes(this);
|
||||
this.myLinkedAccounts = new operations.MyLinkedAccounts(this);
|
||||
this.users = new operations.Users(this);
|
||||
this.userTopics = new operations.UserTopics(this);
|
||||
this.models = models;
|
||||
msRest.addSerializationMixin(this);
|
||||
}
|
||||
|
||||
util.inherits(SocialPlusClient, ServiceClient);
|
||||
|
||||
module.exports = SocialPlusClient;
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Загрузка…
Ссылка в новой задаче