Skip to content

Commit

Permalink
feat: GithubUserInfo (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
toychip committed Nov 29, 2023
1 parent 25b4ffa commit 51ecc82
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/main/java/com/api/TaveShot/global/oauth2/GithubUserInfo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.api.TaveShot.global.oauth2;

import java.util.Map;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;

@Getter
@Builder
@AllArgsConstructor
public record GithubUserInfo(Map<String, Object> userInfo) {

private static final String AVATAR_URL_PATTERN = "avatar_url";
private static final String LOGIN_PATTERN = "login";
private static final String NAME_PATTERN = "name";
private static final String EMAIL_PATTERN = "email";

public String getProfileImageUrl() {
return (String) userInfo.get(AVATAR_URL_PATTERN);
}

public String getLoginId() {
return (String) userInfo.get(LOGIN_PATTERN);
}

public String getName() {
return (String) userInfo.get(NAME_PATTERN);
}

public String getMail() {
return (String) userInfo.get(EMAIL_PATTERN);
}
}

0 comments on commit 51ecc82

Please sign in to comment.