forked from yql/yql-tables
/
freckle.entries.xml
64 lines (61 loc) · 3.23 KB
/
freckle.entries.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?xml version="1.0" encoding="UTF-8"?>
<table xmlns="http://query.yahooapis.com/v1/schema/table.xsd" https="true">
<meta>
<author>Peter Baumgartner</author>
<documentationURL>http://madrobby.github.com/freckle-apidocs/entries.html</documentationURL>
<description>Insert/Select time entries from Freckle</description>
<sampleQuery>SELECT * FROM freckle.entries WHERE site="apitest" AND token="lx3gi6pxdjtjn57afp8c2bv1me7g89j"</sampleQuery>
</meta>
<bindings>
<select itemPath="entries.entry" produces="XML">
<urls>
<url>https://{site}.letsfreckle.com/api/entries.xml</url>
</urls>
<inputs>
<key id="site" type="xs:string" paramType="path" required="true"/>
<key id="X-FreckleToken" as="token" type="xs:string" paramType="header" required="true" private="true"/>
<!-- search queries -->
<key id="search[people]" as="people" type="xs:string" paramType="query" required="false"/>
<key id="search[projects]" as="projects" type="xs:string" paramType="query" required="false"/>
<key id="search[tags]" as="tags" type="xs:string" paramType="query" required="false"/>
<key id="search[from]" as="from" type="xs:date" paramType="query" required="false"/>
<key id="search[to]" as="to" type="xs:date" paramType="query" required="false"/>
<key id="search[billable]" as="billable" type="xs:boolean" paramType="query" required="false"/>
</inputs>
</select>
<insert itemPath="entry" produces="XML">
<urls>
<url>https://{site}.letsfreckle.com/api/entries.xml</url>
</urls>
<inputs>
<key id="site" type="xs:string" paramType="path" required="true"/>
<key id="X-FreckleToken" as="token" type="xs:string" paramType="header" required="true" private="true"/>
<key id="minutes" type="xs:string" paramType="variable" required="true"/>
<key id="user" type="xs:string" paramType="variable" required="true"/>
<key id="project_id" type="xs:string" paramType="variable" required="false"/>
<key id="description" type="xs:string" paramType="variable" required="false"/>
<key id="date" type="xs:date" paramType="variable" required="false"/>
</inputs>
<execute><![CDATA[
var entry = {
"entry": {
"minutes":minutes,
"user":user
}
};
if (project_id) {
entry.entry["project-id"] = project_id;
}
if (description) {
entry.entry.description = description;
}
if (date) {
entry.entry.date = date;
}
response.object = request.contentType('application/xml')
.post(y.jsonToXml(entry).toXMLString())
.response;
]]></execute>
</insert>
</bindings>
</table>