Skip to content

API Reference: Availability

hanjiexi edited this page Jun 5, 2021 · 1 revision

Availability

Resource

A user can mark certain time slots (denoted as UTC-standardized ISO strings on the hour, ie. 2021-04-10T05:00:00Z) as available. If they do so, other users will be able to find matches and invite them to a mock interview. This resource is unique on userId + startTime.

interface Availability {
   id: uuid;
   userId: uuid;
   startTime: string; // ISO DateTime String in UTC
   isAvailable: boolean;
}

AvailabilityWithUser

This represents a more detailed interface to be used when other users are querying availability, and includes details of the other user.

interface AvailabilityWithUser extends Availability {
   user: InterviewUser;
}

Get Availability: GET /availability?start={startTime}&endTime={endTime}

Gets all availabilities for the authenticated user from startTime to endTime inclusive

  • This is authenticated, so no userId is specified in the request
  • Defaults to next 7 days if both query params are not specified
  • We return Availability instead of InterviewAvailability because this is for the calendar

GetAvailabilityResponse

interface GetAvailabilityResponse {
   availabilities: Availability[];
}

Set Availability: PUT /availability

Set availabilities for a user in a batched request

  • This is authenticated, so no userId is specified in the request
  • We return Availability instead of InterviewAvailability because this is for the calendar

SetAvailabilityRequest

interface SetAvailabilityRequest {
   availabilities: {
      [key: string]: boolean; // ISO DateTime String in UTC
   }
}

SetAvailabilityResponse

  • Identical to GetAvailabilityResponse
interface SetAvailabilityResponse {
   availabilities: Availability[];
}

Search Availability: POST /availability/search

Search for availabilities from other users given a certain timeslot (denoted as an ISO DateTime String in UTC)

  • This is an authenticated request. Response should filter out availability of currentUser.
  • Ideally, this response returns availabilities in 'best match' order.
  • This also only returns items with isAvailable: true

SearchAvailabilityRequest

interface SearchAvailabilityRequest {
   startTime: string // ISO DateTime String in UTC
}

SearchAvailabilityResponse

interface SearchAvailabilityResponse {
   availabilities: AvailabilityWithUser[];
}