blob: eb307d814fe125ffdb2fd4371dac600aea96bef2 [file] [log] [blame]
Joe Gregorio5dc0f5c2012-06-05 13:34:31 -04001<?xml version="1.0" encoding="ascii"?>
2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
3 "DTD/xhtml1-transitional.dtd">
4<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5<head>
6 <title>apiclient.schema</title>
7 <link rel="stylesheet" href="epydoc.css" type="text/css" />
8 <script type="text/javascript" src="epydoc.js"></script>
9</head>
10
11<body bgcolor="white" text="black" link="blue" vlink="#204080"
12 alink="#204080">
13<!-- ==================== NAVIGATION BAR ==================== -->
14<table class="navbar" border="0" width="100%" cellpadding="0"
15 bgcolor="#a0c0ff" cellspacing="0">
16 <tr valign="middle">
17
18 <!-- Tree link -->
19 <th>&nbsp;&nbsp;&nbsp;<a
20 href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
21
22 <!-- Index link -->
23 <th>&nbsp;&nbsp;&nbsp;<a
24 href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>
25
26 <!-- Help link -->
27 <th>&nbsp;&nbsp;&nbsp;<a
28 href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
29
30 <th class="navbar" width="100%"></th>
31 </tr>
32</table>
33<table width="100%" cellpadding="0" cellspacing="0">
34 <tr valign="top">
35 <td width="100%">
36 <span class="breadcrumbs">
37 <a href="apiclient-module.html">Package&nbsp;apiclient</a> ::
38 Module&nbsp;schema
39 </span>
40 </td>
41 <td>
42 <table cellpadding="0" cellspacing="0">
43 <!-- hide/show private -->
44 <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
45 onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
46 <tr><td align="right"><span class="options"
47 >[<a href="frames.html" target="_top">frames</a
48 >]&nbsp;|&nbsp;<a href="apiclient.schema-module.html"
49 target="_top">no&nbsp;frames</a>]</span></td></tr>
50 </table>
51 </td>
52 </tr>
53</table>
54<!-- ==================== MODULE DESCRIPTION ==================== -->
55<h1 class="epydoc">Module schema</h1><p class="nomargin-top"><span class="codelink"><a href="apiclient.schema-pysrc.html">source&nbsp;code</a></span></p>
56<pre class="literalblock">
57Schema processing for discovery based APIs
58
59Schemas holds an APIs discovery schemas. It can return those schema as
60deserialized JSON objects, or pretty print them as prototype objects that
61conform to the schema.
62
63For example, given the schema:
64
65 schema = &quot;&quot;&quot;{
66 &quot;Foo&quot;: {
67 &quot;type&quot;: &quot;object&quot;,
68 &quot;properties&quot;: {
69 &quot;etag&quot;: {
70 &quot;type&quot;: &quot;string&quot;,
71 &quot;description&quot;: &quot;ETag of the collection.&quot;
72 },
73 &quot;kind&quot;: {
74 &quot;type&quot;: &quot;string&quot;,
75 &quot;description&quot;: &quot;Type of the collection ('calendar#acl').&quot;,
76 &quot;default&quot;: &quot;calendar#acl&quot;
77 },
78 &quot;nextPageToken&quot;: {
79 &quot;type&quot;: &quot;string&quot;,
80 &quot;description&quot;: &quot;Token used to access the next
81 page of this result. Omitted if no further results are available.&quot;
82 }
83 }
84 }
85 }&quot;&quot;&quot;
86
87 s = Schemas(schema)
88 print s.prettyPrintByName('Foo')
89
90 Produces the following output:
91
92 {
93 &quot;nextPageToken&quot;: &quot;A String&quot;, # Token used to access the
94 # next page of this result. Omitted if no further results are available.
95 &quot;kind&quot;: &quot;A String&quot;, # Type of the collection ('calendar#acl').
96 &quot;etag&quot;: &quot;A String&quot;, # ETag of the collection.
97 },
98
99The constructor takes a discovery document in which to look up named schema.
100
101</pre>
102
103<hr />
104<div class="fields"> <p><strong>Author:</strong>
105 jcgregorio@google.com (Joe Gregorio)
106 </p>
107</div><!-- ==================== CLASSES ==================== -->
108<a name="section-Classes"></a>
109<table class="summary" border="1" cellpadding="3"
110 cellspacing="0" width="100%" bgcolor="white">
111<tr bgcolor="#70b0f0" class="table-header">
112 <td colspan="2" class="table-header">
113 <table border="0" cellpadding="0" cellspacing="0" width="100%">
114 <tr valign="top">
115 <td align="left"><span class="table-header">Classes</span></td>
116 <td align="right" valign="top"
117 ><span class="options">[<a href="#section-Classes"
118 class="privatelink" onclick="toggle_private();"
119 >hide private</a>]</span></td>
120 </tr>
121 </table>
122 </td>
123</tr>
124<tr>
125 <td width="15%" align="right" valign="top" class="summary">
126 <span class="summary-type">&nbsp;</span>
127 </td><td class="summary">
128 <a href="apiclient.schema.Schemas-class.html" class="summary-name">Schemas</a><br />
129 Schemas for an API.
130 </td>
131 </tr>
132<tr class="private">
133 <td width="15%" align="right" valign="top" class="summary">
134 <span class="summary-type">&nbsp;</span>
135 </td><td class="summary">
136 <a href="apiclient.schema._SchemaToStruct-class.html" class="summary-name" onclick="show_private();">_SchemaToStruct</a><br />
137 Convert schema to a prototype object.
138 </td>
139 </tr>
140</table>
Joe Gregorio5dc0f5c2012-06-05 13:34:31 -0400141<!-- ==================== NAVIGATION BAR ==================== -->
142<table class="navbar" border="0" width="100%" cellpadding="0"
143 bgcolor="#a0c0ff" cellspacing="0">
144 <tr valign="middle">
145
146 <!-- Tree link -->
147 <th>&nbsp;&nbsp;&nbsp;<a
148 href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
149
150 <!-- Index link -->
151 <th>&nbsp;&nbsp;&nbsp;<a
152 href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>
153
154 <!-- Help link -->
155 <th>&nbsp;&nbsp;&nbsp;<a
156 href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
157
158 <th class="navbar" width="100%"></th>
159 </tr>
160</table>
161<table border="0" cellpadding="0" cellspacing="0" width="100%%">
162 <tr>
163 <td align="left" class="footer">
Joe Gregoriof4839b02012-09-06 13:47:24 -0400164 Generated by Epydoc 3.0.1 on Thu Sep 6 13:36:11 2012
Joe Gregorio5dc0f5c2012-06-05 13:34:31 -0400165 </td>
166 <td align="right" class="footer">
167 <a target="mainFrame" href="http://epydoc.sourceforge.net"
168 >http://epydoc.sourceforge.net</a>
169 </td>
170 </tr>
171</table>
172
173<script type="text/javascript">
174 <!--
175 // Private objects are initially displayed (because if
176 // javascript is turned off then we want them to be
177 // visible); but by default, we want to hide them. So hide
178 // them unless we have a cookie that says to show them.
179 checkCookie();
180 // -->
181</script>
182</body>
183</html>