Skip to content

Commit

Permalink
feat(modules): added core_user_agree_site_policy function
Browse files Browse the repository at this point in the history
  • Loading branch information
Luke Carr committed May 21, 2020
1 parent 3bb0e9d commit a4c895c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/modules/core/user/agree-site-policy.ts
@@ -0,0 +1,12 @@
import { FunctionResponse } from "../../../functions";
import { Warning } from "../../shared";

export interface SitePolicyAgreementResponse extends FunctionResponse {
/**
* Whether the agreement was processed
* successfuly (true) or not (false).
*/
status: boolean;

warnings?: Warning[];
}
11 changes: 11 additions & 0 deletions src/modules/core/user/index.ts
@@ -1,12 +1,23 @@
import Module from "../..";
import { FunctionResponse } from "../../../functions";
import { SitePolicyAgreementResponse } from "./agree-site-policy";
import { SearchCriteria, GetUsersResponse } from "./get-users";
import { GetUsersByFieldResponse } from "./get-users-by-field";

/**
* Functions for user-related actions.
*/
export default class UserModule extends Module {
/**
* Agrees to the Moodle site policy for the current
* web service user.
*/
public async agreeSitePolicy(): Promise<SitePolicyAgreementResponse> {
return (await this.get(
"core_user_agree_site_policy"
)) as SitePolicyAgreementResponse;
}

/**
* Searches for users on the Moodle site that match
* the provided crtieria.
Expand Down

0 comments on commit a4c895c

Please sign in to comment.