예제 #1
0
        /// <summary>
        /// Updates an existing table. Unless explicitly requested, only the name, description, and attribution will be updated. 
        /// Documentation https://developers.google.com/fusiontables/v1/reference/table/update
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated Fusiontables service.</param>  
        /// <param name="tableId">ID of the table that is being updated.</param>
        /// <param name="body">A valid Fusiontables v1 body.</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>TableResponse</returns>
        public static Table Update(FusiontablesService service, string tableId, Table body, TableUpdateOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                    throw new ArgumentNullException("service");
                if (body == null)
                    throw new ArgumentNullException("body");
                if (tableId == null)
                    throw new ArgumentNullException(tableId);

                // Building the initial request.
                var request = service.Table.Update(body, tableId);

                // Applying optional parameters to the request.                
                request = (TableResource.UpdateRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return request.Execute();
            }
            catch (Exception ex)
            {
                throw new Exception("Request Table.Update failed.", ex);
            }
        }
예제 #2
0
        /// <summary>
        /// Executes an SQL SELECT/INSERT/UPDATE/DELETE/SHOW/DESCRIBE/CREATE statement.
        /// Documentation https://developers.google.com/fusiontables/v1/reference/query/sql
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated Fusiontables service.</param>
        /// <param name="sql">An SQL SELECT/SHOW/DESCRIBE/INSERT/UPDATE/DELETE/CREATE statement.</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>SqlresponseResponse</returns>
        public static Sqlresponse Sql(FusiontablesService service, string sql, QuerySqlOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (sql == null)
                {
                    throw new ArgumentNullException(sql);
                }

                // Building the initial request.
                var request = service.Query.Sql(sql);

                // Applying optional parameters to the request.
                request = (QueryResource.SqlRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Query.Sql failed.", ex);
            }
        }
        /// <summary>
        /// Retrieves a specific template by its id
        /// Documentation https://developers.google.com/fusiontables/v1/reference/template/get
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated Fusiontables service.</param>
        /// <param name="tableId">Table to which the template belongs</param>
        /// <param name="templateId">Identifier for the template that is being requested</param>
        /// <returns>TemplateResponse</returns>
        public static Template Get(FusiontablesService service, string tableId, int?templateId)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (tableId == null)
                {
                    throw new ArgumentNullException(tableId);
                }
                if (templateId == null)
                {
                    throw new ArgumentNullException(templateId);
                }

                // Make the request.
                return(service.Template.Get(tableId, templateId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Template.Get failed.", ex);
            }
        }
        /// <summary>
        /// Retrieves a list of templates.
        /// Documentation https://developers.google.com/fusiontables/v1/reference/template/list
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated Fusiontables service.</param>
        /// <param name="tableId">Identifier for the table whose templates are being requested</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>TemplateListResponse</returns>
        public static TemplateList List(FusiontablesService service, string tableId, TemplateListOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (tableId == null)
                {
                    throw new ArgumentNullException(tableId);
                }

                // Building the initial request.
                var request = service.Template.List(tableId);

                // Applying optional parameters to the request.
                request = (TemplateResource.ListRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Template.List failed.", ex);
            }
        }
예제 #5
0
        /// <summary>
        /// Retrieves a specific column by its ID.
        /// Documentation https://developers.google.com/fusiontables/v2/reference/column/get
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated Fusiontables service.</param>
        /// <param name="tableId">Table to which the column belongs.</param>
        /// <param name="columnId">Name or identifier for the column that is being requested.</param>
        /// <returns>ColumnResponse</returns>
        public static Column Get(FusiontablesService service, string tableId, string columnId)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (tableId == null)
                {
                    throw new ArgumentNullException(tableId);
                }
                if (columnId == null)
                {
                    throw new ArgumentNullException(columnId);
                }

                // Make the request.
                return(service.Column.Get(tableId, columnId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Column.Get failed.", ex);
            }
        }
예제 #6
0
        /// <summary>
        /// Deletes a style.
        /// Documentation https://developers.google.com/fusiontables/v1/reference/style/delete
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated Fusiontables service.</param>
        /// <param name="tableId">Table from which the style is being deleted</param>
        /// <param name="styleId">Identifier (within a table) for the style being deleted</param>
        public static void Delete(FusiontablesService service, string tableId, int?styleId)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (tableId == null)
                {
                    throw new ArgumentNullException(tableId);
                }
                if (styleId == null)
                {
                    throw new ArgumentNullException(styleId);
                }

                // Make the request.
                service.Style.Delete(tableId, styleId).Execute();
            }
            catch (Exception ex)
            {
                throw new Exception("Request Style.Delete failed.", ex);
            }
        }
예제 #7
0
        /// <summary>
        /// Updates an existing style.
        /// Documentation https://developers.google.com/fusiontables/v1/reference/style/update
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated Fusiontables service.</param>
        /// <param name="tableId">Table whose style is being updated.</param>
        /// <param name="styleId">Identifier (within a table) for the style being updated.</param>
        /// <param name="body">A valid Fusiontables v1 body.</param>
        /// <returns>StyleSettingResponse</returns>
        public static StyleSetting Update(FusiontablesService service, string tableId, int?styleId, StyleSetting body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (tableId == null)
                {
                    throw new ArgumentNullException(tableId);
                }
                if (styleId == null)
                {
                    throw new ArgumentNullException(styleId);
                }

                // Make the request.
                return(service.Style.Update(body, tableId, styleId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Style.Update failed.", ex);
            }
        }
예제 #8
0
        /// <summary>
        /// Imports a new table.
        /// Documentation https://developers.google.com/fusiontables/v2/reference/table/importTable
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated Fusiontables service.</param>
        /// <param name="name">The name to be assigned to the new table.</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>TableResponse</returns>
        public static Table ImportTable(FusiontablesService service, string name, TableImportTableOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (name == null)
                {
                    throw new ArgumentNullException(name);
                }

                // Building the initial request.
                var request = service.Table.ImportTable(name);

                // Applying optional parameters to the request.
                request = (TableResource.ImportTableRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Table.ImportTable failed.", ex);
            }
        }
예제 #9
0
        /// <summary>
        /// Creates a new table. 
        /// Documentation https://developers.google.com/fusiontables/v1/reference/table/insert
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated Fusiontables service.</param>  
        /// <param name="body">A valid Fusiontables v1 body.</param>
        /// <returns>TableResponse</returns>
        public static Table Insert(FusiontablesService service, Table body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                    throw new ArgumentNullException("service");
                if (body == null)
                    throw new ArgumentNullException("body");

                // Make the request.
                return service.Table.Insert(body).Execute();
            }
            catch (Exception ex)
            {
                throw new Exception("Request Table.Insert failed.", ex);
            }
        }