All Downloads are FREE. Search and download functionalities are using the official Maven repository.

edu.ksu.canvas.interfaces.AccountWriter Maven / Gradle / Ivy

package edu.ksu.canvas.interfaces;

import edu.ksu.canvas.exception.InvalidOauthTokenException;
import edu.ksu.canvas.model.Account;
import edu.ksu.canvas.model.User;

import java.io.IOException;
import java.util.Optional;

public interface AccountWriter extends CanvasWriter {
    /**
     * Create a new account in Canvas
     * @param accountId the account ID of the account under which to place this account
     * @param account A account object containing the information needed to create a account in Canvas
     * @return The newly created account
     * @throws IOException When there is an error communicating with Canvas
     */
     Optional createAccount(String accountId, Account account) throws IOException;

     /**
      * Update a account in Canvas
      * @param account A account object containing the information needed to update a account in Canvas
      * @return The newly updated account
      * @throws IOException When there is an error communicating with Canvas
      */
      Optional updateAccount(Account account) throws IOException;

    /**
     * @param parentAccountId The ID of the parent account to the account to delete.
     * @param accountId The ID of the account you wish to delete
     * @return true if the account was deleted
     * @throws IOException When there is an error communicating with Canvas
     */
     Boolean deleteAccount(String parentAccountId, String accountId) throws IOException;

    /**
     * @param userId The ID of the user to delete.
     * @param accountId The ID of the account to delete the user from
     * @return the user who was deleted
     * @throws IOException When there is an error communicating with Canvas
     */
     User deleteUser(String userId, String accountId) throws IOException;

    /**
     * Restore a deleted user in Canvas
     * @param accountId account id for restoring user into an account
     * @param userId user id for restoring user
     * @return The newly restored user
     * @throws InvalidOauthTokenException When the supplied OAuth token is not valid
     * @throws IOException When there is an error communicating with Canvas
     */
    Optional restoreUser (String accountId, String userId) throws InvalidOauthTokenException, IOException;
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy