The @helixml/apps-client
library is a TypeScript-based tool for interacting with data stored in Helix Cloud. It utilizes Axios for making HTTP requests, and offers methods for retrieving, updating, and manipulating data.
Retrieving Data
To retrieve data from Helix Cloud, you can use the get
method provided by @helixml/apps-client
. Here’s an example:
import { Client } from '@helixml/apps-client';
const client = new Client('https://your-helix-cloud-instance.com');
client.get('/data/your-data-endpoint')
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error(error);
});
This code creates a new instance of the Client
class, then makes a GET request to the specified endpoint. The response data is then logged to the console.
Updating Data
To update data in Helix Cloud, you can use the put
method provided by @helixml/apps-client
. Here’s an example:
import { Client } from '@helixml/apps-client';
const client = new Client('https://your-helix-cloud-instance.com');
const updatedData = {
field1: 'new value',
field2: 42,
};
client.put('/data/your-data-endpoint', updatedData)
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error(error);
});
This code creates a new instance of the Client
class, then makes a PUT request to the specified endpoint with the updated data. The response data is then logged to the console.
Manipulating Data
@helixml/apps-client
also provides methods for deleting data (delete
) and creating new data (post
). Here’s an example of using delete
:
import { Client } from '@helixml/apps-client';
const client = new Client('https://your-helix-cloud-instance.com');
client.delete('/data/your-data-endpoint/123')
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error(error);
});
This code makes a DELETE request to the specified endpoint and ID, removing the corresponding data.
For creating new data, you can use the post
method:
import { Client } from '@helixml/apps-client';
const client = new Client('https://your-helix-cloud-instance.com');
const newData = {
field1: 'new value',
field2: 42,
};
client.post('/data/your-data-endpoint', newData)
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error(error);
});
This code makes a POST request to the specified endpoint with the new data, creating a new record.
Sources:
- Scalable data ingestion abstraction for ClickHouse | GitLab
- FAQ | Vault | HashiCorp Developer
- Red Hat Integration Overview | Red Hat Developer
- Hive - A Petabyte Scale Data Warehouse using Hadoop - Engineering at Meta
- Why I love OwnCloud: answer to Dropbox lock-in | Opensource.com
- Data Transfer Project: Portability between services - Engineering at Meta
- 4 open source alternatives to Microsoft Access | Opensource.com
- Michael Zamot | Opensource.com
- Popular community plugins that can improve your Grafana dashboards | Grafana Labs
- Open source and open data’s role in Nepal earthquake relief | Opensource.com
- Questions we should ask about COVID-19 contact-tracing apps | Opensource.com
- Data as a microservice: Distributed data-focused integration | Red Hat Developer