1.2.3 • Published 6 years ago

citrine-public-search v1.2.3

Weekly downloads
-
License
Apache 2
Repository
-
Last release
6 years ago

Public Search API Interface

This lib contains very specific wrappers around Citrination's public API. In specific, it consists of 3 exposed methods.

See source code on github

General Usage

npm install citrine-public-search

yarn add citrine-public-search

Then just reference the package, require('citrine-public-search'). The returned object literal will have the 3 methods described below bound to it.

Results Page

const citrinePublicSearch = require('citrine-public-search')

const userInput = <UserRequestObject>;
const <Result> = citrinePublicSearch.getResultsPageData(userInput);
UserRequestObject

The UserRequestObject is an array of Input objects See src/models/input on github for Input definitions. An example of this object can be found in examples/resultsPage

Result

See models/result for implementation details. The data key corresponds to an arbitrary object, which changes depending on endpoint.

An example of the data field of Result for the ResultsPage request can be found in examples/resultsPage/response

Suggested Results

In addition to the main page results, I also provide a suggestedInput array for the links at the bottom of the mockups.

The link should make a request to getResultsPageData with the provided suggestedInput and the only argument. Upon receipt, the page should update with the new values.

Dataset Page

const citrinePublicSearch = require('citrine-public-search')

const datasetId = <DatasetId>;
const <Result> = citrinePublicSearch.getDatasetPageData(datasetId);
DatasetId

The ID of the dataset you are requesting, as a number primitive

Result

See models/result for implementation details. The data key corresponds to an arbitrary object, which changes depending on endpoint.

An example of the data field of Result for the DatasetPage request can be found in examples/datasetPage/response

Material Page

const citrinePublicSearch = require('citrine-public-search')

const chemicalFormula = <ChemicalFormula>;
const <Result> = citrinePublicSearch.getMaterialPageData(datasetId);
ChemicalFormula

Just a string that represents a Chemical Formula. See examples/materialPage/request*.json for examples

Result

See models/result for implementation details. The data key corresponds to an arbitrary object, which changes depending on endpoint.

An example of the data field of Result for the MaterialPage request can be found in examples/materialPage/response*.json

Note that, depending on the material you are searching for, you may not get back certain values. For example, request.json doesn't return dois, imageUrls, or processDefinitions, while request2.json doesn't return any table data (unlikely but can occur) or composition. Be prepared to handle disparate data cases, but expect top level keys to always be served consistently.

1.2.3

6 years ago

1.2.2

6 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.5

6 years ago

1.1.4

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago