More account/post actions

This commit is contained in:
Grishka
2022-04-12 23:04:58 +03:00
parent 6e6f73f2c0
commit 789d02d810
10 changed files with 217 additions and 37 deletions

View File

@@ -4,8 +4,20 @@ import org.joinmastodon.android.api.MastodonAPIRequest;
import org.joinmastodon.android.model.Relationship;
public class SetAccountFollowed extends MastodonAPIRequest<Relationship>{
public SetAccountFollowed(String id, boolean followed){
public SetAccountFollowed(String id, boolean followed, boolean showReblogs){
super(HttpMethod.POST, "/accounts/"+id+"/"+(followed ? "follow" : "unfollow"), Relationship.class);
setRequestBody(new Object());
if(followed)
setRequestBody(new Request(showReblogs, null));
else
setRequestBody(new Object());
}
private static class Request{
public Boolean reblogs, notify;
public Request(Boolean reblogs, Boolean notify){
this.reblogs=reblogs;
this.notify=notify;
}
}
}

View File

@@ -0,0 +1,18 @@
package org.joinmastodon.android.api.requests.accounts;
import org.joinmastodon.android.api.MastodonAPIRequest;
public class SetDomainBlocked extends MastodonAPIRequest<Object>{
public SetDomainBlocked(String domain, boolean blocked){
super(blocked ? HttpMethod.POST : HttpMethod.DELETE, "/domain_blocks", Object.class);
setRequestBody(new Request(domain));
}
private static class Request{
public String domain;
public Request(String domain){
this.domain=domain;
}
}
}