Skip to content

Commit 0532822

Browse files
authored
Merge pull request #136 from teamsnap/team-photos
Team photos
2 parents 51450b9 + 2b01154 commit 0532822

File tree

16 files changed

+371
-53
lines changed

16 files changed

+371
-53
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# TeamSnap JavaScript SDK CHANGELOG
22

3+
### June 21, 2016 // Version 1.14.0
4+
- Adds `loadMemberPhotos` method.
5+
- Adds `loadMemberPhoto` method.
6+
- Adds `loadTeamPhotos` method.
7+
- Adds `loadTeamPhoto` method.
8+
9+
---
10+
311
### June 21, 2016 // Version 1.13.5
412
- Reloads `messages` and `messageData` in `saveBroadcastEmail` method in persistence wrapper.
513

docs/collections.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ An APIv3 endpoint’s name is generally derived from its `Collection+JSON` colle
3535
- [Member Links](./collections/member_links.md)
3636
- [Member Payments](./collections/member_payments.md)
3737
- [Member Phone Numbers](./collections/member_phone_numbers.md)
38+
- [Member Photos](./collections/member_photos.md)
3839
- [Member Statistics](./collections/member_statistics.md)
3940
- [Members](./collections/members.md)
4041
- [Members Preferences](./collections/members_preferences.md)
@@ -56,6 +57,7 @@ An APIv3 endpoint’s name is generally derived from its `Collection+JSON` colle
5657
- [Team Statistics](./collections/team_statistics.md)
5758
- [Teams](./collections/teams.md)
5859
- [Teams Paypal Preferences](./collections/teams_paypal_preferences.md)
60+
- [Team Photos](./collections/team_photos.md)
5961
- [Teams Preferences](./collections/teams_preferences.md)
6062
- [Teams Results](./collections/teams_results.md)
6163
- [Tracked Item Statuses](./collections/tracked_item_statuses.md)

docs/collections/member_photo.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Member Photos
2+
3+
## Methods
4+
5+
- [loadMemberPhotos](#loadMemberPhotos)
6+
- [loadMemberPhoto](#loadMemberPhoto)
7+
8+
9+
---
10+
<a id="loadMemberPhotos"></a>
11+
## `loadMemberPhotos(params, callback)`
12+
Loads items from the `memberPhotos` collection based on given params.
13+
14+
### Params
15+
* `params`: [int, object] - can be either a `teamId` or an object with query parameters.
16+
* `callback`: [function] - callback to be executed when the operation completes.
17+
18+
To see a list of all available search params you can run:
19+
`teamsnap.collections.memberPhotos.queries.search.params`
20+
21+
### Examples
22+
```javascript
23+
// ~~~~~
24+
// Loads all memebrPhoto for `teamId: 1`.
25+
teamsnap.loadMemberPhotos(1);
26+
27+
// ~~~~~
28+
// Loads memberPhoto items for `teamId: 1` and specifies the widths to return.
29+
teamsnap.loadMemberPhotos({teamId: 1, width: 200});
30+
```
31+
32+
33+
---
34+
35+
<a id="loadMemberPhoto"></a>
36+
## `loadMemberPhoto(params, callback)`
37+
Loads a single item from the `memberPhotos` collection based on given params.
38+
39+
### Params
40+
* `params`: [int, object] - can be either a `memberPhotoId` or an object with query parameters.
41+
* `callback`: [function] - callback to be executed when the operation completes.
42+
43+
To see a list of all available search params you can run:
44+
`teamsnap.collections.memberPhotos.queries.search.params`
45+
46+
### Examples
47+
```javascript
48+
// ~~~~~
49+
// Loads a memebrPhoto for `id: 1`.
50+
teamsnap.loadMemberPhoto(1);
51+
52+
// ~~~~~
53+
// Loads a memberPhoto for `memberId: 1` and specifies the width to return.
54+
teamsnap.loadMemberPhoto({memberId: 1, width: 200});
55+
```

docs/collections/team_photos.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Team Photos
2+
3+
## Methods
4+
5+
- [loadTeamPhotos](#loadTeamPhotos)
6+
- [loadTeamPhoto](#loadTeamPhoto)
7+
8+
9+
---
10+
<a id="loadTeamPhotos"></a>
11+
## `loadTeamPhotos(params, callback)`
12+
Loads items from the `teamPhotos` collection based on given params.
13+
14+
### Params
15+
* `params`: [int, object] - can be either a `teamId` or an object with query parameters.
16+
* `callback`: [function] - callback to be executed when the operation completes.
17+
18+
To see a list of all available search params you can run:
19+
`teamsnap.collections.loadTeamPhotos.queries.search.params`
20+
21+
### Examples
22+
```javascript
23+
// ~~~~~
24+
// Loads all teamPhotos for `teamId: 1`.
25+
teamsnap.loadTeamPhotos(1);
26+
27+
// ~~~~~
28+
// Loads teamPhoto items for `teamId: 1` and specifies the widths to return.
29+
teamsnap.loadTeamPhotos({teamId: 1, width: 200});
30+
```
31+
32+
33+
---
34+
35+
<a id="loadTeamPhoto"></a>
36+
## `loadTeamPhoto(params, callback)`
37+
Loads a single item from the `teamPhotos` collection based on given params.
38+
39+
### Params
40+
* `params`: [int, object] - can be either a `teamPhotoId` or an object with query parameters.
41+
* `callback`: [function] - callback to be executed when the operation completes.
42+
43+
To see a list of all available search params you can run:
44+
`teamsnap.collections.loadTeamPhotos.queries.search.params`
45+
46+
### Examples
47+
```javascript
48+
// ~~~~~
49+
// Loads a teamPhoto for `id: 1`.
50+
teamsnap.loadTeamPhoto(1);
51+
52+
// ~~~~~
53+
// Loads a teamPhoto for `teamId: 1` and specifies the width to return.
54+
teamsnap.loadTeamPhoto({teamId: 1, width: 200});
55+
```

lib/teamsnap.js

Lines changed: 77 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,52 +8,53 @@ var window, global = {};
88

99
var modules = {};
1010
var cache = {};
11-
var aliases = {};
1211
var has = ({}).hasOwnProperty;
1312

13+
var aliases = {};
14+
1415
var endsWith = function(str, suffix) {
1516
return str.indexOf(suffix, str.length - suffix.length) !== -1;
1617
};
1718

18-
var _cmp = 'components/';
1919
var unalias = function(alias, loaderPath) {
2020
var start = 0;
2121
if (loaderPath) {
22-
if (loaderPath.indexOf(_cmp) === 0) {
23-
start = _cmp.length;
22+
if (loaderPath.indexOf('components/' === 0)) {
23+
start = 'components/'.length;
2424
}
2525
if (loaderPath.indexOf('/', start) > 0) {
2626
loaderPath = loaderPath.substring(start, loaderPath.indexOf('/', start));
2727
}
2828
}
2929
var result = aliases[alias + '/index.js'] || aliases[loaderPath + '/deps/' + alias + '/index.js'];
3030
if (result) {
31-
return _cmp + result.substring(0, result.length - '.js'.length);
31+
return 'components/' + result.substring(0, result.length - '.js'.length);
3232
}
3333
return alias;
3434
};
3535

36-
var _reg = /^\.\.?(\/|$)/;
37-
var expand = function(root, name) {
38-
var results = [], part;
39-
var parts = (_reg.test(name) ? root + '/' + name : name).split('/');
40-
for (var i = 0, length = parts.length; i < length; i++) {
41-
part = parts[i];
42-
if (part === '..') {
43-
results.pop();
44-
} else if (part !== '.' && part !== '') {
45-
results.push(part);
36+
var expand = (function() {
37+
var reg = /^\.\.?(\/|$)/;
38+
return function(root, name) {
39+
var results = [], parts, part;
40+
parts = (reg.test(name) ? root + '/' + name : name).split('/');
41+
for (var i = 0, length = parts.length; i < length; i++) {
42+
part = parts[i];
43+
if (part === '..') {
44+
results.pop();
45+
} else if (part !== '.' && part !== '') {
46+
results.push(part);
47+
}
4648
}
47-
}
48-
return results.join('/');
49-
};
50-
49+
return results.join('/');
50+
};
51+
})();
5152
var dirname = function(path) {
5253
return path.split('/').slice(0, -1).join('/');
5354
};
5455

5556
var localRequire = function(path) {
56-
return function expanded(name) {
57+
return function(name) {
5758
var absolute = expand(dirname(path), name);
5859
return globals.require(absolute, path);
5960
};
@@ -108,7 +109,6 @@ var window, global = {};
108109
};
109110

110111
require.brunch = true;
111-
require._cache = cache;
112112
globals.require = require;
113113
})();
114114
var require = global.require;
@@ -1601,6 +1601,31 @@ exports.deleteMemberPhoneNumber = function(memberPhoneNumber, callback) {
16011601

16021602
});
16031603

1604+
require.register("collections/memberPhotos", function(exports, require, module) {
1605+
exports.loadMemberPhotos = function(params, callback) {
1606+
if (this.isId(params)) {
1607+
params = {
1608+
teamId: params
1609+
};
1610+
} else if (!(params && typeof params === 'object')) {
1611+
throw new TSArgsError('teamsnap.loadMemberPhotos', 'must provide a `teamId` or query parameters');
1612+
}
1613+
return this.loadItems('memberPhoto', params, callback);
1614+
};
1615+
1616+
exports.loadMemberPhoto = function(params, callback) {
1617+
if (this.isId(params)) {
1618+
params = {
1619+
id: params
1620+
};
1621+
} else if (!(params && typeof params === 'object')) {
1622+
throw new TSArgsError('teamsnap.loadMemberPhoto', 'must provide an `id` or query parameters');
1623+
}
1624+
return this.loadItem('memberPhoto', params, callback);
1625+
};
1626+
1627+
});
1628+
16041629
require.register("collections/memberStatistics", function(exports, require, module) {
16051630
exports.loadMemberStatistics = function(params, callback) {
16061631
if (this.isId(params)) {
@@ -2730,6 +2755,31 @@ exports.deleteTeamMediumComment = function(teamMediumComment, callback) {
27302755

27312756
});
27322757

2758+
require.register("collections/teamPhotos", function(exports, require, module) {
2759+
exports.loadTeamPhotos = function(params, callback) {
2760+
if (this.isId(params)) {
2761+
params = {
2762+
teamId: params
2763+
};
2764+
} else if (!(params && typeof params === 'object')) {
2765+
throw new TSArgsError('teamsnap.loadTeamPhotos', 'must provide a `teamId` or query parameters');
2766+
}
2767+
return this.loadItems('teamPhoto', params, callback);
2768+
};
2769+
2770+
exports.loadTeamPhoto = function(params, callback) {
2771+
if (this.isId(params)) {
2772+
params = {
2773+
id: params
2774+
};
2775+
} else if (!(params && typeof params === 'object')) {
2776+
throw new TSArgsError('teamsnap.loadTeamPhoto', 'must provide an `id` or query parameters');
2777+
}
2778+
return this.loadItem('teamPhoto', params, callback);
2779+
};
2780+
2781+
});
2782+
27332783
require.register("collections/teamPublicSites", function(exports, require, module) {
27342784
exports.loadTeamPublicSites = function(params, callback) {
27352785
if (this.isId(params)) {
@@ -5910,6 +5960,8 @@ add(require('./collections/memberPayments'));
59105960

59115961
add(require('./collections/memberPhoneNumbers'));
59125962

5963+
add(require('./collections/memberPhotos'));
5964+
59135965
add(require('./collections/membersPreferences'));
59145966

59155967
add(require('./collections/memberStatistics'));
@@ -5952,6 +6004,8 @@ add(require('./collections/teamPublicSites'));
59526004

59536005
add(require('./collections/teamsPaypalPreferences'));
59546006

6007+
add(require('./collections/teamPhotos'));
6008+
59556009
add(require('./collections/teamsPreferences'));
59566010

59576011
add(require('./collections/teamsResults'));
@@ -5996,7 +6050,7 @@ ref = require('./model'), Collection = ref.Collection, Item = ref.Item;
59966050
require('./errors');
59976051

59986052
TeamSnap = (function() {
5999-
TeamSnap.prototype.version = '1.13.5';
6053+
TeamSnap.prototype.version = '1.14.0';
60006054

60016055
TeamSnap.prototype.promises = promises;
60026056

@@ -6036,7 +6090,7 @@ var i, len, plural, pluralLookup, singularLookup, teamTypes, teamsnap, type, typ
60366090

60376091
teamsnap = exports;
60386092

6039-
types = ['user', 'assignment', 'availability', 'broadcastAlert', 'broadcastEmail', 'broadcastEmailAttachment', 'contact', 'contactEmailAddress', 'contactPhoneNumber', 'customDatum', 'customField', 'leagueCustomDatum', 'leagueCustomField', 'divisionContact', 'divisionContactEmailAddress', 'divisionContactPhoneNumber', 'divisionLocation', 'divisionMember', 'divisionMemberEmailAddress', 'divisionMemberPhoneNumber', 'divisionMemberPreferences', 'divisionTeamStanding', 'event', 'eventStatistic', 'facebookPage', 'forumPost', 'forumSubscription', 'forumTopic', 'leagueRegistrantDocument', 'location', 'member', 'memberBalance', 'memberEmailAddress', 'memberFile', 'memberLink', 'memberPayment', 'memberPhoneNumber', 'memberPreferences', 'memberStatistic', 'message', 'messageDatum', 'opponent', 'opponentResults', 'paymentNote', 'plan', 'smsGateway', 'sponsor', 'statistic', 'statisticAggregate', 'statisticDatum', 'statisticGroup', 'sport', 'team', 'teamFee', 'teamMedium', 'teamMediumComment', 'teamMediaGroup', 'teamPaypalPreferences', 'teamPreferences', 'teamPublicSite', 'teamResults', 'teamStatistic', 'timeZone', 'trackedItem', 'trackedItemStatus'];
6093+
types = ['user', 'assignment', 'availability', 'broadcastAlert', 'broadcastEmail', 'broadcastEmailAttachment', 'contact', 'contactEmailAddress', 'contactPhoneNumber', 'customDatum', 'customField', 'leagueCustomDatum', 'leagueCustomField', 'divisionContact', 'divisionContactEmailAddress', 'divisionContactPhoneNumber', 'divisionLocation', 'divisionMember', 'divisionMemberEmailAddress', 'divisionMemberPhoneNumber', 'divisionMemberPreferences', 'divisionTeamStanding', 'event', 'eventStatistic', 'facebookPage', 'forumPost', 'forumSubscription', 'forumTopic', 'leagueRegistrantDocument', 'location', 'member', 'memberBalance', 'memberEmailAddress', 'memberFile', 'memberLink', 'memberPayment', 'memberPhoneNumber', 'memberPhoto', 'memberPreferences', 'memberStatistic', 'message', 'messageDatum', 'opponent', 'opponentResults', 'paymentNote', 'plan', 'smsGateway', 'sponsor', 'statistic', 'statisticAggregate', 'statisticDatum', 'statisticGroup', 'sport', 'team', 'teamFee', 'teamMedium', 'teamMediumComment', 'teamMediaGroup', 'teamPaypalPreferences', 'teamPhoto', 'teamPreferences', 'teamPublicSite', 'teamResults', 'teamStatistic', 'timeZone', 'trackedItem', 'trackedItemStatus'];
60406094

60416095
teamTypes = types.slice();
60426096

lib/teamsnap.min.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)