Skip to content

Commit ca5518a

Browse files
author
Damian Staszewski
committed
refactor(*): apply modifications to the static methods
1 parent 5e10723 commit ca5518a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+1875
-1344
lines changed

.github/ISSUES_TEMPLATE.md

Lines changed: 0 additions & 37 deletions
This file was deleted.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 0 additions & 24 deletions
This file was deleted.

README.md

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,37 +31,41 @@ Add to `pom.xml` build.
3131
<repositories>
3232
<repository>
3333
<id>jcenter</id>
34-
<url>https://jcenter.bintray.com</url>
34+
<url>https://jitpack.io</url>
3535
</repository>
3636
</repositories>
3737

3838
<dependencies>
3939
<dependency>
4040
<groupId>com.github.stachu540</groupId>
4141
<!--for all games-->
42-
<artifactId>HiRezAPI-core</artifactId>
42+
<artifactId>HiRezAPI-all</artifactId>
4343
<!--for paladins-->
4444
<!--<artifactId>HiRezAPI-paladins</artifactId>-->
4545
<!--for smite-->
4646
<!--<artifactId>HiRezAPI-smite</artifactId>-->
47-
<version>2.1.0</version>
47+
<!--for realm royale-->
48+
<!--<artifactId>HiRezAPI-realm</artifactId>-->
49+
<version>v3</version>
4850
</dependency>
4951
</dependencies>
5052
```
5153
#### Gradle
5254
Add to `build.gradle` build.
5355
```groovy
5456
repositories {
55-
jcenter()
57+
maven { url "https://jitpack.io" }
5658
}
5759
5860
dependencies {
59-
// for all games
60-
compile "com.github.stachu540:HiRezAPI-core:2.1.0"
61-
// for paladins
62-
// compile "com.github.stachu540:HiRezAPI-paladins:2.1.0"
63-
// for smite
64-
// compile "com.github.stachu540:HiRezAPI-smite:2.1.0"
61+
// for all games
62+
compile "com.github.stachu540:HiRezAPI-all:v3"
63+
// for paladins
64+
// compile "com.github.stachu540:HiRezAPI-paladins:v3"
65+
// for smite
66+
// compile "com.github.stachu540:HiRezAPI-smite:v3"
67+
// for realm royale
68+
// compile "com.github.stachu540:HiRezAPI-realm:v3"
6569
}
6670
```
6771

api/src/main/kotlin/hirez/AbstractAPI.kt

Lines changed: 0 additions & 129 deletions
This file was deleted.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package hirez
2+
3+
import hirez.api.BaseEndpoint
4+
import hirez.api.SessionStorage
5+
6+
/**
7+
*
8+
* @author Damian Staszewski [[email protected]]
9+
* @version %I%, %G%
10+
* @since 3.0.0
11+
*/
12+
data class Config internal constructor(
13+
val devId: String,
14+
val authKey: String,
15+
val defaultLanguage: Language,
16+
val sessionStorage: SessionStorage,
17+
val userAgent: String,
18+
val endpoint: BaseEndpoint
19+
)
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
package hirez
2+
3+
import hirez.api.BaseEndpoint
4+
import hirez.api.SessionStorage
5+
6+
/**
7+
*
8+
* @author Damian Staszewski [[email protected]]
9+
* @version %I%, %G%
10+
* @since 3.0.0
11+
*/
12+
class ConfigBuilder {
13+
lateinit var devId: String
14+
private set
15+
lateinit var authKey: String
16+
private set
17+
lateinit var endpoint: BaseEndpoint
18+
private set
19+
var sessionStorage: SessionStorage = SessionStorage.DEFAULT
20+
private set
21+
var userAgent: String = "HiRez-API v${GitProperties.get(GitProperties.APPLICATION_VERSION)} [Rev. ${GitProperties.get(GitProperties.GIT_COMMIT_ID_ABBREV)}]"
22+
private set
23+
var defaultLanguage: Language = Language.English
24+
private set
25+
26+
fun setDevId(devId: String): ConfigBuilder {
27+
this.devId = devId
28+
return this
29+
}
30+
31+
fun setAuthKey(authKey: String): ConfigBuilder {
32+
this.authKey = authKey
33+
return this
34+
}
35+
36+
fun setEndpoint(endpoint: BaseEndpoint): ConfigBuilder {
37+
this.endpoint = endpoint
38+
return this
39+
}
40+
41+
fun setSessionStorage(sessionStorage: SessionStorage): ConfigBuilder {
42+
this.sessionStorage = sessionStorage
43+
return this
44+
}
45+
46+
fun setUserAgent(userAgent: String): ConfigBuilder {
47+
this.userAgent = userAgent
48+
return this
49+
}
50+
51+
fun setDefaultLanguage(defaultLanguage: Language): ConfigBuilder {
52+
this.defaultLanguage = defaultLanguage
53+
return this
54+
}
55+
56+
val endpointAssigned
57+
get() = ::endpoint.isInitialized
58+
59+
fun build(): Config {
60+
if (!::devId.isInitialized || devId.isBlank()) {
61+
throw NullPointerException("devId must be initialized")
62+
}
63+
if (!::authKey.isInitialized || authKey.isBlank()) {
64+
throw NullPointerException("authKey must be initialized")
65+
}
66+
if (!::endpoint.isInitialized) {
67+
throw NullPointerException("endpoint must be initialized")
68+
}
69+
70+
return Config(devId, authKey, defaultLanguage, sessionStorage, userAgent, endpoint)
71+
}
72+
}

api/src/main/kotlin/hirez/Configuration.kt

Lines changed: 0 additions & 22 deletions
This file was deleted.

api/src/main/kotlin/hirez/GitProperties.kt

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)