Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 1 | <?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> <a |
| 20 | href="module-tree.html">Trees</a> </th> |
| 21 | |
| 22 | <!-- Index link --> |
| 23 | <th> <a |
| 24 | href="identifier-index.html">Indices</a> </th> |
| 25 | |
| 26 | <!-- Help link --> |
| 27 | <th> <a |
| 28 | href="help.html">Help</a> </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 apiclient</a> :: |
| 38 | Module 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 private</a>]</span></td></tr> |
| 46 | <tr><td align="right"><span class="options" |
| 47 | >[<a href="frames.html" target="_top">frames</a |
| 48 | >] | <a href="apiclient.schema-module.html" |
| 49 | target="_top">no 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 code</a></span></p> |
| 56 | <pre class="literalblock"> |
| 57 | Schema processing for discovery based APIs |
| 58 | |
| 59 | Schemas holds an APIs discovery schemas. It can return those schema as |
| 60 | deserialized JSON objects, or pretty print them as prototype objects that |
| 61 | conform to the schema. |
| 62 | |
| 63 | For example, given the schema: |
| 64 | |
| 65 | schema = """{ |
| 66 | "Foo": { |
| 67 | "type": "object", |
| 68 | "properties": { |
| 69 | "etag": { |
| 70 | "type": "string", |
| 71 | "description": "ETag of the collection." |
| 72 | }, |
| 73 | "kind": { |
| 74 | "type": "string", |
| 75 | "description": "Type of the collection ('calendar#acl').", |
| 76 | "default": "calendar#acl" |
| 77 | }, |
| 78 | "nextPageToken": { |
| 79 | "type": "string", |
| 80 | "description": "Token used to access the next |
| 81 | page of this result. Omitted if no further results are available." |
| 82 | } |
| 83 | } |
| 84 | } |
| 85 | }""" |
| 86 | |
| 87 | s = Schemas(schema) |
| 88 | print s.prettyPrintByName('Foo') |
| 89 | |
| 90 | Produces the following output: |
| 91 | |
| 92 | { |
| 93 | "nextPageToken": "A String", # Token used to access the |
| 94 | # next page of this result. Omitted if no further results are available. |
| 95 | "kind": "A String", # Type of the collection ('calendar#acl'). |
| 96 | "etag": "A String", # ETag of the collection. |
| 97 | }, |
| 98 | |
| 99 | The 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"> </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"> </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> |
| 141 | <!-- ==================== VARIABLES ==================== --> |
| 142 | <a name="section-Variables"></a> |
| 143 | <table class="summary" border="1" cellpadding="3" |
| 144 | cellspacing="0" width="100%" bgcolor="white"> |
| 145 | <tr bgcolor="#70b0f0" class="table-header"> |
| 146 | <td colspan="2" class="table-header"> |
| 147 | <table border="0" cellpadding="0" cellspacing="0" width="100%"> |
| 148 | <tr valign="top"> |
| 149 | <td align="left"><span class="table-header">Variables</span></td> |
| 150 | <td align="right" valign="top" |
| 151 | ><span class="options">[<a href="#section-Variables" |
| 152 | class="privatelink" onclick="toggle_private();" |
| 153 | >hide private</a>]</span></td> |
| 154 | </tr> |
| 155 | </table> |
| 156 | </td> |
| 157 | </tr> |
| 158 | <tr> |
| 159 | <td width="15%" align="right" valign="top" class="summary"> |
| 160 | <span class="summary-type"> </span> |
| 161 | </td><td class="summary"> |
| 162 | <a name="__package__"></a><span class="summary-name">__package__</span> = <code title="'apiclient'"><code class="variable-quote">'</code><code class="variable-string">apiclient</code><code class="variable-quote">'</code></code> |
| 163 | </td> |
| 164 | </tr> |
| 165 | </table> |
| 166 | <!-- ==================== NAVIGATION BAR ==================== --> |
| 167 | <table class="navbar" border="0" width="100%" cellpadding="0" |
| 168 | bgcolor="#a0c0ff" cellspacing="0"> |
| 169 | <tr valign="middle"> |
| 170 | |
| 171 | <!-- Tree link --> |
| 172 | <th> <a |
| 173 | href="module-tree.html">Trees</a> </th> |
| 174 | |
| 175 | <!-- Index link --> |
| 176 | <th> <a |
| 177 | href="identifier-index.html">Indices</a> </th> |
| 178 | |
| 179 | <!-- Help link --> |
| 180 | <th> <a |
| 181 | href="help.html">Help</a> </th> |
| 182 | |
| 183 | <th class="navbar" width="100%"></th> |
| 184 | </tr> |
| 185 | </table> |
| 186 | <table border="0" cellpadding="0" cellspacing="0" width="100%%"> |
| 187 | <tr> |
| 188 | <td align="left" class="footer"> |
Joe Gregorio | 0cd347a | 2012-08-30 08:22:27 -0400 | [diff] [blame] | 189 | Generated by Epydoc 3.0.1 on Thu Aug 30 07:12:42 2012 |
Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 190 | </td> |
| 191 | <td align="right" class="footer"> |
| 192 | <a target="mainFrame" href="http://epydoc.sourceforge.net" |
| 193 | >http://epydoc.sourceforge.net</a> |
| 194 | </td> |
| 195 | </tr> |
| 196 | </table> |
| 197 | |
| 198 | <script type="text/javascript"> |
| 199 | <!-- |
| 200 | // Private objects are initially displayed (because if |
| 201 | // javascript is turned off then we want them to be |
| 202 | // visible); but by default, we want to hide them. So hide |
| 203 | // them unless we have a cookie that says to show them. |
| 204 | checkCookie(); |
| 205 | // --> |
| 206 | </script> |
| 207 | </body> |
| 208 | </html> |