donglua / ZoomEye-API

ZoomEye Android API SDK.

Home Page:https://www.zoomeye.org/api/doc

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ZoomEye-API

ZoomEye Android API

Gradle

Download

compile 'org.droiders:zoomeye-api:0.1.3'

Usage

  • Create ZoomEyeApiService object
Retrofit retrofit = new Retrofit.Builder() //
      .client(client) //
      .baseUrl("http://api.zoomeye.org") //
      .addConverterFactory(GsonConverterFactory.create(gson)) //
      .addCallAdapterFactory(RxJavaCallAdapterFactory.create()) //
      .build();
ZoomEyeApiService api = retrofit.create(ZoomEyeApiService.class);
  • Request and error handle
ErrorBodyHandler errorHandler = new ErrorBodyHandler(retrofit);

api.login(new LoginRequest(username, password))
    .observeOn(AndroidSchedulers.mainThread())
    .subscribe(tokenResponse -> {
      if (tokenResponse.isSuccessful()) {
        String accessToken = tokenResponse.body().toString();
        Log.d("ZoomEye", "accessToken = " + accessToken);
        ...
      } else {
        ErrorBody errorBody = errorHandler.parseError(tokenResponse.errorBody());
        Log.d("ZoomEye", errorBody.getMessage());
        ...
      }
    });

App

License

Copyright 2016 Huang Donglu

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

About

ZoomEye Android API SDK.

https://www.zoomeye.org/api/doc

License:Apache License 2.0


Languages

Language:Java 100.0%