Skip to content

Commit 9980050

Browse files
committed
Add access to HTTP methods
1 parent 5be5a79 commit 9980050

1 file changed

Lines changed: 65 additions & 4 deletions

File tree

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 Initialise(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
}

0 commit comments

Comments
 (0)