private void SetPermissions(string fileID, GoogleDrivePermissionRole role, GoogleDrivePermissionType type, string value, bool withLink) { string url = string.Format("https://www.googleapis.com/drive/v2/files/{0}/permissions", fileID); string json = JsonConvert.SerializeObject(new { role = role.ToString(), type = type.ToString(), value = value, withLink = withLink.ToString() }); string response = SendRequestJSON(url, json, GetAuthHeaders()); }
private void SetPermissions(string fileID, GoogleDrivePermissionRole role, GoogleDrivePermissionType type, bool allowFileDiscovery) { if (!CheckAuthorization()) { return; } string url = string.Format("https://www.googleapis.com/drive/v3/files/{0}/permissions", fileID); string json = JsonConvert.SerializeObject(new { role = role.ToString(), type = type.ToString(), allowFileDiscovery = allowFileDiscovery.ToString() }); string response = SendRequest(HttpMethod.POST, url, json, RequestHelpers.ContentTypeJSON, null, GoogleAuth.GetAuthHeaders()); }
public void SetPermissions(string fileID, GoogleDrivePermissionRole role, GoogleDrivePermissionType type, string value, bool withLink) { NameValueCollection headers = new NameValueCollection(); headers.Add("Authorization", "Bearer " + AuthInfo.Token.access_token); string url = string.Format("https://www.googleapis.com/drive/v2/files/{0}/permissions", fileID); string json = JsonConvert.SerializeObject(new { role = role.ToString(), type = type.ToString(), value = value, withLink = withLink.ToString() }); string response = SendPostRequestJSON(url, json, headers: headers); }
private void SetPermissions(string fileID, GoogleDrivePermissionRole role, GoogleDrivePermissionType type, string value, bool withLink) { if (!CheckAuthorization()) { return; } string url = string.Format("https://www.googleapis.com/drive/v2/files/{0}/permissions", fileID); string json = JsonConvert.SerializeObject(new { role = role.ToString(), type = type.ToString(), value = value, withLink = withLink.ToString() }); string response = SendRequest(HttpMethod.POST, url, json, ContentTypeJSON, null, GetAuthHeaders()); }
private void SetPermissions(string fileID, GoogleDrivePermissionRole role, GoogleDrivePermissionType type, string value, bool withLink) { if (!CheckAuthorization()) return; string url = string.Format("https://www.googleapis.com/drive/v2/files/{0}/permissions", fileID); string json = JsonConvert.SerializeObject(new { role = role.ToString(), type = type.ToString(), value = value, withLink = withLink.ToString() }); string response = SendRequestJSON(url, json, GetAuthHeaders()); }