-
-
Notifications
You must be signed in to change notification settings - Fork 265
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
90 changed files
with
3,025 additions
and
243 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
mastodon/src/main/java/org/joinmastodon/android/api/requests/accounts/GetAccountLists.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package org.joinmastodon.android.api.requests.accounts; | ||
|
||
import com.google.gson.reflect.TypeToken; | ||
|
||
import org.joinmastodon.android.api.MastodonAPIRequest; | ||
import org.joinmastodon.android.model.FollowList; | ||
|
||
import java.util.List; | ||
|
||
public class GetAccountLists extends MastodonAPIRequest<List<FollowList>>{ | ||
public GetAccountLists(String id){ | ||
super(HttpMethod.GET, "/accounts/"+id+"/lists", new TypeToken<>(){}); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
mastodon/src/main/java/org/joinmastodon/android/api/requests/accounts/SearchAccounts.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package org.joinmastodon.android.api.requests.accounts; | ||
|
||
import com.google.gson.reflect.TypeToken; | ||
|
||
import org.joinmastodon.android.api.MastodonAPIRequest; | ||
import org.joinmastodon.android.model.Account; | ||
|
||
import java.util.List; | ||
|
||
public class SearchAccounts extends MastodonAPIRequest<List<Account>>{ | ||
public SearchAccounts(String q, int limit, int offset, boolean resolve, boolean following){ | ||
super(HttpMethod.GET, "/accounts/search", new TypeToken<>(){}); | ||
addQueryParameter("q", q); | ||
if(limit>0) | ||
addQueryParameter("limit", limit+""); | ||
if(offset>0) | ||
addQueryParameter("offset", offset+""); | ||
if(resolve) | ||
addQueryParameter("resolve", "true"); | ||
if(following) | ||
addQueryParameter("following", "true"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
mastodon/src/main/java/org/joinmastodon/android/api/requests/lists/AddAccountsToList.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package org.joinmastodon.android.api.requests.lists; | ||
|
||
import org.joinmastodon.android.api.ResultlessMastodonAPIRequest; | ||
|
||
import java.nio.charset.StandardCharsets; | ||
import java.util.Collection; | ||
|
||
import okhttp3.FormBody; | ||
|
||
public class AddAccountsToList extends ResultlessMastodonAPIRequest{ | ||
public AddAccountsToList(String listID, Collection<String> accountIDs){ | ||
super(HttpMethod.POST, "/lists/"+listID+"/accounts"); | ||
FormBody.Builder builder=new FormBody.Builder(StandardCharsets.UTF_8); | ||
for(String id:accountIDs){ | ||
builder.add("account_ids[]", id); | ||
} | ||
setRequestBody(builder.build()); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
mastodon/src/main/java/org/joinmastodon/android/api/requests/lists/DeleteList.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package org.joinmastodon.android.api.requests.lists; | ||
|
||
import org.joinmastodon.android.api.ResultlessMastodonAPIRequest; | ||
|
||
public class DeleteList extends ResultlessMastodonAPIRequest{ | ||
public DeleteList(String id){ | ||
super(HttpMethod.DELETE, "/lists/"+id); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
mastodon/src/main/java/org/joinmastodon/android/api/requests/lists/GetListAccounts.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package org.joinmastodon.android.api.requests.lists; | ||
|
||
import android.text.TextUtils; | ||
|
||
import com.google.gson.reflect.TypeToken; | ||
|
||
import org.joinmastodon.android.api.requests.HeaderPaginationRequest; | ||
import org.joinmastodon.android.model.Account; | ||
|
||
public class GetListAccounts extends HeaderPaginationRequest<Account>{ | ||
public GetListAccounts(String listID, String maxID, int limit){ | ||
super(HttpMethod.GET, "/lists/"+listID+"/accounts", new TypeToken<>(){}); | ||
if(!TextUtils.isEmpty(maxID)) | ||
addQueryParameter("max_id", maxID); | ||
addQueryParameter("limit", String.valueOf(limit)); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
mastodon/src/main/java/org/joinmastodon/android/api/requests/lists/GetLists.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package org.joinmastodon.android.api.requests.lists; | ||
|
||
import com.google.gson.reflect.TypeToken; | ||
|
||
import org.joinmastodon.android.api.MastodonAPIRequest; | ||
import org.joinmastodon.android.model.FollowList; | ||
|
||
import java.util.List; | ||
|
||
public class GetLists extends MastodonAPIRequest<List<FollowList>>{ | ||
public GetLists(){ | ||
super(HttpMethod.GET, "/lists", new TypeToken<>(){}); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
...don/src/main/java/org/joinmastodon/android/api/requests/lists/RemoveAccountsFromList.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package org.joinmastodon.android.api.requests.lists; | ||
|
||
import org.joinmastodon.android.api.ResultlessMastodonAPIRequest; | ||
|
||
import java.nio.charset.StandardCharsets; | ||
import java.util.Collection; | ||
|
||
import okhttp3.FormBody; | ||
|
||
public class RemoveAccountsFromList extends ResultlessMastodonAPIRequest{ | ||
public RemoveAccountsFromList(String listID, Collection<String> accountIDs){ | ||
super(HttpMethod.DELETE, "/lists/"+listID+"/accounts"); | ||
FormBody.Builder builder=new FormBody.Builder(StandardCharsets.UTF_8); | ||
for(String id:accountIDs){ | ||
builder.add("account_ids[]", id); | ||
} | ||
setRequestBody(builder.build()); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
mastodon/src/main/java/org/joinmastodon/android/api/requests/lists/UpdateList.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package org.joinmastodon.android.api.requests.lists; | ||
|
||
import org.joinmastodon.android.api.MastodonAPIRequest; | ||
import org.joinmastodon.android.model.FollowList; | ||
|
||
public class UpdateList extends MastodonAPIRequest<FollowList>{ | ||
public UpdateList(String listID, String title, FollowList.RepliesPolicy repliesPolicy, boolean exclusive){ | ||
super(HttpMethod.PUT, "/lists/"+listID, FollowList.class); | ||
setRequestBody(new Request(title, repliesPolicy, exclusive)); | ||
} | ||
|
||
private static class Request{ | ||
public String title; | ||
public FollowList.RepliesPolicy repliesPolicy; | ||
public boolean exclusive; | ||
|
||
public Request(String title, FollowList.RepliesPolicy repliesPolicy, boolean exclusive){ | ||
this.title=title; | ||
this.repliesPolicy=repliesPolicy; | ||
this.exclusive=exclusive; | ||
} | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
mastodon/src/main/java/org/joinmastodon/android/api/requests/tags/GetFollowedTags.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package org.joinmastodon.android.api.requests.tags; | ||
|
||
import com.google.gson.reflect.TypeToken; | ||
|
||
import org.joinmastodon.android.api.requests.HeaderPaginationRequest; | ||
import org.joinmastodon.android.model.Hashtag; | ||
|
||
public class GetFollowedTags extends HeaderPaginationRequest<Hashtag>{ | ||
public GetFollowedTags(String maxID, int limit){ | ||
super(HttpMethod.GET, "/followed_tags", new TypeToken<>(){}); | ||
if(maxID!=null) | ||
addQueryParameter("max_id", maxID); | ||
if(limit>0) | ||
addQueryParameter("limit", limit+""); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
mastodon/src/main/java/org/joinmastodon/android/api/requests/timelines/GetListTimeline.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package org.joinmastodon.android.api.requests.timelines; | ||
|
||
import com.google.gson.reflect.TypeToken; | ||
|
||
import org.joinmastodon.android.api.MastodonAPIRequest; | ||
import org.joinmastodon.android.model.Status; | ||
|
||
import java.util.List; | ||
|
||
public class GetListTimeline extends MastodonAPIRequest<List<Status>>{ | ||
public GetListTimeline(String listID, String maxID, String minID, int limit, String sinceID){ | ||
super(HttpMethod.GET, "/timelines/list/"+listID, new TypeToken<>(){}); | ||
if(maxID!=null) | ||
addQueryParameter("max_id", maxID); | ||
if(minID!=null) | ||
addQueryParameter("min_id", minID); | ||
if(limit>0) | ||
addQueryParameter("limit", ""+limit); | ||
if(sinceID!=null) | ||
addQueryParameter("since_id", sinceID); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.