You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* feat: introduced basic type map
For later extensibility.
* feat: use stronger types
* fix: tests pass
* fix: compile issues
* fix: better `ensure` types
* fix: keyof everywhere
* Update source/types.ts
Co-authored-by: Lars Johansson <[email protected]>
* Refinements
* K to TEntityType
* Make the entitytype key the base for the responses as well
* Review Fixes
* TS/Prettier/Import fixes
* Made EntityType generic naming consistent
* WIP
* send tentitytypemap as a generic
* add documentation
---------
Co-authored-by: Mathias Lorenzen <[email protected]>
Co-authored-by: Mathias Lykkegaard Lorenzen <[email protected]>
Co-authored-by: Lars Johansson <[email protected]>
Co-authored-by: Lars Johansson <[email protected]>
Copy file name to clipboardExpand all lines: README.md
+17Lines changed: 17 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -34,6 +34,23 @@ yarn:
34
34
yarn add @ftrack/api
35
35
```
36
36
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
+
importSchemaTypesfrom"./__generated__/schema.ts"
45
+
import { Session } from @ftrack/api
46
+
47
+
const session =newSession<SchemaTypes>(...);
48
+
49
+
// user will now be of type User
50
+
// and provide all available properties for its entity type.
51
+
const user =awaitsession.query<"User">("...");
52
+
```
53
+
37
54
## Tutorial
38
55
39
56
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