Prepare entity and api endpoints

This commit is contained in:
Thomas 2022-10-31 11:43:57 +01:00
parent dcd5d97cd5
commit 5656d79296
3 changed files with 57 additions and 0 deletions

View File

@ -24,6 +24,7 @@ import app.fedilab.android.client.entities.api.Context;
import app.fedilab.android.client.entities.api.Poll;
import app.fedilab.android.client.entities.api.ScheduledStatus;
import app.fedilab.android.client.entities.api.Status;
import app.fedilab.android.client.entities.api.StatusSource;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import retrofit2.Call;
@ -61,6 +62,32 @@ public interface MastodonStatusesService {
@Field("language") String language
);
@GET("statuses/{id}/source")
Call<StatusSource> getStatusSource(
@Header("Authorization") String token,
@Path("id") String id);
//Post a status
@FormUrlEncoded
@PUT("statuses/{id}")
Call<Status> updateStatus(
@Header("Idempotency-Key") String idempotency_Key,
@Header("Authorization") String token,
@Path("id") String id,
@Field("status") String status,
@Field("media_ids[]") List<String> media_ids,
@Field("poll[options][]") List<String> poll_options,
@Field("poll[expires_in]") Integer poll_expire_in,
@Field("poll[multiple]") Boolean poll_multiple,
@Field("poll[hide_totals]") Boolean poll_hide_totals,
@Field("in_reply_to_id") String in_reply_to_id,
@Field("sensitive") Boolean sensitive,
@Field("spoiler_text") String spoiler_text,
@Field("visibility") String visibility,
@Field("language") String language
);
//Post a scheduled status
@FormUrlEncoded
@POST("statuses")

View File

@ -36,6 +36,8 @@ public class Status implements Serializable, Cloneable {
public String id;
@SerializedName("created_at")
public Date created_at = new Date();
@SerializedName("edited_at")
public Date edited_at;
@SerializedName("in_reply_to_id")
public String in_reply_to_id;
@SerializedName("in_reply_to_account_id")

View File

@ -0,0 +1,28 @@
package app.fedilab.android.client.entities.api;
/* Copyright 2022 Thomas Schneider
*
* This file is a part of Fedilab
*
* This program is free software; you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
* License, or (at your option) any later version.
*
* Fedilab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details.
*
* You should have received a copy of the GNU General Public License along with Fedilab; if not,
* see <http://www.gnu.org/licenses>. */
import com.google.gson.annotations.SerializedName;
import java.io.Serializable;
public class StatusSource implements Serializable {
@SerializedName("id")
public String id;
@SerializedName("text")
public String text;
@SerializedName("spoiler_text")
public String spoiler_text;
}