Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
iTasks-SDK
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
62
Issues
62
List
Boards
Labels
Milestones
Merge Requests
4
Merge Requests
4
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
clean-and-itasks
iTasks-SDK
Commits
9eac5e1d
Verified
Commit
9eac5e1d
authored
Sep 09, 2019
by
Camil Staps
🍃
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup iTasks.Extensions.Web
parent
063c7a9f
Pipeline
#29232
passed with stage
in 5 minutes and 12 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
19 deletions
+33
-19
Libraries/iTasks/Extensions/Web.dcl
Libraries/iTasks/Extensions/Web.dcl
+32
-16
Libraries/iTasks/Extensions/Web.icl
Libraries/iTasks/Extensions/Web.icl
+1
-3
No files found.
Libraries/iTasks/Extensions/Web.dcl
View file @
9eac5e1d
definition
module
iTasks
.
Extensions
.
Web
import
iTasks
from
Internet
.
HTTP
import
::
HTTPMethod
,
::
HTTPRequest
,
::
HTTPResponse
from
Text
.
URI
import
::
URI
from
Text
.
HTML
import
class
html
/**
* This module provides support for building web applications.
*/
* This module provides support for building web applications.
*/
//* Uniform resource locators
::
URL
=
URL
!
String
...
...
@@ -19,24 +21,38 @@ derive JSONDecode URL
derive
gDefault
URL
derive
gEq
URL
//Simple web server task
//
*
Simple web server task
serveWebService
::
Int
(
HTTPRequest
->
Task
HTTPResponse
)
->
Task
()
//Task for serving a static file
//
*
Task for serving a static file
serveFile
::
[
FilePath
]
HTTPRequest
->
Task
HTTPResponse
/**
* Calls an external HTTP webservice.
*
* @param HTTP Method: the HTTP method (GET or POST) to use
* @param URL: The URL of the webservice
* @param Parameters: A list of name/value pairs
* @param Response handler: A parse function that parses the response
*
* @return The parsed
d value
*
* @gin-title Call web service
* @gin-icon webservice
*/
* Calls an external HTTP webservice.
*
* @param HTTP Method: the HTTP method (GET or POST) to use
* @param URL: The URL of the webservice
* @param Data: The body of the request
* @param Response handler: A parse function that parses the response
*
* @return The parse
d value
*
* @gin-title Call web service
* @gin-icon webservice
*/
callHTTP
::
!
HTTPMethod
!
URI
!
String
!(
HTTPResponse
->
(
MaybeErrorString
a
))
->
Task
a
|
iTask
a
/**
* Calls an external HTTP webservice.
*
* @param HTTP Method: the HTTP method (GET or POST) to use
* @param URL: The URL of the webservice
* @param Parameters: A list of name/value pairs
* @param Response handler: A parse function that parses the response
*
* @return The parsed value
*
* @gin-title Call web service
* @gin-icon webservice
*/
callRPCHTTP
::
!
HTTPMethod
!
URI
![(
String
,
String
)]
!(
HTTPResponse
->
a
)
->
Task
a
|
iTask
a
Libraries/iTasks/Extensions/Web.icl
View file @
9eac5e1d
implementation
module
iTasks
.
Extensions
.
Web
import
iTasks
import
iTasks
.
UI
.
Editor
.
Controls
,
iTasks
.
UI
.
Editor
.
Modifiers
import
Internet
.
HTTP
,
Text
,
Text
.
HTML
,
Text
.
URI
,
Text
.
Encodings
.
MIME
,
Text
.
Encodings
.
UrlEncoding
,
StdArray
,
Data
.
Either
...
...
@@ -14,7 +15,6 @@ import qualified Data.Map as DM
import
Data
.
Map
.
GenJSON
import
qualified
Data
.
List
as
DL
//* URL
gText
{|
URL
|}
_
val
=
[
maybe
""
toString
val
]
gEditor
{|
URL
|}
=
selectByMode
...
...
@@ -215,5 +215,3 @@ callHTTP _ url _ _
callRPCHTTP
::
!
HTTPMethod
!
URI
![(
String
,
String
)]
!(
HTTPResponse
->
a
)
->
Task
a
|
iTask
a
callRPCHTTP
method
url
params
transformResult
=
callHTTP
method
url
(
urlEncodePairs
params
)
(
Ok
o
transformResult
)
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