-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🔨 Refact: Refactor the platform data classes and add the Access base …
…class interface.
- Loading branch information
Showing
18 changed files
with
104 additions
and
30 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
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
2 changes: 1 addition & 1 deletion
2
fluocean-common/src/main/java/io/hanbings/fluocean/common/interfaces/Profilable.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
8 changes: 8 additions & 0 deletions
8
fluocean-common/src/main/java/io/hanbings/fluocean/common/interfaces/Profile.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,8 @@ | ||
package io.hanbings.fluocean.common.interfaces; | ||
|
||
public interface Profile { | ||
String openid(); | ||
interface Wrong { | ||
|
||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
fluocean-common/src/main/java/io/hanbings/fluocean/common/interfaces/Refresh.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,9 @@ | ||
package io.hanbings.fluocean.common.interfaces; | ||
|
||
public interface Refresh { | ||
String accessToken(); | ||
|
||
interface Wrong { | ||
String error(); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
fluocean-common/src/main/java/io/hanbings/fluocean/common/interfaces/Refreshable.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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
package io.hanbings.fluocean.common.interfaces; | ||
|
||
public interface Refreshable<D, W> { | ||
public interface Refreshable<D extends Refresh, W extends Refresh.Wrong> { | ||
Callback<D, W> refresh(String token); | ||
} |
2 changes: 1 addition & 1 deletion
2
fluocean-common/src/main/java/io/hanbings/fluocean/common/interfaces/Revokable.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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
package io.hanbings.fluocean.common.interfaces; | ||
|
||
@SuppressWarnings("SpellCheckingInspection") | ||
public interface Revokable<D, W> { | ||
public interface Revokable<D extends Revoke, W extends Revoke.Wrong> { | ||
Callback<D, W> revoke(String token); | ||
} |
7 changes: 7 additions & 0 deletions
7
fluocean-common/src/main/java/io/hanbings/fluocean/common/interfaces/Revoke.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,7 @@ | ||
package io.hanbings.fluocean.common.interfaces; | ||
|
||
public interface Revoke { | ||
interface Wrong { | ||
|
||
} | ||
} |
13 changes: 11 additions & 2 deletions
13
fluocean-discord/src/main/java/io/hanbings/fluocean/discord/DiscordAccess.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 |
---|---|---|
@@ -1,22 +1,31 @@ | ||
package io.hanbings.fluocean.discord; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.google.gson.annotations.SerializedName; | ||
import io.hanbings.fluocean.common.interfaces.Access; | ||
import io.hanbings.fluocean.common.interfaces.Refresh; | ||
|
||
public record DiscordAccess( | ||
@JsonProperty("access_token") | ||
@SerializedName("access_token") | ||
String accessToken, | ||
@JsonProperty("token_type") | ||
@SerializedName("token_type") | ||
String tokenType, | ||
@JsonProperty("expires_in") | ||
@SerializedName("expires_in") | ||
long expiresIn, | ||
@JsonProperty("refresh_token") | ||
@SerializedName("refresh_token") | ||
String refreshToken, | ||
@JsonProperty("scope") | ||
@SerializedName("scope") | ||
String scope | ||
) { | ||
) implements Access, Refresh { | ||
record Wrong( | ||
@JsonProperty("error") | ||
@SerializedName("error") | ||
String error | ||
) { | ||
) implements Access.Wrong, Refresh.Wrong { | ||
} | ||
} |
6 changes: 4 additions & 2 deletions
6
fluocean-discord/src/main/java/io/hanbings/fluocean/discord/DiscordRevoke.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 |
---|---|---|
@@ -1,6 +1,8 @@ | ||
package io.hanbings.fluocean.discord; | ||
|
||
public record DiscordRevoke() { | ||
record Wrong() { | ||
import io.hanbings.fluocean.common.interfaces.Revoke; | ||
|
||
public record DiscordRevoke() implements Revoke { | ||
record Wrong() implements Revoke.Wrong { | ||
} | ||
} |
30 changes: 23 additions & 7 deletions
30
fluocean-dropbox/src/main/java/io/hanbings/fluocean/dropbox/DropboxAccess.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 |
---|---|---|
@@ -1,32 +1,48 @@ | ||
package io.hanbings.fluocean.dropbox; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.google.gson.annotations.SerializedName; | ||
import io.hanbings.fluocean.common.interfaces.Access; | ||
|
||
public record DropboxAccess( | ||
@JsonProperty("access_token") | ||
@SerializedName("access_token") | ||
String accessToken, | ||
@JsonProperty("expires_in") | ||
@SerializedName("expires_in") | ||
String expiresIn, | ||
@JsonProperty("token_type") | ||
@SerializedName("token_type") | ||
String tokenType, | ||
@JsonProperty("scope") | ||
@SerializedName("scope") | ||
String scope, | ||
@JsonProperty("account_id") | ||
@SerializedName("account_id") | ||
String accountId, | ||
@JsonProperty("team_id") | ||
@SerializedName("team_id") | ||
String teamId, | ||
@JsonProperty("refresh_token") | ||
@SerializedName("refresh_token") | ||
String refreshToken, | ||
@JsonProperty("id_token") | ||
@SerializedName("id_token") | ||
String idToken, | ||
@JsonProperty("uid") | ||
@SerializedName("uid") | ||
String uid | ||
) { | ||
record Wrong(@SerializedName("error") | ||
String error, | ||
@SerializedName("error_description") | ||
String errorDescription, | ||
@SerializedName("state") | ||
String state) { | ||
) implements Access { | ||
record Wrong( | ||
@JsonProperty("error") | ||
@SerializedName("error") | ||
String error, | ||
@JsonProperty("error_description") | ||
@SerializedName("error_description") | ||
String errorDescription, | ||
@JsonProperty("state") | ||
@SerializedName("state") | ||
String state | ||
) implements Access.Wrong { | ||
} | ||
} |
12 changes: 10 additions & 2 deletions
12
fluocean-dropbox/src/main/java/io/hanbings/fluocean/dropbox/DropboxRefresh.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 |
---|---|---|
@@ -1,22 +1,30 @@ | ||
package io.hanbings.fluocean.dropbox; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.google.gson.annotations.SerializedName; | ||
import io.hanbings.fluocean.common.interfaces.Refresh; | ||
|
||
public record DropboxRefresh( | ||
@JsonProperty("access_token") | ||
@SerializedName("access_token") | ||
String accessToken, | ||
@JsonProperty("expires_in") | ||
@SerializedName("expires_in") | ||
String expiresIn, | ||
@JsonProperty("token_type") | ||
@SerializedName("token_type") | ||
String tokenType | ||
) { | ||
) implements Refresh { | ||
record Wrong( | ||
@JsonProperty("error") | ||
@SerializedName("error") | ||
String error, | ||
@JsonProperty("error_description") | ||
@SerializedName("error_description") | ||
String errorDescription, | ||
@JsonProperty("state") | ||
@SerializedName("state") | ||
String state | ||
) { | ||
) implements Refresh.Wrong { | ||
} | ||
} |
6 changes: 4 additions & 2 deletions
6
fluocean-dropbox/src/main/java/io/hanbings/fluocean/dropbox/DropboxRevoke.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 |
---|---|---|
@@ -1,6 +1,8 @@ | ||
package io.hanbings.fluocean.dropbox; | ||
|
||
public record DropboxRevoke() { | ||
record Wrong() { | ||
import io.hanbings.fluocean.common.interfaces.Revoke; | ||
|
||
public record DropboxRevoke() implements Revoke { | ||
record Wrong() implements Revoke.Wrong { | ||
} | ||
} |
13 changes: 10 additions & 3 deletions
13
fluocean-facebook/src/main/java/io/hanbings/fluocean/facebook/FacebookAccess.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 |
---|---|---|
@@ -1,8 +1,15 @@ | ||
package io.hanbings.fluocean.facebook; | ||
|
||
public record FacebookAccess( | ||
import com.google.gson.annotations.SerializedName; | ||
import io.hanbings.fluocean.common.interfaces.Access; | ||
|
||
) { | ||
record Wrong() { | ||
public record FacebookAccess( | ||
@SerializedName("access_token") | ||
String accessToken | ||
) implements Access { | ||
record Wrong( | ||
@SerializedName("error") | ||
String error | ||
) implements Access.Wrong { | ||
} | ||
} |
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
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