Skip to content

Commit

Permalink
chore: started working on new constructors for email/password credent…
Browse files Browse the repository at this point in the history
…ials
  • Loading branch information
Lycoon committed Nov 22, 2023
1 parent 3155a13 commit 22e78cd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/main/java/com/lycoon/clashapi/core/ClashAPI.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@ interface IClashAPI: IClanAPI, IPlayerAPI, ILeagueAPI, ILocationAPI, IGoldPassAP
* Create an instance of this class to start using the API.<br></br>
* Are you lost? Check the [README](https://github.com/Lycoon/clash-api) to see what ClashAPI is all about.
*/
class ClashAPI(token: String) : ClashAPIClient(token), IClashAPI
class ClashAPI : ClashAPIClient, IClashAPI
{
constructor(token: String) : super(token)
constructor(email: String, password: String) : super(email, password)

// ##############################################
// || Clans API ||
// ##############################################
Expand Down
7 changes: 6 additions & 1 deletion src/main/java/com/lycoon/clashapi/core/ClashAPIClient.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,14 @@ import okhttp3.RequestBody.Companion.toRequestBody
import java.io.IOException
import java.util.concurrent.CompletableFuture

abstract class ClashAPIClient(private val token: String)
abstract class ClashAPIClient
{
constructor(token: String) { this.token = token }
constructor(email: String, password: String) {}

private var token: String = ""
private val http: OkHttpClient = OkHttpClient()

private fun getBaseRequest(suffix: String, queryParamsBuilder: QueryParamsBuilder? = null): Request.Builder
{
val query = queryParamsBuilder?.build() ?: ""
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/com/lycoon/clashapi/models/war/WarMember.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ package com.lycoon.clashapi.models.war
import kotlinx.serialization.Serializable

@Serializable
data class WarMember(
data class WarMember
(
val tag: String? = null,
val name: String? = null,
val mapPosition: Int = 0,
Expand Down

0 comments on commit 22e78cd

Please sign in to comment.