modif css, retrait section test, ajout config.nim
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
|
||||
# Data structure for TAGS
|
||||
type Tag = object
|
||||
id : string
|
||||
parent_id : string
|
||||
title: string
|
||||
|
||||
type Tags = object
|
||||
items: seq[Tag]
|
||||
has_more: string
|
||||
|
||||
|
||||
+60
-4
@@ -6,7 +6,7 @@ import jester
|
||||
from os import sleep
|
||||
import httpcore, net, times, strutils
|
||||
|
||||
|
||||
# Setup joplin_ping data
|
||||
type
|
||||
joplin_ping* = object
|
||||
ping_result*: seq[string]
|
||||
@@ -17,18 +17,22 @@ type
|
||||
type
|
||||
joplin_tags* = object
|
||||
id*, parent_id*, title*: seq[string]
|
||||
created_time*, updated_time*, user_created_time*, user_updated_time*, is_shared*: seq[int]
|
||||
req*: Request
|
||||
|
||||
# Setup joplin_notebooks data
|
||||
type
|
||||
joplin_notebooks* = object
|
||||
id*, parent_id*, title*: seq[string]
|
||||
id*, parent_id*, title*, share_id*, icon*: seq[string]
|
||||
created_time*, updated_time*, user_created_time*, user_updated_time*, is_shared*: seq[int]
|
||||
req*: Request
|
||||
|
||||
# Setup joplin_notes data
|
||||
type
|
||||
joplin_notes* = object
|
||||
id*, parent_id*, title*: seq[string]
|
||||
id*, parent_id*, title*, body*, author*, source_url*, source*, source_application*, application_data*, share_id*, conflict_original_id*, body_html*, base_url*: seq[string]
|
||||
created_time*, updated_time*, is_conflict*, is_todo*, todo_due*, todo_completed*, user_created_time*, user_updated_time*, markup_language*, is_shared*: seq[int]
|
||||
latitude*, longitude*, altitude*, order*:seq[float]
|
||||
req*: Request
|
||||
|
||||
let
|
||||
@@ -111,6 +115,7 @@ proc get_joplin_notebooks*(token:string): Future[joplin_notebooks] {.async.} =
|
||||
|
||||
# request joplin API for notebooks
|
||||
url = fmt"http://localhost:41184/folders?page={page}&token={token}"
|
||||
echo("URL notebooks : ", url)
|
||||
var json = await client.getContent(url)
|
||||
|
||||
# parse jason
|
||||
@@ -150,8 +155,9 @@ proc get_joplin_notes*(token:string): Future[joplin_notes] {.async.} =
|
||||
# make sure to check all pages
|
||||
while has_more == true:
|
||||
|
||||
# request joplin API for notebooks
|
||||
# request joplin API for Notes
|
||||
url = fmt"http://localhost:41184/notes?page={page}&token={token}"
|
||||
echo("URL notes : ", url)
|
||||
var json = await client.getContent(url)
|
||||
|
||||
# parse jason
|
||||
@@ -194,6 +200,7 @@ proc get_joplin_tags*(token:string): Future[joplin_tags] {.async.} =
|
||||
|
||||
# request joplin API for notebooks
|
||||
url = fmt"http://localhost:41184/tags?page={page}&token={token}"
|
||||
echo("URL tags : ", url)
|
||||
var json = await client.getContent(url)
|
||||
|
||||
# parse jason
|
||||
@@ -217,3 +224,52 @@ proc get_joplin_tags*(token:string): Future[joplin_tags] {.async.} =
|
||||
return j_tags
|
||||
|
||||
|
||||
|
||||
# proc get_joplin_tags_json*(token:string): Future[] {.async.} =
|
||||
|
||||
# # url = fmt"http://localhost:41184/notes/{id}?fields=id,parent_id,title,body,created_time,updated_time,is_conflict,latitude,longitude,altitude,author,source_url,is_todo,todo_due,todo_completed,source,source_application,application_data,order,user_created_time,user_updated_time,encryption_cipher_text,encryption_applied,markup_language,is_shared,share_id,conflict_original_id,master_key_id&token={token}"
|
||||
|
||||
# # url = fmt"http://localhost:41184/tags/{id}?fields=id,parent_id,title,created_time,updated_time,user_created_time,user_updated_time,is_shared&token={token}"
|
||||
|
||||
# # http://localhost:41184/tags?token=e5f6644fbf6a97ddc55648dae72b11caecda6c6642d8ce0d3b20129b89b196385737eb908923542c3343649ebbf865b55bda031ab4c3a16edc7723ef2ad77d8f
|
||||
|
||||
# # Variables
|
||||
# var j_tags: joplin_tags
|
||||
# var has_more: bool = true
|
||||
# var page: int = 1
|
||||
# var url: string
|
||||
# var client = newAsyncHttpClient()
|
||||
# var pingCheck: joplin_ping
|
||||
# pingCheck = waitFor ping_joplin(token)
|
||||
|
||||
|
||||
# # check the joplin status befor query
|
||||
# if pingCheck.ping_status:
|
||||
|
||||
# # make sure to check all pages
|
||||
# while has_more == true:
|
||||
|
||||
# # request joplin API for notebooks
|
||||
# url = fmt"http://localhost:41184/tags?page={page}&token={token}"
|
||||
# echo("URL tags : ", url)
|
||||
# var json = await client.getContent(url)
|
||||
|
||||
# # parse jason
|
||||
# let joplin_tags_Json = parseJson(json)
|
||||
|
||||
# # valider qu'il n'y a plus de page
|
||||
# if not joplin_tags_Json["has_more"].getBool:
|
||||
# has_more = false
|
||||
|
||||
# # store json info into an object
|
||||
# var count: int = 1
|
||||
# for nb in joplin_tags_Json["items"]:
|
||||
# echo nb["id"].getstr
|
||||
# echo nb["parent_id"].getstr
|
||||
# echo nb["title"].getstr
|
||||
# count += 1
|
||||
|
||||
# # aller à la page suivante
|
||||
# page += 1
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user