Add new endpoints and fix migration to v2

This commit is contained in:
Thomas 2022-11-24 10:53:44 +01:00
parent e32b3bf6da
commit c6bd8ac265
18 changed files with 232 additions and 36 deletions

View File

@ -31,9 +31,9 @@ import androidx.recyclerview.widget.LinearLayoutManager;
import java.util.ArrayList;
import app.fedilab.android.R;
import app.fedilab.android.client.entities.api.AdminAccount;
import app.fedilab.android.client.entities.api.AdminReport;
import app.fedilab.android.client.entities.api.Status;
import app.fedilab.android.client.entities.api.admin.AdminAccount;
import app.fedilab.android.client.entities.api.admin.AdminReport;
import app.fedilab.android.databinding.ActivityAdminReportBinding;
import app.fedilab.android.helper.Helper;
import app.fedilab.android.helper.ThemeHelper;

View File

@ -54,8 +54,8 @@ import java.util.concurrent.TimeUnit;
import app.fedilab.android.BaseMainActivity;
import app.fedilab.android.R;
import app.fedilab.android.client.entities.api.AdminAccount;
import app.fedilab.android.client.entities.api.Attachment;
import app.fedilab.android.client.entities.api.admin.AdminAccount;
import app.fedilab.android.databinding.ActivityAdminAccountBinding;
import app.fedilab.android.helper.Helper;
import app.fedilab.android.helper.MastodonHelper;

View File

@ -56,8 +56,8 @@ import java.util.concurrent.TimeUnit;
import app.fedilab.android.BaseMainActivity;
import app.fedilab.android.R;
import app.fedilab.android.client.entities.api.Account;
import app.fedilab.android.client.entities.api.AdminAccount;
import app.fedilab.android.client.entities.api.Attachment;
import app.fedilab.android.client.entities.api.admin.AdminAccount;
import app.fedilab.android.databinding.ActivityAdminAccountBinding;
import app.fedilab.android.helper.Helper;
import app.fedilab.android.helper.MastodonHelper;

View File

@ -17,8 +17,8 @@ package app.fedilab.android.client.endpoints;
import java.util.List;
import app.fedilab.android.client.entities.api.AdminAccount;
import app.fedilab.android.client.entities.api.AdminReport;
import app.fedilab.android.client.entities.api.admin.AdminAccount;
import app.fedilab.android.client.entities.api.admin.AdminReport;
import retrofit2.Call;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;

View File

@ -1,4 +1,4 @@
package app.fedilab.android.client.entities.api;
package app.fedilab.android.client.entities.api.admin;
/* Copyright 2021 Thomas Schneider
*
* This file is a part of Fedilab
@ -21,6 +21,8 @@ import java.util.Date;
import java.util.LinkedHashMap;
import java.util.List;
import app.fedilab.android.client.entities.api.Account;
public class AdminAccount implements Serializable {
@SerializedName("id")
@ -74,7 +76,7 @@ public class AdminAccount implements Serializable {
@SerializedName("approved")
public boolean approved;
@SerializedName("ips")
public List<IP> ips;
public List<AdminIp> ips;
@SerializedName("account")
public Account account;
@SerializedName("created_by_application_id")
@ -83,13 +85,6 @@ public class AdminAccount implements Serializable {
public String invited_by_account_id;
public static class IP implements Serializable {
@SerializedName("ip")
public String ip;
@SerializedName("used_at")
public Date used_at;
}
@SerializedName("locale")
public String locale;
@SerializedName("invite_request")

View File

@ -1,4 +1,4 @@
package app.fedilab.android.client.entities.api;
package app.fedilab.android.client.entities.api.admin;
/* Copyright 2021 Thomas Schneider
*
* This file is a part of Fedilab
@ -17,6 +17,8 @@ package app.fedilab.android.client.entities.api;
import java.util.List;
import app.fedilab.android.client.entities.api.Pagination;
public class AdminAccounts {
public Pagination pagination = new Pagination();

View File

@ -0,0 +1,43 @@
package app.fedilab.android.client.entities.api.admin;
/* 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;
import java.util.Date;
public class AdminDomainBlock implements Serializable {
@SerializedName("id")
public String id;
@SerializedName("domain")
public String domain;
@SerializedName("created_at")
public Date created_at;
@SerializedName("severity")
public String severity;
@SerializedName("reject_media")
public boolean reject_media;
@SerializedName("reject_reports")
public boolean reject_reports;
@SerializedName("private_comment")
public String private_comment;
@SerializedName("public_comment")
public String public_comment;
@SerializedName("obfuscate")
public boolean obfuscate;
}

View File

@ -0,0 +1,36 @@
package app.fedilab.android.client.entities.api.admin;
/* 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;
import java.util.Date;
import java.util.List;
import app.fedilab.android.client.entities.api.History;
public class AdminEmailDomainBlock implements Serializable {
@SerializedName("id")
public String id;
@SerializedName("domain")
public String domain;
@SerializedName("created_at")
public Date created_at;
@SerializedName("history")
public List<History> history;
}

View File

@ -0,0 +1,29 @@
package app.fedilab.android.client.entities.api.admin;
/* 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;
import java.util.Date;
public class AdminIp implements Serializable {
@SerializedName("ip")
public String ip;
@SerializedName("used_at")
public Date used_at;
}

View File

@ -0,0 +1,37 @@
package app.fedilab.android.client.entities.api.admin;
/* 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;
import java.util.Date;
public class AdminIpBlock implements Serializable {
@SerializedName("id")
public String id;
@SerializedName("ip")
public String ip;
@SerializedName("severity")
public String severity;
@SerializedName("comment")
public String comment;
@SerializedName("created_at")
public Date created_at;
@SerializedName("expires_at")
public Date expires_at;
}

View File

@ -0,0 +1,45 @@
package app.fedilab.android.client.entities.api.admin;
/* 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;
import java.util.Date;
import java.util.List;
public class AdminMeasure implements Serializable {
@SerializedName("key")
public String key;
@SerializedName("unit")
public String unit;
@SerializedName("total")
public int total;
@SerializedName("human_value")
public int human_value;
@SerializedName("previous_total")
public int previous_total;
@SerializedName("data")
public List<Data> data;
public static class Data implements Serializable {
@SerializedName("date")
public Date date;
@SerializedName("value")
public int value;
}
}

View File

@ -1,4 +1,4 @@
package app.fedilab.android.client.entities.api;
package app.fedilab.android.client.entities.api.admin;
/* Copyright 2021 Thomas Schneider
*
* This file is a part of Fedilab
@ -20,30 +20,37 @@ import java.io.Serializable;
import java.util.Date;
import java.util.List;
import app.fedilab.android.client.entities.api.Instance;
import app.fedilab.android.client.entities.api.Status;
public class AdminReport implements Serializable {
@SerializedName("id")
public String id;
@SerializedName("account")
public AdminAccount account;
@SerializedName("action_taken")
public Boolean action_taken;
@SerializedName("action_taken_by_account")
public AdminAccount action_taken_by_account;
@SerializedName("assigned_account")
public AdminAccount assigned_account;
@SerializedName("action_taken_at")
public Date action_taken_at;
@SerializedName("category")
public String category;
@SerializedName("comment")
public String comment;
@SerializedName("forwarded")
public boolean forwarded;
@SerializedName("created_at")
public Date created_at;
@SerializedName("updated_at")
public Date updated_at;
@SerializedName("account")
public AdminAccount account;
@SerializedName("target_account")
public AdminAccount target_account;
@SerializedName("assigned_account")
public AdminAccount assigned_account;
@SerializedName("action_taken_by_account")
public AdminAccount action_taken_by_account;
@SerializedName("statuses")
public List<Status> statuses;
@SerializedName("rules")
public List<Instance.Rule> rules;
@SerializedName("updated_at")
public Date updated_at;
}

View File

@ -1,4 +1,4 @@
package app.fedilab.android.client.entities.api;
package app.fedilab.android.client.entities.api.admin;
/* Copyright 2021 Thomas Schneider
*
* This file is a part of Fedilab
@ -17,6 +17,8 @@ package app.fedilab.android.client.entities.api;
import java.util.List;
import app.fedilab.android.client.entities.api.Pagination;
public class AdminReports {
public Pagination pagination = new Pagination();

View File

@ -28,7 +28,7 @@ import java.util.List;
import java.util.Locale;
import app.fedilab.android.activities.AdminAccountActivity;
import app.fedilab.android.client.entities.api.AdminAccount;
import app.fedilab.android.client.entities.api.admin.AdminAccount;
import app.fedilab.android.databinding.DrawerAdminAccountBinding;
import app.fedilab.android.helper.Helper;
import app.fedilab.android.helper.MastodonHelper;

View File

@ -31,7 +31,7 @@ import java.util.List;
import app.fedilab.android.activities.AccountReportActivity;
import app.fedilab.android.client.entities.api.Account;
import app.fedilab.android.client.entities.api.AdminReport;
import app.fedilab.android.client.entities.api.admin.AdminReport;
import app.fedilab.android.databinding.DrawerReportBinding;
import app.fedilab.android.helper.Helper;
import app.fedilab.android.helper.MastodonHelper;

View File

@ -34,8 +34,8 @@ import java.util.List;
import app.fedilab.android.BaseMainActivity;
import app.fedilab.android.R;
import app.fedilab.android.activities.AdminActionActivity;
import app.fedilab.android.client.entities.api.AdminAccount;
import app.fedilab.android.client.entities.api.AdminAccounts;
import app.fedilab.android.client.entities.api.admin.AdminAccount;
import app.fedilab.android.client.entities.api.admin.AdminAccounts;
import app.fedilab.android.databinding.FragmentPaginationBinding;
import app.fedilab.android.helper.Helper;
import app.fedilab.android.helper.MastodonHelper;

View File

@ -34,8 +34,8 @@ import java.util.List;
import app.fedilab.android.BaseMainActivity;
import app.fedilab.android.R;
import app.fedilab.android.activities.AdminActionActivity;
import app.fedilab.android.client.entities.api.AdminReport;
import app.fedilab.android.client.entities.api.AdminReports;
import app.fedilab.android.client.entities.api.admin.AdminReport;
import app.fedilab.android.client.entities.api.admin.AdminReports;
import app.fedilab.android.databinding.FragmentPaginationBinding;
import app.fedilab.android.helper.Helper;
import app.fedilab.android.helper.ThemeHelper;

View File

@ -27,10 +27,10 @@ import java.util.List;
import java.util.concurrent.TimeUnit;
import app.fedilab.android.client.endpoints.MastodonAdminService;
import app.fedilab.android.client.entities.api.AdminAccount;
import app.fedilab.android.client.entities.api.AdminAccounts;
import app.fedilab.android.client.entities.api.AdminReport;
import app.fedilab.android.client.entities.api.AdminReports;
import app.fedilab.android.client.entities.api.admin.AdminAccount;
import app.fedilab.android.client.entities.api.admin.AdminAccounts;
import app.fedilab.android.client.entities.api.admin.AdminReport;
import app.fedilab.android.client.entities.api.admin.AdminReports;
import app.fedilab.android.helper.Helper;
import app.fedilab.android.helper.MastodonHelper;
import okhttp3.OkHttpClient;