HaskerDeux

Check-in [a09dcdd1f3]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Enable response on delete, forgot about this
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/issue1 | trunk | master
Files: files | file ages | folders
SHA3-256: a09dcdd1f3cd8d5abf519071f702906eef3cb60c8af89b6771a0ca815ff50ca9
User & Date: base@atomicules.co.uk 2016-12-04 15:56:13
Context
2016-12-04
16:04
Add note about used to use Network.Curl check-in: 5f083ddb12 user: base@atomicules.co.uk tags: master, origin/issue1, trunk
15:56
Enable response on delete, forgot about this check-in: a09dcdd1f3 user: base@atomicules.co.uk tags: master, origin/issue1, trunk
15:49
Clean up and correct comments check-in: 97901a5951 user: base@atomicules.co.uk tags: master, origin/issue1, trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to haskerdeux.hs.

81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99


curldelete (token, [todays_date, apiurl, okresponse]) number = do
	tdsf <- curlget (token, todays_date)
	let itemid = Main.id $ tdsf!!(read number::Int)
	let curlheader = "X-CSRF-Token: " ++ token
	body <- readProcess "curl" ["-s", "-XDELETE", apiurl++show itemid, "-c", "haskerdeux.cookies", "-b", "haskerdeux.cookies", "-H", curlheader] []
	return()
	-- TODO: what does the response say?
    -- if respCurlCode resp == CurlOK && respStatus resp == 200
    -- 	then putStrLn okresponse
    -- 	else putStrLn "Uh Oh! Didn't work!"


curlput (token, [todays_date, json, apiurl, okresponse]) number = do
	tdsf <- curlget (token, todays_date)
	let itemid = Main.id $ tdsf!!(read number::Int)
	let curlheader = "X-CSRF-Token: " ++ token
	body <- readProcess "curl" ["-s", "-XPUT", apiurl++show itemid, "-L", "-c", "haskerdeux.cookies", "-b", "haskerdeux.cookies", "-H", curlheader, "-H", "Content-Type: application/json", "-d", json] []







|
<
<
|
|







81
82
83
84
85
86
87
88


89
90
91
92
93
94
95
96
97


curldelete (token, [todays_date, apiurl, okresponse]) number = do
	tdsf <- curlget (token, todays_date)
	let itemid = Main.id $ tdsf!!(read number::Int)
	let curlheader = "X-CSRF-Token: " ++ token
	body <- readProcess "curl" ["-s", "-XDELETE", apiurl++show itemid, "-c", "haskerdeux.cookies", "-b", "haskerdeux.cookies", "-H", curlheader] []
	if "done_updated_at" `isInfixOf` body


		then putStrLn okresponse
		else putStrLn "Uh Oh! Didn't work!"


curlput (token, [todays_date, json, apiurl, okresponse]) number = do
	tdsf <- curlget (token, todays_date)
	let itemid = Main.id $ tdsf!!(read number::Int)
	let curlheader = "X-CSRF-Token: " ++ token
	body <- readProcess "curl" ["-s", "-XPUT", apiurl++show itemid, "-L", "-c", "haskerdeux.cookies", "-b", "haskerdeux.cookies", "-H", curlheader, "-H", "Content-Type: application/json", "-d", json] []