### Key-Value Database Operations Source: https://context7.com/joelface/bg1/llms.txt Illustrates basic key-value storage using localStorage, including setting, getting, deleting, and clearing data. Also shows how to use daily-expiring data that resets at the start of a new park day. ```typescript import kvdb from '@/kvdb'; // Basic key-value operations kvdb.set('user.preferences', { theme: 'dark', notifications: true }); const prefs = kvdb.get<{ theme: string; notifications: boolean }>('user.preferences'); console.log(prefs?.theme); // 'dark' kvdb.delete('user.preferences'); kvdb.clear(); // Clear all storage // Daily data (automatically expires at park day change) interface DailyStats { bookingsCount: number; lastRefresh: string; } kvdb.setDaily('stats', { bookingsCount: 5, lastRefresh: new Date().toISOString() }); // Returns undefined if it's a different park day const stats = kvdb.getDaily('stats'); if (stats) { console.log(`Bookings today: ${stats.bookingsCount}`); } ``` -------------------------------- ### HTTP JSON Fetch Requests Source: https://context7.com/joelface/bg1/llms.txt Provides examples of making JSON-focused HTTP requests using a wrapper around the native fetch API. Covers GET and POST requests, query parameters, custom headers, methods, and timeout configuration. ```typescript import { fetchJson, JsonResponse, JsonOK } from '@/fetch'; // Basic GET request const response = await fetchJson<{ name: string; id: string }> ('https://api.example.com/resource'); if (response.ok) { console.log('Data:', response.data); } else { console.log('Error:', response.status); } // POST request with data const postResponse = await fetchJson('https://api.example.com/resource', { data: { name: 'Test', value: 123 }, // Automatically sets POST method and JSON headers timeout: 5000 // Custom timeout in ms (default: 8000) }); // Request with query parameters const queryResponse = await fetchJson('https://api.example.com/search', { params: { q: 'space mountain', parkId: '80007944' } }); // Results in: https://api.example.com/search?q=space%20mountain&parkId=80007944 // Custom headers and method const customResponse = await fetchJson('https://api.example.com/resource/123', { method: 'DELETE', headers: { 'Authorization': 'Bearer token123' } }); ``` -------------------------------- ### Create and Manipulate ParkTime Objects Source: https://context7.com/joelface/bg1/llms.txt Demonstrates creating ParkTime instances from hours/minutes/seconds or strings, adding durations, modifying components, and comparing times. Assumes park day starts at 4 AM for comparisons. ```typescript import { ParkTime, DateTime, parkDate, formatDate, formatTime, modifyDate, upcomingTimes } from '@/datetime'; // Create ParkTime instances const time1 = new ParkTime(14, 30, 0); // 2:30 PM const time2 = ParkTime.from('09:15:00'); // 9:15 AM const time3 = ParkTime.from({ hour: 18, minute: 45, second: 0 }); // 6:45 PM console.log(time1.toString()); // '14:30:00' console.log(time1.hour, time1.minute, time1.second); // 14 30 0 // Add duration to time const laterTime = time1.add({ hours: 1, minutes: 15 }); console.log(laterTime.toString()); // '15:45:00' // Modify time components const modified = time1.with({ minute: 0 }); console.log(modified.toString()); // '14:00:00' // Compare times (considers park day starting at 4 AM) console.log(time1 > time2); // true console.log(time1.equals('14:30:00')); // true ``` -------------------------------- ### Get Real-Time Show Times with LiveDataClient Source: https://context7.com/joelface/bg1/llms.txt Initialize LiveDataClient to fetch real-time show times for a given park. Displays show names, availability, and upcoming times or unavailability reasons. ```typescript import { LiveDataClient } from '@/api/livedata'; import { Resort, loadResort } from '@/api/resort'; // Initialize client const resort = await loadResort('WDW'); const liveDataClient = new LiveDataClient(resort); // Get show times for a park const park = resort.parks[0]!; const shows = await liveDataClient.shows(park); for (const [id, show] of Object.entries(shows)) { console.log(`${show.name}: `); console.log(` Available: ${show.standby.available}`); if (show.showTimes && show.showTimes.length > 0) { console.log(` Upcoming times: ${show.showTimes.map(t => t.toString()).join(', ')}`); } else { console.log(` Status: ${show.standby.unavailableReason}`); } } ``` -------------------------------- ### Virtual Queue Client API Source: https://context7.com/joelface/bg1/llms.txt Manages virtual queue operations, including fetching queues, getting linked guests, and joining boarding groups. ```APIDOC ## Virtual Queue Client API ### Description The VQClient class manages virtual queue operations including fetching queues, getting linked guests, and joining boarding groups. ### Initialization ```typescript import { VQClient, Queue, Guest, JoinQueueResult } from '@/api/vq'; import { Resort, loadResort } from '@/api/resort'; // Initialize client const resort = await loadResort('WDW'); const vqClient = new VQClient(resort); ``` ### Fetching All Virtual Queues ```typescript // Get all available virtual queues const queues: Queue[] = await vqClient.getQueues(); queues.forEach(queue => { console.log(`Queue: ${queue.name}`); console.log(` ID: ${queue.id}`); console.log(` Accepting joins: ${queue.isAcceptingJoins}`); console.log(` Max party size: ${queue.maxPartySize}`); console.log(` Next open time: ${queue.nextScheduledOpenTime}`); console.log(` Category: ${queue.categoryContentId}`); }); ``` ### Getting a Specific Queue ```typescript // Get a specific queue const queue = await vqClient.getQueue({ id: 'queue-id' }); console.log('Queue details:', queue.name); ``` ### Getting Linked Guests ```typescript // Get linked guests eligible for the queue const guests: Guest[] = await vqClient.getLinkedGuests(queue); guests.forEach(guest => { console.log(`${guest.name}:`); console.log(` ID: ${guest.id}`); console.log(` Primary: ${guest.primary}`); console.log(` Preselected: ${guest.preselected}`); }); ``` ### Joining the Virtual Queue ```typescript // Join the virtual queue const selectedGuests = guests.filter(g => g.preselected); const result: JoinQueueResult = await vqClient.joinQueue(queue, selectedGuests); if (result.boardingGroup !== null) { console.log(`Success! Boarding group: ${result.boardingGroup}`); } else { console.log('Failed to join queue'); console.log('Queue closed:', result.closed); // Check for conflicts for (const [guestId, conflictType] of Object.entries(result.conflicts)) { const guest = guests.find(g => g.id === guestId); console.log(`${guest?.name}: ${conflictType}`); // Conflict types: 'NO_PARK_PASS', 'NOT_IN_PARK', 'REDEEM_LIMIT_REACHED' } } ``` ``` -------------------------------- ### Create and Manipulate DateTime Objects Source: https://context7.com/joelface/bg1/llms.txt Shows how to create DateTime objects, set timezones, get current date and time, format dates and times, and modify dates. Utilizes timezone support for accurate time representation. ```typescript // DateTime combines date and time DateTime.setTimeZone('America/New_York'); // or 'America/Los_Angeles' for DLR const now = DateTime.now(); console.log(now.date); // '2024-01-15' console.log(now.time.toString()); // '10:30:45' const dt = DateTime.from('2024-01-15T14:30:00'); console.log(dt.toString()); // '2024-01-15T14:30:00' // Get current park operating date (accounts for late night hours) const today = parkDate(); // Returns previous day if before 4 AM console.log(today); // '2024-01-15' // Format dates for display console.log(formatDate('2024-01-15')); // 'Monday, January 15' console.log(formatDate('2024-01-15', 'short')); // 'January 15' // Format times for display console.log(formatTime('14:30')); // '2:30 PM' console.log(formatTime('09:00')); // '9:00 AM' // Modify dates const tomorrow = modifyDate('2024-01-15', 1); console.log(tomorrow); // '2024-01-16' // Filter to upcoming times only const showTimes = [ new ParkTime(9, 0, 0), new ParkTime(12, 0, 0), new ParkTime(15, 0, 0), new ParkTime(18, 0, 0) ]; const upcoming = upcomingTimes(showTimes); console.log(upcoming.map(t => t.toString())); // Times from now onward ``` -------------------------------- ### Lightning Lane Client API Source: https://context7.com/joelface/bg1/llms.txt Manages Lightning Lane Multi Pass bookings, including fetching experiences, getting offers, and confirming bookings. ```APIDOC ## Lightning Lane Client API ### Description The LLClient abstract class and its implementations (LLClientWDW, LLClientDLR) manage Lightning Lane Multi Pass bookings including fetching experiences, getting offers, and confirming bookings. ### Initialization ```typescript import { LLClientWDW } from '@/api/ll/wdw'; import { LLClientDLR } from '@/api/ll/dlr'; import { Resort, loadResort } from '@/api/resort'; import { parkDate } from '@/datetime'; // Initialize client for the appropriate resort const resort = await loadResort('WDW'); const llClient = new LLClientWDW(resort); // Set party member IDs for filtering guests llClient.setPartyIds(['guest-id-1', 'guest-id-2']); ``` ### Fetching Experiences ```typescript // Fetch available experiences for a park const park = resort.parks[0]!; // Magic Kingdom const experiences = await llClient.experiences(park, parkDate()); experiences.forEach(exp => { console.log(`${exp.name}:`); console.log(` Standby: ${exp.standby.waitTime ?? 'N/A'} min`); console.log(` LL Available: ${exp.flex?.available}`); console.log(` Next LL Time: ${exp.flex?.nextAvailableTime}`); if (exp.showTimes) { console.log(` Show times: ${exp.showTimes.map(t => t.toString()).join(', ')}`); } }); ``` ### Getting Eligible Guests ```typescript // Get eligible guests for an experience const experience = experiences.find(e => e.flex?.available)!; const { eligible, ineligible } = await llClient.guests(experience); console.log('Eligible guests:', eligible.map(g => g.name)); console.log('Ineligible guests:', ineligible.map(g => `${g.name} (${g.ineligibleReason})` )); ``` ### Requesting an Offer ```typescript // Request a Lightning Lane offer const offer = await llClient.offer(experience, eligible); console.log('Offer ID:', offer.id); console.log('Return window:', `${offer.start.time} - ${offer.end.time}`); console.log('Date:', offer.start.date); ``` ### Getting Available Times (WDW Only) ```typescript // Get available return times (WDW only) const times = await llClient.times(offer); times.forEach((hourGroup, hour) => { console.log(`Hour ${hour + 7}:00 - ${hourGroup.map(t => t.toString()).join(', ')}`); }); ``` ### Changing Offer Time (WDW Only) ```typescript import { ParkTime } from '@/datetime'; const newTime = new ParkTime(14, 30, 0); const updatedOffer = await llClient.changeOfferTime(offer, newTime); console.log('New return time:', updatedOffer.start.time.toString()); ``` ### Booking a Lightning Lane ```typescript // Book the Lightning Lane const booking = await llClient.book(offer); console.log('Booking confirmed!'); console.log('Booking ID:', booking.id); console.log('Experience:', booking.name); console.log('Start:', booking.start.toString()); console.log('End:', booking.end.toString()); console.log('Guests:', booking.guests.map(g => g.name).join(', ')); ``` ### Canceling a Booking ```typescript // Cancel a booking await llClient.cancelBooking(booking.guests); console.log('Booking cancelled'); ``` ### Modifying an Existing Booking ```typescript // Modify an existing booking const newOffer = await llClient.offer(newExperience, eligible, { booking }); const modifiedBooking = await llClient.book(newOffer); console.log('Booking modified to:', modifiedBooking.name); ``` ``` -------------------------------- ### Manage Disney Authentication Tokens Source: https://context7.com/joelface/bg1/llms.txt The AuthStore class handles Disney authentication tokens, validating expiration and managing unauthorized states. It stores tokens in localStorage and provides methods to set, get, and clear authentication data. ```typescript import { AuthStore, AuthData, ReauthNeeded, AUTH_KEY } from '@/api/auth'; import kvdb from '@/kvdb'; // Create and configure auth store const authStore = new AuthStore(); authStore.onUnauthorized = () => { console.log('Session expired, redirecting to login...'); window.location.href = '/login'; }; // Store authentication data after login const authData: AuthData = { swid: '{ABCD1234-5678-90EF-GHIJ-KLMNOPQRSTUV}', accessToken: 'eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...', expires: Date.now() + 86400000 // 24 hours from now }; authStore.setData(authData); // Retrieve current auth data (throws ReauthNeeded if expired) try { const { swid, accessToken } = authStore.getData(); console.log('User ID:', swid); console.log('Token valid'); } catch (error) { if (error instanceof ReauthNeeded) { console.log('Please log in again'); } } // Clear authentication data authStore.deleteData(); ``` -------------------------------- ### Get Current Geolocation with Promise Wrapper Source: https://context7.com/joelface/bg1/llms.txt Utilize the geolocate function for a promise-based interface to the browser's Geolocation API. Handle potential GeolocationPositionError codes for permission denied, unavailable location, or timeouts. ```typescript import { geolocate } from '@/geolocate'; // Get current position try { const position = await geolocate({ enableHighAccuracy: true, timeout: 10000, maximumAge: 60000 }); console.log('Latitude:', position.coords.latitude); console.log('Longitude:', position.coords.longitude); console.log('Accuracy:', position.coords.accuracy, 'meters'); } catch (error) { if (error instanceof GeolocationPositionError) { switch (error.code) { case error.PERMISSION_DENIED: console.log('Location permission denied'); break; case error.POSITION_UNAVAILABLE: console.log('Location unavailable'); break; case error.TIMEOUT: console.log('Location request timed out'); break; } } } ``` -------------------------------- ### Manage Virtual Queue Operations Source: https://context7.com/joelface/bg1/llms.txt Demonstrates how to retrieve available virtual queues, check guest eligibility, and join a queue, including handling potential conflicts. ```typescript import { VQClient, Queue, Guest, JoinQueueResult } from '@/api/vq'; import { Resort, loadResort } from '@/api/resort'; // Initialize client const resort = await loadResort('WDW'); const vqClient = new VQClient(resort); // Get all available virtual queues const queues: Queue[] = await vqClient.getQueues(); queues.forEach(queue => { console.log(`Queue: ${queue.name}`); console.log(` ID: ${queue.id}`); console.log(` Accepting joins: ${queue.isAcceptingJoins}`); console.log(` Max party size: ${queue.maxPartySize}`); console.log(` Next open time: ${queue.nextScheduledOpenTime}`); console.log(` Category: ${queue.categoryContentId}`); }); // Get a specific queue const queue = await vqClient.getQueue({ id: 'queue-id' }); console.log('Queue details:', queue.name); // Get linked guests eligible for the queue const guests: Guest[] = await vqClient.getLinkedGuests(queue); guests.forEach(guest => { console.log(`${guest.name}:`); console.log(` ID: ${guest.id}`); console.log(` Primary: ${guest.primary}`); console.log(` Preselected: ${guest.preselected}`); }); // Join the virtual queue const selectedGuests = guests.filter(g => g.preselected); const result: JoinQueueResult = await vqClient.joinQueue(queue, selectedGuests); if (result.boardingGroup !== null) { console.log(`Success! Boarding group: ${result.boardingGroup}`); } else { console.log('Failed to join queue'); console.log('Queue closed:', result.closed); // Check for conflicts for (const [guestId, conflictType] of Object.entries(result.conflicts)) { const guest = guests.find(g => g.id === guestId); console.log(`${guest?.name}: ${conflictType}`); // Conflict types: 'NO_PARK_PASS', 'NOT_IN_PARK', 'REDEEM_LIMIT_REACHED' } } ``` -------------------------------- ### Time Synchronization with Server Source: https://context7.com/joelface/bg1/llms.txt Demonstrates synchronizing the client clock with the server time using the timesync module. Includes error handling for synchronization failures and retrieving the synchronized current time. ```typescript import { syncTime, now, SyncFailed, MIN_RESYNC_MS } from '@/timesync'; // Synchronize with server time try { await syncTime(); console.log('Time synchronized successfully'); } catch (error) { if (error instanceof SyncFailed) { console.log('Could not sync time - network too slow'); } } // Get synchronized current time const currentTime = now(); console.log('Server-synced timestamp:', currentTime); console.log('As date:', new Date(currentTime)); // Resync interval check console.log('Minimum resync interval:', MIN_RESYNC_MS / 1000 / 60, 'minutes'); ``` -------------------------------- ### Fetch User Plans with ItineraryClient Source: https://context7.com/joelface/bg1/llms.txt Initialize ItineraryClient to retrieve daily plans including Lightning Lane, DAS, dining, and boarding groups. Supports a refresh callback and filtering by booking type. ```typescript import { ItineraryClient, Booking, isLLMP, isDAS } from '@/api/itinerary'; import { Resort, loadResort } from '@/api/resort'; // Initialize client const resort = await loadResort('WDW'); const itineraryClient = new ItineraryClient(resort); // Set up refresh callback itineraryClient.onRefresh = (bookings) => { console.log(`Itinerary refreshed with ${bookings.length} items`); }; // Fetch today's plans const plans: Booking[] = await itineraryClient.plans(); plans.forEach(booking => { console.log(` ${booking.name} (${booking.type})`); console.log(` Park: ${booking.park.name}`); console.log(` Start: ${booking.start.date} ${booking.start.time?.toString() ?? ''}`); if (booking.type === 'LL') { console.log(` Subtype: ${booking.subtype}`); // 'MP', 'SP', or 'OTHER' console.log(` Cancellable: ${booking.cancellable}`); console.log(` Modifiable: ${booking.modifiable}`); if (booking.choices) { console.log(` Multiple experience choices: ${booking.choices.map(c => c.name).join(', ')}`); } } if (booking.type === 'DAS') { console.log(` DAS Type: ${booking.subtype}`); // 'IN_PARK' or 'ADVANCE' } if (booking.type === 'BG') { console.log(` Boarding Group: ${booking.boardingGroup}`); console.log(` Status: ${booking.status}`); } if (booking.type === 'RES') { console.log(` Reservation type: ${booking.subtype}`); // 'DINING' or 'ACTIVITY' } console.log(` Guests: ${booking.guests.map(g => g.name).join(', ')}`); }); // Filter for specific booking types const llBookings = plans.filter(isLLMP); const dasBookings = plans.filter(isDAS); console.log(`Lightning Lane Multi Pass bookings: ${llBookings.length}`); console.log(`DAS bookings: ${dasBookings.length}`); ``` -------------------------------- ### Manage DAS Bookings with DasClient Source: https://context7.com/joelface/bg1/llms.txt Initialize DasClient to fetch DAS parties, available experiences, book return times, and cancel bookings. Handles ConflictsError for eligibility issues. ```typescript import { DasClient, DasParty, Experience, ConflictsError, NoPrimaryGuest } from '@/api/das'; import { Resort, loadResort } from '@/api/resort'; // Initialize client const resort = await loadResort('WDW'); const dasClient = new DasClient(resort); // Get DAS parties for the logged-in user const parties: DasParty[] = await dasClient.parties(); parties.forEach(party => { console.log(`Primary guest: ${party.primaryGuest.name}`); console.log(`Selection limit: ${party.selectionLimit}`); console.log('Linked guests:', party.linkedGuests.map(g => g.name).join(', ')); }); // Get available DAS experiences for a park const park = resort.parks[0]!; const experiences: Experience[] = await dasClient.experiences(park); experiences.forEach(exp => { console.log(`${exp.name}: `); console.log(` Available: ${exp.available}`); console.log(` Next time: ${exp.time.toString()}`); }); // Book a DAS return time const party = parties[0]!; const experience = experiences.find(e => e.available)!; try { const booking = await dasClient.book({ experience, primaryGuest: party.primaryGuest, guests: [party.primaryGuest, ...party.linkedGuests.slice(0, 2)] }); console.log('DAS booking confirmed!'); console.log('Experience:', booking.name); console.log('Return time:', booking.start.time.toString()); console.log('Guests:', booking.guests.map(g => g.name).join(', ')); } catch (error) { if (error instanceof ConflictsError) { console.log('Eligibility conflicts:'); for (const [guestId, conflictType] of Object.entries(error.conflicts)) { console.log(` ${guestId}: ${conflictType}`); // Types: 'PRIMARY_GUEST_NOT_ELIGIBLE', 'PRODUCT_TYPE_LIMIT_REACHED', 'NOT_IN_PARK' } } } // Cancel a DAS booking await dasClient.cancelBooking(booking.guests); console.log('DAS booking cancelled'); ``` -------------------------------- ### Set up React Context for Clients and Resort Data Source: https://context7.com/joelface/bg1/llms.txt Configure React Context providers to share API client instances and resort data across the application. Access these shared resources in child components using the useContext hook. ```typescript import { createClients, Clients } from '@/contexts/ClientsContext'; import ClientsContext from '@/contexts/ClientsContext'; import ResortContext from '@/contexts/ResortContext'; import { Resort, loadResort } from '@/api/resort'; import { useContext } from 'react'; // Initialize resort and clients const resort = await loadResort('WDW'); const clients = createClients(resort); // clients includes: { das, itinerary, liveData, ll, vq } // Wrap your app with providers function App() { return ( ); } // Access in child components function MainContent() { const resort = useContext(ResortContext); const { ll, vq, das, itinerary, liveData } = useContext(ClientsContext); // Use clients for API operations const handleRefresh = async () => { const plans = await itinerary.plans(); const experiences = await ll.experiences(resort.parks[0]!, parkDate()); console.log('Refreshed data'); }; return
Park: {resort.parks[0]?.name}
; } ``` -------------------------------- ### Live Data Client API Source: https://context7.com/joelface/bg1/llms.txt Endpoints for fetching real-time show time data from external sources. ```APIDOC ## GET /livedata/shows ### Description Retrieves real-time show time data for a specific park. ### Method GET ### Parameters #### Query Parameters - **park** (ResortPark) - Required - The park object to query show data for. ### Response #### Success Response (200) - **shows** (Object) - A map of show IDs to show details, including availability and upcoming show times. ``` -------------------------------- ### Resort Configuration API Source: https://context7.com/joelface/bg1/llms.txt The Resort class provides access to static configuration data for Disney resorts, including parks, lands, and experiences. ```APIDOC ## Resort Configuration ### Description Provides lookup functionality for park, land, and experience data based on resort IDs (WDW or DLR). ### Methods - **loadResort(resortId)**: Asynchronously loads resort data. - **park(id)**: Retrieves a specific park by ID. - **experience(id)**: Retrieves a specific experience by ID. - **dropExperiences(park)**: Returns experiences associated with drop times for a given park. ### Parameters #### Path Parameters - **resortId** (string) - Required - The resort identifier (e.g., 'WDW' or 'DLR'). - **id** (string) - Required - The unique identifier for a park or experience. ``` -------------------------------- ### Itinerary Client API Source: https://context7.com/joelface/bg1/llms.txt Endpoints for fetching the user's daily plans, including Lightning Lane, DAS, dining, and boarding groups. ```APIDOC ## GET /itinerary/plans ### Description Fetches the user's daily plans including Lightning Lane bookings, DAS selections, dining reservations, and boarding groups. ### Method GET ### Response #### Success Response (200) - **plans** (Array) - A list of all current bookings for the user. ``` -------------------------------- ### Implement Rate Limiting for API Requests Source: https://context7.com/joelface/bg1/llms.txt Use the RateLimit module to enforce a requests-per-second limit before making API calls. Catch RateLimitExceeded errors to handle cases where the limit is hit. ```typescript import { RateLimit, RateLimitExceeded } from '@/ratelimit'; // Create a rate limiter (5 requests per second) const limiter = new RateLimit(5); // Use before making API requests async function makeRequest() { try { limiter.enforce(); // Proceed with API request const response = await fetch('https://api.example.com/data'); return response.json(); } catch (error) { if (error instanceof RateLimitExceeded) { console.log('Rate limit exceeded, please wait'); return null; } throw error; } } ``` -------------------------------- ### Manage Lightning Lane Multi Pass Bookings Source: https://context7.com/joelface/bg1/llms.txt Demonstrates the full lifecycle of a Lightning Lane booking, including fetching experiences, checking eligibility, requesting offers, and confirming or modifying bookings. ```typescript import { LLClientWDW } from '@/api/ll/wdw'; import { LLClientDLR } from '@/api/ll/dlr'; import { Resort, loadResort } from '@/api/resort'; import { parkDate } from '@/datetime'; // Initialize client for the appropriate resort const resort = await loadResort('WDW'); const llClient = new LLClientWDW(resort); // Set party member IDs for filtering guests llClient.setPartyIds(['guest-id-1', 'guest-id-2']); // Fetch available experiences for a park const park = resort.parks[0]!; // Magic Kingdom const experiences = await llClient.experiences(park, parkDate()); experiences.forEach(exp => { console.log(`${exp.name}:`); console.log(` Standby: ${exp.standby.waitTime ?? 'N/A'} min`); console.log(` LL Available: ${exp.flex?.available}`); console.log(` Next LL Time: ${exp.flex?.nextAvailableTime}`); if (exp.showTimes) { console.log(` Show times: ${exp.showTimes.map(t => t.toString()).join(', ')}`); } }); // Get eligible guests for an experience const experience = experiences.find(e => e.flex?.available)!; const { eligible, ineligible } = await llClient.guests(experience); console.log('Eligible guests:', eligible.map(g => g.name)); console.log('Ineligible guests:', ineligible.map(g => `${g.name} (${g.ineligibleReason})` )); // Request a Lightning Lane offer const offer = await llClient.offer(experience, eligible); console.log('Offer ID:', offer.id); console.log('Return window:', `${offer.start.time} - ${offer.end.time}`); console.log('Date:', offer.start.date); // Get available return times (WDW only) const times = await llClient.times(offer); times.forEach((hourGroup, hour) => { console.log(`Hour ${hour + 7}:00 - ${hourGroup.map(t => t.toString()).join(', ')}`); }); // Change offer time (WDW only) import { ParkTime } from '@/datetime'; const newTime = new ParkTime(14, 30, 0); const updatedOffer = await llClient.changeOfferTime(offer, newTime); console.log('New return time:', updatedOffer.start.time.toString()); // Book the Lightning Lane const booking = await llClient.book(offer); console.log('Booking confirmed!'); console.log('Booking ID:', booking.id); console.log('Experience:', booking.name); console.log('Start:', booking.start.toString()); console.log('End:', booking.end.toString()); console.log('Guests:', booking.guests.map(g => g.name).join(', ')); // Cancel a booking await llClient.cancelBooking(booking.guests); console.log('Booking cancelled'); // Modify an existing booking const newOffer = await llClient.offer(newExperience, eligible, { booking }); const modifiedBooking = await llClient.book(newOffer); console.log('Booking modified to:', modifiedBooking.name); ``` -------------------------------- ### Authentication API Source: https://context7.com/joelface/bg1/llms.txt The AuthStore class manages Disney authentication tokens, including storage, validation, and expiration handling. ```APIDOC ## Authentication Management ### Description Manages Disney authentication tokens stored in localStorage, handles token expiration, and triggers re-authentication flows. ### Methods - **setData(authData)**: Stores authentication data (swid, accessToken, expires). - **getData()**: Retrieves current auth data; throws ReauthNeeded if expired. - **deleteData()**: Clears stored authentication data. ### Request Example { "swid": "{ABCD1234-5678-90EF-GHIJ-KLMNOPQRSTUV}", "accessToken": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...", "expires": 1715856000000 } ``` -------------------------------- ### Access Disney Resort and Park Data Source: https://context7.com/joelface/bg1/llms.txt The Resort class provides access to park, land, and experience data for Disney resorts. Load resort data using `loadResort` and access specific parks or experiences by their IDs. Handles invalid IDs gracefully. ```typescript import { Resort, loadResort, Park, Experience, InvalidId } from '@/api/resort'; // Load resort data asynchronously const resort = await loadResort('WDW'); // or 'DLR' for Disneyland // Access parks console.log('Parks:', resort.parks.map(p => p.name)); // Output: ['Magic Kingdom', 'EPCOT', 'Hollywood Studios', 'Animal Kingdom'] // Get a specific park by ID try { const park: Park = resort.park('80007944'); // Magic Kingdom console.log('Park:', park.name); console.log('Geo bounds:', park.geo); console.log('Drop times:', park.dropTimes.map(t => t.toString())); } catch (error) { if (error instanceof InvalidId) { console.log('Park not found'); } } // Get an experience by ID try { const experience: Experience = resort.experience('80010190'); // Space Mountain console.log('Experience:', experience.name); console.log('Land:', experience.land.name); console.log('Park:', experience.park.name); console.log('Type:', experience.type); // 'A' for attraction console.log('Priority:', experience.priority); console.log('Tier:', experience.tier); } catch (error) { if (error instanceof InvalidId) { console.log('Experience not found'); } } // Get drop time experiences for a park const dropExps = resort.dropExperiences(park); dropExps.forEach(exp => { console.log(`${exp.name}: ${exp.dropTimes?.map(t => t.toString()).join(', ')}`); }); ``` -------------------------------- ### DAS Client API Source: https://context7.com/joelface/bg1/llms.txt Endpoints for managing Disability Access Service bookings, including fetching parties, experiences, and creating or cancelling return times. ```APIDOC ## GET /das/parties ### Description Retrieves the list of DAS parties associated with the logged-in user. ### Method GET ### Response #### Success Response (200) - **parties** (Array) - List of DAS parties containing primary guest and linked guests. ## GET /das/experiences ### Description Fetches available DAS experiences for a specific park. ### Method GET ### Parameters #### Query Parameters - **park** (ResortPark) - Required - The park object to query experiences for. ### Response #### Success Response (200) - **experiences** (Array) - List of available experiences with their availability and next available time. ## POST /das/book ### Description Books a DAS return time for a specific experience and set of guests. ### Method POST ### Request Body - **experience** (Experience) - Required - The experience to book. - **primaryGuest** (Guest) - Required - The primary guest for the booking. - **guests** (Array) - Required - List of guests included in the booking. ### Response #### Success Response (200) - **booking** (Booking) - The confirmed booking details. ## POST /das/cancel ### Description Cancels an existing DAS booking. ### Method POST ### Request Body - **guests** (Array) - Required - The list of guests associated with the booking to cancel. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.