forked from GDSC-PKNU-Official/GDSC_PKNU_Backend
-
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.
Issue GDSC-PKNU-Official#6 feat: GdscNotion.class 생성
- Loading branch information
Showing
1 changed file
with
44 additions
and
0 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
src/main/java/com/gdscpknu/gdscpknu/notion/GdscNotion.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,44 @@ | ||
package com.gdscpknu.gdscpknu.notion; | ||
|
||
import org.jraf.klibnotion.client.Authentication; | ||
import org.jraf.klibnotion.client.ClientConfiguration; | ||
import org.jraf.klibnotion.client.NotionClient; | ||
import org.jraf.klibnotion.client.blocking.BlockingNotionClient; | ||
import org.jraf.klibnotion.client.blocking.BlockingNotionClientUtils; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
public class GdscNotion { | ||
|
||
@Value("${testNotion.introduce.token}") | ||
private String TOKEN; | ||
@Value("${testNotion.introduce.databaseId}") | ||
private String DATABASE_ID; | ||
private final BlockingNotionClient client; | ||
|
||
public GdscNotion(BlockingNotionClient client) { | ||
this.client = initClient(); | ||
} | ||
|
||
public BlockingNotionClient initClient() { | ||
NotionClient notionClient = NotionClient.newInstance( | ||
new ClientConfiguration( | ||
new Authentication(TOKEN) | ||
) | ||
); | ||
return BlockingNotionClientUtils.asBlockingNotionClient(notionClient); | ||
} | ||
|
||
public BlockingNotionClient getClient() { | ||
return client; | ||
} | ||
|
||
public String getTOKEN() { | ||
return TOKEN; | ||
} | ||
|
||
public String getDATABASE_ID() { | ||
return DATABASE_ID; | ||
} | ||
} |