Skip to content

Commit 6cada20

Browse files
committed
v1.0.5
- 'Command' added to parameter list. - Parameter list reordering. - Workday Drive support for uploads and trash.
1 parent 66f12d7 commit 6cada20

File tree

8 files changed

+711
-133
lines changed

8 files changed

+711
-133
lines changed

CLARiNET.csproj

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@
77
<PackageIcon>CLARiNET.ico</PackageIcon>
88
<PackageIconUrl />
99
<ApplicationIcon>CLARiNET.ico</ApplicationIcon>
10-
<Version>1.0.4</Version>
10+
<Version>1.0.5</Version>
1111
</PropertyGroup>
1212

1313
<ItemGroup>
1414
<PackageReference Include="CommandLineParser" Version="2.8.0" />
15-
<PackageReference Include="Microsoft.AspNetCore.DataProtection" Version="5.0.9" />
16-
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="5.0.2" />
17-
<PackageReference Include="System.Security.Cryptography.ProtectedData" Version="5.0.0" />
15+
<PackageReference Include="HtmlAgilityPack" Version="1.11.39" />
16+
<PackageReference Include="Microsoft.AspNetCore.DataProtection" Version="6.0.1" />
17+
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
18+
<PackageReference Include="System.Security.Cryptography.ProtectedData" Version="6.0.0" />
1819
</ItemGroup>
1920

2021
<ItemGroup>

CommandLineOptions.cs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,26 @@ namespace CLARiNET
99
{
1010
public class Options
1111
{
12-
[Value(index: 0,MetaName = "CLAR File", Required = false, HelpText = "Full path and file name for the CLAR")]
13-
public string ClarFile { get; set; }
12+
[Value(index: 0, MetaName = "Command", Required = false, HelpText = "CLARiNET Commands:\n\nCLAR_UPLOAD\nDRIVE_UPLOAD\nDRIVE_TRASH")]
13+
public string Command { get; set; }
1414

15-
[Value(index: 1, MetaName = "Collection", Required = false, HelpText = "Cloud Collection name")]
16-
public string CollectionName { get; set; }
15+
[Value(index: 1, MetaName = "File or Directory", Required = false, HelpText = "Path or Path and file name")]
16+
public string Path { get; set; }
1717

18-
[Value(index: 2, MetaName = "Environment Number", Required = false, HelpText = "Number associated with a Workday environment (list all with -e parameter)")]
18+
[Value(index: 2, MetaName = "Parameters", Required = false, HelpText = "Parameters for the command (For CLAR_UPLOAD, enter the Cloud Collection)")]
19+
public string Parameters { get; set; }
20+
21+
[Value(index: 3, MetaName = "Environment Number", Required = false, HelpText = "Number associated with a Workday environment (list all with -w parameter)")]
1922
public string EnvNum { get; set; }
2023

21-
[Value(index: 3, MetaName = "Tenant", Required = false, HelpText = "Workday Tenant")]
24+
[Value(index: 4, MetaName = "Tenant", Required = false, HelpText = "Workday Tenant")]
2225
public string Tenant { get; set; }
2326

24-
[Value(index: 4, MetaName = "Username", Required = false, HelpText = "Username")]
27+
[Value(index: 5, MetaName = "Username", Required = false, HelpText = "Username")]
2528
public string Username { get; set; }
2629

27-
[Value(index: 5, MetaName = "Password", Required = false, HelpText = "Password (must be encrypted using the -e option)")]
28-
public string Password { get; set; }
30+
[Value(index: 6, MetaName = "Password", Required = false, HelpText = "Password (must be encrypted using the -e option)")]
31+
public string Password { get; set; }
2932

3033
[Option('e', "encrypt", Required = false,
3134
HelpText =

DriveApi.cs

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using System.IO;
7+
8+
namespace CLARiNET
9+
{
10+
internal class DriveApi
11+
{
12+
public static string BuildSoapRequest(string file, string contents, bool trashed)
13+
{
14+
string xmlData = "";
15+
string delimiter = "~";
16+
string[] data = null;
17+
string username = "";
18+
string filename = "";
19+
string wid = "";
20+
21+
if (file.Contains(","))
22+
{
23+
delimiter = ",";
24+
}
25+
26+
data = file.Split(delimiter);
27+
28+
if (data.Length > 1)
29+
{
30+
username = Path.GetFileName(data[0]);
31+
filename = data[1];
32+
33+
if (data.Length > 2)
34+
{
35+
wid = data[2];
36+
}
37+
38+
if (trashed)
39+
{
40+
xmlData = Resources.Put_Drive_Document_Content_Trash_Request;
41+
}
42+
else
43+
{
44+
xmlData = Resources.Put_Drive_Document_Content_Request;
45+
}
46+
47+
xmlData = xmlData.Replace("{contents}", contents)
48+
.Replace("{document_wid}", wid)
49+
.Replace("{filename}", filename)
50+
.Replace("{username}", username);
51+
}
52+
53+
return xmlData;
54+
}
55+
}
56+
}

0 commit comments

Comments
 (0)