> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# getTimeSlots

# Package: @wix/table-reservations

# Namespace: timeSlots

# Method link: https://dev.wix.com/docs/api-reference/business-solutions/restaurants/reservations/time-slots/get-time-slots.md

## Permission Scopes:
Manage Reservations (Basic): SCOPE.DC-RESERVATIONS.MANAGE-RESERVATIONS-BASIC

## Introduction

Returns a list of time slots at a specified reservation location on a specified `date`, and their availability for a specified `partySize`.

Without passing optional parameters, the list will contain a single time slot at the specified `date`.
Use `slotsBefore` and `slotsAfter` to get additional time slots before and after the specified `date`.

If you do not provide a `duration`, the duration will be calculated automatically based on the reservation location's configuration.
The reservation location's settings used to determine the duration are its `defaultTurnoverTime` and `turnoverTimeRules`. These specify how much time should be allotted for a reservation of a party of a specified size.

The interval between `startDate`s of time slots in the response is determined by the reservation location's `timeSlotInterval`. This interval is not affected by the `duration` provided.

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.tableReservations.timeSlots.getTimeSlots(reservationLocationId, date, partySize, options)
 Description: Returns a list of time slots at a specified reservation location on a specified `date`, and their availability for a specified `partySize`.  Without passing optional parameters, the list will contain a single time slot at the specified `date`. Use `slotsBefore` and `slotsAfter` to get additional time slots before and after the specified `date`.  If you do not provide a `duration`, the duration will be calculated automatically based on the reservation location's configuration. The reservation location's settings used to determine the duration are its `defaultTurnoverTime` and `turnoverTimeRules`. These specify how much time should be allotted for a reservation of a party of a specified size.  The interval between `startDate`s of time slots in the response is determined by the reservation location's `timeSlotInterval`. This interval is not affected by the `duration` provided.
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  reservationLocationId, date, partySize
 Method parameters: 
   param name: date | type: string | description: Date and time for which to retrieve a time slot in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#coordinated_Universal_Time_(UTC)) format. | required: true | validation: format date-time
   param name: options | type: GetTimeSlotsOptions  none  
        - name: duration | type: integer | description: Duration in minutes of the time slot.  Min: `5`  | validation: minimum 5, maximum 1000, format int32
        - name: slotsBefore | type: integer | description: The number of time slots to retrieve before the specified `date`.  | validation: minimum 0, maximum 50, format int32
        - name: slotsAfter | type: integer | description: The number of time slots to retrieve after the specified `date`.  | validation: minimum 0, maximum 50, format int32
   param name: partySize | type: integer | description: Size of the party that needs to be seated during this time slot.  Min: `1` | required: true | validation: minimum 1, maximum 10000, format int32
   param name: reservationLocationId | type: string | description: GUID of the reservation location for which to retrieve time slots. | required: true | validation: format GUID
 Return type: PROMISE<GetTimeSlotsResponse>
  - name: timeSlots | type: array<TimeSlot> | description: A list of time slots and their availability according to the specified party size.  
     - name: startDate | type: Date | description: Start date and time of this time slot.  
     - name: duration | type: integer | description: Duration in minutes of this time slot.  
     - name: status | type: Status | description: Availability status of this time slot.  
         - enum:
         -     AVAILABLE: The restaurant can accommodate a party of the given size in this time slot.
         -     UNAVAILABLE: The restaurant can't accommodate a party of the given size in this time slot.
         -     NON_WORKING_HOURS: The restaurant is not open during this time slot. Time slots retrieved by Get Scheduled Time Slots never have this status.
     - name: manualApproval | type: boolean | description: Whether manual approval is required to make a reservation in this time slot.  


```

### Examples

### getTimeSlots
```javascript
import { timeSlots } from '@wix/table-reservations';

async function getTimeSlots(reservationLocationId,date,partySize,options) {
  const response = await timeSlots.getTimeSlots(reservationLocationId,date,partySize,options);
};
```

### getTimeSlots (with elevated permissions)
```javascript
import { timeSlots } from '@wix/table-reservations';
import { auth } from '@wix/essentials';

async function myGetTimeSlotsMethod(reservationLocationId,date,partySize,options) {
  const elevatedGetTimeSlots = auth.elevate(timeSlots.getTimeSlots);
  const response = await elevatedGetTimeSlots(reservationLocationId,date,partySize,options);
}
```

### getTimeSlots (self-hosted)
Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md).

```javascript
import { createClient } from '@wix/sdk';
import { timeSlots } from '@wix/table-reservations';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

const myWixClient = createClient ({
  modules: { timeSlots },
  // Include the auth strategy and host as relevant
});


async function getTimeSlots(reservationLocationId,date,partySize,options) {
  const response = await myWixClient.timeSlots.getTimeSlots(reservationLocationId,date,partySize,options);
};
```

---