Skip to content

Commit af03240

Browse files
committed
Merge pull request #28 from moteus/master
Update documentation. [ci skip]
2 parents 9017827 + 7fbf2a5 commit af03240

2 files changed

Lines changed: 140 additions & 2 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ In fact for now it provide `lcurl` API directly and needed to redesign.<br/>
1818

1919

2020
## Documentation
21-
[lcurl API](http://lua-curl.github.io/lcurl)<br/>
21+
[lcurl API](http://lua-curl.github.io/lcurl/modules/lcurl.html)<br/>
2222
[Lua-cURLv2 API](http://lua-curl.github.io)<br/>
23-
Lua-cURLv3 API - TODO
23+
[Lua-cURLv3 API](http://lua-curl.github.io/lcurl/modules/cURL.html)
2424

2525
##
2626

doc/curl.ldoc

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
---
2+
-- Provide same functions as `lcurl` module with some additions.
3+
-- Here are the only functions that have been added or changed.
4+
--
5+
-- @module cURL
6+
do
7+
8+
--- Create HTTP multipart/formdata object.
9+
--
10+
-- @tparam FORM_DESCRIPTION form description
11+
-- @treturn[1] Form new curl HTTP Post object context
12+
--
13+
-- @see FORM_DESCRIPTION
14+
function form() end
15+
16+
end
17+
18+
do
19+
20+
--- Form description table.
21+
--
22+
-- @table FORM_DESCRIPTION
23+
-- @tfield string|form_stream|form_file|form_buffer content_name
24+
--
25+
-- @usage
26+
-- post_form = cURL.form{
27+
--
28+
-- -- file form filesystem
29+
-- name01 = {
30+
-- file = "post_form.lua",
31+
-- type = "text/plain",
32+
-- name = "post.lua",
33+
-- },
34+
--
35+
-- -- file form string
36+
-- name02 = {
37+
-- data = "<html><bold>bold</bold></html>",
38+
-- name = "dummy.html",
39+
-- type = "text/html",
40+
-- },
41+
--
42+
-- -- file form stream object
43+
-- name03 = {
44+
-- stream = Stream:new('8', 25),
45+
-- name = "stream1.txt",
46+
-- type = "text/plain",
47+
-- headers = {
48+
-- "X-Test-Char : 8",
49+
-- "X-Test-length : 25",
50+
-- }
51+
-- },
52+
--
53+
-- -- file form stream function
54+
-- name04 = {
55+
-- stream = stream,
56+
-- length = length,
57+
-- name = "stream2.txt",
58+
-- type = "text/plain",
59+
-- },
60+
--
61+
-- }
62+
63+
--- Table describe stream part in form.
64+
--
65+
-- @table form_stream
66+
-- @tfield function|table|userdata stream stream function is same as in readfunction.
67+
-- Also stream object may provide `length` method.
68+
-- @tfield[opt=stream:length()] number length
69+
-- @tfield[opt] string name file name
70+
-- @tfield[opt] string type mime type (e.g. 'text/plain')
71+
-- @tfield[opt] table headers array of headers
72+
--
73+
74+
--- Table describe file part in form.
75+
--
76+
-- @table form_file
77+
-- @tfield string file path to file in local FS (e.g. 'path/to/some/file.txt')
78+
-- @tfield[opt=basename(file)] string name file name
79+
-- @tfield[opt] string type mime type (e.g. 'text/plain')
80+
-- @tfield[opt] table headers array of headers
81+
--
82+
83+
--- Table describe buffer part in form.
84+
--
85+
-- @table form_buffer
86+
-- @tfield string data file content
87+
-- @tfield string name file name
88+
-- @tfield[opt] string type mime type (e.g. 'text/plain')
89+
-- @tfield[opt] table headers array of headers
90+
--
91+
92+
end
93+
94+
--- HTTP multipart/formdata object
95+
-- @type httpform
96+
--
97+
do
98+
99+
--- Add new part to form.
100+
--
101+
-- @tparam FORM_DESCRIPTION form description
102+
-- @treturn[1] httpform self
103+
--
104+
-- @see FORM_DESCRIPTION
105+
function add() end
106+
107+
end
108+
109+
--- Easy curl object
110+
-- @type easy
111+
--
112+
do
113+
114+
--- Perform a file transfer
115+
--
116+
-- @tparam[opt] table options
117+
-- @treturn[1] easy self
118+
-- @usage
119+
-- e:perfom{writefunction = assert(io.open("fname.txt", "w+b"))}
120+
function perfom() end
121+
122+
end
123+
124+
--- Muli curl object
125+
-- @type multi
126+
--
127+
do
128+
129+
--- Iterator that returns the next data, type and corresponding easy handle.
130+
--
131+
-- <br/>Returned data types: `response`, `header`, `data`, `error`, `done`.
132+
-- <br/>Note. response data may appeare several times (e.g. if you proceed http request
133+
-- with digest auth you should get 401 and 200 responses).
134+
--
135+
-- @treturn Iterator iterator for generic for
136+
function iperfom() end
137+
138+
end

0 commit comments

Comments
 (0)