Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 284c3bf

Browse files
authored
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
1 parent bb83044 commit 284c3bf

File tree

2 files changed

+15
-16
lines changed

2 files changed

+15
-16
lines changed

src/endpoints/custom-apis.js

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ class CustomApisEndpoint extends CRUDExtend {
77
super(endpoint)
88

99
this.endpoint = 'settings/extensions/custom-apis'
10-
this.entriesEndpoint = 'extensions'
1110
}
1211

1312
Create(body) {
@@ -69,11 +68,11 @@ class CustomApisEndpoint extends CRUDExtend {
6968
)
7069
}
7170

72-
GetEntries(customApiSlug) {
71+
GetEntries(customApiId) {
7372
const { limit, offset, sort, filter } = this
7473

7574
return this.request.send(
76-
buildURL(`${this.entriesEndpoint}/${customApiSlug}`, {
75+
buildURL(`${this.endpoint}/${customApiId}/entries`, {
7776
limit,
7877
offset,
7978
sort,
@@ -83,32 +82,32 @@ class CustomApisEndpoint extends CRUDExtend {
8382
)
8483
}
8584

86-
GetEntry(customApiSlug, customApiEntryId) {
85+
GetEntry(customApiId, customApiEntryId) {
8786
return this.request.send(
88-
`${this.entriesEndpoint}/${customApiSlug}/${customApiEntryId}`,
87+
`${this.endpoint}/${customApiId}/entries/${customApiEntryId}`,
8988
'GET'
9089
)
9190
}
9291

93-
CreateEntry(customApiSlug, body) {
92+
CreateEntry(customApiId, body) {
9493
return this.request.send(
95-
`${this.entriesEndpoint}/${customApiSlug}`,
94+
`${this.endpoint}/${customApiId}/entries`,
9695
'POST',
9796
body
9897
)
9998
}
10099

101-
UpdateEntry(customApiSlug, customApiEntryId, body) {
100+
UpdateEntry(customApiId, customApiEntryId, body) {
102101
return this.request.send(
103-
`${this.entriesEndpoint}/${customApiSlug}/${customApiEntryId}`,
102+
`${this.endpoint}/${customApiId}/entries/${customApiEntryId}`,
104103
'PUT',
105104
body
106105
)
107106
}
108107

109-
DeleteEntry(customApiSlug, customApiEntryId) {
108+
DeleteEntry(customApiId, customApiEntryId) {
110109
return this.request.send(
111-
`${this.entriesEndpoint}/${customApiSlug}/${customApiEntryId}`,
110+
`${this.endpoint}/${customApiId}/entries/${customApiEntryId}`,
112111
'DELETE'
113112
)
114113
}

src/types/custom-apis.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,21 +97,21 @@ export interface CustomApisEndpoint {
9797

9898
DeleteField<T = any>(customApiId: string, customApiFieldId: string): Promise<T>
9999

100-
GetEntries<T = any>(customApiSlug: string): Promise<T>
100+
GetEntries<T = any>(customApiId: string): Promise<T>
101101

102-
GetEntry<T = any>(customApiSlug: string, customApiEntryId: string): Promise<T>
102+
GetEntry<T = any>(customApiId: string, customApiEntryId: string): Promise<T>
103103

104104
CreateEntry<RequestBody = any, ResponseBody = any>(
105-
customApiSlug: string,
105+
customApiId: string,
106106
body: RequestBody
107107
): Promise<ResponseBody>
108108

109109
UpdateEntry<RequestBody = any, ResponseBody = any>(
110-
customApiSlug: string,
110+
customApiId: string,
111111
customApiEntryId: string,
112112
body: RequestBody
113113
): Promise<ResponseBody>
114114

115-
DeleteEntry<T = any>(customApiSlug: string, customApiEntryId: string): Promise<T>
115+
DeleteEntry<T = any>(customApiId: string, customApiEntryId: string): Promise<T>
116116

117117
}

0 commit comments

Comments
 (0)