AO3Service

interface AO3Service

This is the retrofit interface for generating the retrofit service that interacts with AO3.

All functions in here are suspending for now. Calls will be included at a later date.

Types

Link copied to clipboard
object Factory

Functions

Link copied to clipboard
@GET(value = "tags/{tag}/bookmarks")
abstract suspend fun browseBookmarksByTag(@Path(value = "tag") tag: Tag, @Query(value = "page") page: Int, @QueryMap parameters: BookmarksFilterParameters = BookmarksFilterParameters()): AO3Response<TagBookmarksPage>

Retrieves a list of up to 20 bookmark blurbs at the specified page that are associated with the specified tag.

Link copied to clipboard
@GET(value = "users/{user}/works")
abstract suspend fun browseBookmarksByUser(@Path(value = "user") user: String, @Query(value = "page") page: Int, @QueryMap parameters: WorksFilterParameters = WorksFilterParameters()): AO3Response<UserWorksPage>
@GET(value = "users/{user}/pseuds/{pseud}/works")
abstract suspend fun browseBookmarksByUser(@Path(value = "user") user: String, @Path(value = "pseud") pseudonym: String, @Query(value = "page") page: Int, @QueryMap parameters: BookmarksFilterParameters = BookmarksFilterParameters()): AO3Response<UserWorksPage>

Retrieves a list of up to 20 bookmark blurbs at the specified page that are associated with the user.

Link copied to clipboard
@GET(value = "collections")
abstract suspend fun browseCollections(@Query(value = "page") page: Int, @QueryMap parameters: CollectionsFilterParameters = CollectionsFilterParameters()): AO3Response<CollectionsFilterPage>

Retrieves a list of up to 20 collection blurbs at the specified page from all collections.

Link copied to clipboard
@GET(value = "tags/{tag}/works")
abstract suspend fun browseWorksByTag(@Path(value = "tag") tag: Tag, @Query(value = "page") page: Int, @QueryMap parameters: WorksFilterParameters = WorksFilterParameters()): AO3Response<TagWorksPage>

Retrieves a list of up to 20 work blurbs at the specified page that are associated with the specified tag.

Link copied to clipboard
@GET(value = "users/{user}/works")
abstract suspend fun browseWorksByUser(@Path(value = "user") user: String, @Query(value = "page") page: Int, @QueryMap parameters: WorksFilterParameters = WorksFilterParameters()): AO3Response<UserWorksPage>
@GET(value = "users/{user}/pseuds/{pseud}/works")
abstract suspend fun browseWorksByUser(@Path(value = "user") user: String, @Path(value = "pseud") pseudonym: String, @Query(value = "page") page: Int, @QueryMap parameters: WorksFilterParameters = WorksFilterParameters()): AO3Response<UserWorksPage>

Retrieves a list of up to 20 work blurbs at the specified page that are associated with the user.

Link copied to clipboard
@Headers(value = ["Accept: application/json"])
@GET(value = "token_dispenser.json")
abstract suspend fun getCsrfToken(): AO3Response<Csrf>

Retrieves a CSRF token and sets the session cookie to match the token.

Link copied to clipboard
@GET(value = "works/{id}?view_adult=true&view_full_work=true")
abstract suspend fun getWork(@Path(value = "id") id: Long): AO3Response<WorkPage>

Retrieves the work with the specified id.

Link copied to clipboard
@FormUrlEncoded
@POST(value = "users/login")
abstract suspend fun login(@Field(value = "user[login]") username: String, @Field(value = "user[password]") password: String, @Field(value = "authenticity_token") csrf: Csrf, @FieldMap(encoded = false) defaultFormParameters: LoginFieldMap = LoginFieldMap()): AO3Response<Login>

Logs in to AO3 with the specified username and password.

Link copied to clipboard
@FormUrlEncoded
@POST(value = "users/logout")
abstract suspend fun logout(@Field(value = "authenticity_token") csrf: Csrf, @FieldMap(encoded = false) defaultFormParameters: LogoutFieldMap = LogoutFieldMap()): AO3Response<Logout>

Logs out of AO3.

Link copied to clipboard
@Headers(value = ["Accept: application/json"])
@GET(value = "autocomplete/{type}")
abstract suspend fun searchAutocomplete(@Path(value = "type") type: AutocompleteType, @Query(value = "term") query: String): AO3Response<AutocompletePage>

Retrieves a list of up to 15 tags that match the search query.