public void Setup(string workspaceName, params string[] tfsProjectNames) { _workspace = _workspaceService.List().FirstOrDefault(f => f.Name == workspaceName); if (_workspace == null) { Console.WriteLine($"can't find workspace {workspaceName}"); Environment.Exit(0); } _clients = _clientService.List(); foreach (var tfsProjectName in tfsProjectNames) { var client = _clients.FirstOrDefault(f => f.Name == tfsProjectName && f.WorkspaceId == _workspace.Id); if (client != null) { continue; } client = _clientService.Add(new Client { Name = tfsProjectName, WorkspaceId = _workspace.Id }); Console.WriteLine($"synced client {client.Name} in workspace {_workspace.Name}"); } _clients = _clientService.List(); }
public void GetWorkSpaces() { var t = new WorkspaceService(); t.List(); var obj = t.List(); Assert.GreaterOrEqual(obj.Count(), 0); }
public void GetWorkSpaceClients() { var t = new WorkspaceService(Constants.ApiToken); var obj = t.List().FirstOrDefault(); var lst = t.Clients(obj.Id.Value); Assert.Greater(lst.Count(), 0); }
public void GetWorkSpaceTasks() { var t = new WorkspaceService(); var obj = t.List().FirstOrDefault(); var lst = t.Tasks(obj.Id.Value); Assert.Greater(lst.Count(), 0); }
private void SetDefaultWorkspace() { var workspaceService = new WorkspaceService(TogglApiKey); var defaultWorkspace = workspaceService.List().FirstOrDefault(); if (defaultWorkspace?.Id != null) { DefaultWorkspacedId = (int)defaultWorkspace.Id; } }
public void GetWorkSpaceProjects() { var workspace = WorkspaceService.List().SingleOrDefault(); Assert.IsFalse(WorkspaceService.Projects(workspace.Id.Value).Any()); ProjectService.Add(new Project() { }); var t = new WorkspaceService(Constants.ApiToken); var obj = t.List().FirstOrDefault(); var lst = t.Projects(obj.Id.Value); Assert.Greater(lst.Count(), 0); }
public Toggl2TogglIntegration(string toggleApiKey) { timeEntryService = new TimeEntryService(toggleApiKey); var workspaceService = new WorkspaceService(toggleApiKey); var clientService = new ClientService(toggleApiKey); var projectService = new ProjectService(toggleApiKey); clientNameResolvers = new HashSet <ITimeEntryBasedResolver <IClient> >(); projectNameResolvers = new HashSet <ITimeEntryBasedResolver <IProject> >(); tagResolvers = new HashSet <ITimeEntryBasedResolver <ITag> >(); List <Client> clients = clientService.List(false); List <Project> projects = projectService.List(); List <Workspace> workspaces = workspaceService.List(); workspacesClientsProjects = new List <WorkspaceClientProjectModel>(); MapClientsAndProjects(workspaces, clients, projects); }
public async Task <ActionResult <WorkspaceSummary[]> > ListWorkspaces([FromQuery] WorkspaceSearch search, CancellationToken ct) { await Validate(search); await Validate(new ClientAudience { Audience = search.aud, Scope = Actor.Scope }); AuthorizeAll(); search.scope = Actor.Scope; return(Ok( await _svc.List(search, Actor.Id, Actor.IsAdmin, ct) )); }
/// <summary> /// APIキーを認証 /// </summary> public void Init() { ProjectIDs = new Dictionary <string, int>() { { "", 0 } }; Tags = new List <string>() { "" }; try { if (string.IsNullOrEmpty(ApiKey)) { return; } var userService = new UserService(ApiKey); User = userService.GetCurrent().Email; var projectService = new ProjectService(ApiKey); List <Project> projects = projectService.List(); foreach (Project p in projects) { ProjectIDs.Add(p.Name, (int)p.Id); } timeEntryService = new TimeEntryService(ApiKey); var workspaceService = new WorkspaceService(ApiKey); List <Workspace> workspaces = workspaceService.List(); defaultWorkspaceID = workspaces.First().Id.Value; var tags = workspaceService.Tags(defaultWorkspaceID); foreach (Tag t in tags) { Tags.Add(t.Name); } } catch (Exception e) { throw e; } }
public void ListReturnsList() { using (TestSession test = CreateSession()) { test.AddActor("*****@*****.**"); WorkspaceService mgr = test.GetTopologyManager(); for (int i = 0; i < 5; i++) { Workspace topo = mgr.Create(new NewWorkspace { Name = "JamOn" + i.ToString(), Description = i.ToString() }).Result; if (i > 2) { topo.IsPublished = true; mgr.Update(new ChangedWorkspace { Id = topo.Id, Name = topo.Name, Description = topo.Description, Author = topo.Author, IsPublished = true, Audience = topo.Audience, TemplateLimit = topo.TemplateLimit }).Wait(); // mgr.Publish(topo.Id, false).Wait(); } } var list = mgr.List(new Search { Take = 50, //Term = "2", Filter = new string[] { "published", "mine" } }).Result; Assert.True(list.Length == 2); } }
public virtual void Init() { WorkspaceService = new WorkspaceService(Constants.ApiToken); var workspaces = WorkspaceService.List(); ClientService = new ClientService(Constants.ApiToken); TaskService = new TaskService(Constants.ApiToken); TagService = new TagService(Constants.ApiToken); ProjectService = new ProjectService(Constants.ApiToken); UserService = new UserService(Constants.ApiToken); TimeEntryService = new TimeEntryService(Constants.ApiToken); ReportService = new ReportService(Constants.ApiToken); DashboardService = new DashboardService(Constants.ApiToken); foreach (var workspace in workspaces) { var projects = WorkspaceService.Projects(workspace.Id.Value); var tasks = WorkspaceService.Tasks(workspace.Id.Value); var tags = WorkspaceService.Tags(workspace.Id.Value); // TODO var users = WorkspaceService.Users(workspace.Id.Value); // TODO var clients = WorkspaceService.Clients(workspace.Id.Value); var rte = new TimeEntryParams { StartDate = DateTime.Now.AddYears(-1) }; var timeEntries = TimeEntryService.List(rte); Assert.IsTrue(TimeEntryService.DeleteIfAny(timeEntries.Select(te => te.Id.Value).ToArray())); Assert.IsTrue(ProjectService.DeleteIfAny(projects.Select(p => p.Id.Value).ToArray())); Assert.IsTrue(TaskService.DeleteIfAny(tasks.Select(t => t.Id.Value).ToArray())); Assert.IsTrue(ClientService.DeleteIfAny(clients.Select(c => c.Id.Value).ToArray())); Assert.IsFalse(WorkspaceService.Projects(workspace.Id.Value).Any()); Assert.IsFalse(WorkspaceService.Tasks(workspace.Id.Value).Any()); Assert.IsFalse(WorkspaceService.Clients(workspace.Id.Value).Any()); Assert.IsFalse(TimeEntryService.List(rte).Any()); } DefaultWorkspaceId = workspaces.First().Id.Value; }
public virtual void Init() { WorkspaceService = new WorkspaceService(Constants.ApiToken); var workspaces = WorkspaceService.List(); ClientService = new ClientService(Constants.ApiToken); TaskService = new TaskService(Constants.ApiToken); TagService = new TagService(Constants.ApiToken); ProjectService = new ProjectService(Constants.ApiToken); UserService = new UserService(Constants.ApiToken); TimeEntryService = new TimeEntryService(Constants.ApiToken); ReportService = new ReportService(Constants.ApiToken); foreach (var workspace in workspaces) { var projects = WorkspaceService.Projects(workspace.Id.Value); var tasks = WorkspaceService.Tasks(workspace.Id.Value); var tags = WorkspaceService.Tags(workspace.Id.Value); // TODO var users = WorkspaceService.Users(workspace.Id.Value); // TODO var clients = WorkspaceService.Clients(workspace.Id.Value); var rte = new TimeEntryParams { StartDate = DateTime.Now.AddYears(-1)}; var timeEntries = TimeEntryService.List(rte); Assert.IsTrue(TimeEntryService.DeleteIfAny(timeEntries.Select(te => te.Id.Value).ToArray())); Assert.IsTrue(ProjectService.DeleteIfAny(projects.Select(p => p.Id.Value).ToArray())); Assert.IsTrue(TaskService.DeleteIfAny(tasks.Select(t => t.Id.Value).ToArray())); Assert.IsTrue(ClientService.DeleteIfAny(clients.Select(c => c.Id.Value).ToArray())); Assert.IsFalse(WorkspaceService.Projects(workspace.Id.Value).Any()); Assert.IsFalse(WorkspaceService.Tasks(workspace.Id.Value).Any()); Assert.IsFalse(WorkspaceService.Clients(workspace.Id.Value).Any()); Assert.IsFalse(TimeEntryService.List(rte).Any()); } DefaultWorkspaceId = workspaces.First().Id.Value; }
public async Task <ActionResult <WorkspaceSummary[]> > List([FromQuery] Search search, CancellationToken ct) { var result = await _workspaceService.List(search, ct); return(Ok(result)); }
public void GetWorkSpaces() { var workspaces = WorkspaceService.List(); Assert.AreEqual(workspaces.Count(), 1); }