Skip to content

Commit

Permalink
Dime.Scheduler Cloud (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
hbulens authored Nov 29, 2023
1 parent ab10404 commit e2997e9
Show file tree
Hide file tree
Showing 111 changed files with 381 additions and 348 deletions.
16 changes: 6 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</p>
<h1 align="center">Dime.Scheduler CLI</h1>

Connect with Dime.Scheduler through a .NET Tool. Check out the [📚 wiki](https://github.com/dime-scheduler/cli/wiki) for all the information on the CLI.
Connect with Dime.Scheduler through the CLI. Check out the [📚 docs](https://docs.dimescheduler.com/develop/cli/intro) for all the information on the CLI.

## Installation

Expand All @@ -36,22 +36,18 @@ To clone and run this application, you'll need Visual Studio 16.7 or higher. The
The following example adds or updates a category in Dime.Scheduler:

```cmd
dimescheduler category
-a
-u https://mydimescheduler.io
-c [email protected]
-p mystrongpassword
-n Service order status
-h #32a852
dimescheduler category add -k "MYAPIKEY" -n 'Service order 123' -h #32a852
```

To specify an environment, add `--env` followed by either `Dev`, `Test`, or `Staging`.

The entry point of the global tool is the `dimescheduler` command.

<img src="assets/cmd.png" />

See the repo's [📚 wiki](https://github.com/dime-scheduler/cli/wiki) for a list of all commands and their parameters.
See the [📚 docs](https://docs.dimescheduler.com/develop/cli/intro) for a list of all commands and their parameters.

To see the parameters of a command, simply run the `dimescheduler` + `entity` + `--help` command and you'll get all the information you need:
To see the parameters of a command, simply run the `dimescheduler` + `verb` + `entity` + `--help` command and you'll get all the information you need:

<img src="assets/cmd-command.png" />

Expand Down
4 changes: 2 additions & 2 deletions src/cli/Commands/ActionUriCommand.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using Dime.Scheduler.CLI.Options;
using Dime.Scheduler.Sdk.Import;
using Dime.Scheduler.Entities;

namespace Dime.Scheduler.CLI.Commands
{
public class ActionUriCommand :
ImportCommand<ActionUriOptions, ActionUri>,
Command<ActionUriOptions, ActionUri>,
ICommand<ActionUriOptions>
{
protected override string WriteIntro(ActionUriOptions options) => $"Adding action URI.";
Expand Down
4 changes: 2 additions & 2 deletions src/cli/Commands/AppointmentCategoryCommand.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using Dime.Scheduler.CLI.Options;
using Dime.Scheduler.Sdk.Import;
using Dime.Scheduler.Entities;

namespace Dime.Scheduler.CLI.Commands
{
public class AppointmentCategoryCommand :
ImportCommand<AppointmentCategoryOptions, AppointmentCategory>,
Command<AppointmentCategoryOptions, AppointmentCategory>,
ICommand<AppointmentCategoryOptions>
{
protected override string WriteIntro(AppointmentCategoryOptions options)
Expand Down
4 changes: 2 additions & 2 deletions src/cli/Commands/AppointmentCommand.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using Dime.Scheduler.CLI.Options;
using Dime.Scheduler.Sdk.Import;
using Dime.Scheduler.Entities;

namespace Dime.Scheduler.CLI.Commands
{
public class AppointmentCommand :
ImportCommand<AppointmentOptions, Appointment>,
Command<AppointmentOptions, Appointment>,
ICommand<AppointmentOptions>
{
protected override string WriteIntro(AppointmentOptions options)
Expand Down
4 changes: 2 additions & 2 deletions src/cli/Commands/AppointmentContainerCommand.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using Dime.Scheduler.CLI.Options;
using Dime.Scheduler.Sdk.Import;
using Dime.Scheduler.Entities;

namespace Dime.Scheduler.CLI.Commands
{
public class AppointmentContainerCommand :
ImportCommand<AppointmentContainerOptions, AppointmentContainer>,
Command<AppointmentContainerOptions, AppointmentContainer>,
ICommand<AppointmentContainerOptions>
{
protected override string WriteIntro(AppointmentContainerOptions options)
Expand Down
4 changes: 2 additions & 2 deletions src/cli/Commands/AppointmentContentCommand.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using Dime.Scheduler.CLI.Options;
using Dime.Scheduler.Sdk.Import;
using Dime.Scheduler.Entities;

namespace Dime.Scheduler.CLI.Commands
{
public class AppointmentContentCommand :
ImportCommand<AppointmentContentOptions, AppointmentContent>,
Command<AppointmentContentOptions, AppointmentContent>,
ICommand<AppointmentContentOptions>
{
protected override string WriteIntro(AppointmentContentOptions options)
Expand Down
4 changes: 2 additions & 2 deletions src/cli/Commands/AppointmentImportanceCommand.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using Dime.Scheduler.CLI.Options;
using Dime.Scheduler.Sdk.Import;
using Dime.Scheduler.Entities;

namespace Dime.Scheduler.CLI.Commands
{
public class AppointmentImportanceCommand :
ImportCommand<AppointmentImportanceOptions, AppointmentImportance>,
Command<AppointmentImportanceOptions, AppointmentImportance>,
ICommand<AppointmentImportanceOptions>
{
protected override string WriteIntro(AppointmentImportanceOptions options)
Expand Down
4 changes: 2 additions & 2 deletions src/cli/Commands/AppointmentLockedCommand.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using Dime.Scheduler.CLI.Options;
using Dime.Scheduler.Sdk.Import;
using Dime.Scheduler.Entities;

namespace Dime.Scheduler.CLI.Commands
{
public class AppointmentLockedCommand :
ImportCommand<AppointmentLockedOptions, AppointmentLocked>,
Command<AppointmentLockedOptions, AppointmentLocked>,
ICommand<AppointmentLockedOptions>
{
protected override string WriteIntro(AppointmentLockedOptions options)
Expand Down
4 changes: 2 additions & 2 deletions src/cli/Commands/AppointmentPlanningQuantityCommand.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using Dime.Scheduler.CLI.Options;
using Dime.Scheduler.Sdk.Import;
using Dime.Scheduler.Entities;

namespace Dime.Scheduler.CLI.Commands
{
public class AppointmentPlanningQuantityCommand :
ImportCommand<AppointmentPlanningQuantityOptions, AppointmentPlanningQuantity>,
Command<AppointmentPlanningQuantityOptions, AppointmentPlanningQuantity>,
ICommand<AppointmentPlanningQuantityOptions>
{
protected override string WriteIntro(AppointmentPlanningQuantityOptions options)
Expand Down
4 changes: 2 additions & 2 deletions src/cli/Commands/AppointmentTimeMarkerCommand.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using Dime.Scheduler.CLI.Options;
using Dime.Scheduler.Sdk.Import;
using Dime.Scheduler.Entities;

namespace Dime.Scheduler.CLI.Commands
{
public class AppointmentTimeMarkerCommand :
ImportCommand<AppointmentTimeMarkerOptions, AppointmentTimeMarker>,
Command<AppointmentTimeMarkerOptions, AppointmentTimeMarker>,
ICommand<AppointmentTimeMarkerOptions>
{
protected override string WriteIntro(AppointmentTimeMarkerOptions options)
Expand Down
4 changes: 2 additions & 2 deletions src/cli/Commands/AppointmentUriCommand.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using Dime.Scheduler.CLI.Options;
using Dime.Scheduler.Sdk.Import;
using Dime.Scheduler.Entities;

namespace Dime.Scheduler.CLI.Commands
{
public class AppointmentUriCommand :
ImportCommand<AppointmentUriOptions, AppointmentUri>,
Command<AppointmentUriOptions, AppointmentUri>,
ICommand<AppointmentUriOptions>
{
protected override string WriteIntro(AppointmentUriOptions options)
Expand Down
4 changes: 2 additions & 2 deletions src/cli/Commands/AssignmentCommand.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using Dime.Scheduler.CLI.Options;
using Dime.Scheduler.Sdk.Import;
using Dime.Scheduler.Entities;

namespace Dime.Scheduler.CLI.Commands
{
public class AssignmentCommand :
ImportCommand<AssignmentOptions, Assignment>,
Command<AssignmentOptions, Assignment>,
ICommand<AssignmentOptions>
{
protected override string WriteIntro(AssignmentOptions options)
Expand Down
4 changes: 2 additions & 2 deletions src/cli/Commands/CaptionCommand.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using Dime.Scheduler.CLI.Options;
using Dime.Scheduler.Sdk.Import;
using Dime.Scheduler.Entities;

namespace Dime.Scheduler.CLI.Commands
{
public class CaptionCommand :
ImportCommand<CaptionOptions, Caption>,
Command<CaptionOptions, Caption>,
ICommand<CaptionOptions>
{
protected override string WriteIntro(CaptionOptions options)
Expand Down
4 changes: 2 additions & 2 deletions src/cli/Commands/CategoryCommand.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using Dime.Scheduler.CLI.Options;
using Dime.Scheduler.Sdk.Import;
using Dime.Scheduler.Entities;

namespace Dime.Scheduler.CLI.Commands
{
public class CategoryCommand :
ImportCommand<CategoryOptions, Category>,
Command<CategoryOptions, Category>,
ICommand<CategoryOptions>
{
protected override string WriteIntro(CategoryOptions options)
Expand Down
37 changes: 37 additions & 0 deletions src/cli/Commands/Command.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using System;
using Dime.Scheduler.CLI.Options;
using Dime.Scheduler.Entities;
using Task = System.Threading.Tasks.Task;

namespace Dime.Scheduler.CLI.Commands
{
public abstract class Command<TOptions, TImportable>
where TOptions : BaseOptions, IImportConvertable
where TImportable : class, IImportRequestable
{
protected abstract string WriteIntro(TOptions options);

public virtual async Task ProcessAsync(TOptions options)
{
try
{
Console.WriteLine(WriteIntro(options));

DimeSchedulerClient client = new(options.Key, options.Environment.GetDescription());

CrudAction action = options.Action.GetValueFromDescription<CrudAction>();
ImportSet result = await client.Import.ProcessAsync(options.ToImport(), action != CrudAction.Delete ? TransactionType.Append : TransactionType.Delete);

Console.WriteLine(result.Success ? "Completed successfully" : "Request failed: " + result.Message);
}
catch (ArgumentException argException)
{
Console.WriteLine("Action for this type was not recognized. Supported actions: add, update, delete");
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
}
}
4 changes: 2 additions & 2 deletions src/cli/Commands/ContainerCommand.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using Dime.Scheduler.CLI.Options;
using Dime.Scheduler.Sdk.Import;
using Dime.Scheduler.Entities;

namespace Dime.Scheduler.CLI.Commands
{
public class ContainerCommand :
ImportCommand<ContainerOptions, Container>,
Command<ContainerOptions, Container>,
ICommand<ContainerOptions>
{
protected override string WriteIntro(ContainerOptions options)
Expand Down
4 changes: 2 additions & 2 deletions src/cli/Commands/FilterGroupCommand.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using Dime.Scheduler.CLI.Options;
using Dime.Scheduler.Sdk.Import;
using Dime.Scheduler.Entities;

namespace Dime.Scheduler.CLI.Commands
{
public class FilterGroupCommand :
ImportCommand<FilterGroupOptions, FilterGroup>,
Command<FilterGroupOptions, FilterGroup>,
ICommand<FilterGroupOptions>
{
protected override string WriteIntro(FilterGroupOptions options)
Expand Down
4 changes: 2 additions & 2 deletions src/cli/Commands/FilterValueCommand.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using Dime.Scheduler.CLI.Options;
using Dime.Scheduler.Sdk.Import;
using Dime.Scheduler.Entities;

namespace Dime.Scheduler.CLI.Commands
{
public class FilterValueCommand :
ImportCommand<FilterValueOptions, FilterValue>,
Command<FilterValueOptions, FilterValue>,
ICommand<FilterValueOptions>
{
protected override string WriteIntro(FilterValueOptions options)
Expand Down
36 changes: 0 additions & 36 deletions src/cli/Commands/ImportCommand.cs

This file was deleted.

4 changes: 2 additions & 2 deletions src/cli/Commands/JobCommand.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using Dime.Scheduler.CLI.Options;
using Dime.Scheduler.Sdk.Import;
using Dime.Scheduler.Entities;

namespace Dime.Scheduler.CLI.Commands
{
public class JobCommand :
ImportCommand<JobOptions, Job>,
Command<JobOptions, Job>,
ICommand<JobOptions>
{
protected override string WriteIntro(JobOptions options)
Expand Down
4 changes: 2 additions & 2 deletions src/cli/Commands/LiveResourceLocationCommand.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using Dime.Scheduler.CLI.Options;
using Dime.Scheduler.Sdk.Import;
using Dime.Scheduler.Entities;

namespace Dime.Scheduler.CLI.Commands
{
public class LiveResourceLocationCommand :
ImportCommand<ResourceLiveLocationOptions, ResourceGpsTracking>,
Command<ResourceLiveLocationOptions, ResourceGpsTracking>,
ICommand<ResourceLiveLocationOptions>
{
protected override string WriteIntro(ResourceLiveLocationOptions options)
Expand Down
4 changes: 2 additions & 2 deletions src/cli/Commands/NotificationCommand.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using Dime.Scheduler.CLI.Options;
using Dime.Scheduler.Sdk.Import;
using Dime.Scheduler.Entities;

namespace Dime.Scheduler.CLI.Commands
{
public class NotificationCommand :
ImportCommand<NotificationOptions, Notification>,
Command<NotificationOptions, Notification>,
ICommand<NotificationOptions>
{
protected override string WriteIntro(NotificationOptions options)
Expand Down
4 changes: 2 additions & 2 deletions src/cli/Commands/PinCommand.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
using Dime.Scheduler.CLI.Options;
using Dime.Scheduler.CLI.Utils;
using Dime.Scheduler.Sdk.Import;
using Dime.Scheduler.Entities;

namespace Dime.Scheduler.CLI.Commands
{
public class PinCommand :
ImportCommand<PinOptions, Pin>,
Command<PinOptions, Pin>,
ICommand<PinOptions>
{
protected override string WriteIntro(PinOptions options)
Expand Down
4 changes: 2 additions & 2 deletions src/cli/Commands/ResourceCalendarCommand.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using Dime.Scheduler.CLI.Options;
using Dime.Scheduler.Sdk.Import;
using Dime.Scheduler.Entities;

namespace Dime.Scheduler.CLI.Commands
{
public class ResourceCalendarCommand :
ImportCommand<ResourceCalendarOptions, ResourceCalendar>,
Command<ResourceCalendarOptions, ResourceCalendar>,
ICommand<ResourceCalendarOptions>
{
protected override string WriteIntro(ResourceCalendarOptions options)
Expand Down
Loading

0 comments on commit e2997e9

Please sign in to comment.