public static async Task Run(WrikeClient client) { //Get all timelog records in all accounts. var timelogs = await client.Timelogs.GetAsync(); var newTimelog = new WrikeTimelog("IEACGXLUKQIGFGAK", 1m, DateTime.Now, comment: "test timelog"); newTimelog = await client.Timelogs.CreateAsync(newTimelog); //Get all timelog records for a task. //var timelogs = await client.Timelogs.GetAsync(taskId: "IEABX2HEKQGPEIPC"); //Get all timelog records in the account. //var timelogs = await client.Timelogs.GetAsync(accountId: "IEABX2HE"); //Get all timelog records in the account by createdDate //var timelogs = await client.Timelogs.GetAsync( // accountId: "IEABX2HE", // createdDate: new WrikeDateFilterRange(new DateTime(2018, 1, 29), new DateTime(2018, 1, 30))); //var timelog = await client.Timelogs.GetAsync(timelogId: "IEABX2HEJQAAKOKI"); /* * var newTimelog = new WrikeTimelog("IEABX2HEKQGGVPW3", "comment test", 0.5m, DateTime.Now); * newTimelog = await client.Timelogs.CreateAsync(newTimelog); * * var updatedTimelog = await client.Timelogs.UpdateAsync(newTimelog.Id, comment: "updated comment"); * * await client.Timelogs.DeleteAsync(newTimelog.Id); */ }
public static async Task Run(WrikeClient client) { var contacts = await client.Contacts.GetAsync(); var user = await client.Users.GetAsync(contacts[1].Id); //user.Profiles[0].Role = Core.WrikeUserRole.User; //user.Profiles[0].External = true; //user = await client.Users.UpdateAsync(user.Id, user.Profiles[0]); }
private static void GettingAndRefreshingTokenDoneByWrikeClient() { //TODO: why we need redirectUri? var wrikeClient = new WrikeClient(new WrikeAccessTokenRequest( ClientId, ClientSecret, AuthorizationCode), "http://localhost"); var colors = wrikeClient.Colors.GetAsync().Result; wrikeClient.RefreshToken(); colors = wrikeClient.Colors.GetAsync().Result; }
public static async Task Run(WrikeClient client) { var existingInvitations = await client.Invitations.GetAsync(); var newInvitation = new WrikeInvitation(email: "*****@*****.**" , firstName: "Sinann", lastName: "Tavilogluu", role: WrikeUserRole.Collaborator); newInvitation = await client.Invitations.CreateAsync(newInvitation, "Invitation Subject", "Invitation Message"); existingInvitations = await client.Invitations.GetAsync(); var updatedInvitation = await client.Invitations.UpdateAsync(newInvitation.Id, resend : true); await client.Invitations.DeleteAsync(updatedInvitation.Id); }
public static async Task Run(WrikeClient client) { var attachments = await client.Attachments.GetAsync(); var preview = await client.Attachments.DownloadPreviewAsync(attachments[0].Id, Core.Attachments.WrikePreviewDimension.w44); var url = await client.Attachments.GetAccessUrlAsync(attachments[0].Id); var attachmentUrl = await client.Attachments.GetAccessUrlAsync(attachments[0].Id); attachments = await client.Attachments.GetAsync(new List <string> { attachments[0].Id }); var wrikeLogoFileBytes = File.ReadAllBytes("wrikeLogo.png"); //var createdTaskAttachment = // await client.Attachments.CreateInTask(TaskId, "wrikeLogo.png", wrikeLogoFileBytes) var createdFolderAttachment = await client.Attachments.CreateInFolderAsync(FolderId, "wrikeLogo.png", wrikeLogoFileBytes); var currentAccount = await client.Accounts.GetAsync(); var tasks = await client.Tasks.GetAsync(fields : new List <string>() { WrikeTask.OptionalFields.HasAttachments, WrikeTask.OptionalFields.AttachmentCount }); var tasksWithAttachments = tasks.Where(o => o.HasAttachments).ToList(); foreach (var task in tasksWithAttachments) { var taskAttachments = await client.Attachments.GetInTaskAsync(task.Id, withUrls : true); foreach (var taskAttachment in taskAttachments) { var stream = await client.Attachments.DownloadAsync(taskAttachment.Id); } } }
static void Main(string[] args) { //AuthorizationSamples.RunAuthorizationCodes(); var bearerToken = "eyJ0dCI6InAiLCJhbGciOiJIUzI1NiIsInR2IjoiMSJ9.eyJkIjoie1wiYVwiOjIzMTc2ODQsXCJpXCI6NTM3NDAyNCxcImNcIjo0NTk1MDE0LFwidlwiOm51bGwsXCJ1XCI6NDc2NzU4MSxcInJcIjpcIlVTXCIsXCJzXCI6W1wiV1wiLFwiRlwiLFwiSVwiLFwiVVwiLFwiS1wiLFwiQ1wiXSxcInpcIjpbXSxcInRcIjowfSIsImlhdCI6MTUzNzMyMTkyOH0.r8MaouEsyTiWJ0qPqUt2McslSPP2NTinL9YrnQ9Lcow"; var wrikeClient = new WrikeClient(bearerToken); //ColorSamples.Run(wrikeClient).Wait(); //VersionSamples.Run(wrikeClient).Wait(); //WebHooksSamples.Run(wrikeClient).Wait(); //CommentsSamples.Run(wrikeClient).Wait(); //DependenciesSamples.Run(wrikeClient).Wait(); //AccountsSamples.Run(wrikeClient).Wait(); //FoldersAndProjectsSamples.Run(wrikeClient).Wait(); //TimelogSamples.Run(wrikeClient).Wait(); //TimelogCategoriesSamples.Run(wrikeClient).Wait(); ContactsSamples.Run(wrikeClient).Wait(); //TasksSamples.Run(wrikeClient).Wait(); //WorkflowSamples.Run(wrikeClient).Wait(); //GroupsSamples.Run(wrikeClient).Wait(); //InvitationsSamples.Run(wrikeClient).Wait(); //CustomFieldsSamples.Run(wrikeClient).Wait(); //UsersSamples.Run(wrikeClient).Wait(); //try other samples... //AttachmentsSamples.Run(wrikeClient).Wait(); }
private static void GettingAndRefreshingTokenDoneByUser() { var accesTokenResponse = WrikeClient.GetAccesToken(new WrikeAccessTokenRequest( ClientId, ClientSecret, AuthorizationCode), "http://localhost"); var wrikeClient = new WrikeClient(accesTokenResponse.AccessToken, accesTokenResponse.Host); var colors = wrikeClient.Colors.GetAsync().Result; var refreshTokenResponse = WrikeClient.RefreshToken(ClientId, ClientSecret, accesTokenResponse.RefreshToken, accesTokenResponse.Host); wrikeClient = new WrikeClient(refreshTokenResponse.AccessToken, accesTokenResponse.Host); colors = wrikeClient.Colors.GetAsync().Result; }
public static async Task Run(WrikeClient client) { var webhooks = await client.WebHooks.GetAsync(); //var webhooks = await client.WebHooks.GetAsync(new List<string> { "webHookId", "webHookId"}); var newWebHook = new WrikeWebHook(TestWebHookAddress); newWebHook = await client.WebHooks.CreateAsync(newWebHook); //var newWebHook = new WrikeWebHook(TestWebHookAddress, "folderID"); //newWebHook = await client.WebHooks.CreateAsync(newWebHook); newWebHook = await client.WebHooks.UpdateAsync(newWebHook.Id, WrikeWebHookStatus.Suspended); await client.WebHooks.DeleteAsync(newWebHook.Id); }
public static async Task Run(WrikeClient client) { var currentAccount = await client.Accounts.GetAsync(); var optionalFields = new List <string> { WrikeAccount.OptionalFields.Metadata, WrikeAccount.OptionalFields.CustomFields, WrikeAccount.OptionalFields.Subscription }; currentAccount = await client.Accounts.GetAsync(optionalFields : optionalFields); var metadataList = new List <WrikeMetadata> { new WrikeMetadata("testMetadata", "testMetadata") }; currentAccount = await client.Accounts.UpdateAsync(metadataList); }
public static async Task Run(WrikeClient client) { var allGroups = await client.Groups.GetAsync(); var newGroup = new WrikeGroup("Sinan's Test Group"); newGroup = await client.Groups.CreateAsync(newGroup); var updatedGroup = await client.Groups.UpdateAsync( newGroup.Id, title : "Sinan's Group [Updated]", avatar : new WrikeGroupAvatar("#795548", "SG")); await client.Groups.DeleteAsync(newGroup.Id, true); await client.Groups.DeleteAsync(newGroup.Id); }
public static async Task Run(WrikeClient client) { var tasks = await client.Tasks.GetAsync(); var specialTask = tasks.FirstOrDefault(t => t.Permalink.Contains("273185186")); var newComment = new WrikeTaskComment("test comment #1", specialTask.Id); var comments = await client.Comments.GetAsync(); newComment = await client.Comments.CreateAsync(newComment, true); var updatedComment = await client.Comments.UpdateAsync(newComment.Id, "updated comment #1", true); comments = await client.Comments.GetAsync(new List <string> { newComment.Id }); await client.Comments.DeleteAsync(newComment.Id); }
public static void RunAuthorizationCodes() { var authorizationUrl = WrikeClient.GetAuthorizationUrl( ClientId, redirectUri: "http://localhost", state: "myTestState", scope: new List <string> { WrikeScopes.Default, WrikeScopes.wsReadWrite }); //Use this url Wrike redirect to the provided redirectUri with the Authorization code //go on authorization process with that code AuthorizationCode = "UsNrpHoFexXtqI26i2sVWX68W7JANS9iTdWU7tCSVm7GfJdfZuS4VdjTZRTzvqVg-NW"; //GettingAndRefreshingTokenDoneByUser(); GettingAndRefreshingTokenDoneByWrikeClient(); //PermanentTokenUsage(); }
public static async Task Run(WrikeClient client) { var contacts = await client.Contacts.GetAsync(); contacts = await client.Contacts.GetAsync(new List <string> { contacts.First().Id }); contacts = await client.Contacts.GetAsync(me : true); contacts = await client.Contacts.GetAsync(me : true, retrieveMetadata : true); var updatedContact = await client.Contacts.UpdateAsync( "KUAERP25", new List <Core.WrikeMetadata> { new Core.WrikeMetadata("testMetaKey", "testMetaValue") }); var personTypeContacts = await client.Contacts.GetContactsByTypeAsync(WrikeUserType.Person); }
public static async Task Run(WrikeClient client) { await client.Dependencies.DeleteAsync("aads"); var dependencies = await client.Dependencies.GetInTaskAsync(DependentTaskId); var newDependency = new WrikeDependency(DependentTaskId, SuccessorTaskId, WrikeDependencyRelationType.FinishToStart); newDependency = await client.Dependencies.CreateAsync(newDependency); dependencies = await client.Dependencies.GetInTaskAsync(DependentTaskId); dependencies = await client.Dependencies.GetInTaskAsync(DependentTaskId); //var newWrikeDependencyWithSuccessor = new WrikeDependencyWithSuccessor(SuccessorTaskId, WrikeDependencyRelationType.FinishToFinish); //newWrikeDependencyWithSuccessor = await client.Dependencies.CreateAsync(DependentTaskId, newWrikeDependencyWithSuccessor); //await client.Dependencies.DeleteAsync(newDependency.Id); }
public static async Task Run(WrikeClient client) { var workflows = await client.Workflows.GetAsync(); //var newWorkFlow = new WrikeWorkflow("MyNewWorkflow"); //var newWorkflow = await client.Workflows.CreateAsync(accountId, newWorkFlow); //var updatedWorkflow = await client.Workflows.UpdateAsync(newWorkflow.Id, // "UpdatedWorkFlow", false, new Core.WrikeCustomStatus { // Color = Core.WrikeColor.CustomStatusColor.Green, // Name = "CustomStatus01", // Hidden = false, // Standard = false, // Group = WrikeTaskStatus.Active // }); //updatedWorkflow = await client.Workflows.UpdateAsync(newWorkflow.Id, // "UpdatedWorkFlow2"); await ExtensionSamples(client); }
public static async Task Run(WrikeClient client) { //try other options... var folderTrees = await client.FoldersAndProjects.GetFolderTreeAsync(); var folders = await client.FoldersAndProjects.GetFoldersAsync(DefaultFolderIds); //var copiedFolder = await client.FoldersAndProjects.CopyAsync("IEACGXLUI4IEQ6NB", "IEACGXLUI4IHJMYP","CopiedFolder"); //var folders = await client.FoldersAndProjects.GetFoldersAsync( // new List<string> { "folderId", "folderId" }, // new List<string> { // WrikeFolder.OptionalFields.AttachmentCount, // WrikeFolder.OptionalFields.BriefDescription, // WrikeFolder.OptionalFields.CustomColumnIds} // ); //folders = await client.FoldersAndProjects.GetFoldersAsync( //new List<string> { "folderId", "folderId" } //); var rootFolderId = "root-folderId"; var newFolder = new WrikeFolder("Sinan Test Folder2", description: "Test Folder for development of wrike integration"); newFolder = await client.FoldersAndProjects.CreateAsync(rootFolderId, newFolder); newFolder = await client.FoldersAndProjects.UpdateAsync(newFolder.Id, "Sinan Test Folder #2", addShareds : new List <string> { "newIdToAdd" }); await client.FoldersAndProjects.DeleteAsync(newFolder.Id); }
public static async Task Run(WrikeClient client) { var customFields = await client.CustomFields.GetAsync(); var newCustomField = new WrikeCustomField("TestCustomField", WrikeCustomFieldType.Text); newCustomField = await client.CustomFields.CreateAsync(newCustomField); customFields = await client.CustomFields.GetAsync(); foreach (var customField in customFields) { await client.CustomFields.UpdateAsync(customField.Id, type : customField.Type); } //customFields = await client.CustomFields.GetAsync(new List<string> { "customFieldId", "customFieldId" }); //var newCustomField = new WrikeCustomField //{ // AccountId = "accountId", // Title = "New Custom Field", // Type = WrikeCustomFieldType.Duration //}; //newCustomField = await client.CustomFields.CreateAsync(newCustomField); //TODO: returns invalid-parameter error if type is not Text customFields[18].Settings.DecimalPlaces = 0; customFields[18].Settings.Aggregation = WrikeCustomFieldAggregationType.None; var updatedCustomField = await client.CustomFields.UpdateAsync( customFields[18].Id, settings : customFields[18].Settings); }
public static async Task Run(WrikeClient client) { var tasks = await client.Tasks.GetAsync(); var dueDate = DateTime.Now.AddDays(1); var newTask = new WrikeTask($"Due Date Should Be {dueDate.ToString("yyyy-MM-dd")}", dates: new WrikeTaskDate { Due = dueDate }); newTask = await client.Tasks.CreateAsync("IEACGXLUI4IEQ6NG", newTask); //many other optional parameters //var tasks = await client.Tasks.GetAsync( // createdDate: new WrikeDateFilterRange(new DateTime(2018, 1, 1), new DateTime(2018, 2, 5)), // sortOrder: WrikeSortOrder.Asc, // sortField: WrikeTaskSortField.CreatedDate, // scheduledDate: new WrikeDateFilterRange(new DateTime(2018, 1, 1), new DateTime(2018, 2, 5)), // dueDate: new WrikeDateFilterEqual(new DateTime(2018, 2, 5)), // limit: 10 // ); //tasks = await client.Tasks.GetAsync(accountId: "accountId"); //tasks = await client.Tasks.GetAsync(folderId: "folderId"); //tasks = await client.Tasks.GetAsync(new List<string> { "taskId", "taskId" }); //tasks = await client.Tasks.GetAsync( // new List<string> { "taskId", "taskId" }, // new List<string> { // WrikeTask.OptionalFields.AttachmentCount, // WrikeTask.OptionalFields.Recurrent } // ); //var tasks = await client.Tasks.GetAsync(); //paged example var pagedTaskList = await client.Tasks.GetAsync(pageSize : 20); //you can read this property only after first paged request, otherwise it is 0 var responseSize = client.Tasks.LastResponseSize; //if you keep requesting with LastNextPageToken it will be empty when you get your last tasks of paged response var nextPageToken = client.Tasks.LastNextPageToken; while (!string.IsNullOrWhiteSpace(nextPageToken)) { pagedTaskList = await client.Tasks.GetAsync(nextPageToken : nextPageToken); nextPageToken = client.Tasks.LastNextPageToken; //client.Tasks.LastResponseSize is zero here } //another paged example do { var pagedList2 = await client.Tasks.GetAsync(nextPageToken : client.Tasks.LastNextPageToken, pageSize : 20); } while (!string.IsNullOrWhiteSpace(client.Tasks.LastNextPageToken)); //var newTask = new WrikeTask //{ // Title = "new task title", // Description = "new task description", // Status = WrikeTaskStatus.Active, // Importance = WrikeTaskImportance.High, // Dates = new WrikeTaskDate // { // Due = DateTime.Now.AddDays(5), // Duration = 180000, // Start = DateTime.Now, // Type = WrikeTaskDateType.Planned, // WorkOnWeekends = false // }, // SharedIds = null, // ParentIds = null, // ResponsibleIds = null, // FollowerIds = null, // FollowedByMe = false, // SuperTaskIds = null, // Metadata = new List<WrikeMetadata> { // new WrikeMetadata("metadata1","metadata1.value") // }, // CustomStatusId = null //}; //newTask = await client.Tasks.CreateAsync("folderId", newTask); //tasks = await client.Tasks.GetAsync(); //newTask = await client.Tasks.UpdateAsync( // newTask.Id, // title: "updated task title", // description: "updated description"); //var deletedTask = await client.Tasks.DeleteAsync(newTask.Id); //tasks = await client.Tasks.GetAsync(); }
public static async Task ExtensionSamples(WrikeClient client) { var newWorkflow = new WrikeWorkflow("Sinan's Extension Workflow") { CustomStatuses = new List <WrikeCustomStatus> { new WrikeCustomStatus { Color = WrikeColor.CustomStatusColor.Blue, Group = WrikeTaskStatus.Active, Hidden = false, Name = "New" }, new WrikeCustomStatus { Color = WrikeColor.CustomStatusColor.Brown, Group = WrikeTaskStatus.Active, Hidden = false, Name = "In Progress(MaterialCollector)" }, new WrikeCustomStatus { Color = WrikeColor.CustomStatusColor.DarkBlue, Group = WrikeTaskStatus.Active, Hidden = false, Name = "Collection Completed" } , new WrikeCustomStatus { Color = WrikeColor.CustomStatusColor.DarkCyan, Group = WrikeTaskStatus.Active, Hidden = false, Name = "Assigned To Content Manager" }, new WrikeCustomStatus { Color = WrikeColor.CustomStatusColor.DarkBlue, Group = WrikeTaskStatus.Active, Hidden = false, Name = "In Progress(Content Manager)" }, new WrikeCustomStatus { Color = WrikeColor.CustomStatusColor.Gray, Group = WrikeTaskStatus.Completed, Hidden = false, Name = "Completed" }, new WrikeCustomStatus { Color = WrikeColor.CustomStatusColor.DarkBlue, Group = WrikeTaskStatus.Completed, Hidden = false, Name = "BookAndAdApproved" } } }; newWorkflow = await client.Workflows.CreateWorkflowWithCustomStatusesAsync(newWorkflow); }
public static async Task Run(WrikeClient client) { var version = await client.Version.GetAsync(); }
private static void PermanentTokenUsage() { var wrikeClient = new WrikeClient(PermanentToken); var colors = wrikeClient.Colors.GetAsync().Result; }
public static async Task Run(WrikeClient client) { //Get all timelog categorie in the account. var timelogCategories = await client.TimeLogCategories.GetAsync(); }
static WrikeClientFactory() { _wrikeClient = new WrikeClient("eyJ0dCI6InAiLCJhbGciOiJIUzI1NiIsInR2IjoiMSJ9.eyJkIjoie1wiYVwiOjIzMTc2ODQsXCJpXCI6NTM3NDAyNCxcImNcIjo0NTk1MDE0LFwidlwiOm51bGwsXCJ1XCI6NDc2NzU4MSxcInJcIjpcIlVTXCIsXCJzXCI6W1wiV1wiLFwiRlwiLFwiSVwiLFwiVVwiLFwiS1wiLFwiQ1wiXSxcInpcIjpbXSxcInRcIjowfSIsImlhdCI6MTUzNzMyMTkyOH0.r8MaouEsyTiWJ0qPqUt2McslSPP2NTinL9YrnQ9Lcow"); }
public static async Task Run(WrikeClient client) { var colors = await client.Colors.GetAsync(); }