Skip to content

Commit c00d499

Browse files
committed
Merge branch 'dev'
2 parents 35dad90 + f0f7414 commit c00d499

8 files changed

Lines changed: 96 additions & 31 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ publish/
124124

125125
# NuGet Packages Directory
126126
packages/
127+
*.nupkg
127128
## TODO: If the tool you use requires repositories.config uncomment the next line
128129
#!packages/repositories.config
129130

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ Install the NuGet package by running `scriptcs -install ScriptCs.OctopusClient`
1111

1212
``` csharp
1313
var octopus = Require<OctopusClientPack>();
14-
var repo = octopus.GetRepository("http://server/octopusdeploy/api", "API-XXXXXXXXXXXXXXXXXXXXXXXXXXX");
14+
var server = octopus.Server("http://server/octopusdeploy/api", "API-XXXXXXXXXXXXXXXXXXXXXXXXXXX");
1515
Console.WriteLine("Getting the current user...");
16-
var user = repo.Users.GetCurrent();
16+
var user = server.Users.GetCurrent();
1717
Console.WriteLine("Current user: {0}", user.DisplayName);
1818
Console.WriteLine("Getting your dashboard...");
19-
var dashboard = repo.Dashboards.GetDashboard();
19+
var dashboard = server.Dashboards.GetDashboard();
2020
foreach(var item in dashboard.Items)
2121
{
22-
var project = repo.Projects.Get(item.ProjectId);
23-
var environment = repo.Environments.Get(item.EnvironmentId);
22+
var project = server.Projects.Get(item.ProjectId);
23+
var environment = server.Environments.Get(item.EnvironmentId);
2424
Console.WriteLine("Project: {0} -> Environment: {1} -> Release Version: {2}", project.Name, environment.Name, item.ReleaseVersion);
2525
}
2626
```
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="Newtonsoft.Json" version="6.0.3" targetFramework="net45" />
4-
<package id="Octopus.Client" version="2.5.3.245" targetFramework="net40" />
5-
<package id="ScriptCs.Contracts" version="0.9.0" targetFramework="net45" />
6-
<package id="ScriptCs.OctopusClient" version="0.0.2" targetFramework="net45" />
3+
<package id="Newtonsoft.Json" version="6.0.5" targetFramework="net45" />
4+
<package id="Octopus.Client" version="2.5.8.447" targetFramework="net40" />
5+
<package id="ScriptCs.Contracts" version="0.10.2" targetFramework="net45" />
6+
<package id="ScriptCs.OctopusClient" version="0.1.1" targetFramework="net45" />
77
<package id="Sprache" version="1.10.0.37" targetFramework="net40" />
88
</packages>
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
var octopus = Require<OctopusClientPack>();
2-
var repo = octopus.GetRepository("http://server/octopusdeploy/api", "API-XXXXXXXXXXXXXXXXXXXXXXXXXXX");
2+
var server = octopus.Server("http://server/octopusdeploy/api", "API-XXXXXXXXXXXXXXXXXXXXXXXXXXX");
33
Console.WriteLine("Getting the current user...");
4-
var user = repo.Users.GetCurrent();
4+
var user = server.Users.GetCurrent();
55
Console.WriteLine("Current user: {0}", user.DisplayName);
66
Console.WriteLine("Getting your dashboard...");
7-
var dashboard = repo.Dashboards.GetDashboard();
7+
var dashboard = server.Dashboards.GetDashboard();
88
foreach(var item in dashboard.Items)
99
{
10-
var project = repo.Projects.Get(item.ProjectId);
11-
var environment = repo.Environments.Get(item.EnvironmentId);
10+
var project = server.Projects.Get(item.ProjectId);
11+
var environment = server.Environments.Get(item.EnvironmentId);
1212
Console.WriteLine("Project: {0} -> Environment: {1} -> Release Version: {2}", project.Name, environment.Name, item.ReleaseVersion);
1313
}
Lines changed: 65 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,76 @@
1-
using Octopus.Client;
1+
using System.IO;
2+
using System.Runtime.InteropServices.ComTypes;
3+
using Octopus.Client;
4+
using Octopus.Client.Model;
25
using ScriptCs.Contracts;
36

47
namespace ScriptCs.OctopusClient
58
{
69
public class OctopusClientPack : IScriptPackContext
710
{
8-
public OctopusRepository GetRepository(string hostUrl, string apiKey)
11+
private IOctopusClient _client;
12+
13+
public OctopusRepository Server(string hostUrl, string apiKey)
914
{
1015
var endpoint = new OctopusServerEndpoint(hostUrl, apiKey);
11-
12-
return new OctopusRepository(endpoint);
16+
var repository = new OctopusRepository(endpoint);
17+
_client = repository.Client;
18+
19+
return repository;
20+
}
21+
22+
public RootResource GetRootDocument()
23+
{
24+
return _client.RootDocument;
25+
}
26+
27+
public ResourceCollection<T> List<T>(string path, object pathParameters = null)
28+
{
29+
return _client.List<T>(path, pathParameters);
30+
}
31+
32+
public T Get<T>(string path, object pathParameters = null)
33+
{
34+
return _client.Get<T>(path, pathParameters);
35+
}
36+
37+
public Stream GetContent(string path)
38+
{
39+
return _client.GetContent(path);
40+
}
41+
42+
public T Create<T>(string path, T resource)
43+
{
44+
return _client.Create(path, resource);
45+
}
46+
47+
public void Post(string path)
48+
{
49+
_client.Post(path);
50+
}
51+
public void Post<T>(string path, T resource)
52+
{
53+
_client.Post(path, resource);
54+
}
55+
56+
public void Put<T>(string path, T resource)
57+
{
58+
_client.Put(path, resource);
59+
}
60+
61+
public void PutContent(string path, Stream content)
62+
{
63+
_client.PutContent(path, content);
64+
}
65+
66+
public T Update<T>(string path, T resource)
67+
{
68+
return _client.Update(path, resource);
69+
}
70+
71+
public TaskResource Delete(string path)
72+
{
73+
return _client.Delete(path);
1374
}
1475
}
1576
}

src/ScriptCs.OctopusClient/Properties/AssemblyInfo.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@
1515

1616
[assembly: Guid("2bd92078-7efd-4c16-898e-f995bcbe0d58")]
1717

18-
[assembly: AssemblyVersion("0.0.2")]
19-
[assembly: AssemblyFileVersion("0.0.2")]
20-
[assembly: AssemblyInformationalVersion("0.0.2")]
18+
[assembly: AssemblyVersion("0.1.1")]
19+
[assembly: AssemblyFileVersion("0.1.1")]
20+
[assembly: AssemblyInformationalVersion("0.1.1")]

src/ScriptCs.OctopusClient/ScriptCs.OctopusClient.csproj

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,19 @@
3434
<ItemGroup>
3535
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
3636
<SpecificVersion>False</SpecificVersion>
37-
<HintPath>..\packages\Newtonsoft.Json.6.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
37+
<HintPath>..\packages\Newtonsoft.Json.6.0.5\lib\net45\Newtonsoft.Json.dll</HintPath>
3838
</Reference>
39-
<Reference Include="Octopus.Client">
40-
<HintPath>..\packages\Octopus.Client.2.5.3.245\lib\net40\Octopus.Client.dll</HintPath>
39+
<Reference Include="Octopus.Client, Version=2.5.8.0, Culture=neutral, processorArchitecture=MSIL">
40+
<SpecificVersion>False</SpecificVersion>
41+
<HintPath>..\packages\Octopus.Client.2.5.8.447\lib\net40\Octopus.Client.dll</HintPath>
4142
</Reference>
42-
<Reference Include="Octopus.Platform">
43-
<HintPath>..\packages\Octopus.Client.2.5.3.245\lib\net40\Octopus.Platform.dll</HintPath>
43+
<Reference Include="Octopus.Platform, Version=2.5.8.0, Culture=neutral, processorArchitecture=MSIL">
44+
<SpecificVersion>False</SpecificVersion>
45+
<HintPath>..\packages\Octopus.Client.2.5.8.447\lib\net40\Octopus.Platform.dll</HintPath>
4446
</Reference>
45-
<Reference Include="ScriptCs.Contracts">
46-
<HintPath>..\packages\ScriptCs.Contracts.0.9.0\lib\net45\ScriptCs.Contracts.dll</HintPath>
47+
<Reference Include="ScriptCs.Contracts, Version=0.10.0.0, Culture=neutral, processorArchitecture=MSIL">
48+
<SpecificVersion>False</SpecificVersion>
49+
<HintPath>..\packages\ScriptCs.Contracts.0.10.2\lib\net45\ScriptCs.Contracts.dll</HintPath>
4750
</Reference>
4851
<Reference Include="Sprache">
4952
<HintPath>..\packages\Sprache.1.10.0.37\lib\net40\Sprache.dll</HintPath>
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="Newtonsoft.Json" version="6.0.3" targetFramework="net45" />
4-
<package id="Octopus.Client" version="2.5.3.245" targetFramework="net45" />
5-
<package id="ScriptCs.Contracts" version="0.9.0" targetFramework="net45" />
3+
<package id="Newtonsoft.Json" version="6.0.5" targetFramework="net45" />
4+
<package id="Octopus.Client" version="2.5.8.447" targetFramework="net45" />
5+
<package id="ScriptCs.Contracts" version="0.10.2" targetFramework="net45" />
66
<package id="Sprache" version="1.10.0.37" targetFramework="net45" />
77
</packages>

0 commit comments

Comments
 (0)