Esempio n. 1
0
        public List <Workshop> All()

        {
            WebClient webClient = new WebClient();

            webClient.QueryString.Add("maxRecords", "20");
            webClient.QueryString.Add("api_key", _apiKey);
            webClient.QueryString.Add("view", "Upcoming");

            var response = webClient.DownloadString(_url + "v0/" + _tableId + "/Marketplace");
            AirtableResponse airtableResponse = JsonConvert.DeserializeObject <AirtableResponse>(response);

            List <Workshop> allWorkshops = new List <Workshop>();

            for (int i = 0; i < airtableResponse.Records.Length; i++)
            {
                Workshop workshop = new Workshop()
                {
                    id        = airtableResponse.Records[i].ID,
                    name      = airtableResponse.Records[i].Fields.Name,
                    host      = airtableResponse.Records[i].Fields.Host,
                    time      = airtableResponse.Records[i].Fields.Time,
                    location  = airtableResponse.Records[i].Fields.Location,
                    duration  = airtableResponse.Records[i].Fields.Duration / 60,
                    type      = airtableResponse.Records[i].Fields.SessionType,
                    attendees = airtableResponse.Records[i].Fields.Attendees
                };
                allWorkshops.Add(workshop);
            }

            return(allWorkshops);
        }
Esempio n. 2
0
 public void SetUpAll(AirtableResponse expectedResponse, string TABLE_ID, string AIRTABLE_API_KEY) =>
 simulator.Get("/v0/" + TABLE_ID + "/Marketplace")
 .WithParameter("maxRecords", maxRecords)
 .WithParameter("api_key", AIRTABLE_API_KEY)
 .WithParameter("view", "Upcoming")
 .Responds(expectedResponse);