@helixml/apps-client
TypeScript icon, indicating that this package has built-in type declarations

0.1.3 • Public • Published

@helixml/apps-client

helix logo

The @helixml/apps-client is the client library to interact with apps hosted on Helix Cloud.

Installation

To use the @helixml/apps-client in your project, install it via npm:

npm install @helixml/apps-client

or using yarn:

yarn add @helixml/apps-client

Usage

Import and use the AppClient component in your React application:

import { useCallback } from 'react';
import AppClient from '@helixml/apps-client';

const app = AppClient({
  // this api token is for a Helix app that has been linked to github.
  token: 'APP_API_TOKEN',
})

function App() {
  const handleBackend = useCallback(async () => {
    const result = await app.runScript({
      file_path: '/gptscripts/helloworld.gpt',
      input: 'Oranges',
    });

    if(result.error) {
      throw new Error(result.error);
    } else {
      alert(result.output);
    }
  }, []);

  return (
    <div className="App">
      <button
        onClick={ handleBackend }
      >
        Run a cool GPTScript
      </button>
    </div>
  );
}

export default App;

License

This project is licensed under the MIT License - see the LICENSE file for details.

Readme

Keywords

none

Package Sidebar

Install

npm i @helixml/apps-client

Weekly Downloads

6

Version

0.1.3

License

MIT

Unpacked Size

46.6 kB

Total Files

6

Last publish

Collaborators

  • philwinder
  • binocarlos