Skip to content

Commit

Permalink
fixup! fix: migrate settingsService to TS
Browse files Browse the repository at this point in the history
Signed-off-by: Maksim Sukharev <[email protected]>
  • Loading branch information
Antreesy committed Dec 11, 2024
1 parent 37f30a6 commit e181bb0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/services/settingsService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import type {
setSipSettingsResponse,
setUserSettingsParams,
setUserSettingsResponse,
UserPreferencesResponse,
} from '../types/index.ts'

/**
Expand Down Expand Up @@ -87,13 +88,12 @@ const setBlurVirtualBackground = async function(value: boolean) {

/**
* Set user config using provisioning API
* from https://docs.nextcloud.com/server/latest/developer_manual/client_apis/OCS/ocs-user-preferences-api.html
*
* @param appId - app id
* @param configKey - key of the config to set
* @param configValue - value to set
*/
const setUserConfig = async function(appId: string, configKey: string, configValue: string): Promise<unknown> {
const setUserConfig = async function(appId: string, configKey: string, configValue: string): UserPreferencesResponse {
return axios.post(generateOcsUrl('apps/provisioning_api/api/v1/config/users/{appId}/{configKey}', { appId, configKey }), {
configValue,
})
Expand Down
4 changes: 4 additions & 0 deletions src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,10 @@ export type OutOfOfficeResponse = ApiResponseUnwrapped<{
}
}>

// User preferences response
// from https://docs.nextcloud.com/server/latest/developer_manual/client_apis/OCS/ocs-user-preferences-api.html
export type UserPreferencesResponse = ApiResponseUnwrapped<unknown>

// Settings
export type setSipSettingsParams = Required<operations['settings-setsip-settings']>['requestBody']['content']['application/json']
export type setSipSettingsResponse = ApiResponse<operations['settings-setsip-settings']['responses'][200]['content']['application/json']>
Expand Down

0 comments on commit e181bb0

Please sign in to comment.