-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(modules): separated module responses into separate files
- Loading branch information
Luke Carr
committed
May 21, 2020
1 parent
ebbcdd1
commit 3eb3b25
Showing
10 changed files
with
83 additions
and
76 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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import Module from "../.."; | ||
import { SignUpSettingsResponse } from "./sign-up-settings"; | ||
|
||
/** | ||
* Functions relating to Moodle's email-based self-registration. | ||
* | ||
* This module's function calls may throw errors if self registration is disabled. | ||
*/ | ||
export default class AuthEmailModule extends Module { | ||
/** | ||
* Get the sign-up required settings and profile fields. | ||
*/ | ||
public async getSignUpSettings(): Promise<SignUpSettingsResponse> { | ||
return (await this.get( | ||
"auth_email_get_signup_settings" | ||
)) as SignUpSettingsResponse; | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { FunctionResponse } from "../../../functions"; | ||
import { User } from "../../shared"; | ||
|
||
export interface GetUsersByFieldResponse extends FunctionResponse { | ||
/** | ||
* The array of users that match the provided field | ||
* crtieria. | ||
*/ | ||
users: User[]; | ||
} |
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,26 @@ | ||
import { FunctionResponse } from "../../../functions"; | ||
import { User, Warning } from "../../shared"; | ||
|
||
export interface SearchCriteria { | ||
/** | ||
* The name of the field used to search | ||
* for users. | ||
*/ | ||
key: string; | ||
|
||
/** | ||
* The field value to match when searching | ||
* for users. | ||
*/ | ||
value: string | number; | ||
} | ||
|
||
export interface GetUsersResponse extends FunctionResponse { | ||
/** | ||
* The array of users that match the provided search | ||
* crtieria. | ||
*/ | ||
users: User[]; | ||
|
||
warnings?: Warning[]; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import Module from "../.."; | ||
import { SiteInfoResponse } from "./get-site-info"; | ||
|
||
/** | ||
* Functions relating to system actions. | ||
*/ | ||
export default class WebServiceModule extends Module { | ||
/** | ||
* Returns information about the Moodle site and the Web Services API. | ||
* This function's response also contains information relating to the | ||
* web service user, such as capabilities and authorized API actions. | ||
*/ | ||
public async getSiteInfo(): Promise<SiteInfoResponse> { | ||
return (await this.get( | ||
"core_webservice_get_site_info" | ||
)) as SiteInfoResponse; | ||
} | ||
} |
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,2 @@ | ||
export { default as User } from "./user"; | ||
export { default as Warning } from "./warning"; | ||
export * from "./user"; | ||
export * from "./warning"; |
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