-
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.
Add example config files
- Loading branch information
Showing
6 changed files
with
86 additions
and
71 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"default": "projects", | ||
"academic_refs": { | ||
"DATABASE_ID": "database_id_for_academic_refs_db" | ||
}, | ||
"projects": { | ||
"DATABASE_ID": "database_id_for_projects_db", | ||
"properties": ["Date Created","Slug","Title","Principal Investigator","Investigators","Assigned Project","Study Status"] | ||
} | ||
} |
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,6 @@ | ||
{ | ||
"name": "name_of_integration", | ||
"auth": "secret_notion_integration_auth_key", | ||
"notionVersion": "2021-08-16", | ||
"baseUrl": "https://api.notion.com/v1" | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<cfscript> | ||
void public function main() { | ||
var NOTION_TOKEN = Application.notion.auth; | ||
var notion = new lib.NotionClient (auth: NOTION_TOKEN); | ||
var useDatabaseKey = "projects"; | ||
var DATABASE_ID = Application.notion["databases"][useDatabaseKey]?.DATABASE_ID; | ||
// Get list of users | ||
writeOutput("Getting list of users<BR/>"); | ||
var usersList = notion.users.list().results; | ||
// writeDump(var=usersList); | ||
writeOutput("<HR/>"); | ||
// Get user info by userid | ||
if (!arrayIsEmpty(userslist)){ | ||
writeOutput("Getting user info by userid<BR/>"); | ||
var userInfo = notion.users.retrieve(userslist[1].id); | ||
// writeDump(var=userInfo); | ||
writeOutput("<HR/>"); | ||
} | ||
// Simple search | ||
writeOutput("Performing a simple search<BR/>"); | ||
// writeDump(var=notion.search.search(argumentCollection = { | ||
// query: 'cardiac', | ||
// sort: { | ||
// direction: 'ascending', | ||
// timestamp: 'last_edited_time', | ||
// }, | ||
// })); | ||
writeOutput("<HR/>"); | ||
// Query a database and get content for first page | ||
writeOutput("Querying a database, retrieving a page from database, and retrieving blocks for a page<BR/>"); | ||
var DATABASE_ID = DATABASE_ID?:''; | ||
var resultDB = notion.databases.query(argumentCollection={database_id: DATABASE_ID}); | ||
writeOutput("Database results<BR/>"); | ||
// writeDump(var = resultDB); | ||
writeOutput("<HR/>"); | ||
for (var i=1; i <= arrayLen(resultDB.results); i++){ | ||
var result = resultDB.results[i]; | ||
if (result.object eq 'page'){ | ||
var id = result.id; | ||
var resultPage = notion.pages.retrieve(id); | ||
writeDump(var=resultPage); | ||
var resultPageTitle = resultPage.properties.Slug.title[1].plain_text; | ||
writeOutput("Page results for page with title <u>#resultPageTitle#</u> and id #resultPage.id#<BR/>"); | ||
writeOutput("<HR/>"); | ||
var resultBlocks = notion.blocks.retrieve(resultPage.id); | ||
// var resultBlocks = notion.blocks.children.list(id).results; | ||
writeOutput("Blocks for page with title <u>#resultPageTitle#</u> and id #resultPage.id#<BR/>"); | ||
writeDump(var=resultBlocks?.results); | ||
writeOutput("<HR/>"); | ||
break; | ||
} | ||
} | ||
writeOutput("FINISHED!<BR/>"); | ||
} | ||
main(); | ||
</cfscript> |
This file was deleted.
Oops, something went wrong.