Notifications
This commit is contained in:
@@ -5,12 +5,13 @@ import com.google.gson.reflect.TypeToken;
|
||||
import org.joinmastodon.android.api.MastodonAPIRequest;
|
||||
import org.joinmastodon.android.model.Relationship;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
public class GetAccountRelationships extends MastodonAPIRequest<List<Relationship>>{
|
||||
public GetAccountRelationships(@NonNull List<String> ids){
|
||||
public GetAccountRelationships(@NonNull Collection<String> ids){
|
||||
super(HttpMethod.GET, "/accounts/relationships", new TypeToken<>(){});
|
||||
for(String id:ids)
|
||||
addQueryParameter("id[]", id);
|
||||
|
||||
@@ -1,18 +1,27 @@
|
||||
package org.joinmastodon.android.api.requests.notifications;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
import org.joinmastodon.android.api.MastodonAPIRequest;
|
||||
import org.joinmastodon.android.model.Notification;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
public class GetNotifications extends MastodonAPIRequest<List<Notification>>{
|
||||
public GetNotifications(String maxID, int limit){
|
||||
public GetNotifications(String maxID, int limit, EnumSet<Notification.Type> excludeTypes){
|
||||
super(HttpMethod.GET, "/notifications", new TypeToken<>(){});
|
||||
if(maxID!=null)
|
||||
addQueryParameter("max_id", maxID);
|
||||
if(limit>0)
|
||||
addQueryParameter("limit", ""+limit);
|
||||
if(excludeTypes!=null){
|
||||
for(Notification.Type nt:excludeTypes){
|
||||
try{
|
||||
addQueryParameter("exclude_types[]", nt.getDeclaringClass().getField(nt.name()).getAnnotation(SerializedName.class).value());
|
||||
}catch(NoSuchFieldException ignore){}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user