2020-03-04 18:04:55 +01:00
|
|
|
package com.h.pixeldroid.api
|
|
|
|
|
2020-03-18 20:56:42 +01:00
|
|
|
import com.h.pixeldroid.objects.*
|
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-03-04 18:04:55 +01:00
|
|
|
import retrofit2.Call
|
|
|
|
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-03-06 09:00:18 +01: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-03-05 19:08:57 +01:00
|
|
|
@FormUrlEncoded
|
|
|
|
@POST("/api/v1/apps")
|
|
|
|
fun registerApplication(
|
|
|
|
@Field("client_name") client_name: String,
|
|
|
|
@Field("redirect_uris") redirect_uris: String,
|
|
|
|
@Field("scopes") scopes: String? = null,
|
|
|
|
@Field("website") website: String? = null
|
|
|
|
): Call<Application>
|
|
|
|
|
2020-03-06 18:24:20 +01:00
|
|
|
@FormUrlEncoded
|
|
|
|
@POST("/oauth/token")
|
|
|
|
fun obtainToken(
|
|
|
|
@Field("client_id") client_id: String,
|
|
|
|
@Field("client_secret") client_secret: String,
|
|
|
|
@Field("redirect_uri") redirect_uri: String,
|
|
|
|
@Field("scope") scope: String? = "read",
|
|
|
|
@Field("code") code: String? = null,
|
|
|
|
@Field("grant_type") grant_type: String? = null
|
|
|
|
): Call<Token>
|
|
|
|
|
2020-04-24 12:10:25 +02:00
|
|
|
@FormUrlEncoded
|
|
|
|
@POST("/api/v1/accounts/{id}/follow")
|
|
|
|
fun follow(
|
|
|
|
//The authorization header needs to be of the form "Bearer <token>"
|
|
|
|
@Path("id") statusId: String,
|
|
|
|
@Header("Authorization") authorization: String,
|
|
|
|
@Field("reblogs") reblogs : Boolean = true
|
|
|
|
) : Call<Relationship>
|
|
|
|
|
|
|
|
@POST("/api/v1/accounts/{id}/unfollow")
|
|
|
|
fun unfollow(
|
|
|
|
//The authorization header needs to be of the form "Bearer <token>"
|
|
|
|
@Path("id") statusId: String,
|
|
|
|
@Header("Authorization") authorization: String
|
|
|
|
) : Call<Relationship>
|
|
|
|
|
2020-04-09 22:36:59 +02:00
|
|
|
@POST("api/v1/statuses/{id}/favourite")
|
|
|
|
fun likePost(
|
|
|
|
//The authorization header needs to be of the form "Bearer <token>"
|
|
|
|
@Header("Authorization") authorization: String,
|
|
|
|
@Path("id") statusId: String
|
2020-04-24 12:10:25 +02:00
|
|
|
|
2020-04-09 22:36:59 +02:00
|
|
|
) : Call<Status>
|
|
|
|
|
|
|
|
@POST("/api/v1/statuses/{id}/unfavourite")
|
|
|
|
fun unlikePost(
|
|
|
|
//The authorization header needs to be of the form "Bearer <token>"
|
|
|
|
@Header("Authorization") authorization: String,
|
|
|
|
@Path("id") statusId: String
|
|
|
|
) : Call<Status>
|
|
|
|
|
|
|
|
@POST("/api/v1/statuses/{id}/favourited_by")
|
|
|
|
fun postLikedBy(
|
|
|
|
@Path("id") statusId: String
|
|
|
|
) : Call<List<Account>>
|
|
|
|
|
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")
|
Commenting & seeing comments on a post ( issues: #37 #77 ) (#87)
Comment and like buttons added + a few UI tweaks
* WIP posts
* WIP posts
* trying to add images
* trying to add images
* Got posts working and linked them to the profile
* added tests for Post
* layout changes
* moved a test file
* refactoring
* refactoring
* removed wrong annotation in unit test
* removed an import that was breaking the build
* removed tests that broke from merge, will override with master
* added UI test for the post activity
* WIP posts
* WIP posts
* trying to add images
* trying to add images
* Got posts working and linked them to the profile
* layout changes
* refactoring
* refactoring
* WIP posts
* WIP posts
* trying to add images
* trying to add images
* Got posts working and linked them to the profile
* added tests for Post
* layout changes
* moved a test file
* refactoring
* refactoring
* removed wrong annotation in unit test
* removed an import that was breaking the build
* removed tests that broke from merge, will override with master
* fixed merging errors
* trying my best to merge
* removed drawable definition in activity_post.xml
* Started converting Post to a fragment
* got a working feed
* WI
* removed non-valid test
* rebase on other branch
* moved the feed to the home page
* Add tests
* delete test for now
* Adapt test to changes (no more profile from drawer)
* Add unit test for api
* Add test for profile, refactor to allow testing, add exception to security policy to allow tests
* Adapt test to new situation
* Fix typo due to change
* refactor somewhat
* added a feed test
* WIP posts
* trying to add images
* WIP posts
* trying to add images
* Got posts working and linked them to the profile
* added tests for Post
* layout changes
* moved a test file
* refactoring
* refactoring
* WIP posts
* WIP posts
* trying to add images
* trying to add images
* Got posts working and linked them to the profile
* added tests for Post
* layout changes
* moved a test file
* refactoring
* refactoring
* removed wrong annotation in unit test
* removed an import that was breaking the build
* removed tests that broke from merge, will override with master
* added UI test for the post activity
* WIP posts
* trying to add images
* WIP posts
* trying to add images
* Got posts working and linked them to the profile
* added tests for Post
* layout changes
* moved a test file
* refactoring
* refactoring
* WIP posts
* WIP posts
* trying to add images
* trying to add images
* Got posts working and linked them to the profile
* added tests for Post
* layout changes
* moved a test file
* refactoring
* refactoring
* removed wrong annotation in unit test
* removed an import that was breaking the build
* removed tests that broke from merge, will override with master
* added UI test for the post activity
* fixed merging errors
* trying my best to merge
* removed drawable definition in activity_post.xml
* Started converting Post to a fragment
* got a working feed
* WI
* removed non-valid test
* WIP posts
* WIP posts
* trying to add images
* trying to add images
* Got posts working and linked them to the profile
* added tests for Post
* layout changes
* moved a test file
* WIP posts
* WIP posts
* trying to add images
* trying to add images
* Got posts working and linked them to the profile
* added tests for Post
* layout changes
* moved a test file
* refactoring
* refactoring
* refactoring
* refactoring
* removed wrong annotation in unit test
* WIP posts
* WIP posts
* WIP posts
* WIP posts
* trying to add images
* trying to add images
* trying to add images
* trying to add images
* Got posts working and linked them to the profile
* Got posts working and linked them to the profile
* added tests for Post
* layout changes
* layout changes
* moved a test file
* refactoring
* refactoring
* refactoring
* refactoring
* removed wrong annotation in unit test
* removed an import that was breaking the build
* removed an import that was breaking the build
* removed tests that broke from merge, will override with master
* removed tests that broke from merge, will override with master
* added UI test for the post activity
* fixed merging errors
* trying my best to merge
* removed drawable definition in activity_post.xml
* Started converting Post to a fragment
* got a working feed
* WI
* removed non-valid test
* rebase on other branch
* moved the feed to the home page
* added a feed test
* added a working feed test
* fixed broken test
* merged with master
* added a max height for images and made profile pictures round
* Added a default image for the post
* created a PostActivity to look a single posts
* fixed buggy postActivity
* Complete overhall of the feed UI
* removed test that didn't please Travis
* removed legacy test
* changed feedAdapter init location (outside of network callback)
* changed the feed from public timeline to home timeline
* Refactored myProfile page
* Converted profile picture to round image
* restored feed test
* I can like a post, but unlike is still a WIP
* Liking kind of works now and added tests
* fixed an error, now we can unlike as well
* fixed travis constraint error
* Display user's posts on profile page
* moved test to Mock server tests
* fixed test
* last resort debugging
* Changed fixed size of profile posts
* last resort debugging
* last resort debugging
* last resort debugging
* made post_activity profilepic round
* Total refactor of profile posts
* still have a weird bug with the comments: input is always null (WIP)
* still trying to fix coments
* removed annoying side margins in the home feed
* trying to fix comments
* fixed null comment
* converted all posts back to statuses and got rid of post
* Refactored recycler view
* Merged with my-profile
* Posts displayed on profile page
* Added links to profile activity where needed
* fixed comment posting
* finished implementing comments, but api is buggy so none are visible
* removed useless space in profile page
* fixed ci config bug
* trying to trigger ci hook (github was down last time)
* updated tests with master tests
* added tests for the comments
* added tests for the comments
* added first() matcher to fix comment test
* still trying to fix comment tests' null progress bar
* getting rid of that null progress bar
* added comment test
* fixed merge error
* added like button test
* added more post tests
* took pr coments into account
* added back an old test
* added mockServer response for comment test and fixed comment null pointer bug
* changed notification UI to better separate notifications
* added mockserver response for likes and corrected like toggling error
* added a test for posting comments
* fixed typo in test
* a gift for code climate
* refactored stuff
* fixed broken imports
* comment refactored as xml
Co-authored-by: Matthieu <61561059+Wv5twkFEKh54vo4tta9yu7dHa3@users.noreply.github.com>
Co-authored-by: mjaillot <marie.jaillot@epfl.ch>
2020-04-11 12:55:06 +02:00
|
|
|
fun postStatus(
|
2020-04-09 22:36:59 +02:00
|
|
|
//The authorization header needs to be of the form "Bearer <token>"
|
|
|
|
@Header("Authorization") authorization: String,
|
|
|
|
@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
|
|
|
|
) : Call<Status>
|
|
|
|
|
2020-04-23 17:48:45 +02:00
|
|
|
@FormUrlEncoded
|
|
|
|
@POST("/api/v1/statuses/{id}/reblog")
|
|
|
|
fun reblogStatus(
|
|
|
|
@Header("Authorization") authorization: String,
|
|
|
|
@Path("id") statusId: String,
|
|
|
|
@Field("visibility") visibility: String? = null
|
|
|
|
) : Call<Status>
|
|
|
|
|
|
|
|
@POST("/api/v1/statuses/{id}/unreblog")
|
|
|
|
fun undoReblogStatus(
|
|
|
|
@Path("id") statusId: String,
|
|
|
|
@Header("Authorization") authorization: String
|
|
|
|
) : Call<Status>
|
|
|
|
|
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")
|
|
|
|
fun statusComments(
|
|
|
|
@Path("id") statusId: String,
|
|
|
|
@Header("Authorization") authorization: String? = null
|
|
|
|
) : Call<Context>
|
|
|
|
|
2020-03-07 11:00:24 +01:00
|
|
|
@GET("/api/v1/timelines/public")
|
2020-03-04 18:04:55 +01:00
|
|
|
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-03-04 18:04:55 +01:00
|
|
|
): Call<List<Status>>
|
|
|
|
|
2020-03-13 11:48:45 +01:00
|
|
|
@GET("/api/v1/timelines/home")
|
|
|
|
fun timelineHome(
|
|
|
|
//The authorization header needs to be of the form "Bearer <token>"
|
|
|
|
@Header("Authorization") authorization: String,
|
|
|
|
@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
|
|
|
|
): Call<List<Status>>
|
|
|
|
|
2020-04-30 17:54:21 +02:00
|
|
|
@GET("/api/v2/search")
|
|
|
|
fun search(
|
|
|
|
//The authorization header needs to be of the form "Bearer <token>"
|
|
|
|
@Header("Authorization") authorization: String,
|
|
|
|
@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,
|
|
|
|
@Query("offset") offset: Int? = null,
|
|
|
|
@Query("following") following: Boolean? = null
|
|
|
|
): Call<Results>
|
|
|
|
|
2020-03-18 20:56:42 +01:00
|
|
|
/*
|
|
|
|
Note: as of 0.10.8, Pixelfed does not seem to respect the Mastodon API documentation,
|
|
|
|
you *need* to pass one of the so-called "optional" arguments. See:
|
|
|
|
https://github.com/pixelfed/pixelfed/blob/dev/app/Http/Controllers/Api/ApiV1Controller.php
|
|
|
|
An example that works: specify min_id as 1 (not 0 though)
|
|
|
|
*/
|
|
|
|
@GET("/api/v1/notifications")
|
|
|
|
fun notifications(
|
|
|
|
//The authorization header needs to be of the form "Bearer <token>"
|
|
|
|
@Header("Authorization") authorization: String,
|
|
|
|
@Query("max_id") max_id: String? = null,
|
|
|
|
@Query("since_id") since_id: String? = null,
|
|
|
|
@Query("min_id") min_id: String? = null,
|
|
|
|
@Query("exclude_types") limit: String? = null,
|
|
|
|
@Query("account_id") exclude_types: Boolean? = null
|
|
|
|
): Call<List<Notification>>
|
|
|
|
|
2020-03-13 11:48:45 +01:00
|
|
|
@GET("/api/v1/accounts/verify_credentials")
|
|
|
|
fun verifyCredentials(
|
|
|
|
//The authorization header needs to be of the form "Bearer <token>"
|
|
|
|
@Header("Authorization") authorization: String
|
|
|
|
): Call<Account>
|
|
|
|
|
2020-04-09 22:36:59 +02:00
|
|
|
@GET("/api/v1/accounts/{id}/statuses")
|
|
|
|
fun accountPosts(
|
|
|
|
@Header("Authorization") authorization: String,
|
|
|
|
@Path("id") account_id: String? = null
|
|
|
|
): Call<List<Status>>
|
|
|
|
|
2020-04-24 12:10:25 +02:00
|
|
|
@GET("/api/v1/accounts/relationships")
|
|
|
|
fun checkRelationships(
|
|
|
|
@Header("Authorization") authorization : String,
|
|
|
|
@Query("id[]") account_ids : List<String>
|
|
|
|
) : Call<List<Relationship>>
|
|
|
|
|
|
|
|
@GET("/api/v1/accounts/{id}/followers")
|
|
|
|
fun followers(
|
|
|
|
@Path("id") account_id: String,
|
|
|
|
@Header("Authorization") authorization: String,
|
|
|
|
@Query("max_id") max_id: String? = null,
|
|
|
|
@Query("since_id") since_id: String? = null,
|
|
|
|
@Query("limit") limit: Number? = null
|
|
|
|
) : Call<List<Account>>
|
|
|
|
|
|
|
|
@GET("/api/v1/accounts/{id}/following")
|
|
|
|
fun following(
|
|
|
|
@Path("id") account_id: String,
|
|
|
|
@Header("Authorization") authorization: String,
|
|
|
|
@Query("max_id") max_id: String? = null,
|
|
|
|
@Query("since_id") since_id: String? = null,
|
|
|
|
@Query("limit") limit: Number? = 40
|
|
|
|
) : Call<List<Account>>
|
|
|
|
|
2020-04-23 17:48:45 +02:00
|
|
|
@GET("/api/v1/accounts/{id}")
|
|
|
|
fun getAccount(
|
|
|
|
@Header("Authorization") authorization: String,
|
|
|
|
@Path("id") accountId : String
|
|
|
|
): Call<Account>
|
|
|
|
|
2020-03-04 18:04:55 +01:00
|
|
|
companion object {
|
|
|
|
fun create(baseUrl: String): PixelfedAPI {
|
|
|
|
return Retrofit.Builder()
|
|
|
|
.baseUrl(baseUrl)
|
|
|
|
.addConverterFactory(GsonConverterFactory.create())
|
|
|
|
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
|
|
|
|
.build().create(PixelfedAPI::class.java)
|
|
|
|
}
|
|
|
|
}
|
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(
|
|
|
|
//The authorization header needs to be of the form "Bearer <token>"
|
|
|
|
@Header("Authorization") authorization: String,
|
|
|
|
@Part file: MultipartBody.Part
|
|
|
|
): Call<Attachment>
|
|
|
|
|
|
|
|
// get instance configuration
|
|
|
|
@GET("/api/v1/instance")
|
|
|
|
fun instance() : Call<Instance>
|
2020-03-04 18:04:55 +01:00
|
|
|
}
|
|
|
|
|