Skip to content

Commit b2fb5e8

Browse files
committed
Added Person Endpoints and renamed some Files
1 parent 4172ca5 commit b2fb5e8

32 files changed

+763
-75
lines changed

library/src/main/kotlin/me/proxer/library/api/info/InfoApi.kt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,20 @@ class InfoApi internal constructor(retrofit: Retrofit) {
8888
return ModifyUserInfoEndpoint(internalApi, entryId, UserInfoType.FINISHED)
8989
}
9090

91+
/**
92+
* Returns the respective endpoint.
93+
*/
94+
fun person(personId: String): PersonEndpoint {
95+
return PersonEndpoint(internalApi, personId)
96+
}
97+
98+
/**
99+
* Returns the respective endpoint.
100+
*/
101+
fun persons(entryId: String): PersonsCoreEndpoint {
102+
return PersonsCoreEndpoint(internalApi, entryId)
103+
}
104+
91105
/**
92106
* Returns the respective endpoint.
93107
*/

library/src/main/kotlin/me/proxer/library/api/info/InternalApi.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import me.proxer.library.entity.info.EpisodeInfo
99
import me.proxer.library.entity.info.ForumDiscussion
1010
import me.proxer.library.entity.info.Industry
1111
import me.proxer.library.entity.info.MediaUserInfo
12+
import me.proxer.library.entity.info.Person
13+
import me.proxer.library.entity.info.PersonCore
1214
import me.proxer.library.entity.info.Recommendation
1315
import me.proxer.library.entity.info.Relation
1416
import me.proxer.library.entity.info.TranslatorGroup
@@ -61,6 +63,12 @@ internal interface InternalApi {
6163
@GET("info/industry")
6264
fun industry(@Query("id") id: String?): ProxerCall<Industry>
6365

66+
@GET("info/person")
67+
fun person(@Query("id") id: String?): ProxerCall<Person>
68+
69+
@GET("info/persons")
70+
fun persons(@Query("id") id: String?): ProxerCall<List<PersonCore>>
71+
6472
@FormUrlEncoded
6573
@POST("info/setuserinfo")
6674
fun modifyUserInfo(
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package me.proxer.library.api.info
2+
3+
import me.proxer.library.ProxerCall
4+
import me.proxer.library.api.Endpoint
5+
import me.proxer.library.entity.info.Person
6+
7+
/**
8+
* Endpoint for retrieving all information of a [Person].
9+
*
10+
* @author TrueMB
11+
*/
12+
class PersonEndpoint internal constructor(
13+
private val internalApi: InternalApi,
14+
private val id: String
15+
) : Endpoint<Person> {
16+
17+
override fun build(): ProxerCall<Person> {
18+
return internalApi.person(id)
19+
}
20+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package me.proxer.library.api.info
2+
3+
import me.proxer.library.ProxerCall
4+
import me.proxer.library.api.Endpoint
5+
import me.proxer.library.entity.info.PersonCore
6+
7+
/**
8+
* Endpoint for retrieving multiple [PersonCore] Objects for a medium entry.
9+
*
10+
* @author TrueMB
11+
*/
12+
class PersonsCoreEndpoint internal constructor(
13+
private val internalApi: InternalApi,
14+
private val id: String
15+
) : Endpoint<List<PersonCore>> {
16+
17+
override fun build(): ProxerCall<List<PersonCore>> {
18+
return internalApi.persons(id)
19+
}
20+
}

library/src/main/kotlin/me/proxer/library/api/list/CharacterSearchEndpoint.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package me.proxer.library.api.list
33
import me.proxer.library.ProxerCall
44
import me.proxer.library.api.PagingLimitEndpoint
55
import me.proxer.library.entity.list.CharacterListEntry
6-
import me.proxer.library.enums.DescriptionType
6+
import me.proxer.library.enums.CharacterDescriptionType
77

88
/**
99
* Search for all available characters. Features various filter and uses paging.
@@ -17,18 +17,18 @@ class CharacterSearchEndpoint internal constructor(
1717
private var page: Int? = null
1818
private var limit: Int? = null
1919

20-
private var start: String? = null
20+
private var searchStart: String? = null
2121
private var contains: String? = null
2222
private var search: String? = null
23-
private var subject: DescriptionType? = null
23+
private var subject: CharacterDescriptionType? = null
2424

2525
override fun page(page: Int?) = this.apply { this.page = page }
2626
override fun limit(limit: Int?) = this.apply { this.limit = limit }
2727

2828
/**
29-
* Sets the start String to search for.
29+
* Sets the search start String
3030
*/
31-
fun start(start: String?) = this.apply { this.start = start }
31+
fun searchStart(searchStart: String?) = this.apply { this.searchStart = searchStart }
3232

3333
/**
3434
* Sets the contains String to search for.
@@ -43,9 +43,9 @@ class CharacterSearchEndpoint internal constructor(
4343
/**
4444
* Sets the subject that should be looked in.
4545
*/
46-
fun subject(subject: DescriptionType?) = this.apply { this.subject = subject }
46+
fun subject(subject: CharacterDescriptionType?) = this.apply { this.subject = subject }
4747

4848
override fun build(): ProxerCall<List<CharacterListEntry>> {
49-
return internalApi.characterSearch(start, contains, search, subject, page, limit)
49+
return internalApi.characterSearch(searchStart, contains, search, subject, page, limit)
5050
}
5151
}

library/src/main/kotlin/me/proxer/library/api/list/InternalApi.kt

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,21 @@ import me.proxer.library.entity.list.CharacterListEntry
55
import me.proxer.library.entity.list.IndustryCore
66
import me.proxer.library.entity.list.IndustryProject
77
import me.proxer.library.entity.list.MediaListEntry
8+
import me.proxer.library.entity.list.PersonListEntry
89
import me.proxer.library.entity.list.Tag
910
import me.proxer.library.entity.list.TranslatorGroupCore
1011
import me.proxer.library.entity.list.TranslatorGroupProject
1112
import me.proxer.library.enums.Category
1213
import me.proxer.library.enums.Country
13-
import me.proxer.library.enums.DescriptionType
14+
import me.proxer.library.enums.CharacterDescriptionType
1415
import me.proxer.library.enums.IndustryType
1516
import me.proxer.library.enums.Language
1617
import me.proxer.library.enums.LengthBound
1718
import me.proxer.library.enums.MediaListSortCriteria
1819
import me.proxer.library.enums.MediaSearchSortCriteria
1920
import me.proxer.library.enums.MediaType
2021
import me.proxer.library.enums.Medium
22+
import me.proxer.library.enums.PersonDescriptionType
2123
import me.proxer.library.enums.ProjectState
2224
import me.proxer.library.enums.SortType
2325
import me.proxer.library.enums.TagRateFilter
@@ -70,7 +72,7 @@ internal interface InternalApi {
7072
@Query("start") start: String?,
7173
@Query("contains") contains: String?,
7274
@Query("search") search: String?,
73-
@Query("subject") subject: DescriptionType?,
75+
@Query("subject") subject: CharacterDescriptionType?,
7476
@Query("page") page: Int?,
7577
@Query("limit") limit: Int?
7678
): ProxerCall<List<CharacterListEntry>>
@@ -93,6 +95,16 @@ internal interface InternalApi {
9395
@Query("limit") limit: Int?
9496
): ProxerCall<List<IndustryCore>>
9597

98+
@GET("list/persons")
99+
fun personList(
100+
@Query("start") searchStart: String?,
101+
@Query("contains") contains: String?,
102+
@Query("search") search: String?,
103+
@Query("subject") subject: PersonDescriptionType?,
104+
@Query("p") page: Int?,
105+
@Query("limit") limit: Int?
106+
): ProxerCall<List<PersonListEntry>>
107+
96108
@GET("list/translatorgroupprojects")
97109
fun translatorGroupProjectList(
98110
@Query("id") id: String?,

library/src/main/kotlin/me/proxer/library/api/list/ListApi.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ class ListApi internal constructor(retrofit: Retrofit) {
3232
return MediaSearchEndpoint(internalApi)
3333
}
3434

35+
/**
36+
* Returns the respective endpoint.
37+
*/
38+
fun personSearch(): PersonSearchEndpoint {
39+
return PersonSearchEndpoint(internalApi)
40+
}
41+
3542
/**
3643
* Returns the respective endpoint.
3744
*/
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
package me.proxer.library.api.list
2+
3+
import me.proxer.library.ProxerCall
4+
import me.proxer.library.api.PagingLimitEndpoint
5+
import me.proxer.library.entity.list.PersonListEntry
6+
import me.proxer.library.enums.PersonDescriptionType
7+
8+
/**
9+
* Endpoint for retrieving a list of Persons. Features various filter and uses paging.
10+
*
11+
* @author TrueMB
12+
*/
13+
class PersonSearchEndpoint internal constructor(
14+
private val internalApi: InternalApi
15+
) : PagingLimitEndpoint<List<PersonListEntry>> {
16+
17+
private var page: Int? = null
18+
private var limit: Int? = null
19+
20+
private var searchStart: String? = null
21+
private var contains: String? = null
22+
private var search: String? = null
23+
private var subject: PersonDescriptionType? = null
24+
25+
override fun page(page: Int?) = this.apply { this.page = page }
26+
override fun limit(limit: Int?) = this.apply { this.limit = limit }
27+
28+
/**
29+
* Sets the query to search for only from the start.
30+
*/
31+
fun searchStart(searchStart: String?) = this.apply { this.searchStart = searchStart }
32+
33+
/**
34+
* Sets the contains String to search for.
35+
*/
36+
fun contains(contains: String?) = this.apply { this.contains = contains }
37+
38+
/**
39+
* Sets the query to search for.
40+
*/
41+
fun search(search: String?) = this.apply { this.search = search }
42+
43+
/**
44+
* Sets the subject (description) in which should be searched. (default: intro)
45+
*/
46+
fun subject(subject: PersonDescriptionType?) = this.apply { this.subject = subject }
47+
48+
override fun build(): ProxerCall<List<PersonListEntry>> {
49+
return internalApi.personList(searchStart, contains, search, subject, page, limit)
50+
}
51+
}

library/src/main/kotlin/me/proxer/library/api/list/TagListEndpoint.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ import me.proxer.library.enums.TagType
1212
*
1313
* @author Ruben Gees
1414
*/
15-
class TagListEndpoint internal constructor(private val internalApi: InternalApi) : Endpoint<List<Tag>> {
15+
class TagListEndpoint internal constructor(
16+
private val internalApi: InternalApi
17+
18+
) : Endpoint<List<Tag>> {
1619

1720
private var name: String? = null
1821
private var type: TagType? = null

library/src/main/kotlin/me/proxer/library/entity/info/Character.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import java.util.Date
1717
* @property birthday The birthday.
1818
* @property height The height.
1919
* @property weight The weight.
20-
* @property descriptions The description.
20+
* @property descriptions The descriptions.
2121
* @property persons The persons in contact with the character
2222
*
2323
* @author Ruben Gees
@@ -33,6 +33,6 @@ data class Character(
3333
@Json(name = "birthday") val birthday: Date,
3434
@Json(name = "height") val height: String,
3535
@Json(name = "weight") val weight: String,
36-
@Json(name = "description") val descriptions: Set<Description>,
36+
@Json(name = "description") val descriptions: Set<CharacterDescription>,
3737
@Json(name = "persons") val persons: Set<PersonCore>
3838
) : ProxerIdItem

0 commit comments

Comments
 (0)