//---------------------------------------------------------------------------- // // AirtableBase.ListRecords // // Called to get a list of records in the table specified by 'tableName' // //---------------------------------------------------------------------------- public async Task <AirtableListRecordsResponse> ListRecords( string tableName, string offset = null, IEnumerable <string> fields = null, string filterByFormula = null, int?maxRecords = null, int?pageSize = null, IEnumerable <Sort> sort = null, string view = null) { if (string.IsNullOrEmpty(tableName)) { throw new ArgumentException("Table Name cannot be null", "tableName"); } AirtableRecordList recordList = null; var uri = BuildUriForListRecords(tableName, offset, fields, filterByFormula, maxRecords, pageSize, sort, view); var request = new HttpRequestMessage(HttpMethod.Get, uri); var response = await Client.SendAsync(request); AirtableApiException error = await CheckForAirtableException(response); if (error != null) { return(new AirtableListRecordsResponse(error)); } var responseBody = await response.Content.ReadAsStringAsync(); recordList = JsonConvert.DeserializeObject <AirtableRecordList>(responseBody); return(new AirtableListRecordsResponse(recordList)); }
//---------------------------------------------------------------------------- // // AirtableBase.ListRecords // // Called to get a list of records in the table specified by 'tableName' // //---------------------------------------------------------------------------- public async Task <AirtableListRecordsResponse> ListRecords( string tableName, string offset = null, IEnumerable <string> fields = null, string filterByFormula = null, int?maxRecords = null, int?pageSize = null, IEnumerable <Sort> sort = null, string view = null) { HttpResponseMessage response = await ListRecordsInternal(tableName, offset, fields, filterByFormula, maxRecords, pageSize, sort, view); AirtableApiException error = await CheckForAirtableException(response); if (error != null) { return(new AirtableListRecordsResponse(error)); } var responseBody = await response.Content.ReadAsStringAsync(); AirtableRecordList recordList = JsonSerializer.Deserialize <AirtableRecordList>(responseBody, JsonOptionIgnoreNullValues); return(new AirtableListRecordsResponse(recordList)); }
public AirtableListRecordsResponse(AirtableRecordList recordList) : base() { Offset = recordList.Offset; Records = recordList.Records; }