diff --git a/app/src/main/java/org/ntlab/acanthus_client/views/main_menu_ui/edit/EditViewModel.java b/app/src/main/java/org/ntlab/acanthus_client/views/main_menu_ui/edit/EditViewModel.java index 1ef9fef..6720486 100644 --- a/app/src/main/java/org/ntlab/acanthus_client/views/main_menu_ui/edit/EditViewModel.java +++ b/app/src/main/java/org/ntlab/acanthus_client/views/main_menu_ui/edit/EditViewModel.java @@ -3,6 +3,9 @@ import org.ntlab.acanthus_client.entities.AidJson; import org.ntlab.acanthus_client.entities.WorkJson; import org.ntlab.acanthus_client.resources.accounts.WorkRest; +import org.ntlab.acanthus_client.resources.gallery.InvitesRest; + +import java.util.concurrent.Callable; import androidx.lifecycle.LiveData; import androidx.lifecycle.MutableLiveData; @@ -47,8 +50,8 @@ call.enqueue(new Callback() { @Override public void onResponse(Call call, Response response) { - if (response.isSuccessful()){ - if (response.body()!=null){ + if (response.isSuccessful()) { + if (response.body() != null) { aid[0] = response.body().getAid(); aidJsonMutableLiveData.setValue(response.body()); } @@ -65,7 +68,7 @@ } //ユーザーの作成した作品の表示APIの呼び出し - public void getWorkList(Integer uid, String token){ + public void getWorkList(Integer uid, String token) { Retrofit retrofit = new Retrofit.Builder() .baseUrl("http://nitta-lab-www.is.konan-u.ac.jp/acanthus/") .addConverterFactory(JacksonConverterFactory.create()) @@ -77,8 +80,8 @@ call.enqueue(new Callback() { @Override public void onResponse(Call call, Response response) { - if (response.isSuccessful()){ - if (response.body()!=null){ + if (response.isSuccessful()) { + if (response.body() != null) { workJsonMutableLiveData.setValue(response.body()); } } @@ -91,4 +94,28 @@ }); } + //ユーザーの作品へ他ユーザーを招待するAPIの呼び出し + public void invitesEditor(Integer aid, String ownerUid, String invitedUid, String ownerToken) { + Retrofit retrofit = new Retrofit.Builder() + .baseUrl("http://nitta-lab-www.is.konan-u.ac.jp/acanthus/") + .addConverterFactory(JacksonConverterFactory.create()) + .build(); + final InvitesRest invitesRest = retrofit.create(InvitesRest.class); + + //作品への招待 + Call call = invitesRest.addInvite(aid, ownerUid, invitedUid, ownerToken); + call.enqueue(new Callback() { + @Override + public void onResponse(Call call, Response response) { + if (response.isSuccessful() && response.body() != null) { + } + } + + @Override + public void onFailure(Call call, Throwable t) { + + } + }); + } + } \ No newline at end of file