Skip to content

Commit 28e8048

Browse files
authored
Merge pull request #749 from companieshouse/feat/roe-2732/add-force-flag
feat/roe-2732: add force flag to PUT and GET requests
2 parents 0e663cc + 4dd445b commit 28e8048

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/services/overseas-entities/service.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ import Mapping from "../../mapping/mapping";
2424
export default class OverseasEntityService {
2525
constructor (private readonly client: IHttpClient) { }
2626

27-
public async getOverseasEntity (transactionId: string, overseasEntityId: string): Promise< Resource<OverseasEntity> | ApiErrorResponse > {
28-
const URL = `transactions/${transactionId}/overseas-entity/${overseasEntityId}`
27+
public async getOverseasEntity (transactionId: string, overseasEntityId: string, forceFetch: boolean = false): Promise< Resource<OverseasEntity> | ApiErrorResponse > {
28+
const URL = `transactions/${transactionId}/overseas-entity/${overseasEntityId}${(forceFetch ? "?force=true" : "")}`
2929
const response: HttpResponse = await this.client.httpGet(URL);
3030

3131
if (response.error) {
@@ -84,8 +84,8 @@ export default class OverseasEntityService {
8484
return resource;
8585
}
8686

87-
public async putOverseasEntity (transactionId: string, overseasEntityId: string, body: OverseasEntity): Promise<Resource<HttpStatusCode> | ApiErrorResponse> {
88-
const URL = `transactions/${transactionId}/overseas-entity/${overseasEntityId}`
87+
public async putOverseasEntity (transactionId: string, overseasEntityId: string, body: OverseasEntity, forceUpdate: boolean = false): Promise<Resource<HttpStatusCode> | ApiErrorResponse> {
88+
const URL = `transactions/${transactionId}/overseas-entity/${overseasEntityId}${(forceUpdate ? "?force=true" : "")}`
8989

9090
const resp = await this.client.httpPut(URL, mapOverseasEntity(body));
9191

0 commit comments

Comments
 (0)