public async Task<int> RunAsync(string[] remainingArguments) { if (String.IsNullOrWhiteSpace(clientId)) { Console.Write("Client ID: "); clientId = Console.ReadLine(); } if (String.IsNullOrWhiteSpace(clientSecret)) { Console.Write("Client Secret: "); clientSecret = Console.ReadLine(); } var info = await APIInfo.GetFromRemote(baseUrl, ApiArea.Integrations); var authApi = new AuthorizationApi(baseUrl, clientId, clientSecret); var authorization = authApi.GetApiClientAccessToken(new string[] { "Trusted.Experiences" }); var factory = new TrustedApiFactory(info, authorization.AccessToken); var api = factory.GetExperiencesApi(); var experiences = new List<ExperienceModel>(); var result = await api.GetExperiences(); experiences.AddRange(result); foreach (var experience in experiences) { Console.WriteLine("{1} ({0})", experience.ID, experience.Title ); } return 0; }
public async Task<int> RunAsync(string[] remainingArguments) { if (String.IsNullOrWhiteSpace(clientId)) { Console.Write("Client ID: "); clientId = Console.ReadLine(); } if (String.IsNullOrWhiteSpace(clientSecret)) { Console.Write("Client Secret: "); clientSecret = Console.ReadLine(); } if (!id.HasValue) { Console.Write("Workflow ID: "); string idString = Console.ReadLine(); if (!String.IsNullOrWhiteSpace(idString)) { id = int.Parse(idString); } } var info = await APIInfo.GetFromRemote(baseUrl, ApiArea.Integrations); var authApi = new AuthorizationApi(baseUrl, clientId, clientSecret); var authorization = authApi.GetApiClientAccessToken(new string[] { "Integrations.Workflows" }); var factory = new IntegrationsApiFactory(info, authorization.AccessToken); var api = factory.GetWorkflowApi(); var workflows = new List<WorkflowModel>(); if (id.HasValue) { var workflow = await api.GetWorkflow(id.Value); workflows.Add(workflow); } else { var result = await api.GetWorkflows(); workflows.AddRange(result); } foreach (var workflow in workflows) { Console.WriteLine("{1} ({0})", workflow.ID, workflow.Title ); if (!String.IsNullOrWhiteSpace(workflow.Description)) { Console.WriteLine(workflow.Description); } Console.WriteLine(); } return 0; }
public async Task<int> RunAsync(string[] remainingArguments) { if (String.IsNullOrWhiteSpace(clientId)) { Console.Write("Client ID: "); clientId = Console.ReadLine(); } if (String.IsNullOrWhiteSpace(clientSecret)) { Console.Write("Client Secret: "); clientSecret = Console.ReadLine(); } if (!id.HasValue) { Console.Write("Workflow ID: "); string idString = Console.ReadLine(); id = int.Parse(idString); } var info = await APIInfo.GetFromRemote(baseUrl, ApiArea.Integrations); var authApi = new AuthorizationApi(baseUrl, clientId, clientSecret); var authorization = authApi.GetApiClientAccessToken(new string[] { "Integrations.Workflows" }); var factory = new IntegrationsApiFactory(info, authorization.AccessToken); var api = factory.GetWorkflowProgressApi(); var result = await api.Get(id.Value); foreach (var student in result) { Console.WriteLine("{0}: {1} {2} ({3}) - {4} {5}", student.JobSeeker.EntityID, student.JobSeeker.FirstName, student.JobSeeker.LastName, student.JobSeeker.StudentID, student.Status, student.CompletedDate ); } return 0; }