Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the missing parametes for UpdateList #125

Open
wants to merge 1 commit into
base: v4
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Mastonet/IMastodonClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,10 @@ public interface IMastodonClient
/// Update a list.
/// </summary>
/// <param name="title">The title of the list</param>
/// <param name="exclusive">Whether members of this list need to get removed from the “Home” feed</param>
/// <param name="replies_policy">One of followed, list, or none. Defaults to list.</param>
/// <returns>The list updated</returns>
Task<List> UpdateList(string listId, string newTitle);
Task<List> UpdateList(string listId, string newTitle, bool exclusive, string replies_policy);

/// <summary>
/// Remove a list.
Expand Down
14 changes: 9 additions & 5 deletions Mastonet/MastodonClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ public MastodonClient(string instance, string accessToken, HttpClient client)
/// </summary>
/// <returns>Returns the current Instance. Does not require authentication</returns>
[Obsolete("This method is deprecated on Mastodon v4. Use GetInstanceV2() instead.")]
public Task<Instance> GetInstance()
public Task<Instance> GetInstance()
{
return this.Get<Instance>("/api/v1/instance");
}

/// <summary>
/// Getting instance information
/// </summary>
Expand Down Expand Up @@ -87,11 +87,11 @@ public Task<MastodonList<Status>> GetTrendingStatuses(int? offset = null, int? l
{
var queryParams = "";

if(offset.HasValue)
if (offset.HasValue)
{
queryParams = "?offset=" + offset.Value;
}
if(limit.HasValue)
if (limit.HasValue)
{
queryParams += (queryParams != "" ? "&" : "?") + "limit=" + limit.Value;
}
Expand Down Expand Up @@ -248,8 +248,10 @@ public Task<List> CreateList(string title)
/// Update a list.
/// </summary>
/// <param name="title">The title of the list</param>
/// <param name="exclusive">Whether members of this list need to get removed from the “Home” feed</param>
/// <param name="replies_policy">One of followed, list, or none. Defaults to list.</param>
/// <returns>The list updated</returns>
public Task<List> UpdateList(string listId, string newTitle)
public Task<List> UpdateList(string listId, string newTitle, bool exclusive, string replies_policy = "list")
{
if (string.IsNullOrEmpty(newTitle))
{
Expand All @@ -259,6 +261,8 @@ public Task<List> UpdateList(string listId, string newTitle)
var data = new List<KeyValuePair<string, string>>()
{
new KeyValuePair<string, string>("title", newTitle),
new KeyValuePair<string, string>("exclusive", exclusive.ToString()),
new KeyValuePair<string, string>("replies_policy", replies_policy)
};

return this.Put<List>("/api/v1/lists/" + listId, data);
Expand Down