Skip to content

Commit 0be059b

Browse files
committed
Get Time zones (for schedules)
1 parent c482203 commit 0be059b

File tree

6 files changed

+72
-0
lines changed

6 files changed

+72
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using System.Management.Automation;
2+
using UiPath.PowerShell.Models;
3+
using UiPath.PowerShell.Util;
4+
using UiPath.Web.Client;
5+
6+
namespace UiPath.PowerShell.Cmdlets
7+
{
8+
/// <summary>
9+
/// <para type="synopsis">Shows the valid time zone names recognized by the Orchestrator.</para>
10+
/// </summary>
11+
[Cmdlet(VerbsCommon.Get, Nouns.TimeZones)]
12+
public class GetTimeZones : AuthenticatedCmdlet
13+
{
14+
protected override void ProcessRecord()
15+
{
16+
var timeZones = HandleHttpOperationException(() => Api.Settings.GetTimezones());
17+
foreach(var tz in timeZones.Items)
18+
{
19+
WriteObject(Timezone.FromDto(tz));
20+
}
21+
}
22+
}
23+
}

UiPath.PowerShell/Cmdlets/Nouns.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ internal static class Nouns
2222
internal const string QueueDefinition = UiPath + "QueueDefinition";
2323
internal const string QueueItem = UiPath + "QueuItem";
2424
internal const string Tenant = UiPath + "Tenant";
25+
internal const string TimeZones = UiPath + "TimeZones";
2526
internal const string User = UiPath + "User";
2627
}
2728
}

UiPath.PowerShell/Models/Timezone.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using UiPath.Web.Client.Models;
2+
3+
namespace UiPath.PowerShell.Models
4+
{
5+
public class Timezone
6+
{
7+
public string Name { get; internal set; }
8+
public string Value { get; internal set; }
9+
10+
internal static Timezone FromDto(NameValueDto dto)
11+
{
12+
return new Timezone
13+
{
14+
Name = dto.Name,
15+
Value = dto.Value
16+
};
17+
}
18+
}
19+
}

UiPath.PowerShell/UiPath.PowerShell.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
<Compile Include="Cmdlets\GetPermission.cs" />
8181
<Compile Include="Cmdlets\GetRole.cs" />
8282
<Compile Include="Cmdlets\GetProcessSchedule.cs" />
83+
<Compile Include="Cmdlets\GetTimeZones.cs" />
8384
<Compile Include="Cmdlets\GrantRolePermission.cs" />
8485
<Compile Include="Cmdlets\RemoveAsset.cs" />
8586
<Compile Include="Cmdlets\GetAsset.cs" />
@@ -114,6 +115,7 @@
114115
<Compile Include="Models\Role.cs" />
115116
<Compile Include="Cmdlets\RevokeRolePermission.cs" />
116117
<Compile Include="Models\ProcessSchedule.cs" />
118+
<Compile Include="Models\Timezone.cs" />
117119
<Compile Include="Util\AuthenticatedCmdlet.cs" />
118120
<Compile Include="Util\FilterAttribute.cs" />
119121
<Compile Include="Util\FilteredBaseCmdlet.cs" />

docs/Get-UiPathTimeZones.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
```PowerShell
2+
3+
NAME
4+
Get-UiPathTimeZones
5+
6+
SYNOPSIS
7+
Shows the valid time zone names recognized by the Orchestrator.
8+
9+
10+
SYNTAX
11+
Get-UiPathTimeZones [-AuthToken <AuthToken>] [<CommonParameters>]
12+
13+
14+
DESCRIPTION
15+
16+
17+
RELATED LINKS
18+
19+
REMARKS
20+
To see the examples, type: "get-help Get-UiPathTimeZones -examples".
21+
For more information, type: "get-help Get-UiPathTimeZones -detailed".
22+
For technical information, type: "get-help Get-UiPathTimeZones -full".
23+
24+
25+
26+
```

docs/Home.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
- [Get-UiPathRobot](Get-UiPathRobot.md)
2727
- [Get-UiPathRole](Get-UiPathRole.md)
2828
- [Get-UiPathTenant](Get-UiPathTenant.md)
29+
- [Get-UiPathTimeZones](Get-UiPathTimeZones.md)
2930
- [Get-UiPathUser](Get-UiPathUser.md)
3031
- [Grant-UiPathRolePermission](Grant-UiPathRolePermission.md)
3132
- [Register-UiPathLicense](Register-UiPathLicense.md)

0 commit comments

Comments
 (0)