public DisneyTableReservationList(AuthToken token, String partySize, String mealPeriod, String searchDate) { checkDateRange(checkDateFormat(searchDate)); _searchDate = searchDate; _mealPeriod = mealPeriod; _partySize = partySize; String docPath = searchDate + "_" + mealPeriod; token = token.returnNewTokenWhenExpired(); DisneyPostRequest reservationRequest = new DisneyPostRequest(_url, token, _partySize, _mealPeriod, _searchDate); this.parseRestaurantIdsFromServerResponse(reservationRequest.ResponseMessage, docPath); }
public AuthToken() { DisneyPostRequest tokenRequest = new DisneyPostRequest(this._tokenUrl); try { _authJsonResponse = this.parseServerResponse(tokenRequest.ResponseMessage); this.Token = _authJsonResponse["access_token"]; this._createdAt = DateTime.Now; this._expirationSeconds = Convert.ToDouble(_authJsonResponse["expires_in"]); this._expiresAt = _createdAt.AddSeconds(_expirationSeconds); } catch(NullReferenceException err) { Console.WriteLine(err.Message + "\nCouldn't get access token, try again later."); } catch(OverflowException overflow) { Console.WriteLine(overflow.Message); } }