Skip to content

Commit

Permalink
added all the requests available on coinLore
Browse files Browse the repository at this point in the history
  • Loading branch information
iankang committed Mar 12, 2022
1 parent 7b226c1 commit 7a6872c
Show file tree
Hide file tree
Showing 23 changed files with 358 additions and 81 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package com.example.coinloreapi.api

import com.example.coinloreapi.models.*
import retrofit2.Response
import retrofit2.http.GET
import retrofit2.http.Query


interface CoinLoreAPIRequests {

@GET("api/global/")
suspend fun getGlobalCoinData(): Response<GlobalCoinResponse>

@GET("api/tickers/")
suspend fun getCoinsTickers(
@Query("start") start: Long? = null,
@Query("limit") limit: Long? = null,
): Response<CoinsTickersResponse>

@GET("api/ticker/")
suspend fun getCoinTicker(
@Query("id") id: Int
): Response<CoinTickerResponse>

@GET("api/coin/markets")
suspend fun getCoinMarkets(
@Query("id") id: Int
): Response<CoinMarketsResponse>

@GET("api/exchanges/")
suspend fun getAllExchanges():Response<HashMap<String, ExchangesItems>>

@GET("api/exchange/")
suspend fun getExchange(
@Query("id") id:Int
):Response<ExchangeItemResponse>

@GET("api/coin/social_stats/")
suspend fun getCoinSocialMedia(
@Query("id") id:Int
):Response<CoinSocialMediaResponse>

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.example.coinloreapi.di

import com.example.coinloreapi.api.CoinLoreAPI
import com.example.coinloreapi.api.CoinLoreAPIRequests
import com.example.coinloreapi.utils.Constants.COIN_LORE_BASE_API
import okhttp3.Interceptor
import okhttp3.OkHttpClient
Expand Down Expand Up @@ -47,6 +47,6 @@ fun provideOkHttpClient(httpLoggingInterceptor: HttpLoggingInterceptor):OkHttpCl
.build()
}

fun provideCoinLoreApi(retrofit: Retrofit):CoinLoreAPI{
return retrofit.create(CoinLoreAPI::class.java)
fun provideCoinLoreApi(retrofit: Retrofit):CoinLoreAPIRequests{
return retrofit.create(CoinLoreAPIRequests::class.java)
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.example.coinloreapi.di

import com.example.coinloreapi.repository.GlobalCoinRepository
import com.example.coinloreapi.repository.CoinLoreApi
import org.koin.dsl.module

val repositoryModule = module {
single { provideGlobalCoinRepository() }
}

fun provideGlobalCoinRepository():GlobalCoinRepository{
return GlobalCoinRepository()
fun provideGlobalCoinRepository():CoinLoreApi{
return CoinLoreApi()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.example.coinloreapi.models


import com.google.gson.annotations.SerializedName

class CoinMarketsResponse : ArrayList<CoinMarketsResponseItem>()
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.example.coinloreapi.models


import com.google.gson.annotations.SerializedName

data class CoinMarketsResponseItem(
@SerializedName("base")
val base: String,
@SerializedName("name")
val name: String,
@SerializedName("price")
val price: Double,
@SerializedName("price_usd")
val priceUsd: Double,
@SerializedName("quote")
val quote: String,
@SerializedName("time")
val time: Int,
@SerializedName("volume")
val volume: Double,
@SerializedName("volume_usd")
val volumeUsd: Double
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.example.coinloreapi.models


import com.google.gson.annotations.SerializedName

data class CoinSocialMediaResponse(
@SerializedName("reddit")
var reddit: Reddit? = null,
@SerializedName("twitter")
var twitter: Twitter? = null
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package com.example.coinloreapi.models


class CoinTickerResponse : ArrayList<CoinTickerResponseItem>()
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package com.example.coinloreapi.models


import com.google.gson.annotations.SerializedName

data class CoinTickerResponseItem(
@SerializedName("csupply")
val csupply: String,
@SerializedName("id")
val id: String,
@SerializedName("market_cap_usd")
val marketCapUsd: String,
@SerializedName("msupply")
val msupply: String,
@SerializedName("name")
val name: String,
@SerializedName("nameid")
val nameid: String,
@SerializedName("percent_change_1h")
val percentChange1h: String,
@SerializedName("percent_change_24h")
val percentChange24h: String,
@SerializedName("percent_change_7d")
val percentChange7d: String,
@SerializedName("price_btc")
val priceBtc: String,
@SerializedName("price_usd")
val priceUsd: String,
@SerializedName("rank")
val rank: Int,
@SerializedName("symbol")
val symbol: String,
@SerializedName("tsupply")
val tsupply: String,
@SerializedName("volume24")
val volume24: String,
@SerializedName("volume24_native")
val volume24Native: String
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.example.coinloreapi.models


import com.google.gson.annotations.SerializedName

data class CoinsTickersResponse(
@SerializedName("data")
val data: List<Data>,
@SerializedName("info")
val info: Info
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package com.example.coinloreapi.models


import com.google.gson.annotations.SerializedName

data class Data(
@SerializedName("csupply")
val csupply: String,
@SerializedName("id")
val id: String,
@SerializedName("market_cap_usd")
val marketCapUsd: String,
@SerializedName("msupply")
val msupply: String,
@SerializedName("name")
val name: String,
@SerializedName("nameid")
val nameid: String,
@SerializedName("percent_change_1h")
val percentChange1h: String,
@SerializedName("percent_change_24h")
val percentChange24h: String,
@SerializedName("percent_change_7d")
val percentChange7d: String,
@SerializedName("price_btc")
val priceBtc: String,
@SerializedName("price_usd")
val priceUsd: String,
@SerializedName("rank")
val rank: Int,
@SerializedName("symbol")
val symbol: String,
@SerializedName("tsupply")
val tsupply: String,
@SerializedName("volume24")
val volume24: Double,
@SerializedName("volume24a")
val volume24a: Double
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.example.coinloreapi.models


import com.google.gson.annotations.SerializedName

data class ExchangeItemDetail(
@SerializedName("date_live")
var dateLive: String? = null,
@SerializedName("name")
var name: String? = null,
@SerializedName("url")
var url: String? = null
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.example.coinloreapi.models

data class ExchangeItemDetails(
var date_live: String? = null,
var name: String? = null,
var url: String? = null
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.example.coinloreapi.models


import com.google.gson.annotations.SerializedName

data class ExchangeItemResponse(
@SerializedName("pairs")
var pairs: List<Pairs>? = null,
@SerializedName("0")
var exchangeItemDetail: ExchangeItemDetail? = null
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package com.example.coinloreapi.models

data class ExchangesItems(
var `0`: String? = null,
var `1`: String? = null,
var `10`: Any? = null,
var `11`: Any? = null,
var `12`: Any? = null,
var `13`: String? = null,
var `14`: Any? = null,
var `2`: String? = null,
var `3`: String? = null,
var `4`: String? = null,
var `5`: String? = null,
var `6`: String? = null,
var `7`: String? = null,
var `8`: String? = null,
var `9`: String? = null,
var alexa: Any? = null,
var auto: String? = null,
var centralized: Any? = null,
var country: String? = null,
var date_added: String? = null,
var date_live: String? = null,
var dex: Any? = null,
var f: String? = null,
var fiat: String? = null,
var id: String? = null,
var mining: Any? = null,
var name: String? = null,
var name_id: String? = null,
var pairs: Int? = null,
var tr: Int? = null,
var udate: String? = null,
var url: String? = null,
var usdt: String? = null,
var volume_usd: Double? = null,
var volume_usd_adj: Double? = null
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.example.coinloreapi.models


import com.google.gson.annotations.SerializedName

data class Info(
@SerializedName("coins_num")
val coinsNum: Double,
@SerializedName("time")
val time: Double
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.example.coinloreapi.models


import com.google.gson.annotations.SerializedName

data class Pairs(
@SerializedName("base")
var base: String? = null,
@SerializedName("price")
var price: Double? = null,
@SerializedName("price_usd")
var priceUsd: Double? = null,
@SerializedName("quote")
var quote: Any? = null,
@SerializedName("time")
var time: Int? = null,
@SerializedName("volume")
var volume: Double? = null
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.example.coinloreapi.models


import com.google.gson.annotations.SerializedName

data class Reddit(
@SerializedName("avg_active_users")
var avgActiveUsers: Double? = null,
@SerializedName("subscribers")
var subscribers: Int? = null
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.example.coinloreapi.models


import com.google.gson.annotations.SerializedName

data class Twitter(
@SerializedName("followers_count")
var followersCount: Int? = null,
@SerializedName("status_count")
var statusCount: Int? = null
)
Loading

0 comments on commit 7a6872c

Please sign in to comment.