@grantgraph/actions
v0.1.53
Published
## Introduction
Readme
GrantGraph Actions
Introduction
GrantGraph Actions is our company's API functions, facilitating the interaction with our data.
Table of Contents
Installation
To incorporate GrantGraph Actions into your project, install the npm lib: The lib won't work if you don't have aws credentials for the GG AWS Cloud installed on the machine you're using the library on.
npm install @grantgraph/actionsUsage
After installation, you can import the API functions as follows:
import { getGrant } from "@grantgraph/actions";API Reference
getGrant
Retrieves the details of a grant by its ID.
// Function signature
getGrant({grantId: string}): Promise<GrantEntry | null>;Parameters:
grantId: The unique identifier for the grant.
Returns:
- A promise that resolves to the grant details object or null if not found.
getGrants
Retrieves a set of grants. If you pass the grantIds object limit will be ignored.
// Function signature
getGrants({
grantIds?: string[]
limit?: number | 'all'
}): Promise<GrantEntry[] | null>;Parameters:
grantIds: The ids of the grants you want.limit: The amount of non-specific grants you want to pull.
Returns:
- A promise that resolves to the grant details or null if not found.
Configuration
You'll need the env var GRANTS_TABLE running in your env. If you're using NextJS this will come from your .env.local file that we create from the vercel env pull. If you're using this in notebooks etc you'll want to use the dotenv lib to load the vars from whatever .env file you wanna use.
GRANTS_TABLE=your_dynamodb_grants_table_nameReplace your_dynamodb_grants_table_name with the actual table name you are using in DynamoDB.
