Skip to content

Commit b284afa

Browse files
committed
Add getDefault method
This adds support for the Default Nginx Template endpoint.
1 parent ae97438 commit b284afa

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

__tests__/nginxTemplates.test.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,17 @@ test('it lists all nginx templates', async () => {
4040
expect(window.fetch).toHaveBeenCalledTimes(1);
4141
});
4242

43+
test('it gets the default nginx template', async () => {
44+
setupFetchStub();
45+
46+
const forge = new Forge('API_TOKEN');
47+
await forge.nginxTemplates.get(1, 1);
48+
49+
expectToHaveBeenCalledWith('/servers/1/nginx/templates/1', 'GET');
50+
51+
expect(window.fetch).toHaveBeenCalledTimes(1);
52+
});
53+
4354
test('it gets a nginx template', async () => {
4455
setupFetchStub();
4556

lib/Forge.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,8 @@
209209
create: (serverId, payload) =>
210210
this.post(`/servers/${serverId}/nginx/templates`, payload),
211211
list: (serverId) => this.get(`/servers/${serverId}/nginx/templates`),
212+
getDefault: (serverId, templateId) =>
213+
this.get(`/servers/${serverId}/nginx/templates/${templateId}`),
212214
get: (serverId, templateId) =>
213215
this.get(`/servers/${serverId}/nginx/templates/${templateId}`),
214216
update: (serverId, templateId, payload) =>

src/Forge.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,8 @@ class Forge extends ForgeRequest {
140140
create: (serverId, payload) =>
141141
this.post(`/servers/${serverId}/nginx/templates`, payload),
142142
list: (serverId) => this.get(`/servers/${serverId}/nginx/templates`),
143+
getDefault: (serverId, templateId) =>
144+
this.get(`/servers/${serverId}/nginx/templates/${templateId}`),
143145
get: (serverId, templateId) =>
144146
this.get(`/servers/${serverId}/nginx/templates/${templateId}`),
145147
update: (serverId, templateId, payload) =>

0 commit comments

Comments
 (0)