Skip to content
This repository was archived by the owner on May 28, 2024. It is now read-only.

Commit 235a715

Browse files
authored
Merge pull request #57 from deskbookers/ft-DSK-1323-availability-api-fullcalendar
Ft dsk 1323 availability api fullcalendar
2 parents 73a761d + 0e763d1 commit 235a715

File tree

3 files changed

+60
-2
lines changed

3 files changed

+60
-2
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ for (let workplace of workplaces) {
5353
* [`report(params)`](docs/actions.md#reportparams)
5454
* availability
5555
* [`retrieve(params)`](docs/availability.md#retrieveparams)
56+
* [`retrieveForFullCalendar(params)`](docs/availability.md#retrieveforfullcalendarparams)
5657
* spaces
5758
* [`retrieve(id)`](docs/spaces.md#retrieveid)
5859
* [`urgency(id, params)`](docs/spaces.md#urgencyid-params)

docs/availability.md

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ await deskbookers.availability.retrieve({
1111
})
1212
```
1313

14-
#### Arguments
14+
### Arguments
1515
Name | Type | Description | Required
1616
--- | --- | --- | ---
1717
venueId | Number | Venue ID | Yes
1818
start | String | Start date (YYYY-MM-DD) | Yes
1919
end | String | End date (YYYY-MM-DD), exclusive | Yes
2020
noCache | Bool | Ignore cache | No
2121

22-
#### Example response
22+
### Example response
2323

2424
```json
2525
{
@@ -53,3 +53,44 @@ noCache | Bool | Ignore cache | No
5353
]
5454
}
5555
```
56+
57+
## `retrieveForFullCalendar(params)`
58+
Retrieve fullcalendar availability for a given space and date range.
59+
60+
```js
61+
await deskbookers.availability.retrieveForFullCalendar({
62+
spaceId: 12345,
63+
start: '2017-05-01',
64+
end: '2017-05-08'
65+
})
66+
```
67+
68+
### Arguments
69+
Name | Type | Description | Required
70+
--- | --- | --- | ---
71+
spaceId | Number | Space ID | Yes
72+
start | String | Start date (YYYY-MM-DD) | Yes
73+
end | String | End date (YYYY-MM-DD), exclusive | Yes
74+
noCache | Bool | Ignore cache | No
75+
76+
### Example response
77+
78+
```json
79+
[
80+
{
81+
"type": "closed",
82+
"start": 1508709600,
83+
"end": 1508742000
84+
},
85+
{
86+
"type": "onRequest",
87+
"start": 1508824800,
88+
"end": 1508828400
89+
},
90+
{
91+
"type": "occupied",
92+
"start": 1508868000,
93+
"end": 1508882400
94+
}
95+
]
96+
```

src/resources/Availability.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,20 @@ export default class Availability extends Resource {
1818
}
1919
})
2020
}
21+
22+
async retrieveForFullCalendar({
23+
start,
24+
end,
25+
spaceId,
26+
noCache = false
27+
}) {
28+
return await this.request({
29+
path: `spaces/${spaceId}/fullCalendar`,
30+
params: {
31+
noCache,
32+
start,
33+
end
34+
}
35+
})
36+
}
2137
}

0 commit comments

Comments
 (0)