Skip to content

Commit

Permalink
Merge pull request #146 from Scalingo/feat/addons-resume
Browse files Browse the repository at this point in the history
feat(addons): resume endpoint
  • Loading branch information
ksol authored Jun 17, 2021
2 parents 5ab9737 + da3f0c5 commit 3bfaa89
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## Unreleased

* Addons: resume endpoint

## 0.3.6

* Users: account deletion confirmation
Expand Down
12 changes: 12 additions & 0 deletions src/Addons/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
AddonProvider,
AddonSso,
AddonUpgradeResponse,
AddonResumeResponse,
} from "../models/regional/addons";
import { CreateParams, UpdateParams } from "../params/regional/addons";

Expand Down Expand Up @@ -102,6 +103,17 @@ export default class Addons {
);
}

/**
* Resume an addon
* @param appId ID of the current application
* @param addonId ID of the current addon
*/
resume(appId: string, addonId: string): Promise<AddonResumeResponse> {
return unpackData(
this._client.apiClient().post(`/apps/${appId}/addons/${addonId}/resume`)
);
}

/**
* Remove an addon
* @see https://developers.scalingo.com/addons#remove-an-addon
Expand Down
6 changes: 6 additions & 0 deletions src/models/regional/addons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ export interface AddonUpgradeResponse {
message: string;
}

export interface AddonResumeResponse {
addon: Addon;
/** Custom message from the addon provider */
message: string;
}

export interface Plan {
/** Unique ID of the plan */
id: string;
Expand Down
12 changes: 12 additions & 0 deletions test/Addons/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,18 @@ describe("Addons#update", () => {
);
});

describe("Addons#resume", () => {
testPost(
"https://api.scalingo.com/v1/apps/toto/addons/some-addon/resume",
null,
null,
null,
(client) => {
return new Addons(client).resume("toto", "some-addon");
}
);
});

describe("Addons#destroy", () => {
testDelete(
"https://api.scalingo.com/v1/apps/toto/addons/54100930736f7563d5030000",
Expand Down

0 comments on commit 3bfaa89

Please sign in to comment.