From 320ff939b1360ad99789252fb0cf584698f82b96 Mon Sep 17 00:00:00 2001 From: andurilchao Date: Wed, 7 Aug 2024 10:06:25 -0700 Subject: [PATCH] Update README.md --- README.md | 77 ++++++++++++++++++++++++++++++++----------------------- 1 file changed, 45 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index e1d7ef4..e23ee0c 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,24 @@ -# anduril-javascript +# Anduril SDK Javascript + +The official [Anduril](https://www.anduril.com/) client library. + +## Requirements + +[Active LTS Node.js version](https://nodejs.org/en/about/previous-releases) +08/24: Node.js 20 or later + +## Installation + +### Authentication + +To authenticate with the Github package repository, you will need to generate a [personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-personal-access-token-classic). This should have at least `read:packages` scope. Please keep the token safe for the next stage of the setup procedure. ### .npmrc Create a file in the package directory ``` @anduril:registry=https://npm.pkg.github.com -//npm.pkg.github.com/:_authToken= +//npm.pkg.github.com/:_authToken= ``` ### package.json @@ -20,45 +33,45 @@ Create a file in the package directory } ``` -### Index.ts +## Usage + +Index.ts -```ts -import { EntityManagerAPI } from "@anduril/anduril-javascript/src/anduril/entitymanager/v1/entity_manager_api.pub_connect"; +```javascript +import { EntityManagerAPI } from "@anduril/anduril-javascript/src/anduril/entitymanager/v1/entity_manager_api.pub_connect.js"; import { createGrpcTransport } from "@connectrpc/connect-node"; import { createPromiseClient } from "@connectrpc/connect"; -import { PublishEntitiesRequest } from "@anduril/anduril-javascript/src/anduril/entitymanager/v1/entity_manager_api.pub_pb"; -import { Entity } from "@anduril/anduril-javascript/src/anduril/entitymanager/v1/entity.pub_pb"; -import { createWritableIterable } from "@connectrpc/connect/protocol"; -import { PartialMessage } from "@bufbuild/protobuf"; +import { Entity } from "@anduril/anduril-javascript/src/anduril/entitymanager/v1/entity.pub_pb.js"; const transport = createGrpcTransport({ - // Requests will be made to /./method - baseUrl: "https://desert-guardian.anduril.com", - - // You have to tell the Node.js http API which HTTP version to use. - httpVersion: "2", - - // Interceptors apply to all calls running through this transport. - interceptors: [], - }); + // Requests will be made to /./method + baseUrl: "https://desert-guardian.anduril.com", + + // You have to tell the Node.js http API which HTTP version to use. + httpVersion: "2", + + // Interceptors apply to all calls running through this transport. + interceptors: [], +}); async function main() { - const client = createPromiseClient(EntityManagerAPI, transport); - const headers = new Headers(); - headers.set("Authorization", "Bearer "); - - const entity = new Entity({ - entityId: "asdasd", - isLive: true, - description: "A new entity", - }) - - const resPut = await client.putEntity(request,{ headers: headers }); - console.log(resPut); + const client = createPromiseClient(EntityManagerAPI, transport); + const headers = new Headers(); + headers.set("Authorization", "Bearer "); + + const response = await client.getEntity( + { entityId: "" }, + { headers: headers }, + ); + console.log(response); } void main(); - +``` + +## Support + +For support with this library please [file an issue](https://github.com/anduril/anduril-javascript/issues/new) or reach out to your Anduril representative. + -````