Skip to content

Commit 5401b8e

Browse files
committed
Revert "Remove duplicated instructions"
This reverts commit 7bdbaf9.
1 parent f0ebc39 commit 5401b8e

File tree

1 file changed

+59
-1
lines changed

1 file changed

+59
-1
lines changed

README.md

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,65 @@ The official [Anduril](https://www.anduril.com/) client library.
99

1010
## Installation
1111

12-
To install the JavaScript gRPC SDK, go to [Install JavaScript gRPC SDK](https://docs.anduril.com/sdks/javascript).
12+
### Authentication
13+
14+
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.
15+
16+
### .npmrc
17+
Create a file in the package directory
18+
19+
```
20+
@anduril:registry=https://npm.pkg.github.com
21+
//npm.pkg.github.com/:_authToken=<GITHUB_PERSONAL_ACCESS_TOKEN>
22+
```
23+
24+
### package.json
25+
Create a file in the package directory
26+
27+
```json
28+
{
29+
"dependencies": {
30+
"@anduril/anduril-javascript": "1.0.6",
31+
"@connectrpc/connect-node": "1.4.0"
32+
}
33+
}
34+
```
35+
36+
## Usage
37+
38+
Index.ts
39+
40+
```javascript
41+
import { EntityManagerAPI } from "@anduril/anduril-javascript/src/anduril/entitymanager/v1/entity_manager_api.pub_connect.js";
42+
import { createGrpcTransport } from "@connectrpc/connect-node";
43+
import { createPromiseClient } from "@connectrpc/connect";
44+
import { Entity } from "@anduril/anduril-javascript/src/anduril/entitymanager/v1/entity.pub_pb.js";
45+
46+
const transport = createGrpcTransport({
47+
// Requests will be made to <baseUrl>/<package>.<service>/method
48+
baseUrl: "https://desert-guardian.anduril.com",
49+
50+
// You have to tell the Node.js http API which HTTP version to use.
51+
httpVersion: "2",
52+
53+
// Interceptors apply to all calls running through this transport.
54+
interceptors: [],
55+
});
56+
57+
async function main() {
58+
const client = createPromiseClient(EntityManagerAPI, transport);
59+
const headers = new Headers();
60+
headers.set("Authorization", "Bearer <YOUR BEAERER TOKEN>");
61+
62+
const response = await client.getEntity(
63+
{ entityId: "<ENTITY ID>" },
64+
{ headers: headers },
65+
);
66+
console.log(response);
67+
}
68+
69+
void main();
70+
```
1371

1472
## Support
1573

0 commit comments

Comments
 (0)