Exemple #1
0
        public async Task <AirtableRetrieveRecordResponse> GetRecordMethodAsync(AirtableBase airtableBase, String stringIDparam)
        {
            Task <AirtableRetrieveRecordResponse> task = airtableBase.RetrieveRecord(tablename, stringIDparam);

            response = await task;
            return(response);
        }
        // STATUS [ July 13, 2019 ] : this works
        /// <summary>
        ///     Get one record from a given table
        /// </summary>
        /// <remarks>
        ///     Configuration for each table is setup in Startup.cs and airtableConfiguration.json
        ///     See: https://github.com/ngocnicholas/airtable.net
        /// </remarks>
        /// <param name="tableName">
        ///     Equivalent to the TableName in airtableConfiguration.json
        ///     Equivalent to the tab name in actual airtable
        /// </param>
        /// <param name="tableAuthenticationString">
        ///     Equivalent to the AuthenticationString in airtableConfiguration.json
        /// </param>
        /// <param name="recordId">
        ///     The airtable generated record Id
        ///     This is visible thorugh the API but NOT in the actual table
        ///     It is different than things like "Author_Id", "Record_Id", "Website_Id"
        /// </param>
        /// <example>
        ///     var oneRecord = await _atM.GetOneRecordFromAirtableAsync("SpRankings", authenticationString, "rec7yJqKs5Ht3I7j3");
        /// </example>
        public async Task <AirtableRecord> GetOneRecordFromAirtableAsync(string tableName, string tableAuthenticationString, string recordId)
        {
            using (AirtableBase airtableBase = new AirtableBase(_airtableConfig.ApiKey, tableAuthenticationString))
            {
                Task <AirtableRetrieveRecordResponse> recordTask         = airtableBase.RetrieveRecord(tableName, recordId);
                AirtableRetrieveRecordResponse        recordTaskResponse = await recordTask.ConfigureAwait(false);

                AirtableRecord oneRecord = recordTaskResponse.Record;
                return(oneRecord);
            }
        }
Exemple #3
0
        //

        public async Task <bool> LoopTasks()
        {
            AirtableBase airtableBase = new AirtableBase(appKey, baseID);
            var          tasks        = new List <Task <AirtableRetrieveRecordResponse> >();

            foreach (string stringID in stringIDs)
            {
                if (stringID != null)
                {
                    Task <AirtableRetrieveRecordResponse> task = airtableBase.RetrieveRecord(tablename, stringID);
                    response = await task;
                    outRecords.Add(response.Record);
                    errorMessage = "Success!";
                }
                else
                {
                    outRecords.Add(null);
                    errorMessage = response.AirtableApiError.DetailedErrorMessage2;
                }
            }
            return(true);
        }