Search in sources :

Example 1 with Api

use of com.voipgrid.vialer.api.Api in project vialer-android by VoIPGRID.

the class SetupActivity method resetPassword.

private void resetPassword(String email) {
    Api api = ServiceGenerator.createService(this, Api.class, getString(R.string.api_url));
    Call<Object> call = api.resetPassword(new PasswordResetParams(email));
    call.enqueue(this);
}
Also used : PasswordResetParams(com.voipgrid.vialer.models.PasswordResetParams) Api(com.voipgrid.vialer.api.Api)

Example 2 with Api

use of com.voipgrid.vialer.api.Api in project vialer-android by VoIPGRID.

the class WebActivity method autoLoginToken.

/**
 * Request an autologin token
 */
private void autoLoginToken() {
    mProgressBar.setVisibility(View.VISIBLE);
    Api api = ServiceGenerator.createService(this, Api.class, getString(R.string.api_url), getIntent().getStringExtra(USERNAME), getIntent().getStringExtra(PASSWORD));
    Call<AutoLoginToken> call = api.autoLoginToken();
    call.enqueue(this);
}
Also used : Api(com.voipgrid.vialer.api.Api) AutoLoginToken(com.voipgrid.vialer.api.models.AutoLoginToken)

Example 3 with Api

use of com.voipgrid.vialer.api.Api in project vialer-android by VoIPGRID.

the class AccountActivity method save.

private void save() {
    findViewById(R.id.container).setFocusableInTouchMode(true);
    String number = ((EditText) findViewById(R.id.account_mobile_number_edit_text)).getText().toString();
    number = PhoneNumberUtils.formatMobileNumber(number);
    Api api = ServiceGenerator.createService(this, Api.class, getString(R.string.api_url), getEmail(), getPassword());
    Call<MobileNumber> call = api.mobileNumber(new MobileNumber(number));
    call.enqueue(this);
    mSystemUser.setMobileNumber(number);
    populate();
}
Also used : MobileNumber(com.voipgrid.vialer.api.models.MobileNumber) Api(com.voipgrid.vialer.api.Api)

Example 4 with Api

use of com.voipgrid.vialer.api.Api in project vialer-android by VoIPGRID.

the class CallRecordFragment method loadCallRecordsFromApi.

private void loadCallRecordsFromApi() {
    mHaveNetworkRecords = false;
    AccountHelper accountHelper = new AccountHelper(getActivity());
    Api api = ServiceGenerator.createService(getContext(), Api.class, getString(R.string.api_url), accountHelper.getEmail(), accountHelper.getPassword());
    Call<VoipGridResponse<CallRecord>> call = api.getRecentCalls(50, 0, CallRecord.getLimitDate());
    call.enqueue(this);
}
Also used : AccountHelper(com.voipgrid.vialer.util.AccountHelper) VoipGridResponse(com.voipgrid.vialer.api.models.VoipGridResponse) Api(com.voipgrid.vialer.api.Api)

Example 5 with Api

use of com.voipgrid.vialer.api.Api in project vialer-android by VoIPGRID.

the class UpdateHelper method enableSecureCalling.

/**
 * Migrate secure calling permissions to use secure calling by default.
 * V5_2
 */
private void enableSecureCalling() {
    AccountHelper accountHelper = new AccountHelper(mContext);
    Api mApi = ServiceGenerator.createService(mContext, Api.class, mContext.getString(R.string.api_url), accountHelper.getEmail(), accountHelper.getPassword());
    Call<UseEncryption> call = mApi.useEncryption(new UseEncryption(true));
    try {
        Response response = call.execute();
        if (!response.isSuccessful()) {
            handleApiFailure(response.code());
        }
    } catch (IOException e) {
        handleApiFailure(0);
    }
}
Also used : Response(retrofit2.Response) Api(com.voipgrid.vialer.api.Api) UseEncryption(com.voipgrid.vialer.api.models.UseEncryption) IOException(java.io.IOException)

Aggregations

Api (com.voipgrid.vialer.api.Api)5 AutoLoginToken (com.voipgrid.vialer.api.models.AutoLoginToken)1 MobileNumber (com.voipgrid.vialer.api.models.MobileNumber)1 UseEncryption (com.voipgrid.vialer.api.models.UseEncryption)1 VoipGridResponse (com.voipgrid.vialer.api.models.VoipGridResponse)1 PasswordResetParams (com.voipgrid.vialer.models.PasswordResetParams)1 AccountHelper (com.voipgrid.vialer.util.AccountHelper)1 IOException (java.io.IOException)1 Response (retrofit2.Response)1