UNPKG

common-core-api

Version:

Pre-Beta. Wrapper for common-standards-project api

88 lines (68 loc) 3.31 kB
### common-core-api Implementation of http://commonstandardsproject.com api for Node.js/Npm Git for common-standards-project: https://github.com/commoncurriculum/common-standards-project Uses https://www.algolia.com for search as instructed in http://commonstandardsproject.com docs algoliasearch-client-js -> https://github.com/algolia/algoliasearch-client-js ### Api <font style="font-family:monospace;"> <font color="#fa2a52">const</font> commonCoreApi = <font color="#5f9ea0">require</font>( <font color="#bb9c30">"common-core-api"</font> )<br> #### Connect <font style="font-family:monospace;"> <font color="#fa2a52">const</font> commonCore = <font color="#9400d3">commonCoreApi</font>( <font color="#bb9c30">"api-key"</font> , <font color="#bb9c30">"algolia-id"</font> , <font color="#bb9c30">"algolia-key"</font> ) </font> #### Use <font style="font-family:monospace;"><font color="#fa2a52">const</font> commonCore = <font color="#5f9ea0">require</font>( <font color="#bb9c30">"common-core-api"</font> )( <font color="#bb9c30">"api-key"</font> , <font color="#bb9c30">"algolia-id"</font> , <font color="#bb9c30">"algolia-key"</font> ) <br> Get jurisdictions <font style="color:#9400d3">commonCore</font><font color="#6e2094">.jurisdictions()</font> <br> Get jurisdiction <font style="color:#9400d3">commonCore</font><font color="#6e2094">.jurisdictions( <font color="#bb9c30">"jurisdiction.id"</font> )</font> <font style="color:#9400d3">commonCore</font><font color="#6e2094">.j( <font color="#bb9c30">"jurisdiction.id"</font> )</font> <br> Get standard_set <font style="color:#9400d3">commonCore</font><font color="#6e2094">.standard_sets( <font color="#bb9c30">"standard_set.id"</font> )</font> <font style="color:#9400d3">commonCore</font><font color="#6e2094">.ss( <font color="#bb9c30">"standard_set.id"</font> )</font> <br> Search <font style="color:#9400d3">commonCore</font><font color="#6e2094">.search( <font color="#bb9c30">"query"</font> )</font> <font style="color:#9400d3">commonCore</font><font color="#6e2094">.s( <font color="#bb9c30">"query"</font> )</font> <br> <font style="color:#9400d3">commonCore</font><font color="#6e2094">.get('url')</font> Url { protocol: 'http:', slashes: true, auth: null, host: 'commonstandardsproject.com', port: null, hostname: 'commonstandardsproject.com', hash: null, search: null, query: null, pathname: '/api/v1', path: '/api/v1', href: 'http://commonstandardsproject.com/api/v1' } <br> <font style="color:#9400d3">commonCore</font><font color="#6e2094">.get('schemas')</font> { jurs: { event: 'jurs', name: 'jurisdictions', description: 'Doc sample of request result', doc: [Getter] }, sets: { event: 'sets', name: 'standard-sets', description: 'Doc sample of request result', doc: [Getter] }, search: { event: 'search', name: 'algolia-search', description: 'Search result sample from algolia-search', doc: [Getter] } } </font> </font> #### Editing Currently no methods for interfacing with editing