Skip to content

Commit 1e5f1d5

Browse files
committed
Build 1.6.0
1 parent c646349 commit 1e5f1d5

File tree

2 files changed

+42
-3
lines changed

2 files changed

+42
-3
lines changed

lib/teamsnap.js

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3116,6 +3116,10 @@ ScopedCollection = (function(superClass) {
31163116
return this.commands.exec(this._request, commandName, params, callback);
31173117
};
31183118

3119+
ScopedCollection.prototype.file = function(commandName, params, progress, callback) {
3120+
return this.commands.fileExec(this._request, commandName, params, progress, callback);
3121+
};
3122+
31193123
return ScopedCollection;
31203124

31213125
})(Collection);
@@ -3369,6 +3373,29 @@ MetaList = (function() {
33693373
return this._request(request, 'post', rel, params, 'items').callback(callback);
33703374
};
33713375

3376+
MetaList.prototype.fileExec = function(request, rel, params, progress, callback) {
3377+
var progressEvent, progressHook;
3378+
if (typeof params === 'function') {
3379+
callback = progressEvent;
3380+
progressEvent = params;
3381+
params = void 0;
3382+
}
3383+
progressHook = function(xhr, data) {
3384+
if (data instanceof FormData) {
3385+
return xhr.upload.addEventListener('progress', function(e) {
3386+
if (e.lengthComputable) {
3387+
return progress({
3388+
loaded: e.loaded,
3389+
total: e.total
3390+
});
3391+
}
3392+
});
3393+
}
3394+
};
3395+
request.hook(progressHook);
3396+
return this._request(request, 'post', rel, params, 'items').callback(callback);
3397+
};
3398+
33723399
MetaList.prototype.cloneEmpty = function() {
33733400
var clone, entry, rel;
33743401
clone = new MetaList();
@@ -3838,6 +3865,18 @@ modifySDK = function(sdk) {
38383865
}).callback(callback);
38393866
};
38403867
});
3868+
wrapSave(sdk, 'bulkSaveStatisticData', function(templates) {
3869+
if ((templates[0] != null) && (templates[0].memberId != null)) {
3870+
return sdk.loadMemberStatistics({
3871+
memberId: templates[0].memberId
3872+
});
3873+
}
3874+
});
3875+
wrapSave(sdk, 'saveStatisticDatum', function(statisticDatum) {
3876+
return sdk.loadMemberStatistics({
3877+
statisticId: statisticDatum.statisticId
3878+
});
3879+
});
38413880
wrapMethod(sdk, 'bulkDeleteStatisticData', function(bulkDeleteStatisticData) {
38423881
return function(member, event, callback) {
38433882
var ref1, toRemove;
@@ -4942,7 +4981,7 @@ ref = require('./model'), Collection = ref.Collection, Item = ref.Item;
49424981
require('./errors');
49434982

49444983
TeamSnap = (function() {
4945-
TeamSnap.prototype.version = '1.5.1';
4984+
TeamSnap.prototype.version = '1.6.0';
49464985

49474986
TeamSnap.prototype.promises = promises;
49484987

0 commit comments

Comments
 (0)