`string errorMessage = null;
var records = new List();
using (AirtableMeta m = new AirtableMeta(appKey))
{
Task<AirtableMetaBasesResponse> task = m.ListBases(appKey);
AirtableMetaBasesResponse response = await task; //null ref exception
if (response.Success)
{
records.AddRange(response.Bases);
}
else if (response.AirtableApiError is AirtableApiException)
{
errorMessage = response.AirtableApiError.ErrorMessage;
}
else
{
errorMessage = "Unknown error";
}
}
if (!string.IsNullOrEmpty(errorMessage))
{
Debug.WriteLine(errorMessage);
}
else
{
// Do something with the retrieved 'records' and the 'offset'
// for the next page of the record list.
if (records.Any())
{
foreach (var record in records)
{
Debug.WriteLine(record.Id);
Debug.WriteLine(record.Name);
Debug.WriteLine(record.Permission);
}
}
else
{
Debug.WriteLine("records is empty");
}
}`
`string errorMessage = null;
var records = new List();
using (AirtableMeta m = new AirtableMeta(appKey))
{
Task<AirtableMetaTablesResponse> task = m.ListTables(appKey, baseId);
AirtableMetaTablesResponse response = await task; //null ref exception
if (response.Success)
{
records.AddRange(response.Tables);
}
else if (response.AirtableApiError is AirtableApiException)
{
errorMessage = response.AirtableApiError.ErrorMessage;
}
else
{
errorMessage = "Unknown error";
}
}
if (!string.IsNullOrEmpty(errorMessage))
{
Debug.WriteLine(errorMessage);
}
else
{
// Do something with the retrieved 'records' and the 'offset'
// for the next page of the record list.
if (records.Any())
{
foreach (var record in records)
{
Debug.WriteLine(record.Id);
Debug.WriteLine(record.Name);
Debug.WriteLine(record.PrimaryField);
foreach (var field in record.Fields)
{
Debug.WriteLine(field.Id);
Debug.WriteLine(field.Name);
Debug.WriteLine(field.Type);
}
foreach (var view in record.Views)
{
Debug.WriteLine(view.Id);
Debug.WriteLine(view.Name);
Debug.WriteLine(view.Type);
}
}
}
else
{
Debug.WriteLine("records is empty");
}
}`
`string errorMessage = null; var records = new List();
`string errorMessage = null; var records = new List();