Merge pull request #4 from Microsoft/PostImageFix

changed post image and get image type
This commit is contained in:
Sharad Agarwal 2016-03-24 20:57:32 -07:00
Родитель 669c64f0e2 a366598cef
Коммит 9275010ab7
20 изменённых файлов: 58 добавлений и 30 удалений

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

@ -227,7 +227,7 @@ Blobs.prototype.getBlob = function (blobHandle, authorization, options, callback
httpRequest.body = null;
// Send Request
httpRequest.streamedResponse = true;
return client.pipeline(httpRequest, function (err, response) {
return client.pipeline(httpRequest, function (err, response, responseBody) {
if (err) {
return callback(err);
}
@ -236,8 +236,22 @@ Blobs.prototype.getBlob = function (blobHandle, authorization, options, callback
if (statusCode !== 200 && statusCode !== 400 && statusCode !== 401 && statusCode !== 404 && statusCode !== 500) {
var error = new Error(util.format('Unexpected status code: %s', statusCode));
error.statusCode = response.statusCode;
error.request = httpRequest;
error.response = response;
error.request = msRest.stripRequest(httpRequest);
error.response = msRest.stripResponse(response);
if (responseBody === '') responseBody = null;
var parsedErrorResponse;
try {
if (responseBody !== undefined) 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);
}

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

@ -259,8 +259,8 @@ CommentReplies.prototype.postReply = function (commentHandle, request, authoriza
if (request !== null && request !== undefined) {
var requestModelMapper = new client.models['PostReplyRequest']().mapper();
requestModel = client.serialize(requestModelMapper, request, 'request');
requestContent = JSON.stringify(requestModel);
}
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})));

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

@ -111,8 +111,8 @@ CommentReports.prototype.postReport = function (commentHandle, postReportRequest
if (postReportRequest !== null && postReportRequest !== undefined) {
var requestModelMapper = new client.models['PostReportRequest']().mapper();
requestModel = client.serialize(requestModelMapper, postReportRequest, 'postReportRequest');
requestContent = JSON.stringify(requestModel);
}
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})));

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

@ -260,7 +260,7 @@ Images.prototype.getImage = function (blobHandle, options, callback) {
httpRequest.body = null;
// Send Request
httpRequest.streamedResponse = true;
return client.pipeline(httpRequest, function (err, response) {
return client.pipeline(httpRequest, function (err, response, responseBody) {
if (err) {
return callback(err);
}
@ -269,8 +269,22 @@ Images.prototype.getImage = function (blobHandle, options, callback) {
if (statusCode !== 200 && statusCode !== 400 && statusCode !== 401 && statusCode !== 404 && statusCode !== 500) {
var error = new Error(util.format('Unexpected status code: %s', statusCode));
error.statusCode = response.statusCode;
error.request = httpRequest;
error.response = response;
error.request = msRest.stripRequest(httpRequest);
error.response = msRest.stripResponse(response);
if (responseBody === '') responseBody = null;
var parsedErrorResponse;
try {
if (responseBody !== undefined) 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);
}

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

@ -245,8 +245,8 @@ MyBlockedUsers.prototype.postBlockedUser = function (request, authorization, opt
if (request !== null && request !== undefined) {
var requestModelMapper = new client.models['PostBlockedUserRequest']().mapper();
requestModel = client.serialize(requestModelMapper, request, 'request');
requestContent = JSON.stringify(requestModel);
}
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})));

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

@ -245,8 +245,8 @@ MyFollowers.prototype.postFollower = function (request, authorization, options,
if (request !== null && request !== undefined) {
var requestModelMapper = new client.models['PostFollowerRequest']().mapper();
requestModel = client.serialize(requestModelMapper, request, 'request');
requestContent = JSON.stringify(requestModel);
}
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})));

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

@ -245,8 +245,8 @@ MyFollowing.prototype.postFollowing = function (request, authorization, options,
if (request !== null && request !== undefined) {
var requestModelMapper = new client.models['PostFollowingRequest']().mapper();
requestModel = client.serialize(requestModelMapper, request, 'request');
requestContent = JSON.stringify(requestModel);
}
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})));

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

@ -248,8 +248,8 @@ MyLinkedAccounts.prototype.postLinkedAccount = function (request, authorization,
if (request !== null && request !== undefined) {
var requestModelMapper = new client.models['PostLinkedAccountRequest']().mapper();
requestModel = client.serialize(requestModelMapper, request, 'request');
requestContent = JSON.stringify(requestModel);
}
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})));

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

@ -104,8 +104,8 @@ MyNotifications.prototype.putNotificationsStatus = function (request, authorizat
if (request !== null && request !== undefined) {
var requestModelMapper = new client.models['PutNotificationsStatusRequest']().mapper();
requestModel = client.serialize(requestModelMapper, request, 'request');
requestContent = JSON.stringify(requestModel);
}
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})));

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

@ -244,8 +244,8 @@ MyPins.prototype.postPin = function (request, authorization, options, callback)
if (request !== null && request !== undefined) {
var requestModelMapper = new client.models['PostPinRequest']().mapper();
requestModel = client.serialize(requestModelMapper, request, 'request');
requestContent = JSON.stringify(requestModel);
}
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})));

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

@ -130,8 +130,8 @@ MyPushRegistrations.prototype.putPushRegistration = function (platform, registra
if (request !== null && request !== undefined) {
var requestModelMapper = new client.models['PutPushRegistrationRequest']().mapper();
requestModel = client.serialize(requestModelMapper, request, 'request');
requestContent = JSON.stringify(requestModel);
}
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})));

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

@ -111,8 +111,8 @@ ReplyReports.prototype.postReport = function (replyHandle, postReportRequest, au
if (postReportRequest !== null && postReportRequest !== undefined) {
var requestModelMapper = new client.models['PostReportRequest']().mapper();
requestModel = client.serialize(requestModelMapper, postReportRequest, 'postReportRequest');
requestContent = JSON.stringify(requestModel);
}
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})));

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

@ -133,8 +133,8 @@ Sessions.prototype.postSession = function (request, options, callback) {
if (request !== null && request !== undefined) {
var requestModelMapper = new client.models['PostSessionRequest']().mapper();
requestModel = client.serialize(requestModelMapper, request, 'request');
requestContent = JSON.stringify(requestModel);
}
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})));

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

@ -265,8 +265,8 @@ TopicComments.prototype.postComment = function (topicHandle, request, authorizat
if (request !== null && request !== undefined) {
var requestModelMapper = new client.models['PostCommentRequest']().mapper();
requestModel = client.serialize(requestModelMapper, request, 'request');
requestContent = JSON.stringify(requestModel);
}
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})));

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

@ -111,8 +111,8 @@ TopicReports.prototype.postReport = function (topicHandle, postReportRequest, au
if (postReportRequest !== null && postReportRequest !== undefined) {
var requestModelMapper = new client.models['PostReportRequest']().mapper();
requestModel = client.serialize(requestModelMapper, postReportRequest, 'postReportRequest');
requestContent = JSON.stringify(requestModel);
}
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})));

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

@ -275,8 +275,8 @@ Topics.prototype.postTopic = function (request, authorization, options, callback
if (request !== null && request !== undefined) {
var requestModelMapper = new client.models['PostTopicRequest']().mapper();
requestModel = client.serialize(requestModelMapper, request, 'request');
requestContent = JSON.stringify(requestModel);
}
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})));
@ -559,8 +559,8 @@ Topics.prototype.putTopic = function (topicHandle, request, authorization, optio
if (request !== null && request !== undefined) {
var requestModelMapper = new client.models['PutTopicRequest']().mapper();
requestModel = client.serialize(requestModelMapper, request, 'request');
requestContent = JSON.stringify(requestModel);
}
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})));

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

@ -111,8 +111,8 @@ UserReports.prototype.postReport = function (userHandle, postReportRequest, auth
if (postReportRequest !== null && postReportRequest !== undefined) {
var requestModelMapper = new client.models['PostReportRequest']().mapper();
requestModel = client.serialize(requestModelMapper, postReportRequest, 'postReportRequest');
requestContent = JSON.stringify(requestModel);
}
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})));

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

@ -155,8 +155,8 @@ Users.prototype.postUser = function (request, options, callback) {
if (request !== null && request !== undefined) {
var requestModelMapper = new client.models['PostUserRequest']().mapper();
requestModel = client.serialize(requestModelMapper, request, 'request');
requestContent = JSON.stringify(requestModel);
}
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})));
@ -541,8 +541,8 @@ Users.prototype.putUserInfo = function (request, authorization, options, callbac
if (request !== null && request !== undefined) {
var requestModelMapper = new client.models['PutUserInfoRequest']().mapper();
requestModel = client.serialize(requestModelMapper, request, 'request');
requestContent = JSON.stringify(requestModel);
}
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})));
@ -686,8 +686,8 @@ Users.prototype.putUserPhoto = function (request, authorization, options, callba
if (request !== null && request !== undefined) {
var requestModelMapper = new client.models['PutUserPhotoRequest']().mapper();
requestModel = client.serialize(requestModelMapper, request, 'request');
requestContent = JSON.stringify(requestModel);
}
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})));
@ -832,8 +832,8 @@ Users.prototype.putUserVisibility = function (request, authorization, options, c
if (request !== null && request !== undefined) {
var requestModelMapper = new client.models['PutUserVisibilityRequest']().mapper();
requestModel = client.serialize(requestModelMapper, request, 'request');
requestContent = JSON.stringify(requestModel);
}
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})));

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

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

@ -54,7 +54,7 @@
"required": true,
"schema": {
"format": "file",
"type": "object"
"type": "file"
}
}
],
@ -571,7 +571,7 @@
"required": true,
"schema": {
"format": "file",
"type": "object"
"type": "file"
}
}
],
@ -4194,7 +4194,7 @@
"tags": [
"Users"
],
"summary": "Create a new user using the following flow:\r\n 1. Validate and parse the identity provider access token to construct an identity provider user\r\n 2. If identity provider user present in linked account table, read user profile for this specific application from user profile table\r\n 3. If user profile exists, return user conflict\r\n 4. Otherwise, it means that the user does not have a profile for this particular application. Create one.\r\n 5. Otherwise, the identity provider user is not present. Create the user, and its user profile.\r\n 6. Generate session token, and return\r\n The purpose of steps 2-4 is to ensure that if the user has already registered with us using the same identity provider\r\n but for a different SocialPlus application, we reuse his user-handle and just resume to create a new profile for this specific \r\n SocialPlus application. The end result is that we know it is the same user in both apps.",
"summary": "Create a new user using the following flow:\r\n 1. Validate and parse the identity provider access token to construct an identity provider user\r\n 2. If identity provider user present in linked account table, read user profile for this specific application from user profile table\r\n 3. If user profile exists, return user conflict\r\n 4. Otherwise, it means that the user does not have a profile for this particular application. Create one.\r\n 5. Otherwise, the identity provider user is not present. Create the user, and its user profile.\r\n 6. Generate session token, and return\r\n The purpose of steps 2-4 is to ensure that if the user has already registered with us using the same identity provider\r\n but for a different SocialPlus application, we reuse his user-handle and just resume to create a new profile for this specific\r\n SocialPlus application. The end result is that we know it is the same user in both apps.",
"operationId": "Users_PostUser",
"consumes": [
"application/json",