-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f0f9539
commit 3c31098
Showing
13 changed files
with
445 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
src/main/java/com/uwetrottmann/trakt5/entities/AddNoteRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Copyright 2024 Uwe Trottmann | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.uwetrottmann.trakt5.entities; | ||
|
||
import javax.annotation.Nonnull; | ||
|
||
public class AddNoteRequest extends UpdateNoteRequest { | ||
|
||
public NoteAttachedTo attached_to; | ||
public Movie movie; | ||
public Show show; | ||
public Season season; | ||
public Episode episode; | ||
public Person person; | ||
|
||
public AddNoteRequest(@Nonnull Movie movie, @Nonnull String notes) { | ||
super(notes); | ||
this.movie = movie; | ||
} | ||
|
||
public AddNoteRequest(@Nonnull Show show, @Nonnull String notes) { | ||
super(notes); | ||
this.show = show; | ||
} | ||
|
||
public AddNoteRequest(@Nonnull Season season, @Nonnull String notes) { | ||
super(notes); | ||
this.season = season; | ||
} | ||
|
||
public AddNoteRequest(@Nonnull Episode episode, @Nonnull String notes) { | ||
super(notes); | ||
this.episode = episode; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* Copyright 2024 Uwe Trottmann | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.uwetrottmann.trakt5.entities; | ||
|
||
import org.threeten.bp.OffsetDateTime; | ||
|
||
public class Note { | ||
|
||
public long id; | ||
public String notes; | ||
public String privacy; | ||
public boolean spoiler; | ||
public OffsetDateTime created_at; | ||
public OffsetDateTime updated_at; | ||
public User user; | ||
|
||
} |
28 changes: 28 additions & 0 deletions
28
src/main/java/com/uwetrottmann/trakt5/entities/NoteAttachedTo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* Copyright 2024 Uwe Trottmann | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.uwetrottmann.trakt5.entities; | ||
|
||
import com.uwetrottmann.trakt5.enums.NoteType; | ||
|
||
public class NoteAttachedTo { | ||
public NoteType type; | ||
public Long id; | ||
|
||
public NoteAttachedTo(NoteType type) { | ||
this.type = type; | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
src/main/java/com/uwetrottmann/trakt5/entities/NoteResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Copyright 2024 Uwe Trottmann | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.uwetrottmann.trakt5.entities; | ||
|
||
public class NoteResponse { | ||
|
||
public NoteAttachedTo attached_to; | ||
public String type; | ||
public Movie movie; | ||
public Show show; | ||
public Season season; | ||
public Episode episode; | ||
public Person person; | ||
public Note note; | ||
|
||
} |
42 changes: 42 additions & 0 deletions
42
src/main/java/com/uwetrottmann/trakt5/entities/UpdateNoteRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright 2024 Uwe Trottmann | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.uwetrottmann.trakt5.entities; | ||
|
||
import com.uwetrottmann.trakt5.enums.Privacy; | ||
|
||
import javax.annotation.Nonnull; | ||
|
||
public class UpdateNoteRequest { | ||
|
||
String notes; | ||
Boolean spoiler; | ||
Privacy privacy; | ||
|
||
public UpdateNoteRequest(@Nonnull String notes) { | ||
this.notes = notes; | ||
} | ||
|
||
public UpdateNoteRequest setSpoiler(boolean spoiler) { | ||
this.spoiler = spoiler; | ||
return this; | ||
} | ||
|
||
public UpdateNoteRequest setPrivacy(@Nonnull Privacy privacy) { | ||
this.privacy = privacy; | ||
return this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright 2024 Uwe Trottmann | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.uwetrottmann.trakt5.enums; | ||
|
||
import com.google.gson.annotations.SerializedName; | ||
|
||
public enum NoteType { | ||
|
||
@SerializedName("movie") | ||
MOVIE, | ||
@SerializedName("show") | ||
SHOW, | ||
@SerializedName("season") | ||
SEASON, | ||
@SerializedName("episode") | ||
EPISODE, | ||
@SerializedName("person") | ||
PERSON, | ||
@SerializedName("history") | ||
HISTORY, | ||
@SerializedName("collection") | ||
COLLECTION, | ||
@SerializedName("rating") | ||
RATING | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* Copyright 2024 Uwe Trottmann | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.uwetrottmann.trakt5.enums; | ||
|
||
import com.google.gson.annotations.SerializedName; | ||
|
||
public enum Privacy { | ||
|
||
@SerializedName("private") | ||
PRIVATE, | ||
|
||
@SerializedName("friends") | ||
FRIENDS, | ||
|
||
@SerializedName("public") | ||
PUBLIC | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/* | ||
* Copyright 2024 Uwe Trottmann | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.uwetrottmann.trakt5.services; | ||
|
||
import com.uwetrottmann.trakt5.entities.AddNoteRequest; | ||
import com.uwetrottmann.trakt5.entities.Note; | ||
import com.uwetrottmann.trakt5.entities.UpdateNoteRequest; | ||
import retrofit2.Call; | ||
import retrofit2.http.Body; | ||
import retrofit2.http.DELETE; | ||
import retrofit2.http.GET; | ||
import retrofit2.http.POST; | ||
import retrofit2.http.PUT; | ||
import retrofit2.http.Path; | ||
|
||
public interface Notes { | ||
|
||
/** | ||
* <b>VIP Only, OAuth Required</b> | ||
* <p> | ||
* Add a note (maximum 500 characters). | ||
* <p> | ||
* <a href="https://trakt.docs.apiary.io/#reference/notes/notes/add-notes">Online documentation</a> | ||
*/ | ||
@POST("notes") | ||
Call<Note> addNote( | ||
@Body AddNoteRequest request | ||
); | ||
|
||
/** | ||
* <b>VIP Only, OAuth Required</b> | ||
* <p> | ||
* Get a note. | ||
* <p> | ||
* <a href="https://trakt.docs.apiary.io/#reference/notes/note/get-a-note">Online documentation</a> | ||
*/ | ||
@GET("notes/{id}") | ||
Call<Note> getNote( | ||
@Path("id") long id | ||
); | ||
|
||
/** | ||
* <b>VIP Only, OAuth Required</b> | ||
* <p> | ||
* Update a note (maximum 500 characters). | ||
* <p> | ||
* <a href="https://trakt.docs.apiary.io/#reference/notes/note/update-a-note">Online documentation</a> | ||
*/ | ||
@PUT("notes/{id}") | ||
Call<Note> updateNote( | ||
@Path("id") long id, | ||
@Body UpdateNoteRequest request | ||
); | ||
|
||
/** | ||
* <b>VIP Only, OAuth Required</b> | ||
* <p> | ||
* Delete a note. | ||
* <p> | ||
* <a href="https://trakt.docs.apiary.io/#reference/notes/note/delete-a-note">Online documentation</a> | ||
*/ | ||
@DELETE("notes/{id}") | ||
Call<Void> deleteNote( | ||
@Path("id") long id | ||
); | ||
} |
Oops, something went wrong.