Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New API design for the package with Types class #9

Merged
merged 7 commits into from
Nov 13, 2023
Merged

Conversation

niloysikdar
Copy link
Member

@niloysikdar niloysikdar commented Nov 12, 2023

This Pull Request covers the major rewrite of the classes and methods of the hypercode npm package; Contains breaking changes. Also, removes all external 3rd party dependencies to make our package lighter and independent.

Before:

import hyper from "hypercode";

const result = await hyper.string('Who is the CEO of SpaceX?', "context-123");

Now

import { Hyper } from "hypercode";

const hyper = new Hyper("hyper_123");

const { data, error } = await hyper.types.string('Who is the CEO of SpaceX?', {
  contextId: "context-123",
});

Other Hyper API endpoints will have separate subclasses and methods (coming soon).

Example:

const { data, error } = await hyper.contexts.list();
// This will return all the created contexts inside the `data` field
// https://docs.gethyper.ai/context#get-v1-contexts


const { data, error } = await hyper.search.execute("quarterly sales report", {
  contextId: "context-123",
});
// This will perform nuanced searches across integrated third-party data sources and internal documents, and return the result inside the `data` field
// https://docs.gethyper.ai/search#post-v1-search

add `Types` subclass to the `Hyper` class to access `/types` endpoints

BREAKING CHANGE: New Hyper API and methods
add more methods to the `Types` class
add missing tests for `string`, `integer`, `float`, `boolean` and `datetime` methods
remove second param `contextId` for the types' methods and pass `contextId` inside optional
`options` param
@niloysikdar niloysikdar merged commit a0969c4 into main Nov 13, 2023
10 checks passed
@niloysikdar niloysikdar deleted the new-api branch November 13, 2023 16:33
Copy link

🎉 This PR is included in version 2.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant