Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
isidore
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
crawlers
isidore
Commits
1c79f0a5
Commit
1c79f0a5
authored
Jun 17, 2019
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[API Change][FIX]Reply or replies.
parent
069118b2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
6 deletions
+15
-6
Isidore.hs
src/Isidore.hs
+1
-1
Client.hs
src/Isidore/Client.hs
+14
-5
No files found.
src/Isidore.hs
View file @
1c79f0a5
...
...
@@ -36,7 +36,7 @@ type AuthorQuery = Text
get
::
Maybe
Limit
->
Maybe
TextQuery
->
Maybe
AuthorQuery
->
IO
(
Either
ServantError
Reply
)
->
IO
(
Either
ServantError
Content
)
get
n
q
a
=
do
manager'
<-
newManager
tlsManagerSettings
runClientM
(
clientIsidore
n
q
a
)
...
...
src/Isidore/Client.hs
View file @
1c79f0a5
...
...
@@ -99,7 +99,8 @@ data IsidoreDoc = IsidoreDoc
deriving
(
Show
)
data
Reply
=
Reply
{
_docs
::
[
IsidoreDoc
]}
data
Reply
=
Replies
{
_docs
::
[
IsidoreDoc
]}
|
Reply
{
_doc
::
IsidoreDoc
}
deriving
(
Show
)
instance
FromJSON
IsidoreDoc
where
...
...
@@ -113,15 +114,23 @@ instance FromJSON IsidoreDoc where
i
=
(
o
.:
"isidore"
)
data
Content
=
Content
{
_reply
::
Reply
}
deriving
Show
instance
FromJSON
Reply
where
parseJSON
(
Object
o
)
=
Reply
<$>
(
responseReplies
>>=
parseJSON
)
instance
FromJSON
Content
where
parseJSON
(
Object
o
)
=
Content
<$>
(
responseReplies
>>=
parseJSON
)
where
responseReplies
=
(
o
.:
"response"
)
>>=
(
.:
"replies"
)
>>=
(
.:
"content"
)
>>=
(
.:
"reply"
)
instance
FromJSON
Reply
where
parseJSON
(
Array
os
)
=
Replies
<$>
mapM
parseJSON
(
V
.
toList
os
)
parseJSON
o
=
Reply
<$>
parseJSON
o
data
Output
=
JSON
instance
ToHttpApiData
Output
where
...
...
@@ -134,12 +143,12 @@ type Search = "search"
:>
QueryParam
"output"
Output
:>
QueryParam
"q"
T
.
Text
:>
QueryParam
"author"
T
.
Text
:>
Get
'[
J
SON
]
Reply
:>
Get
'[
J
SON
]
Content
isidoreAPI
::
Proxy
IsidoreAPI
isidoreAPI
=
Proxy
clientIsidore
::
Maybe
Int
->
Maybe
T
.
Text
->
Maybe
T
.
Text
->
ClientM
Reply
clientIsidore
::
Maybe
Int
->
Maybe
T
.
Text
->
Maybe
T
.
Text
->
ClientM
Content
clientIsidore
n
q
a
=
client
isidoreAPI
n
(
Just
JSON
)
q
a
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment