npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

argil

v0.1.2

Published

JavaScript SDK for Argil's API

Downloads

8

Readme

Argil JavaScript SDK

Welcome to the Argil JavaScript SDK. This library provides a simple and intuitive interface to interact with Argil's API, allowing you to leverage the power of AI-driven workflows and automations in your JavaScript applications.

For the full Argil documentation, please visit https://docs.argil.ai.

Table of Contents

Installation

This library is distributed on npm. In order to add it as a dependency, run the following command:

npm install argil --save

or if you prefer using yarn:

yarn add argil

Usage

Here is a quick example of how to use the Argil JavaScript SDK:

  1. Import from argil and SDK instanciation

You can either provide the ARGIL_API_KEY environment variable and instantiate the SDK without passing any parameters:

import { ArgilSdk } from 'argil';

const sdk = new ArgilSdk();

Or pass the configuration parameters to the constructor:

import { ArgilSdk, ArgilSdkGlobalConfigParams } from 'argil';

const config: ArgilSdkGlobalConfigParams = {
  apiKey: 'your-api-key', // optional, can be provided with an environment variable named ARGIL_API_KEY
  apiUrl: 'https://api.argil.ai', // optional, default is 'https://api.argil.ai'
  synchronous: false, // optional, default is false. Defines if the workflows should run synchronously or not.
  defaultSyncTimeout: 60000, // optional, default is 60000 milliseconds for synchronous requests
  defaultAsyncTimeout: 2000, // optional, default is 2000 milliseconds for asynchronous requests
};

const sdk = new ArgilSdk(config);
  1. Use the SDK client to call Argil's API routes
// Run a workflow
const run = await sdk.workflows.run(
  'workflow-id',
  {
    "input_field_name1": $input_value1,
    "input_field_name2": $input_value2
    // Input fields depends on the workflow you run, please look at our full documentation.
  },
  { // An optional runtime config object to set options for this specific run.
    timeout: 5000, // optional, can override the default timeout for this specific request
    synchronous: true // optional, can override the default synchronous flag for this specific request
  }
);

// Get a workflow run
const workflowRun = await sdk.workflowRuns.get(run.id);

// Get all workflow runs
const workflowRuns = await sdk.workflowRuns.list();

API Reference

The Argil JavaScript SDK provides the following classes:

  • ArgilSdk: The main class that provides access to the different services.
  • Workflows: A class for interacting with the Workflows service of the Argil API.
  • WorkflowRuns: A class for interacting with the WorkflowRuns service of the Argil API.
  • ArgilSdkGlobalConfig: A class for managing the global configuration for the SDK.
  • ArgilSdkRuntimeConfig: A class for managing the runtime configuration for the SDK.
  • ArgilError: A custom error class for providing more detailed and specific error messages.

For more detailed information, please refer to the source code and inline comments.

Contributing

We welcome contributions from the community.

License

This project is licensed under the GPL-3.0-or-later license. For more information, see the LICENSE.md file.

Support

If you encounter any problems or have any questions, please open an issue on our GitHub repository.

Acknowledgements

This project uses the following open-source packages:

  • axios: Promise based HTTP client for the browser and node.js

Contact

For any inquiries, please contact us at [email protected].