Search in sources :

Example 1 with ResetParent

use of com.instructure.canvasapi2.models.ResetParent in project instructure-android by instructure.

the class UserAPI method resetParentPassword.

/**
 * The API call to actually reset the parent's password to the one they just created.
 *
 * @param userName
 * @param password
 * @param callback
 */
public static void resetParentPassword(@NonNull RestBuilder adapter, @NonNull RestParams params, @NonNull String userName, @NonNull String password, @NonNull StatusCallback<ResetParent> callback) {
    Parent parent = new Parent();
    parent.setUsername(userName);
    parent.setPassword(password);
    callback.addCall(adapter.build(UsersInterface.class, params).resetParentPasswordAirwolf(parent)).enqueue(callback);
}
Also used : Parent(com.instructure.canvasapi2.models.Parent) ResetParent(com.instructure.canvasapi2.models.ResetParent)

Example 2 with ResetParent

use of com.instructure.canvasapi2.models.ResetParent in project instructure-android by instructure.

the class UserManager_Test method resetParentPassword.

public static void resetParentPassword(String airwolfDomain, RestBuilder adapter, RestParams params, String email, String password, StatusCallback<ResetParent> callback) {
    adapter.setStatusCallback(callback);
    Response response = new Response.Builder().code(200).message("success").protocol(Protocol.HTTP_1_0).body(ResponseBody.create(MediaType.parse("application/json"), "success".getBytes())).addHeader("content-type", "application/json").build();
    retrofit2.Response response1 = retrofit2.Response.success(response);
    callback.onResponse(response1, new LinkHeaders(), ApiType.API);
}
Also used : Response(okhttp3.Response) ParentResponse(com.instructure.canvasapi2.models.ParentResponse) LinkHeaders(com.instructure.canvasapi2.utils.LinkHeaders) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder)

Example 3 with ResetParent

use of com.instructure.canvasapi2.models.ResetParent in project instructure-android by instructure.

the class UserManager method resetParentPasswordAirwolf.

public static void resetParentPasswordAirwolf(String airwolfDomain, String username, String password, StatusCallback<ResetParent> callback) {
    if (isTesting() || mTesting) {
        RestBuilder adapter = new RestBuilder(callback);
        RestParams params = new RestParams.Builder().withShouldIgnoreToken(false).withPerPageQueryParam(false).withDomain(airwolfDomain).withAPIVersion("").withForceReadFromNetwork(true).build();
        UserManager_Test.resetParentPassword(airwolfDomain, adapter, params, username, password, callback);
    } else {
        RestBuilder adapter = new RestBuilder(callback);
        RestParams params = new RestParams.Builder().withShouldIgnoreToken(false).withPerPageQueryParam(false).withDomain(airwolfDomain).withAPIVersion("").withForceReadFromNetwork(true).build();
        UserAPI.resetParentPassword(adapter, params, username, password, callback);
    }
}
Also used : RestParams(com.instructure.canvasapi2.builders.RestParams) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder)

Aggregations

RestBuilder (com.instructure.canvasapi2.builders.RestBuilder)2 RestParams (com.instructure.canvasapi2.builders.RestParams)1 Parent (com.instructure.canvasapi2.models.Parent)1 ParentResponse (com.instructure.canvasapi2.models.ParentResponse)1 ResetParent (com.instructure.canvasapi2.models.ResetParent)1 LinkHeaders (com.instructure.canvasapi2.utils.LinkHeaders)1 Response (okhttp3.Response)1