-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Use API key authn * Exception handling * Use API endpoints and bump RestSharp * Use API endpoints and bump RestSharp * Map SDK to API service * Add endpoints * Import * Routes, verbs and endpoints * Add AppointmentNo to appointment graph * Add flag to create job along with a task * Optional source app/type parameters in appointment attributes * Add Appointment No to notification #142 * Remove import params to appointment no * Notification enum * Undo notification type * Bump package * Simplify DimeSchedulerClient initialization * Examples * Readme * Namespaces and refactoring * Validate parameters * Required parameters and connector endpoint * Eliminate requirement for source app & type when removing appointments * Bump package * Namespacing * Bump version to beta.1 * Example console app
- Loading branch information
Showing
232 changed files
with
2,072 additions
and
1,738 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using Dime.Scheduler; | ||
using Spectre.Console; | ||
|
||
public class AppendResource | ||
{ | ||
public AppendResource(Dime.Scheduler.Environment environment, string key) | ||
{ | ||
Environment = environment; | ||
Key = key; | ||
} | ||
|
||
private Dime.Scheduler.Environment Environment { get; } | ||
private string Key { get; } | ||
|
||
public async Task Run() | ||
{ | ||
DimeSchedulerClient client = new(Key, Environment); | ||
|
||
string name = AnsiConsole.Ask<string>("What is the name of the resource?"); | ||
string resourceNo = AnsiConsole.Ask<string>("What is their employee code?"); | ||
|
||
Dime.Scheduler.Entities.Resource resource = new() | ||
{ | ||
SourceApp = "EXAMPLE", | ||
SourceType = "EXAMPLE", | ||
DisplayName = name, | ||
ResourceNo = resourceNo | ||
}; | ||
|
||
await AnsiConsole.Status().Start("Saving...", async ctx => | ||
{ | ||
await client.Resources.CreateAsync(resource); | ||
Thread.Sleep(2000); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using Dime.Scheduler; | ||
using Spectre.Console; | ||
|
||
public class AppendTask | ||
{ | ||
public AppendTask(Dime.Scheduler.Environment environment, string key) | ||
{ | ||
Environment = environment; | ||
Key = key; | ||
} | ||
|
||
private Dime.Scheduler.Environment Environment { get; } | ||
private string Key { get; } | ||
|
||
public async Task Run() | ||
{ | ||
DimeSchedulerClient client = new(Key, Environment); | ||
|
||
string name = AnsiConsole.Ask<string>("Name of this task:"); | ||
string descr = AnsiConsole.Ask<string>("Short description:"); | ||
|
||
// Required fields in a task include Source App, Source Type, Job No, Task No, Short Description | ||
// By setting the CreateJob property to true, Dime.Scheduler will automatically create a job for this task | ||
Dime.Scheduler.Entities.Task task = new() | ||
{ | ||
SourceApp = "EXAMPLE", | ||
SourceType = "EXAMPLE", | ||
JobNo = name, | ||
TaskNo = name, | ||
Description = descr, | ||
ShortDescription = descr.Length < 50 ? descr : descr.Substring(0, 50), | ||
CreateJob = true | ||
}; | ||
|
||
await AnsiConsole.Status().Start("Saving...", async ctx => | ||
{ | ||
await client.Tasks.CreateAsync(task); | ||
Thread.Sleep(2000); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Dime.Scheduler" Version="1.0.0-beta.1" /> | ||
<PackageReference Include="Spectre.Console" Version="0.48.0" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using Spectre.Console; | ||
|
||
bool again = true; | ||
do | ||
{ | ||
// Step 1: action selection | ||
string action = AnsiConsole.Prompt( | ||
new SelectionPrompt<string>() | ||
.Title("What would you like to try out?") | ||
.PageSize(10) | ||
.MoreChoicesText("[grey](Move up and down to show more examples)[/]") | ||
.AddChoices(new[] { "Task", "Resource" })); | ||
|
||
// Step 2: environment selection | ||
string environment = AnsiConsole.Prompt( | ||
new SelectionPrompt<string>() | ||
.Title("What environment should we be running the command on?") | ||
.PageSize(10) | ||
.AddChoices(new[] { "Production", "Sandbox" })); | ||
|
||
Dime.Scheduler.Environment env = environment == "Production" ? Dime.Scheduler.Environment.Production : Dime.Scheduler.Environment.Sandbox; | ||
|
||
// Step 3: API key | ||
string key = AnsiConsole.Ask<string>("Please share the API key to use:"); | ||
|
||
switch (action) | ||
{ | ||
case "Task": | ||
AppendTask taskCmd = new(env, key); | ||
await taskCmd.Run(); | ||
break; | ||
|
||
case "Resource": | ||
AppendResource resourceCmd = new(env, key); | ||
await resourceCmd.Run(); | ||
break; | ||
} | ||
|
||
if (!AnsiConsole.Confirm("Want to do anything else?")) | ||
again = false; | ||
} | ||
while (again); |
Oops, something went wrong.