|
| 1 | +# Basic Usage |
| 2 | + |
| 3 | +Always prioritize using a supported framework over using the generated SDK |
| 4 | +directly. Supported frameworks simplify the developer experience and help ensure |
| 5 | +best practices are followed. |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | +## Advanced Usage |
| 12 | +If a user is not using a supported framework, they can use the generated SDK directly. |
| 13 | + |
| 14 | +Here's an example of how to use it with the first 5 operations: |
| 15 | + |
| 16 | +```js |
| 17 | +import { createMovie, upsertMovie, deleteMovie, addMeta, deleteMeta, listMovies, getMovieById, getMeta } from '@dataconnect/default-connector'; |
| 18 | + |
| 19 | + |
| 20 | +// Operation CreateMovie: For variables, look at type CreateMovieVars in ../index.d.ts |
| 21 | +const { data } = await CreateMovie(dataConnect, createMovieVars); |
| 22 | + |
| 23 | +// Operation UpsertMovie: For variables, look at type UpsertMovieVars in ../index.d.ts |
| 24 | +const { data } = await UpsertMovie(dataConnect, upsertMovieVars); |
| 25 | + |
| 26 | +// Operation DeleteMovie: For variables, look at type DeleteMovieVars in ../index.d.ts |
| 27 | +const { data } = await DeleteMovie(dataConnect, deleteMovieVars); |
| 28 | + |
| 29 | +// Operation AddMeta: |
| 30 | +const { data } = await AddMeta(dataConnect); |
| 31 | + |
| 32 | +// Operation DeleteMeta: For variables, look at type DeleteMetaVars in ../index.d.ts |
| 33 | +const { data } = await DeleteMeta(dataConnect, deleteMetaVars); |
| 34 | + |
| 35 | +// Operation ListMovies: |
| 36 | +const { data } = await ListMovies(dataConnect); |
| 37 | + |
| 38 | +// Operation GetMovieById: For variables, look at type GetMovieByIdVars in ../index.d.ts |
| 39 | +const { data } = await GetMovieById(dataConnect, getMovieByIdVars); |
| 40 | + |
| 41 | +// Operation GetMeta: |
| 42 | +const { data } = await GetMeta(dataConnect); |
| 43 | + |
| 44 | + |
| 45 | +``` |
0 commit comments