Skip to content

Commit ae3672a

Browse files
committed
add documentation
1 parent f943e02 commit ae3672a

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,23 @@ yarn:
3434
yarn add @ftrack/api
3535
```
3636

37+
## TypeScript: Generated Schema Types
38+
39+
You can generate schema types for your own workspace with [@ftrack/ts-schema-generator](https://github.com/ftrackhq/ftrack-ts-schema-generator).
40+
41+
Once generated, you can integrate them with @ftrack/api by passing them as a type variable:
42+
43+
```ts
44+
import SchemaTypes from "./__generated__/schema.ts"
45+
import { Session } from @ftrack/api
46+
47+
const session = new Session<SchemaTypes>(...);
48+
49+
// user will now be of type User
50+
// and provide all available properties for its entity type.
51+
const user = await session.query<"User">("...");
52+
```
53+
3754
## Tutorial
3855

3956
The API uses sessions to manage communication with an ftrack server. Create a session that connects to your ftrack server (changing the passed values as appropriate):

0 commit comments

Comments
 (0)