2021-04-22 11:47:18 +02:00
|
|
|
package org.pixeldroid.app.utils.api
|
2020-03-04 18:04:55 +01:00
|
|
|
|
2021-04-22 11:47:18 +02:00
|
|
|
import org.pixeldroid.app.utils.api.objects.*
|
2020-05-21 19:31:41 +02:00
|
|
|
import io.reactivex.Observable
|
Feature/post creation (#83)
* added perm and features for cameraS, gps and external storage
* added camera activity accessible from main activity
* added button to redirect to camera activity
* implementing callback flow to use camera
* working camera
* added texture view for camera display
* added camera activity
* implemented texture listener
* camera not working, flow done, no feedback implemented
* camera working
* refactored code, still an activity
* added private to internal function, better error function handling
* deleted camera activity
* added camera fragment
* added camera fragment
* refactored camera as fragment
* necessary dependencies for fragment testing
* initial camera fragment test
* corrected access to activity form fragment
* Added state changes and termination
* added lines to test, to test coverage
* Removed unsupported state STARTED state transition
* Added basic tests to test code coverage
* use layout for tests, to trigger permissions requirements
* grant camera permission to app in camera test
* replaced null handlers by proper function getter
* changed layout, added takePictureButton
* using expresso to get code coverage on camea
* take picture flow not finished
* dummy change to camera test to perform new build
* added connection flow before test to reach main activity
* can take a picture and put it to ImageView
* replaced button text with images
* smaller buttons
* test camera fragment buttons
* added orientation handler
* changed icon to make travis happy
* test new espresso config for travis
* removed useless rule
* deleted useless val
* added layout ID's
* moved swipes from Before to Tests, and thread sleep
* stoped swiping, now tests from fragment directly
* start post creation flow
* use Uri when taking photo, can now go back from picture preview
* adjusted test and flow idea
* tests on displayed UI elements for the post creation fragment
* refactor camera fragment into transition new post fragemnt
* finished first phase: get a picture Uri
* fixed lint error found by travis CI
* added global timeout to test
* test the new way of test
* refactor new way of testing
* added in-app camera view and linked everything to the final flow + started API to post
* strugling on the upload media part
* upload image on server implemented
* post upload implemented
* added API call to get max_toot_chars and correct def of a post description
* fixed some tests
* fix tests: clicking on tabs make the app crash because of the camera fragment
* comment problematic chunk of code while samuel tries to fix it
* switch minimumsdk to api 24
* Revert "switch minimumsdk to api 24"
This reverts commit 24ce46dd82038b59732fd958e5e071ded39cd549.
* deactivited live camera for API 23
* tests for post creation fragment UI elements
* remove worthless UI testing and add gallery intent test
* removed camera intent for now
* some refactor
* lint error and more refactor
* more refactor on merge from master
* refactor and test for PostCreationActivity
* Revert "refactor and test for PostCreationActivity"
This reverts commit a0c146bcc545cdc3792df4806e6b0c908bd18747.
* Revert "Revert "refactor and test for PostCreationActivity""
This reverts commit 147a9ed80d5f9c9e3c38b5a977786bfb39eeb1b6.
* permissions correction for test
* updtated test
* fix a test and refactor
* relink correct fragment
* save picture locally
* test post button
* requested changes
* fixed required changes
* Revert "fixed required changes"
This reverts commit 405a9d4d1af05353e30028e60041cc1c97569c1b.
* redo change request
* added /media api response to mockserver
Co-authored-by: Andrea Clement <samuel.dietz@epfl.ch>
2020-04-24 12:44:12 +02:00
|
|
|
import okhttp3.MultipartBody
|
2020-11-27 17:02:52 +01:00
|
|
|
import retrofit2.Response
|
2020-03-04 18:04:55 +01:00
|
|
|
import retrofit2.Retrofit
|
|
|
|
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory
|
|
|
|
import retrofit2.converter.gson.GsonConverterFactory
|
2020-03-13 11:48:45 +01:00
|
|
|
import retrofit2.http.*
|
2020-03-18 20:56:42 +01:00
|
|
|
import retrofit2.http.Field
|
2020-05-21 19:31:41 +02:00
|
|
|
|
2020-03-04 18:04:55 +01:00
|
|
|
/*
|
|
|
|
Implements the Pixelfed API
|
|
|
|
https://docs.pixelfed.org/technical-documentation/api-v1.html
|
|
|
|
However, since this is mostly based on the Mastodon API, the documentation there
|
|
|
|
will be more useful: https://docs.joinmastodon.org/
|
|
|
|
*/
|
|
|
|
|
|
|
|
interface PixelfedAPI {
|
|
|
|
|
2020-08-22 22:34:21 +02:00
|
|
|
|
2020-05-03 14:30:01 +02:00
|
|
|
companion object {
|
2020-11-29 20:19:25 +01:00
|
|
|
fun createFromUrl(baseUrl: String): PixelfedAPI {
|
2020-05-03 14:30:01 +02:00
|
|
|
return Retrofit.Builder()
|
|
|
|
.baseUrl(baseUrl)
|
|
|
|
.addConverterFactory(GsonConverterFactory.create())
|
|
|
|
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
|
|
|
|
.build().create(PixelfedAPI::class.java)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-03-05 19:08:57 +01:00
|
|
|
@FormUrlEncoded
|
|
|
|
@POST("/api/v1/apps")
|
2020-12-29 19:34:48 +01:00
|
|
|
suspend fun registerApplication(
|
2020-03-05 19:08:57 +01:00
|
|
|
@Field("client_name") client_name: String,
|
|
|
|
@Field("redirect_uris") redirect_uris: String,
|
|
|
|
@Field("scopes") scopes: String? = null,
|
|
|
|
@Field("website") website: String? = null
|
2020-12-29 19:34:48 +01:00
|
|
|
): Application
|
2020-08-22 22:34:21 +02:00
|
|
|
|
2020-03-05 19:08:57 +01:00
|
|
|
|
2020-03-06 18:24:20 +01:00
|
|
|
@FormUrlEncoded
|
|
|
|
@POST("/oauth/token")
|
2020-12-29 19:34:48 +01:00
|
|
|
suspend fun obtainToken(
|
2020-03-06 18:24:20 +01:00
|
|
|
@Field("client_id") client_id: String,
|
|
|
|
@Field("client_secret") client_secret: String,
|
2020-11-29 20:19:25 +01:00
|
|
|
@Field("redirect_uri") redirect_uri: String? = null,
|
2020-03-06 18:24:20 +01:00
|
|
|
@Field("scope") scope: String? = "read",
|
|
|
|
@Field("code") code: String? = null,
|
2020-11-29 20:19:25 +01:00
|
|
|
@Field("grant_type") grant_type: String? = null,
|
|
|
|
@Field("refresh_token") refresh_token: String? = null
|
2020-12-29 19:34:48 +01:00
|
|
|
): Token
|
2020-08-22 22:34:21 +02:00
|
|
|
|
|
|
|
// get instance configuration
|
|
|
|
@GET("/api/v1/instance")
|
2020-12-29 19:34:48 +01:00
|
|
|
suspend fun instance() : Instance
|
2020-08-22 22:34:21 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Instance info from the Nodeinfo .well_known (https://nodeinfo.diaspora.software/protocol.html) endpoint
|
|
|
|
*/
|
|
|
|
@GET("/.well-known/nodeinfo")
|
2020-12-29 19:34:48 +01:00
|
|
|
suspend fun wellKnownNodeInfo() : NodeInfoJRD
|
2020-08-22 22:34:21 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Instance info from [NodeInfo] (https://nodeinfo.diaspora.software/schema.html) endpoint
|
|
|
|
*/
|
|
|
|
@GET
|
2020-12-29 19:34:48 +01:00
|
|
|
suspend fun nodeInfoSchema(
|
2020-08-22 22:34:21 +02:00
|
|
|
@Url nodeInfo_schema_url: String
|
2020-12-29 19:34:48 +01:00
|
|
|
) : NodeInfo
|
2020-03-06 18:24:20 +01:00
|
|
|
|
2020-04-24 12:10:25 +02:00
|
|
|
@FormUrlEncoded
|
|
|
|
@POST("/api/v1/accounts/{id}/follow")
|
2020-12-29 19:34:48 +01:00
|
|
|
suspend fun follow(
|
2020-04-24 12:10:25 +02:00
|
|
|
@Path("id") statusId: String,
|
|
|
|
@Field("reblogs") reblogs : Boolean = true
|
2020-12-29 19:34:48 +01:00
|
|
|
) : Relationship
|
2020-04-24 12:10:25 +02:00
|
|
|
|
|
|
|
@POST("/api/v1/accounts/{id}/unfollow")
|
2020-12-29 19:34:48 +01:00
|
|
|
suspend fun unfollow(
|
2020-04-24 12:10:25 +02:00
|
|
|
@Path("id") statusId: String,
|
2020-12-29 19:34:48 +01:00
|
|
|
) : Relationship
|
2020-04-24 12:10:25 +02:00
|
|
|
|
2020-04-09 22:36:59 +02:00
|
|
|
@POST("api/v1/statuses/{id}/favourite")
|
2020-12-30 18:13:39 +01:00
|
|
|
suspend fun likePost(
|
2020-04-09 22:36:59 +02:00
|
|
|
@Path("id") statusId: String
|
2020-04-24 12:10:25 +02:00
|
|
|
|
2020-12-30 18:13:39 +01:00
|
|
|
) : Status
|
2020-04-09 22:36:59 +02:00
|
|
|
|
|
|
|
@POST("/api/v1/statuses/{id}/unfavourite")
|
2020-12-30 18:13:39 +01:00
|
|
|
suspend fun unlikePost(
|
2020-04-09 22:36:59 +02:00
|
|
|
@Path("id") statusId: String
|
2020-12-30 18:13:39 +01:00
|
|
|
) : Status
|
2020-04-09 22:36:59 +02:00
|
|
|
|
Feature/post creation (#83)
* added perm and features for cameraS, gps and external storage
* added camera activity accessible from main activity
* added button to redirect to camera activity
* implementing callback flow to use camera
* working camera
* added texture view for camera display
* added camera activity
* implemented texture listener
* camera not working, flow done, no feedback implemented
* camera working
* refactored code, still an activity
* added private to internal function, better error function handling
* deleted camera activity
* added camera fragment
* added camera fragment
* refactored camera as fragment
* necessary dependencies for fragment testing
* initial camera fragment test
* corrected access to activity form fragment
* Added state changes and termination
* added lines to test, to test coverage
* Removed unsupported state STARTED state transition
* Added basic tests to test code coverage
* use layout for tests, to trigger permissions requirements
* grant camera permission to app in camera test
* replaced null handlers by proper function getter
* changed layout, added takePictureButton
* using expresso to get code coverage on camea
* take picture flow not finished
* dummy change to camera test to perform new build
* added connection flow before test to reach main activity
* can take a picture and put it to ImageView
* replaced button text with images
* smaller buttons
* test camera fragment buttons
* added orientation handler
* changed icon to make travis happy
* test new espresso config for travis
* removed useless rule
* deleted useless val
* added layout ID's
* moved swipes from Before to Tests, and thread sleep
* stoped swiping, now tests from fragment directly
* start post creation flow
* use Uri when taking photo, can now go back from picture preview
* adjusted test and flow idea
* tests on displayed UI elements for the post creation fragment
* refactor camera fragment into transition new post fragemnt
* finished first phase: get a picture Uri
* fixed lint error found by travis CI
* added global timeout to test
* test the new way of test
* refactor new way of testing
* added in-app camera view and linked everything to the final flow + started API to post
* strugling on the upload media part
* upload image on server implemented
* post upload implemented
* added API call to get max_toot_chars and correct def of a post description
* fixed some tests
* fix tests: clicking on tabs make the app crash because of the camera fragment
* comment problematic chunk of code while samuel tries to fix it
* switch minimumsdk to api 24
* Revert "switch minimumsdk to api 24"
This reverts commit 24ce46dd82038b59732fd958e5e071ded39cd549.
* deactivited live camera for API 23
* tests for post creation fragment UI elements
* remove worthless UI testing and add gallery intent test
* removed camera intent for now
* some refactor
* lint error and more refactor
* more refactor on merge from master
* refactor and test for PostCreationActivity
* Revert "refactor and test for PostCreationActivity"
This reverts commit a0c146bcc545cdc3792df4806e6b0c908bd18747.
* Revert "Revert "refactor and test for PostCreationActivity""
This reverts commit 147a9ed80d5f9c9e3c38b5a977786bfb39eeb1b6.
* permissions correction for test
* updtated test
* fix a test and refactor
* relink correct fragment
* save picture locally
* test post button
* requested changes
* fixed required changes
* Revert "fixed required changes"
This reverts commit 405a9d4d1af05353e30028e60041cc1c97569c1b.
* redo change request
* added /media api response to mockserver
Co-authored-by: Andrea Clement <samuel.dietz@epfl.ch>
2020-04-24 12:44:12 +02:00
|
|
|
//Used in our case to post a comment or a status
|
2020-04-09 22:36:59 +02:00
|
|
|
@FormUrlEncoded
|
|
|
|
@POST("/api/v1/statuses")
|
2020-12-29 22:35:45 +01:00
|
|
|
suspend fun postStatus(
|
2020-04-09 22:36:59 +02:00
|
|
|
@Field("status") statusText : String,
|
Feature/post creation (#83)
* added perm and features for cameraS, gps and external storage
* added camera activity accessible from main activity
* added button to redirect to camera activity
* implementing callback flow to use camera
* working camera
* added texture view for camera display
* added camera activity
* implemented texture listener
* camera not working, flow done, no feedback implemented
* camera working
* refactored code, still an activity
* added private to internal function, better error function handling
* deleted camera activity
* added camera fragment
* added camera fragment
* refactored camera as fragment
* necessary dependencies for fragment testing
* initial camera fragment test
* corrected access to activity form fragment
* Added state changes and termination
* added lines to test, to test coverage
* Removed unsupported state STARTED state transition
* Added basic tests to test code coverage
* use layout for tests, to trigger permissions requirements
* grant camera permission to app in camera test
* replaced null handlers by proper function getter
* changed layout, added takePictureButton
* using expresso to get code coverage on camea
* take picture flow not finished
* dummy change to camera test to perform new build
* added connection flow before test to reach main activity
* can take a picture and put it to ImageView
* replaced button text with images
* smaller buttons
* test camera fragment buttons
* added orientation handler
* changed icon to make travis happy
* test new espresso config for travis
* removed useless rule
* deleted useless val
* added layout ID's
* moved swipes from Before to Tests, and thread sleep
* stoped swiping, now tests from fragment directly
* start post creation flow
* use Uri when taking photo, can now go back from picture preview
* adjusted test and flow idea
* tests on displayed UI elements for the post creation fragment
* refactor camera fragment into transition new post fragemnt
* finished first phase: get a picture Uri
* fixed lint error found by travis CI
* added global timeout to test
* test the new way of test
* refactor new way of testing
* added in-app camera view and linked everything to the final flow + started API to post
* strugling on the upload media part
* upload image on server implemented
* post upload implemented
* added API call to get max_toot_chars and correct def of a post description
* fixed some tests
* fix tests: clicking on tabs make the app crash because of the camera fragment
* comment problematic chunk of code while samuel tries to fix it
* switch minimumsdk to api 24
* Revert "switch minimumsdk to api 24"
This reverts commit 24ce46dd82038b59732fd958e5e071ded39cd549.
* deactivited live camera for API 23
* tests for post creation fragment UI elements
* remove worthless UI testing and add gallery intent test
* removed camera intent for now
* some refactor
* lint error and more refactor
* more refactor on merge from master
* refactor and test for PostCreationActivity
* Revert "refactor and test for PostCreationActivity"
This reverts commit a0c146bcc545cdc3792df4806e6b0c908bd18747.
* Revert "Revert "refactor and test for PostCreationActivity""
This reverts commit 147a9ed80d5f9c9e3c38b5a977786bfb39eeb1b6.
* permissions correction for test
* updtated test
* fix a test and refactor
* relink correct fragment
* save picture locally
* test post button
* requested changes
* fixed required changes
* Revert "fixed required changes"
This reverts commit 405a9d4d1af05353e30028e60041cc1c97569c1b.
* redo change request
* added /media api response to mockserver
Co-authored-by: Andrea Clement <samuel.dietz@epfl.ch>
2020-04-24 12:44:12 +02:00
|
|
|
@Field("in_reply_to_id") in_reply_to_id : String? = null,
|
2020-04-09 22:36:59 +02:00
|
|
|
@Field("media_ids[]") media_ids : List<String> = emptyList(),
|
|
|
|
@Field("poll[options][]") poll_options : List<String>? = null,
|
|
|
|
@Field("poll[expires_in]") poll_expires : List<String>? = null,
|
|
|
|
@Field("poll[multiple]") poll_multiple : List<String>? = null,
|
|
|
|
@Field("poll[hide_totals]") poll_hideTotals : List<String>? = null,
|
|
|
|
@Field("sensitive") sensitive : Boolean? = null,
|
|
|
|
@Field("spoiler_text") spoiler_text : String? = null,
|
|
|
|
@Field("visibility") visibility : String = "public",
|
|
|
|
@Field("scheduled_at") scheduled_at : String? = null,
|
|
|
|
@Field("language") language : String? = null
|
2020-12-29 22:35:45 +01:00
|
|
|
) : Status
|
2020-04-09 22:36:59 +02:00
|
|
|
|
2020-11-28 15:05:13 +01:00
|
|
|
@DELETE("/api/v1/statuses/{id}")
|
|
|
|
suspend fun deleteStatus(
|
|
|
|
@Path("id") statusId: String
|
|
|
|
)
|
|
|
|
|
2020-04-23 17:48:45 +02:00
|
|
|
@FormUrlEncoded
|
|
|
|
@POST("/api/v1/statuses/{id}/reblog")
|
2020-12-30 18:13:39 +01:00
|
|
|
suspend fun reblogStatus(
|
2020-04-23 17:48:45 +02:00
|
|
|
@Path("id") statusId: String,
|
|
|
|
@Field("visibility") visibility: String? = null
|
2020-12-30 18:13:39 +01:00
|
|
|
) : Status
|
2020-04-23 17:48:45 +02:00
|
|
|
|
|
|
|
@POST("/api/v1/statuses/{id}/unreblog")
|
2020-12-30 18:13:39 +01:00
|
|
|
suspend fun undoReblogStatus(
|
2020-04-23 17:48:45 +02:00
|
|
|
@Path("id") statusId: String,
|
2020-12-30 18:13:39 +01:00
|
|
|
) : Status
|
2020-04-23 17:48:45 +02:00
|
|
|
|
2020-04-09 22:36:59 +02:00
|
|
|
//Used in our case to retrieve comments for a given status
|
|
|
|
@GET("/api/v1/statuses/{id}/context")
|
2020-12-30 18:13:39 +01:00
|
|
|
suspend fun statusComments(
|
2020-04-09 22:36:59 +02:00
|
|
|
@Path("id") statusId: String,
|
2020-12-30 18:13:39 +01:00
|
|
|
) : Context
|
2020-04-09 22:36:59 +02:00
|
|
|
|
2020-03-07 11:00:24 +01:00
|
|
|
@GET("/api/v1/timelines/public")
|
2020-11-27 17:02:52 +01:00
|
|
|
suspend fun timelinePublic(
|
2020-03-05 19:08:57 +01:00
|
|
|
@Query("local") local: Boolean? = null,
|
|
|
|
@Query("max_id") max_id: String? = null,
|
|
|
|
@Query("since_id") since_id: String? = null,
|
|
|
|
@Query("min_id") min_id: String? = null,
|
2020-04-02 19:57:07 +02:00
|
|
|
@Query("limit") limit: String? = null
|
2020-11-27 17:02:52 +01:00
|
|
|
): List<Status>
|
2020-03-04 18:04:55 +01:00
|
|
|
|
2020-03-13 11:48:45 +01:00
|
|
|
@GET("/api/v1/timelines/home")
|
2020-11-27 17:02:52 +01:00
|
|
|
suspend fun timelineHome(
|
2020-03-13 11:48:45 +01:00
|
|
|
@Query("max_id") max_id: String? = null,
|
|
|
|
@Query("since_id") since_id: String? = null,
|
|
|
|
@Query("min_id") min_id: String? = null,
|
2020-04-02 19:57:07 +02:00
|
|
|
@Query("limit") limit: String? = null,
|
2020-03-13 11:48:45 +01:00
|
|
|
@Query("local") local: Boolean? = null
|
2020-11-27 17:02:52 +01:00
|
|
|
): List<Status>
|
2020-03-13 11:48:45 +01:00
|
|
|
|
2021-06-07 22:23:59 +02:00
|
|
|
@GET("/api/v1/timelines/tag/{hashtag}")
|
|
|
|
suspend fun hashtag(
|
|
|
|
@Path("hashtag") hashtag: String? = null,
|
|
|
|
@Query("local") local: Boolean? = null,
|
|
|
|
@Query("only_media") only_media: Boolean? = null,
|
|
|
|
@Query("max_id") max_id: String? = null,
|
|
|
|
@Query("since_id") since_id: String? = null,
|
|
|
|
@Query("min_id") min_id: String? = null,
|
|
|
|
@Query("limit") limit: Int? = null,
|
|
|
|
): List<Status>
|
|
|
|
|
2020-04-30 17:54:21 +02:00
|
|
|
@GET("/api/v2/search")
|
2020-11-27 17:02:52 +01:00
|
|
|
suspend fun search(
|
2020-04-30 17:54:21 +02:00
|
|
|
@Query("account_id") account_id: String? = null,
|
|
|
|
@Query("max_id") max_id: String? = null,
|
|
|
|
@Query("min_id") min_id: String? = null,
|
|
|
|
@Query("type") type: Results.SearchType? = null,
|
|
|
|
@Query("exclude_unreviewed") exclude_unreviewed: Boolean? = null,
|
|
|
|
@Query("q") q: String,
|
|
|
|
@Query("resolve") resolve: Boolean? = null,
|
|
|
|
@Query("limit") limit: String? = null,
|
2020-10-31 22:11:01 +01:00
|
|
|
@Query("offset") offset: String? = null,
|
2020-04-30 17:54:21 +02:00
|
|
|
@Query("following") following: Boolean? = null
|
2020-11-27 17:02:52 +01:00
|
|
|
): Results
|
2020-04-30 17:54:21 +02:00
|
|
|
|
2020-03-18 20:56:42 +01:00
|
|
|
@GET("/api/v1/notifications")
|
2020-11-27 17:02:52 +01:00
|
|
|
suspend fun notifications(
|
2020-03-18 20:56:42 +01:00
|
|
|
@Query("max_id") max_id: String? = null,
|
|
|
|
@Query("since_id") since_id: String? = null,
|
|
|
|
@Query("min_id") min_id: String? = null,
|
2020-11-27 17:02:52 +01:00
|
|
|
@Query("limit") limit: String? = null,
|
|
|
|
@Query("exclude_types") exclude_types: List<String>? = null,
|
|
|
|
@Query("account_id") account_id: Boolean? = null
|
|
|
|
): List<Notification>
|
2020-03-18 20:56:42 +01:00
|
|
|
|
2020-03-13 11:48:45 +01:00
|
|
|
@GET("/api/v1/accounts/verify_credentials")
|
2020-12-29 19:34:48 +01:00
|
|
|
suspend fun verifyCredentials(
|
2020-03-13 11:48:45 +01:00
|
|
|
//The authorization header needs to be of the form "Bearer <token>"
|
2021-04-18 22:32:50 +02:00
|
|
|
@Header("Authorization") authorization: String? = null
|
2020-12-29 19:34:48 +01:00
|
|
|
): Account
|
|
|
|
|
2020-03-13 11:48:45 +01:00
|
|
|
|
2020-04-09 22:36:59 +02:00
|
|
|
@GET("/api/v1/accounts/{id}/statuses")
|
2021-01-22 16:42:23 +01:00
|
|
|
suspend fun accountPosts(
|
2021-01-22 19:25:57 +01:00
|
|
|
@Path("id") account_id: String,
|
2021-01-22 19:42:56 +01:00
|
|
|
@Query("min_id") min_id: String? = null,
|
|
|
|
@Query("max_id") max_id: String?,
|
2021-01-22 19:25:57 +01:00
|
|
|
@Query("limit") limit: Int
|
|
|
|
) : List<Status>
|
2020-04-09 22:36:59 +02:00
|
|
|
|
2020-04-24 12:10:25 +02:00
|
|
|
@GET("/api/v1/accounts/relationships")
|
2020-12-29 19:34:48 +01:00
|
|
|
suspend fun checkRelationships(
|
2020-04-24 12:10:25 +02:00
|
|
|
@Query("id[]") account_ids : List<String>
|
2020-12-29 19:34:48 +01:00
|
|
|
) : List<Relationship>
|
2020-04-24 12:10:25 +02:00
|
|
|
|
|
|
|
@GET("/api/v1/accounts/{id}/followers")
|
2020-11-27 17:02:52 +01:00
|
|
|
suspend fun followers(
|
2020-04-24 12:10:25 +02:00
|
|
|
@Path("id") account_id: String,
|
|
|
|
@Query("max_id") max_id: String? = null,
|
|
|
|
@Query("since_id") since_id: String? = null,
|
2020-10-31 22:11:01 +01:00
|
|
|
@Query("limit") limit: Number? = null,
|
|
|
|
@Query("page") page: String? = null
|
2020-11-27 17:02:52 +01:00
|
|
|
) : Response<List<Account>>
|
2020-04-24 12:10:25 +02:00
|
|
|
|
|
|
|
@GET("/api/v1/accounts/{id}/following")
|
2020-11-27 17:02:52 +01:00
|
|
|
suspend fun following(
|
2020-04-24 12:10:25 +02:00
|
|
|
@Path("id") account_id: String,
|
|
|
|
@Query("max_id") max_id: String? = null,
|
|
|
|
@Query("since_id") since_id: String? = null,
|
2020-10-31 22:11:01 +01:00
|
|
|
@Query("limit") limit: Number? = 40,
|
|
|
|
@Query("page") page: String? = null
|
2020-11-27 17:02:52 +01:00
|
|
|
) : Response<List<Account>>
|
2020-04-24 12:10:25 +02:00
|
|
|
|
2020-04-23 17:48:45 +02:00
|
|
|
@GET("/api/v1/accounts/{id}")
|
2020-12-29 22:14:32 +01:00
|
|
|
suspend fun getAccount(
|
2020-04-23 17:48:45 +02:00
|
|
|
@Path("id") accountId : String
|
2020-12-29 22:14:32 +01:00
|
|
|
): Account
|
2020-04-23 17:48:45 +02:00
|
|
|
|
2020-05-03 14:30:01 +02:00
|
|
|
@GET("/api/v1/statuses/{id}")
|
2020-12-26 12:10:54 +01:00
|
|
|
suspend fun getStatus(
|
2020-05-03 14:30:01 +02:00
|
|
|
@Path("id") accountId : String
|
2020-12-26 12:10:54 +01:00
|
|
|
): Status
|
Feature/post creation (#83)
* added perm and features for cameraS, gps and external storage
* added camera activity accessible from main activity
* added button to redirect to camera activity
* implementing callback flow to use camera
* working camera
* added texture view for camera display
* added camera activity
* implemented texture listener
* camera not working, flow done, no feedback implemented
* camera working
* refactored code, still an activity
* added private to internal function, better error function handling
* deleted camera activity
* added camera fragment
* added camera fragment
* refactored camera as fragment
* necessary dependencies for fragment testing
* initial camera fragment test
* corrected access to activity form fragment
* Added state changes and termination
* added lines to test, to test coverage
* Removed unsupported state STARTED state transition
* Added basic tests to test code coverage
* use layout for tests, to trigger permissions requirements
* grant camera permission to app in camera test
* replaced null handlers by proper function getter
* changed layout, added takePictureButton
* using expresso to get code coverage on camea
* take picture flow not finished
* dummy change to camera test to perform new build
* added connection flow before test to reach main activity
* can take a picture and put it to ImageView
* replaced button text with images
* smaller buttons
* test camera fragment buttons
* added orientation handler
* changed icon to make travis happy
* test new espresso config for travis
* removed useless rule
* deleted useless val
* added layout ID's
* moved swipes from Before to Tests, and thread sleep
* stoped swiping, now tests from fragment directly
* start post creation flow
* use Uri when taking photo, can now go back from picture preview
* adjusted test and flow idea
* tests on displayed UI elements for the post creation fragment
* refactor camera fragment into transition new post fragemnt
* finished first phase: get a picture Uri
* fixed lint error found by travis CI
* added global timeout to test
* test the new way of test
* refactor new way of testing
* added in-app camera view and linked everything to the final flow + started API to post
* strugling on the upload media part
* upload image on server implemented
* post upload implemented
* added API call to get max_toot_chars and correct def of a post description
* fixed some tests
* fix tests: clicking on tabs make the app crash because of the camera fragment
* comment problematic chunk of code while samuel tries to fix it
* switch minimumsdk to api 24
* Revert "switch minimumsdk to api 24"
This reverts commit 24ce46dd82038b59732fd958e5e071ded39cd549.
* deactivited live camera for API 23
* tests for post creation fragment UI elements
* remove worthless UI testing and add gallery intent test
* removed camera intent for now
* some refactor
* lint error and more refactor
* more refactor on merge from master
* refactor and test for PostCreationActivity
* Revert "refactor and test for PostCreationActivity"
This reverts commit a0c146bcc545cdc3792df4806e6b0c908bd18747.
* Revert "Revert "refactor and test for PostCreationActivity""
This reverts commit 147a9ed80d5f9c9e3c38b5a977786bfb39eeb1b6.
* permissions correction for test
* updtated test
* fix a test and refactor
* relink correct fragment
* save picture locally
* test post button
* requested changes
* fixed required changes
* Revert "fixed required changes"
This reverts commit 405a9d4d1af05353e30028e60041cc1c97569c1b.
* redo change request
* added /media api response to mockserver
Co-authored-by: Andrea Clement <samuel.dietz@epfl.ch>
2020-04-24 12:44:12 +02:00
|
|
|
|
|
|
|
@Multipart
|
|
|
|
@POST("/api/v1/media")
|
|
|
|
fun mediaUpload(
|
2021-01-25 18:54:55 +01:00
|
|
|
@Part description: MultipartBody.Part? = null,
|
Feature/post creation (#83)
* added perm and features for cameraS, gps and external storage
* added camera activity accessible from main activity
* added button to redirect to camera activity
* implementing callback flow to use camera
* working camera
* added texture view for camera display
* added camera activity
* implemented texture listener
* camera not working, flow done, no feedback implemented
* camera working
* refactored code, still an activity
* added private to internal function, better error function handling
* deleted camera activity
* added camera fragment
* added camera fragment
* refactored camera as fragment
* necessary dependencies for fragment testing
* initial camera fragment test
* corrected access to activity form fragment
* Added state changes and termination
* added lines to test, to test coverage
* Removed unsupported state STARTED state transition
* Added basic tests to test code coverage
* use layout for tests, to trigger permissions requirements
* grant camera permission to app in camera test
* replaced null handlers by proper function getter
* changed layout, added takePictureButton
* using expresso to get code coverage on camea
* take picture flow not finished
* dummy change to camera test to perform new build
* added connection flow before test to reach main activity
* can take a picture and put it to ImageView
* replaced button text with images
* smaller buttons
* test camera fragment buttons
* added orientation handler
* changed icon to make travis happy
* test new espresso config for travis
* removed useless rule
* deleted useless val
* added layout ID's
* moved swipes from Before to Tests, and thread sleep
* stoped swiping, now tests from fragment directly
* start post creation flow
* use Uri when taking photo, can now go back from picture preview
* adjusted test and flow idea
* tests on displayed UI elements for the post creation fragment
* refactor camera fragment into transition new post fragemnt
* finished first phase: get a picture Uri
* fixed lint error found by travis CI
* added global timeout to test
* test the new way of test
* refactor new way of testing
* added in-app camera view and linked everything to the final flow + started API to post
* strugling on the upload media part
* upload image on server implemented
* post upload implemented
* added API call to get max_toot_chars and correct def of a post description
* fixed some tests
* fix tests: clicking on tabs make the app crash because of the camera fragment
* comment problematic chunk of code while samuel tries to fix it
* switch minimumsdk to api 24
* Revert "switch minimumsdk to api 24"
This reverts commit 24ce46dd82038b59732fd958e5e071ded39cd549.
* deactivited live camera for API 23
* tests for post creation fragment UI elements
* remove worthless UI testing and add gallery intent test
* removed camera intent for now
* some refactor
* lint error and more refactor
* more refactor on merge from master
* refactor and test for PostCreationActivity
* Revert "refactor and test for PostCreationActivity"
This reverts commit a0c146bcc545cdc3792df4806e6b0c908bd18747.
* Revert "Revert "refactor and test for PostCreationActivity""
This reverts commit 147a9ed80d5f9c9e3c38b5a977786bfb39eeb1b6.
* permissions correction for test
* updtated test
* fix a test and refactor
* relink correct fragment
* save picture locally
* test post button
* requested changes
* fixed required changes
* Revert "fixed required changes"
This reverts commit 405a9d4d1af05353e30028e60041cc1c97569c1b.
* redo change request
* added /media api response to mockserver
Co-authored-by: Andrea Clement <samuel.dietz@epfl.ch>
2020-04-24 12:44:12 +02:00
|
|
|
@Part file: MultipartBody.Part
|
2020-05-21 19:31:41 +02:00
|
|
|
): Observable<Attachment>
|
Feature/post creation (#83)
* added perm and features for cameraS, gps and external storage
* added camera activity accessible from main activity
* added button to redirect to camera activity
* implementing callback flow to use camera
* working camera
* added texture view for camera display
* added camera activity
* implemented texture listener
* camera not working, flow done, no feedback implemented
* camera working
* refactored code, still an activity
* added private to internal function, better error function handling
* deleted camera activity
* added camera fragment
* added camera fragment
* refactored camera as fragment
* necessary dependencies for fragment testing
* initial camera fragment test
* corrected access to activity form fragment
* Added state changes and termination
* added lines to test, to test coverage
* Removed unsupported state STARTED state transition
* Added basic tests to test code coverage
* use layout for tests, to trigger permissions requirements
* grant camera permission to app in camera test
* replaced null handlers by proper function getter
* changed layout, added takePictureButton
* using expresso to get code coverage on camea
* take picture flow not finished
* dummy change to camera test to perform new build
* added connection flow before test to reach main activity
* can take a picture and put it to ImageView
* replaced button text with images
* smaller buttons
* test camera fragment buttons
* added orientation handler
* changed icon to make travis happy
* test new espresso config for travis
* removed useless rule
* deleted useless val
* added layout ID's
* moved swipes from Before to Tests, and thread sleep
* stoped swiping, now tests from fragment directly
* start post creation flow
* use Uri when taking photo, can now go back from picture preview
* adjusted test and flow idea
* tests on displayed UI elements for the post creation fragment
* refactor camera fragment into transition new post fragemnt
* finished first phase: get a picture Uri
* fixed lint error found by travis CI
* added global timeout to test
* test the new way of test
* refactor new way of testing
* added in-app camera view and linked everything to the final flow + started API to post
* strugling on the upload media part
* upload image on server implemented
* post upload implemented
* added API call to get max_toot_chars and correct def of a post description
* fixed some tests
* fix tests: clicking on tabs make the app crash because of the camera fragment
* comment problematic chunk of code while samuel tries to fix it
* switch minimumsdk to api 24
* Revert "switch minimumsdk to api 24"
This reverts commit 24ce46dd82038b59732fd958e5e071ded39cd549.
* deactivited live camera for API 23
* tests for post creation fragment UI elements
* remove worthless UI testing and add gallery intent test
* removed camera intent for now
* some refactor
* lint error and more refactor
* more refactor on merge from master
* refactor and test for PostCreationActivity
* Revert "refactor and test for PostCreationActivity"
This reverts commit a0c146bcc545cdc3792df4806e6b0c908bd18747.
* Revert "Revert "refactor and test for PostCreationActivity""
This reverts commit 147a9ed80d5f9c9e3c38b5a977786bfb39eeb1b6.
* permissions correction for test
* updtated test
* fix a test and refactor
* relink correct fragment
* save picture locally
* test post button
* requested changes
* fixed required changes
* Revert "fixed required changes"
This reverts commit 405a9d4d1af05353e30028e60041cc1c97569c1b.
* redo change request
* added /media api response to mockserver
Co-authored-by: Andrea Clement <samuel.dietz@epfl.ch>
2020-04-24 12:44:12 +02:00
|
|
|
|
2020-05-03 14:30:01 +02:00
|
|
|
// get discover
|
|
|
|
@GET("/api/v2/discover/posts")
|
2021-04-18 22:32:50 +02:00
|
|
|
suspend fun discover() : DiscoverPosts
|
2020-10-04 23:27:06 +02:00
|
|
|
|
|
|
|
@FormUrlEncoded
|
|
|
|
@POST("/api/v1/reports")
|
2020-12-19 21:41:07 +01:00
|
|
|
@JvmSuppressWildcards
|
2020-12-29 22:14:32 +01:00
|
|
|
suspend fun report(
|
2020-10-04 23:27:06 +02:00
|
|
|
@Field("account_id") account_id: String,
|
|
|
|
@Field("status_ids") status_ids: List<Status>,
|
|
|
|
@Field("comment") comment: String,
|
|
|
|
@Field("forward") forward: Boolean = true
|
2020-12-29 22:14:32 +01:00
|
|
|
) : Report
|
2020-10-04 23:27:06 +02:00
|
|
|
|
2020-07-26 20:56:01 +02:00
|
|
|
}
|