Skip to content

Commit c3cc920

Browse files
fix: 🐛 added api_version param which is to be passed in headers
1 parent 4723524 commit c3cc920

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

lib/organization/teams/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,11 @@ export function Teams (http, data) {
153153
* client.organization('organizationUid').teams().fetchAll()
154154
* .then((response) => console.log(response))
155155
*/
156-
this.fetchAll = fetchAll(http, TeamsCollection)
156+
this.fetchAll = fetchAll(http, TeamsCollection, { api_version: 1.1 })
157157
}
158158
}
159159
export function TeamsCollection (http, teamsData) {
160-
const obj = cloneDeep(teamsData) || []
160+
const obj = cloneDeep(teamsData.teams) || []
161161
const teamsCollection = obj.map((team) => {
162162
return new Teams(http, team)
163163
})

test/typescript/teams.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ export function testTeams (organization: Organization) {
77
test('should fetch all the teams', done => {
88
organization.teams().fetchAll()
99
.then((teams) => {
10-
expect(teams[0].organizationUid).not.to.be.equal(undefined)
11-
expect(teams[0].name).not.to.be.equal(null)
12-
expect(teams[0].created_by).not.to.be.equal(null)
13-
expect(teams[0].updated_by).not.to.be.equal(null)
10+
expect(teams.items[0].organizationUid).not.to.be.equal(undefined)
11+
expect(teams.items[0].name).not.to.be.equal(null)
12+
expect(teams.items[0].created_by).not.to.be.equal(null)
13+
expect(teams.items[0].updated_by).not.to.be.equal(null)
1414
done()
1515
})
1616
.catch(done)

types/teams/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export interface Team extends TeamData {
1515
}
1616

1717
export interface Teams extends Creatable<Team, TeamData> {
18-
fetchAll(params?: AnyProperty): Promise<ContentstackCollection<Teams>>
18+
fetchAll(params?: AnyProperty): Promise<ContentstackCollection<Team>>
1919
}
2020

2121
export interface TeamData extends AnyProperty {

0 commit comments

Comments
 (0)