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

Commit c2e0d34

Browse files
committed
Merge branch 'master' of github.com:deskbookers/sdk-javascript
2 parents 86c65c5 + 235a715 commit c2e0d34

File tree

7 files changed

+67
-6
lines changed

7 files changed

+67
-6
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
}

src/resources/Resource.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { signer, formatArgs, phpJsonEncode } from '../utils/requests'
22
import platform from 'platform'
3-
import { get, includes, isEmpty } from 'lodash'
3+
import get from 'lodash/get'
4+
import includes from 'lodash/includes'
5+
import isEmpty from 'lodash/isEmpty'
46
import {
57
DeskbookersError,
68
InvalidResponseError

src/resources/account/Preferences.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import Resource from '../Resource'
2-
import { pickAll } from 'ramda'
2+
import pickAll from 'ramda/src/pickAll'
33

44
// Construct Map from object
55
const constructMap = o => {

src/utils/requests.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import { parse } from 'url'
33
import { stringify } from 'qs'
44
import jsonEncode from 'json_encode'
55
import urlencode from 'deskbookers-phpurlencode'
6-
import { includes, isEmpty } from 'lodash'
6+
import includes from 'lodash/includes'
7+
import isEmpty from 'lodash/isEmpty'
78

89
export const signer = ({ publicKey, privateKey }, url, options, args) => {
910
// Prepare vars

test/payments.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
import dotenv from 'dotenv'
3-
import { get } from 'lodash'
3+
import get from 'lodash/get'
44
import 'fetch-everywhere'
55
import test from 'ava'
66
import Deskbookers from '../src'

0 commit comments

Comments
 (0)