public async Task <GoApiResponse <BookClassGoApiResult> > BookClass(BookClassParams param) { GoApiResponse <BookClassGoApiResult> result = null; using (var restClient = new HttpClient()) { restClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("bearer", Token); var query = CreateQueryBuilder("/v1.0/Alexa/BookClass").ToString(); var json = JsonConvert.SerializeObject(param); var stringContent = new StringContent(json, UnicodeEncoding.UTF8, "application/json"); using (var goApiResult = await restClient.PostAsync(query, stringContent)) { var content = await goApiResult.Content.ReadAsStringAsync(); if (goApiResult.StatusCode != HttpStatusCode.OK) { result = JsonConvert.DeserializeObject <GoApiResponse <BookClassGoApiResult> >(content, GetJsonSerializerSettings()); } result = JsonConvert.DeserializeObject <GoApiResponse <BookClassGoApiResult> >(content, GetJsonSerializerSettings()); } } return(result); }
public async Task <GoApiResponse <List <UpcomingBookingGoApiDto> > > UpcomingBookings() { GoApiResponse <List <UpcomingBookingGoApiDto> > result = null; using (var restClient = new HttpClient()) { restClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("bearer", Token); var query = CreateQueryBuilder("/v1.0/Alexa/UpcomingBookings").ToString(); using (var goApiResult = await restClient.GetAsync(query)) { var content = await goApiResult.Content.ReadAsStringAsync(); if (goApiResult.StatusCode != HttpStatusCode.OK) { result = JsonConvert.DeserializeObject <GoApiResponse <List <UpcomingBookingGoApiDto> > >(content, GetJsonSerializerSettings()); } result = JsonConvert.DeserializeObject <GoApiResponse <List <UpcomingBookingGoApiDto> > >(content, GetJsonSerializerSettings()); } } return(result); }
public async Task <GoApiResponse <List <UpcomingClassGoApiDto> > > UpcomingClasses(string className, string clubName, DateTime dateFrom, DateTime dateTo) { GoApiResponse <List <UpcomingClassGoApiDto> > result = null; using (var restClient = new HttpClient()) { restClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("bearer", Token); var query = CreateUpcomingClassesQuery(className, clubName, dateFrom, dateTo); using (var goApiResult = await restClient.GetAsync(query)) { var content = await goApiResult.Content.ReadAsStringAsync(); if (goApiResult.StatusCode != HttpStatusCode.OK) { result = JsonConvert.DeserializeObject <GoApiResponse <List <UpcomingClassGoApiDto> > >(content, GetJsonSerializerSettings()); } result = JsonConvert.DeserializeObject <GoApiResponse <List <UpcomingClassGoApiDto> > >(content, GetJsonSerializerSettings()); } } return(result); }