Skip to content

Commit

Permalink
lists: Add “exclusive” parameter for full support (andregasser#379)
Browse files Browse the repository at this point in the history
* lists: Add exclusive parameter for creating a list

* lists: Make repliesPolicy a nullable value with null default

Do not set the default that is enforced by the Mastodon API anyway
locally in the library.
  • Loading branch information
PattaFeuFeu authored Dec 6, 2023
1 parent 75e400e commit 052cc60
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
6 changes: 4 additions & 2 deletions bigbone-rx/src/main/kotlin/social/bigbone/rx/RxListMethods.kt
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,15 @@ class RxListMethods(client: MastodonClient) {
* Create a new list.
* @param title The title of the list to be created.
* @param repliesPolicy One of [MastodonList.RepliesPolicy], defaults to [MastodonList.RepliesPolicy.List].
* @param exclusive Whether members of this list need to get removed from the “Home” feed.
* @see <a href="https://docs.joinmastodon.org/methods/lists/#create">Mastodon API documentation: methods/lists/#create</a>
*/
@JvmOverloads
fun createList(
title: String,
repliesPolicy: MastodonList.RepliesPolicy = MastodonList.RepliesPolicy.LIST
): Single<MastodonList> = Single.fromCallable { listMethods.createList(title, repliesPolicy).execute() }
repliesPolicy: MastodonList.RepliesPolicy? = null,
exclusive: Boolean? = null
): Single<MastodonList> = Single.fromCallable { listMethods.createList(title, repliesPolicy, exclusive).execute() }

/**
* Change the title of a list, or which replies to show.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,22 @@ class ListMethods(private val client: MastodonClient) {
* Create a new list.
* @param title The title of the list to be created.
* @param repliesPolicy One of [MastodonList.RepliesPolicy], defaults to [MastodonList.RepliesPolicy.List].
* @param exclusive Whether members of this list need to get removed from the “Home” feed.
* @see <a href="https://docs.joinmastodon.org/methods/lists/#create">Mastodon API documentation: methods/lists/#create</a>
*/
@JvmOverloads
fun createList(
title: String,
repliesPolicy: MastodonList.RepliesPolicy = MastodonList.RepliesPolicy.LIST
repliesPolicy: MastodonList.RepliesPolicy? = null,
exclusive: Boolean? = null
): MastodonRequest<MastodonList> {
return client.getMastodonRequest(
endpoint = "api/v1/lists",
method = MastodonClient.Method.POST,
parameters = Parameters().apply {
append("title", title)
append("replies_policy", repliesPolicy.name.lowercase())
repliesPolicy?.let { append("replies_policy", repliesPolicy.name.lowercase()) }
exclusive?.let { append("exclusive", exclusive) }
}
)
}
Expand Down
4 changes: 2 additions & 2 deletions docs/api-coverage/lists.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ View and manage lists. See also: /api/v1/timelines/list/id for loading a list ti
</tr>
<tr>
<td style="width:45%;text-align:left;"><code>POST /api/v1/lists</code><br>Create a list</td>
<td style="width:10%;text-align:center;"><img src="/assets/orange16.png"></td>
<td style="width:45%;text-align:left;">Property <code>exclusive</code> is missing which determines “whether members of this list need to get removed from the ‘Home’ feed”</td>
<td style="width:10%;text-align:center;"><img src="/assets/green16.png"></td>
<td style="width:45%;text-align:left;">Fully supported.</td>
</tr>
<tr>
<td style="width:45%;text-align:left;"><code>PUT /api/v1/lists/:id</code><br>Update a list</td>
Expand Down

0 comments on commit 052cc60

Please sign in to comment.