Skip to content

Commit 51e9a34

Browse files
authored
Rel 996124 updated samples (#30)
* REL-996124 Updated samples * REL-996124 Updated samples * REL-996124 Updated samples * REL-996124 Cleaning
1 parent 352565a commit 51e9a34

10 files changed

Lines changed: 279 additions & 1 deletion

Samples/DotNetClientConsole/Helpers/RelativityImportEndpoints.cs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,21 @@ public static class RelativityImportEndpoints
7676
/// <returns>String representing the uri to get import sources for specified job.</returns>
7777
public static string GetImportSourcesForJobUri(int workspaceId, Guid importId) => $"api/import-service/v1/workspaces/{workspaceId}/import-jobs/{importId}/sources";
7878

79+
/// <summary>
80+
/// Get import job default location uri.
81+
/// </summary>
82+
/// <param name="workspaceId">Workspace ID.</param>
83+
/// <returns>String representing the uri to get default location for the import files upload.</returns>
84+
public static string GetImportJobDefaultLocationUri(int workspaceId) => $"api/import-service/v1/workspaces/{workspaceId}/import-jobs/location";
85+
86+
/// <summary>
87+
/// Get import's job source default location uri.
88+
/// </summary>
89+
/// <param name="workspaceId">Workspace ID.</param>
90+
/// <param name="importId">Import job ID.</param>
91+
/// <returns>String representing the uri to get default location for the import files upload based on the job GUID.</returns>
92+
public static string GetImportSourceDefaultLocationUri(int workspaceId, Guid importId) => $"api/import-service/v1/workspaces/{workspaceId}/import-jobs/{importId}/location";
93+
7994
// Document Configuration section
8095

8196
/// <summary>
@@ -131,7 +146,18 @@ public static class RelativityImportEndpoints
131146
/// <param name="workspaceId">Workspace ID.</param>
132147
/// <param name="importId">Import job ID.</param>
133148
/// <param name="sourceId">Source ID.</param>
149+
/// <param name="start">Start index of item errors.</param>
150+
/// <param name="length">Length of item errors to get.</param>
134151
/// <returns>String representing the uri to get errors reported during import for a single source.</returns>
135152
public static string GetImportSourceItemErrorsUri(int workspaceId, Guid importId, Guid sourceId, int start, int length) => $"api/import-service/v1/workspaces/{workspaceId}/import-jobs/{importId}/sources/{sourceId}/itemerrors?start={start}&length={length}";
153+
154+
/// <summary>
155+
/// Get import source delete uri.
156+
/// </summary>
157+
/// <param name="workspaceId">Workspace ID.</param>
158+
/// <param name="importId">Import job ID.</param>
159+
/// <param name="sourceId">Source ID.</param>
160+
/// <returns>String representing the uri to delete parent folder of import source.</returns>
161+
public static string GetImportSourceDeleteUri(int workspaceId, Guid importId, Guid sourceId) => $"api/import-service/v1/workspaces/{workspaceId}/import-jobs/{importId}/sources/{sourceId}/delete";
136162
}
137163
}

Samples/DotNetClientConsole/Program.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ private static void Main(string[] args)
6969
// await sampleCollection.Sample22_ReadResponse();
7070

7171
// await sampleCollection.Sample23_GetDataSourceErrors();
72+
73+
// await sampleCollection.Sample24_DeleteSource();
74+
75+
// await sampleCollection.Sample25_GetLocation_Job();
76+
77+
// await sampleCollection.Sample26_GetLocation_Workspace();
7278
});
7379

7480
try
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// <copyright file="Sample24_DeleteSource.cs" company="Relativity ODA LLC">
2+
// © Relativity All Rights Reserved.
3+
// </copyright>
4+
5+
namespace Relativity.Import.Samples.DotNetClient.SampleCollection;
6+
7+
using System.Text;
8+
using Relativity.Import.Samples.DotNetClient.Helpers;
9+
10+
/// <summary>
11+
/// Class containing examples of using import service SDK.
12+
/// </summary>
13+
public partial class ImportServiceSample
14+
{
15+
/// <summary>
16+
/// Example of deleting a folder associated with a specific workspace, job, and source in Relativity.
17+
/// </summary>
18+
/// <returns>A <see cref="Task"/> representing the result of the asynchronous operation.</returns>
19+
public async Task Sample24_DeleteSource()
20+
{
21+
// Targetted workspace ID
22+
int workspaceId = 1000000;
23+
24+
// Targetted job GUID
25+
Guid jobID = Guid.Parse("00000000-0000-0000-0000-000000000000");
26+
27+
// Targetted job source GUID
28+
Guid sourceID = Guid.Parse("00000000-0000-0000-0000-000000000000");
29+
30+
using HttpClient client = HttpClientHelper.CreateHttpClient();
31+
var content = new StringContent(string.Empty, Encoding.UTF8, "application/json");
32+
33+
var requestUri = RelativityImportEndpoints.GetImportSourceDeleteUri(workspaceId, jobID, sourceID);
34+
var response = await client.PostAsync(requestUri, content);
35+
await ImportJobSampleHelper.EnsureSuccessResponse(response);
36+
}
37+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// <copyright file="Sample25_GetLocation_Job.cs" company="Relativity ODA LLC">
2+
// © Relativity All Rights Reserved.
3+
// </copyright>
4+
5+
namespace Relativity.Import.Samples.DotNetClient.SampleCollection;
6+
7+
using System.Text;
8+
using Relativity.Import.Samples.DotNetClient.Helpers;
9+
10+
/// <summary>
11+
/// Class containing examples of using import service SDK.
12+
/// </summary>
13+
public partial class ImportServiceSample
14+
{
15+
/// <summary>
16+
/// Example of getting default location for import job.
17+
/// </summary>
18+
/// <returns>A <see cref="Task"/> representing the result of the asynchronous operation.</returns>
19+
public async Task Sample25_GetLocation_Job()
20+
{
21+
// Targetted workspace ID
22+
int workspaceId = 1036722;
23+
24+
// Targetted job GUID
25+
Guid jobID = Guid.Parse("00000000-0000-0000-0000-000000000000");
26+
27+
using HttpClient client = HttpClientHelper.CreateHttpClient();
28+
var content = new StringContent(string.Empty, Encoding.UTF8, "application/json");
29+
30+
var requestUri = RelativityImportEndpoints.GetImportSourceDefaultLocationUri(workspaceId, jobID);
31+
var response = await client.GetAsync(requestUri);
32+
var result = await ImportJobSampleHelper.EnsureSuccessValueResponse<string>(response);
33+
34+
Console.WriteLine("Default location for job with ID {0} is: {1}", jobID, result.Value);
35+
}
36+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// <copyright file="Sample26_GetLocation_Workspace.cs" company="Relativity ODA LLC">
2+
// © Relativity All Rights Reserved.
3+
// </copyright>
4+
5+
namespace Relativity.Import.Samples.DotNetClient.SampleCollection;
6+
7+
using System.Text;
8+
using Relativity.Import.Samples.DotNetClient.Helpers;
9+
10+
/// <summary>
11+
/// Class containing examples of using import service SDK.
12+
/// </summary>
13+
public partial class ImportServiceSample
14+
{
15+
/// <summary>
16+
/// Example of getting default import location for workspace.
17+
/// </summary>
18+
/// <returns>A <see cref="Task"/> representing the result of the asynchronous operation.</returns>
19+
public async Task Sample26_GetLocation_Workspace()
20+
{
21+
// Targetted workspace ID
22+
int workspaceId = 1036722;
23+
24+
using HttpClient client = HttpClientHelper.CreateHttpClient();
25+
var content = new StringContent(string.Empty, Encoding.UTF8, "application/json");
26+
27+
var requestUri = RelativityImportEndpoints.GetImportJobDefaultLocationUri(workspaceId);
28+
var response = await client.GetAsync(requestUri);
29+
var result = await ImportJobSampleHelper.EnsureSuccessValueResponse<string>(response);
30+
31+
Console.WriteLine("Default import location for workspace with ID {0} is: {1}", workspaceId, result.Value);
32+
}
33+
}

Samples/KeplerClientConsole/Program.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,12 @@ private static void Main(string[] args)
7070
// await sampleCollection.Sample22_ReadResponse();
7171

7272
// await sampleCollection.Sample23_GetDataSourceErrors();
73+
74+
// await sampleCollection.Sample24_DeleteSource();
75+
76+
// await sampleCollection.Sample25_GetLocation();
77+
78+
// await sampleCollection.Sample26_GetLocation_Workspace();
7379
});
7480

7581
try

Samples/KeplerClientConsole/Relativity.Import.Samples.DotNetFrameworkClient.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
</ItemGroup>
2626

2727
<ItemGroup>
28-
<PackageReference Include="Relativity.Import.SDK" Version="1.0.22" />
28+
<PackageReference Include="Relativity.Import.SDK" Version="1.2.1" />
2929
</ItemGroup>
3030

3131
</Project>
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// <copyright file="Sample24_DeleteSource.cs" company="Relativity ODA LLC">
2+
// © Relativity All Rights Reserved.
3+
// </copyright>
4+
5+
namespace Relativity.Import.Samples.DotNetFrameworkClient.SamplesCollection
6+
{
7+
using System;
8+
using System.Threading.Tasks;
9+
10+
using Relativity.Import.Samples.DotNetFrameworkClient.ImportSampleHelpers;
11+
using Relativity.Import.V1;
12+
13+
/// <summary>
14+
/// Class containing examples of using import service SDK.
15+
/// </summary>
16+
public partial class ImportServiceSample
17+
{
18+
/// <summary>
19+
/// Example of deleting a folder associated with a specific workspace, job, and source in Relativity.
20+
/// </summary>
21+
/// <returns>A <see cref="Task"/> representing the result of the asynchronous operation.</returns>
22+
public async Task Sample24_DeleteSource()
23+
{
24+
// Targetted workspace ID
25+
int workspaceId = 100000;
26+
27+
// Targetted job GUID
28+
Guid jobID = Guid.Parse("00000000-0000-0000-0000-000000000000");
29+
30+
// Targetted job source GUID
31+
Guid sourceID = Guid.Parse("00000000-0000-0000-0000-000000000000");
32+
33+
// Create proxy for IImportSourceController
34+
using (var importService = this.serviceFactory.CreateProxy<Relativity.Import.V1.Services.IImportSourceController>())
35+
{
36+
// Send the request
37+
Response response = await importService.DeleteParentFolderAsync(workspaceId, jobID, sourceID);
38+
39+
ResponseHelper.EnsureSuccessResponse(response, "Get location for workspace");
40+
41+
if (response?.IsSuccess ?? false)
42+
{
43+
Console.WriteLine("Folder deleted for {workspaceId}", workspaceId);
44+
Console.WriteLine("Job ID: {jobID}", jobID);
45+
Console.WriteLine("Source ID: {sourceID}", sourceID);
46+
}
47+
}
48+
}
49+
}
50+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// <copyright file="Sample25_GetLocation_Job.cs" company="Relativity ODA LLC">
2+
// © Relativity All Rights Reserved.
3+
// </copyright>
4+
5+
namespace Relativity.Import.Samples.DotNetFrameworkClient.SamplesCollection
6+
{
7+
using System;
8+
using System.Threading.Tasks;
9+
using Relativity.Import.Samples.DotNetFrameworkClient.ImportSampleHelpers;
10+
11+
/// <summary>
12+
/// Class containing examples of using import service SDK.
13+
/// </summary>
14+
public partial class ImportServiceSample
15+
{
16+
/// <summary>
17+
/// Example of getting the default location for the import files upload based on the job GUID.
18+
/// </summary>
19+
/// <returns>A <see cref="Task"/> representing the result of the asynchronous operation.</returns>
20+
public async Task Sample25_GetLocation_Job()
21+
{
22+
// Targetted workspace ID
23+
int workspaceId = 1000000;
24+
25+
// Targetted job GUID
26+
Guid jobGuid = Guid.Parse("00000000-0000-0000-0000-000000000000");
27+
28+
// Create proxy for IImportJobController
29+
using (var importService = this.serviceFactory.CreateProxy<Relativity.Import.V1.Services.IImportJobController>())
30+
{
31+
// Send te request
32+
var response = await importService.GetDefaultLocationForJobAsync(workspaceId, jobGuid);
33+
34+
ResponseHelper.EnsureSuccessResponse(response, "Get location for workspace");
35+
36+
if (response?.IsSuccess ?? false)
37+
{
38+
Console.WriteLine("Location for workspace with ID {0} is: {1}", workspaceId, response.Value);
39+
}
40+
}
41+
}
42+
}
43+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// <copyright file="Sample26_GetLocation_Workspace.cs" company="Relativity ODA LLC">
2+
// © Relativity All Rights Reserved.
3+
// </copyright>
4+
5+
namespace Relativity.Import.Samples.DotNetFrameworkClient.SamplesCollection
6+
{
7+
using System;
8+
using System.Threading.Tasks;
9+
using Relativity.Import.Samples.DotNetFrameworkClient.ImportSampleHelpers;
10+
using Relativity.Import.V1;
11+
12+
/// <summary>
13+
/// Class containing examples of using import service SDK.
14+
/// </summary>
15+
public partial class ImportServiceSample
16+
{
17+
/// <summary>
18+
/// Example of getting the default location for the import files upload.
19+
/// </summary>
20+
/// <returns>A <see cref="Task"/> representing the result of the asynchronous operation.</returns>
21+
public async Task Sample26_GetLocation_Workspace()
22+
{
23+
// Targetted workspace ID
24+
int workspaceId = 1000000;
25+
26+
// Create proxy for IImportJobController
27+
using (var importService = this.serviceFactory.CreateProxy<Relativity.Import.V1.Services.IImportJobController>())
28+
{
29+
// Send the request
30+
ValueResponse<string> response = await importService.GetDefaultLocationForWorkspaceAsync(workspaceId);
31+
32+
ResponseHelper.EnsureSuccessResponse(response, "Get location for workspace");
33+
34+
if (response?.IsSuccess ?? false)
35+
{
36+
Console.WriteLine("Location for workspace with ID {0} is: {1}", workspaceId, response.Value);
37+
}
38+
}
39+
}
40+
}
41+
}

0 commit comments

Comments
 (0)