blob: 1574957b38f29ca56c2dd4c8c384315d333649ff [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: module apiclient.schema</title>
</head><body bgcolor="#f0f0f8">
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong><a href="apiclient.html"><font color="#ffffff">apiclient</font></a>.schema</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/usr/local/google/home/jcgregorio/projects/apiclient-release/apiclient/schema.py">/usr/local/google/home/jcgregorio/projects/apiclient-release/apiclient/schema.py</a></font></td></tr></table>
<p><tt>Schema&nbsp;processing&nbsp;for&nbsp;discovery&nbsp;based&nbsp;APIs<br>
&nbsp;<br>
<a href="#Schemas">Schemas</a>&nbsp;holds&nbsp;an&nbsp;APIs&nbsp;discovery&nbsp;schemas.&nbsp;It&nbsp;can&nbsp;return&nbsp;those&nbsp;schema&nbsp;as<br>
deserialized&nbsp;JSON&nbsp;objects,&nbsp;or&nbsp;pretty&nbsp;print&nbsp;them&nbsp;as&nbsp;prototype&nbsp;objects&nbsp;that<br>
conform&nbsp;to&nbsp;the&nbsp;schema.<br>
&nbsp;<br>
For&nbsp;example,&nbsp;given&nbsp;the&nbsp;schema:<br>
&nbsp;<br>
&nbsp;schema&nbsp;=&nbsp;"""{<br>
&nbsp;&nbsp;&nbsp;"Foo":&nbsp;{<br>
&nbsp;&nbsp;&nbsp;&nbsp;"type":&nbsp;"<a href="__builtin__.html#object">object</a>",<br>
&nbsp;&nbsp;&nbsp;&nbsp;"properties":&nbsp;{<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"etag":&nbsp;{<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"type":&nbsp;"string",<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"description":&nbsp;"ETag&nbsp;of&nbsp;the&nbsp;collection."<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;},<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"kind":&nbsp;{<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"type":&nbsp;"string",<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"description":&nbsp;"Type&nbsp;of&nbsp;the&nbsp;collection&nbsp;('calendar#acl').",<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"default":&nbsp;"calendar#acl"<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;},<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"nextPageToken":&nbsp;{<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"type":&nbsp;"string",<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"description":&nbsp;"Token&nbsp;used&nbsp;to&nbsp;access&nbsp;the&nbsp;next<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;page&nbsp;of&nbsp;this&nbsp;result.&nbsp;Omitted&nbsp;if&nbsp;no&nbsp;further&nbsp;results&nbsp;are&nbsp;available."<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>
&nbsp;&nbsp;&nbsp;&nbsp;}<br>
&nbsp;&nbsp;&nbsp;}<br>
&nbsp;}"""<br>
&nbsp;<br>
&nbsp;s&nbsp;=&nbsp;<a href="#Schemas">Schemas</a>(schema)<br>
&nbsp;print&nbsp;s.prettyPrintByName('Foo')<br>
&nbsp;<br>
&nbsp;Produces&nbsp;the&nbsp;following&nbsp;output:<br>
&nbsp;<br>
&nbsp;&nbsp;{<br>
&nbsp;&nbsp;&nbsp;"nextPageToken":&nbsp;"A&nbsp;String",&nbsp;#&nbsp;Token&nbsp;used&nbsp;to&nbsp;access&nbsp;the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;next&nbsp;page&nbsp;of&nbsp;this&nbsp;result.&nbsp;Omitted&nbsp;if&nbsp;no&nbsp;further&nbsp;results&nbsp;are&nbsp;available.<br>
&nbsp;&nbsp;&nbsp;"kind":&nbsp;"A&nbsp;String",&nbsp;#&nbsp;Type&nbsp;of&nbsp;the&nbsp;collection&nbsp;('calendar#acl').<br>
&nbsp;&nbsp;&nbsp;"etag":&nbsp;"A&nbsp;String",&nbsp;#&nbsp;ETag&nbsp;of&nbsp;the&nbsp;collection.<br>
&nbsp;&nbsp;},<br>
&nbsp;<br>
The&nbsp;constructor&nbsp;takes&nbsp;a&nbsp;discovery&nbsp;document&nbsp;in&nbsp;which&nbsp;to&nbsp;look&nbsp;up&nbsp;named&nbsp;schema.</tt></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#aa55cc">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
<tr><td bgcolor="#aa55cc"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="copy.html">copy</a><br>
</td><td width="25%" valign=top><a href="json.html">json</a><br>
</td><td width="25%" valign=top></td><td width="25%" valign=top></td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ee77aa">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
<tr><td bgcolor="#ee77aa"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl>
<dt><font face="helvetica, arial"><a href="__builtin__.html#object">__builtin__.object</a>
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="apiclient.schema.html#Schemas">Schemas</a>
</font></dt></dl>
</dd>
</dl>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="Schemas">class <strong>Schemas</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt><a href="#Schemas">Schemas</a>&nbsp;for&nbsp;an&nbsp;API.<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="Schemas-__init__"><strong>__init__</strong></a>(self, discovery)</dt><dd><tt>Constructor.<br>
&nbsp;<br>
Args:<br>
&nbsp;&nbsp;discovery:&nbsp;<a href="__builtin__.html#object">object</a>,&nbsp;Deserialized&nbsp;discovery&nbsp;document&nbsp;from&nbsp;which&nbsp;we&nbsp;pull<br>
&nbsp;&nbsp;&nbsp;&nbsp;out&nbsp;the&nbsp;named&nbsp;schema.</tt></dd></dl>
<dl><dt><a name="Schemas-get"><strong>get</strong></a>(self, name)</dt><dd><tt>Get&nbsp;deserialized&nbsp;JSON&nbsp;schema&nbsp;from&nbsp;the&nbsp;schema&nbsp;name.<br>
&nbsp;<br>
Args:<br>
&nbsp;&nbsp;name:&nbsp;string,&nbsp;Schema&nbsp;name.</tt></dd></dl>
<dl><dt><a name="Schemas-prettyPrintByName"><strong>prettyPrintByName</strong></a>(self, name)</dt><dd><tt>Get&nbsp;pretty&nbsp;printed&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;prototype&nbsp;from&nbsp;the&nbsp;schema&nbsp;name.<br>
&nbsp;<br>
Args:<br>
&nbsp;&nbsp;name:&nbsp;string,&nbsp;Name&nbsp;of&nbsp;schema&nbsp;in&nbsp;the&nbsp;discovery&nbsp;document.<br>
&nbsp;<br>
Returns:<br>
&nbsp;&nbsp;string,&nbsp;A&nbsp;string&nbsp;that&nbsp;contains&nbsp;a&nbsp;prototype&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;with<br>
&nbsp;&nbsp;&nbsp;&nbsp;comments&nbsp;that&nbsp;conforms&nbsp;to&nbsp;the&nbsp;given&nbsp;schema.</tt></dd></dl>
<dl><dt><a name="Schemas-prettyPrintSchema"><strong>prettyPrintSchema</strong></a>(self, schema)</dt><dd><tt>Get&nbsp;pretty&nbsp;printed&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;prototype&nbsp;of&nbsp;schema.<br>
&nbsp;<br>
Args:<br>
&nbsp;&nbsp;schema:&nbsp;<a href="__builtin__.html#object">object</a>,&nbsp;Parsed&nbsp;JSON&nbsp;schema.<br>
&nbsp;<br>
Returns:<br>
&nbsp;&nbsp;string,&nbsp;A&nbsp;string&nbsp;that&nbsp;contains&nbsp;a&nbsp;prototype&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;with<br>
&nbsp;&nbsp;&nbsp;&nbsp;comments&nbsp;that&nbsp;conforms&nbsp;to&nbsp;the&nbsp;given&nbsp;schema.</tt></dd></dl>
<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
</td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#55aa55">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
<tr><td bgcolor="#55aa55"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><strong>__author__</strong> = 'jcgregorio@google.com (Joe Gregorio)'</td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#7799ee">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Author</strong></big></font></td></tr>
<tr><td bgcolor="#7799ee"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%">jcgregorio@google.com&nbsp;(Joe&nbsp;Gregorio)</td></tr></table>
</body></html>