From 284c3bf2f720ffef9e83b345e1431cd126404f03 Mon Sep 17 00:00:00 2001 From: sarawasim1 <111089200+sarawasim1@users.noreply.github.com> Date: Mon, 3 Jun 2024 16:46:08 -0700 Subject: [PATCH] refactor(custom apis): updated entries to use id instead of slug (#933) BREAKING CHANGE: changed the endpoint in entries and it now uses customApiId instead of customApiSlug --- src/endpoints/custom-apis.js | 21 ++++++++++----------- src/types/custom-apis.ts | 10 +++++----- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/endpoints/custom-apis.js b/src/endpoints/custom-apis.js index eebd4876e..07c857b1e 100644 --- a/src/endpoints/custom-apis.js +++ b/src/endpoints/custom-apis.js @@ -7,7 +7,6 @@ class CustomApisEndpoint extends CRUDExtend { super(endpoint) this.endpoint = 'settings/extensions/custom-apis' - this.entriesEndpoint = 'extensions' } Create(body) { @@ -69,11 +68,11 @@ class CustomApisEndpoint extends CRUDExtend { ) } - GetEntries(customApiSlug) { + GetEntries(customApiId) { const { limit, offset, sort, filter } = this return this.request.send( - buildURL(`${this.entriesEndpoint}/${customApiSlug}`, { + buildURL(`${this.endpoint}/${customApiId}/entries`, { limit, offset, sort, @@ -83,32 +82,32 @@ class CustomApisEndpoint extends CRUDExtend { ) } - GetEntry(customApiSlug, customApiEntryId) { + GetEntry(customApiId, customApiEntryId) { return this.request.send( - `${this.entriesEndpoint}/${customApiSlug}/${customApiEntryId}`, + `${this.endpoint}/${customApiId}/entries/${customApiEntryId}`, 'GET' ) } - CreateEntry(customApiSlug, body) { + CreateEntry(customApiId, body) { return this.request.send( - `${this.entriesEndpoint}/${customApiSlug}`, + `${this.endpoint}/${customApiId}/entries`, 'POST', body ) } - UpdateEntry(customApiSlug, customApiEntryId, body) { + UpdateEntry(customApiId, customApiEntryId, body) { return this.request.send( - `${this.entriesEndpoint}/${customApiSlug}/${customApiEntryId}`, + `${this.endpoint}/${customApiId}/entries/${customApiEntryId}`, 'PUT', body ) } - DeleteEntry(customApiSlug, customApiEntryId) { + DeleteEntry(customApiId, customApiEntryId) { return this.request.send( - `${this.entriesEndpoint}/${customApiSlug}/${customApiEntryId}`, + `${this.endpoint}/${customApiId}/entries/${customApiEntryId}`, 'DELETE' ) } diff --git a/src/types/custom-apis.ts b/src/types/custom-apis.ts index 54e06e3ad..ddd4caf45 100644 --- a/src/types/custom-apis.ts +++ b/src/types/custom-apis.ts @@ -97,21 +97,21 @@ export interface CustomApisEndpoint { DeleteField(customApiId: string, customApiFieldId: string): Promise - GetEntries(customApiSlug: string): Promise + GetEntries(customApiId: string): Promise - GetEntry(customApiSlug: string, customApiEntryId: string): Promise + GetEntry(customApiId: string, customApiEntryId: string): Promise CreateEntry( - customApiSlug: string, + customApiId: string, body: RequestBody ): Promise UpdateEntry( - customApiSlug: string, + customApiId: string, customApiEntryId: string, body: RequestBody ): Promise - DeleteEntry(customApiSlug: string, customApiEntryId: string): Promise + DeleteEntry(customApiId: string, customApiEntryId: string): Promise }