Skip to content
This repository was archived by the owner on Jan 9, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## Unreleased
## [2.86.0] - 2019-11-19
### Added
- support for profile images

## 2.77.3 - Aug 16, 2019
- Added support for the following sheet summary methods:
- `sheets.getSummary`
Expand Down
11 changes: 10 additions & 1 deletion lib/users/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,23 @@ exports.create = function(options) {
var removeUser = (deleteOptions, callback) =>
requestor.delete(_.extend({}, optionsToSend, deleteOptions), callback);

var addProfileImage = (postOptions, callback) => {
var urlOptions = {url: buildProfileImageUrl(postOptions)};
return requestor.postFile(_.extend({}, optionsToSend, urlOptions, postOptions), callback);
};

var buildProfileImageUrl = urlOptions =>
options.apiUrls.users + urlOptions.userId + '/profileimage'

var userObject = {
getUser : listAllUsers,
listAllUsers : listAllUsers,
getCurrentUser : getCurrentUser,
addUser : addUser,
addUserAndSendEmail : addUserAndSendEmail,
updateUser : updateUser,
removeUser : removeUser
removeUser : removeUser,
addProfileImage : addProfileImage,
};

_.extend(userObject, alternateEmails.create(options));
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "smartsheet",
"version": "2.77.4",
"version": "2.86.0",
"description": "Smartsheet JavaScript client SDK",
"main": "index.js",
"scripts": {
Expand Down
3 changes: 2 additions & 1 deletion test/functional/client_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ describe('Client Unit Tests', function() {
describe('#users', function () {
it('should have user object', function () {
smartsheet.should.have.property('users');
Object.keys(smartsheet.users).should.be.length(12);
Object.keys(smartsheet.users).should.be.length(13);
});

it('should have get methods', function () {
Expand All @@ -381,6 +381,7 @@ describe('Client Unit Tests', function() {
smartsheet.users.should.have.property('addUser');
smartsheet.users.should.have.property('addUserAndSendEmail');
smartsheet.users.should.have.property('addAlternateEmail');
smartsheet.users.should.have.property('addProfileImage');
});

it('should have update methods', function () {
Expand Down
2 changes: 2 additions & 0 deletions test/functional/endpoints_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,8 @@ describe('Method Unit Tests', function () {
{ name: 'listAlternateEmails', stub: 'get', options: {userId: 123}, expectedRequest: {url: "users/123/alternateemails/"}},
{ name: 'makeAlternateEmailPrimary', stub: 'post', options: {userId: 123, alternateEmailId: 234}, expectedRequest: {url: "users/123/alternateemails/234/makeprimary"}},
{ name: 'deleteAlternateEmail', stub: 'delete', options: {userId: 123, alternateEmailId: 234}, expectedRequest: {url: "users/123/alternateemails/234"}},
// profile image
{ name: 'addProfileImage', stub: 'postFile', options: {userId: 123}, expectedRequest: {url: "users/123/profileimage"}},
]
},
{
Expand Down