-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(hub-common): add CRUD functions for entity settings (#1275)
* fix(hub-common): add CRUD functions for entity settings affects: @esri/hub-common * fix(hub-common): rename setting interfaces affects: @esri/hub-common, @esri/hub-discussions * fix(hub-discussions): export updated setting interfaces from hub-common affects: @esri/hub-discussions
- Loading branch information
1 parent
6969758
commit 8eabc30
Showing
7 changed files
with
95 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export * from "./channels"; | ||
export * from "./settings"; | ||
export * from "./types"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./settings"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import { request } from "../request"; | ||
import { | ||
ICreateSettingParams, | ||
IEntitySetting, | ||
IFetchSettingParams, | ||
IRemoveSettingParams, | ||
IRemoveSettingResponse, | ||
IUpdateSettingParams, | ||
} from "../types"; | ||
|
||
/** | ||
* create setting | ||
* | ||
* @export | ||
* @param {ICreateSettingParams} options | ||
* @return {*} {Promise<IEntitySetting>} | ||
*/ | ||
export function createSetting( | ||
options: ICreateSettingParams | ||
): Promise<IEntitySetting> { | ||
options.httpMethod = "POST"; | ||
return request(`/settings`, options); | ||
} | ||
|
||
/** | ||
* fetch setting | ||
* | ||
* @export | ||
* @param {IFetchSettingParams} options | ||
* @return {*} {Promise<IEntitySetting>} | ||
*/ | ||
export function fetchSetting( | ||
options: IFetchSettingParams | ||
): Promise<IEntitySetting> { | ||
options.httpMethod = "GET"; | ||
return request(`/settings/${options.id}`, options); | ||
} | ||
|
||
/** | ||
* update setting | ||
* | ||
* @export | ||
* @param {IUpdateSettingParams} options | ||
* @return {*} {Promise<IEntitySetting>} | ||
*/ | ||
export function updateSetting( | ||
options: IUpdateSettingParams | ||
): Promise<IEntitySetting> { | ||
options.httpMethod = "PATCH"; | ||
return request(`/settings/${options.id}`, options); | ||
} | ||
|
||
/** | ||
* remove setting | ||
* | ||
* @export | ||
* @param {IRemoveSettingParams} options | ||
* @return {*} {Promise<IRemoveSettingResponse>} | ||
*/ | ||
export function removeSetting( | ||
options: IRemoveSettingParams | ||
): Promise<IRemoveSettingResponse> { | ||
options.httpMethod = "DELETE"; | ||
return request(`/settings/${options.id}`, options); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,6 @@ | ||
import { request } from "../request"; | ||
import { | ||
ICreateSettingParams, | ||
ISetting, | ||
IFetchSettingParams, | ||
IRemoveSettingParams, | ||
IRemoveSettingResponse, | ||
IUpdateSettingParams, | ||
} from "../types"; | ||
|
||
/** | ||
* create setting | ||
* | ||
* @export | ||
* @param {ICreateSettingParams} options | ||
* @return {*} {Promise<ISetting>} | ||
*/ | ||
export function createSetting( | ||
options: ICreateSettingParams | ||
): Promise<ISetting> { | ||
options.httpMethod = "POST"; | ||
return request(`/settings`, options); | ||
} | ||
|
||
/** | ||
* fetch setting | ||
* | ||
* @export | ||
* @param {IFetchSettingParams} options | ||
* @return {*} {Promise<ISetting>} | ||
*/ | ||
export function fetchSetting(options: IFetchSettingParams): Promise<ISetting> { | ||
options.httpMethod = "GET"; | ||
return request(`/settings/${options.id}`, options); | ||
} | ||
|
||
/** | ||
* update setting | ||
* | ||
* @export | ||
* @param {IUpdateSettingParams} options | ||
* @return {*} {Promise<ISetting>} | ||
*/ | ||
export function updateSetting( | ||
options: IUpdateSettingParams | ||
): Promise<ISetting> { | ||
options.httpMethod = "PATCH"; | ||
return request(`/settings/${options.id}`, options); | ||
} | ||
|
||
/** | ||
* remove setting | ||
* | ||
* @export | ||
* @param {IRemoveSettingParams} options | ||
* @return {*} {Promise<IRemoveSettingResponse>} | ||
*/ | ||
export function removeSetting( | ||
options: IRemoveSettingParams | ||
): Promise<IRemoveSettingResponse> { | ||
options.httpMethod = "DELETE"; | ||
return request(`/settings/${options.id}`, options); | ||
} | ||
export { | ||
createSetting, | ||
fetchSetting, | ||
updateSetting, | ||
removeSetting, | ||
} from "@esri/hub-common"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters