/// <summary>
        /// Inserts a new account for a user
        /// Documentation https://developers.google.com/mirror/v1/reference/accounts/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 mirror service.</param>
        /// <param name="userToken">The ID for the user.</param>
        /// <param name="accountType">Account type to be passed to Android Account Manager.</param>
        /// <param name="accountName">The name of the account to be passed to the Android Account Manager.</param>
        /// <param name="body">A valid mirror v1 body.</param>
        /// <returns>AccountResponse</returns>
        public static Account Insert(mirrorService service, string userToken, string accountType, string accountName, Account body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (userToken == null)
                {
                    throw new ArgumentNullException(userToken);
                }
                if (accountType == null)
                {
                    throw new ArgumentNullException(accountType);
                }
                if (accountName == null)
                {
                    throw new ArgumentNullException(accountName);
                }

                // Make the request.
                return(service.Accounts.Insert(body, userToken, accountType, accountName).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Accounts.Insert failed.", ex);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Retrieves an attachment on a timeline item by item ID and attachment ID.
        /// Documentation https://developers.google.com/mirror/v1/reference/attachments/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 mirror service.</param>
        /// <param name="itemId">The ID of the timeline item the attachment belongs to.</param>
        /// <param name="attachmentId">The ID of the attachment.</param>
        /// <returns>AttachmentResponse</returns>
        public static Attachment Get(mirrorService service, string itemId, string attachmentId)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (itemId == null)
                {
                    throw new ArgumentNullException(itemId);
                }
                if (attachmentId == null)
                {
                    throw new ArgumentNullException(attachmentId);
                }

                // Make the request.
                return(service.Attachments.Get(itemId, attachmentId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Attachments.Get failed.", ex);
            }
        }
        /// <summary>
        /// Updates a contact in place.
        /// Documentation https://developers.google.com/mirror/v1/reference/contacts/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 mirror service.</param>
        /// <param name="id">The ID of the contact.</param>
        /// <param name="body">A valid mirror v1 body.</param>
        /// <returns>ContactResponse</returns>
        public static Contact Update(mirrorService service, string id, Contact body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (id == null)
                {
                    throw new ArgumentNullException(id);
                }

                // Make the request.
                return(service.Contacts.Update(body, id).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Contacts.Update failed.", ex);
            }
        }
        /// <summary>
        /// Retrieves a list of contacts for the authenticated user.
        /// Documentation https://developers.google.com/mirror/v1/reference/contacts/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 mirror service.</param>
        /// <returns>ContactsListResponseResponse</returns>
        public static ContactsListResponse List(mirrorService service)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }

                // Make the request.
                return(service.Contacts.List().Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Contacts.List failed.", ex);
            }
        }
        /// <summary>
        /// Gets a single location by ID.
        /// Documentation https://developers.google.com/mirror/v1/reference/locations/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 mirror service.</param>
        /// <param name="id">The ID of the location or latest for the last known location.</param>
        /// <returns>LocationResponse</returns>
        public static Location Get(mirrorService service, string id)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (id == null)
                {
                    throw new ArgumentNullException(id);
                }

                // Make the request.
                return(service.Locations.Get(id).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Locations.Get failed.", ex);
            }
        }