Skip to content

andhiratobing/github-user-paging

Repository files navigation

Demo

Demo.mp4

API Documentation

BASE_URL

https://api.github.com/ 

Request:

  • Method : GET
  • Header :
    • Accept: application/json
    • Authorization : YOUR_TOKEN_GITHUB

Search user

  • Endpoint : search/users
  • Example :
     @GET("search/users") @Headers("Accept: $ACCEPT_VERSION", "Authorization: token$YOUR_TOKEN_GITHUB") suspend fun searchUsers( @Query("q") query: String, @Query("page") page: Int, @Query("per_page") perPage: Int, ): UserResponse 

Detail user

  • Endpoint : users/{username}
  • Example :
     @GET("users/{username}") @Headers("Accept: $ACCEPT_VERSION", "Authorization: token $YOUR_TOKEN_GITHUB") fun detailUsers( @Path("username") username: String, ): Call<DetailUserResponse> 

Followers

  • Endpoint : users/{username}/followers
  • Example :
     @GET("users/{username}/followers") @Headers("Authorization: token $YOUR_TOKEN_GITHUB") suspend fun getFollowers( @Path("username") username: String, @Query("page") page: Int, @Query("per_page") perPage: Int, ): List<UserResponseItem> 

Following

  • Endpoint : users/{username}/following
  • Example :
     @GET("users/{username}/following") @Headers("Authorization: token $YOUR_TOKEN_GITHUB") suspend fun getFollowing( @Path("username") username: String, @Query("page") page: Int, @Query("per_page") perPage: Int, ): List<UserResponseItem> 

Repositories

  • Endpoint : users/{username}/repos
  • Example :
     @GET("users/{username}/repos") @Headers("Authorization: token $YOUR_TOKEN_GITHUB") suspend fun getRepos( @Path("username") username: String, @Query("page") page: Int, @Query("per_page") perPage: Int, ): List<ReposResponse> 

How to clone

  • Syntax :

    git clone -b <NAMA_BRANCH> <GIT_REMOTE_URL>

  • Master

    git clone -b master https://github.com/andhiratobing/github-user-paging 
  • Submission 1

    git clone -b submission_1 https://github.com/andhiratobing/github-user-paging/tree/submission_1 
  • Submission 2

    git clone -b submission_2 https://github.com/andhiratobing/github-user-paging/tree/submission_2 
  • Submission 3

    git clone -b submission_3 https://github.com/andhiratobing/github-user-paging/tree/submission_3 

MAD Scorecard

Dependencies

LICENSE

 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ Copyright © 2021 Andhi Ratobing 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.