Skip to content

Commit

Permalink
Merge pull request #176 from flotiq/feature/generating_packages_changes
Browse files Browse the repository at this point in the history
More information about posibble problems with sdk
  • Loading branch information
CiotkaCierpienia authored Apr 8, 2024
2 parents 56aec38 + 06e2575 commit f92cf81
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
7 changes: 5 additions & 2 deletions docs/API/generate-package.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,14 @@ openapi-generator generate -g <name> -i <path_to_open_api_schema_json> --skip-va
```
{ data-search-exclude }

_Worth to know is that you should have installed Java to run successfully command above._


Parameters description:

* `<name>` - name of framework/language you want to generate package for (ex. typescript-angular)
* `<name>` - name of framework/language you want to generate package for (ex. typescript-angular).
* `<path_to_open_api_schema_json>` - path to generated OpenApiSchema file.
* `<output_path>` - specify where you want to output your generated package
* `<output_path>` - specify where you want to output your generated package.

## Use Swagger Editor to generate server and client libraries

Expand Down
20 changes: 18 additions & 2 deletions docs/API/generate-package/sdk-nodejs.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ To use SDK in your project follow below steps:
2. In your `[projectDirectory]/flotiq-javascript-sdk/` run `npm i && npm run build`
3. In your `[projectDirectory]` run `npm i ./flotiq-javascript-sdk --save`

Possibly you would have to add `--legacy-peer-deps` to your commands, if you get plugin versions error.

_Other installation methods are described in [Additional usage methods](#additional-usage-methods) section._

### 2. Configure your SDK
Expand All @@ -28,6 +30,8 @@ To initialize SDK we will use `FlotiqUserApi.ApiClient.init` method, which requi
Your Flotiq API_KEY is located in the [Flotiq Dashboard](https://editor.flotiq.com).
If you need more directions go to the [docs](https://flotiq.com/docs/API/).

You can create empty file, where you put code with your configuration and requests, such as `app.js`

```javascript
const FlotiqUserApi = require("flotiq_user_api");
FlotiqUserApi.ApiClient.init("API_KEY");
Expand All @@ -50,7 +54,7 @@ let opts = {
};
api.listFlotiqblogauthor(opts).then(
function (data) {
console.log("API called successfully. Returned data: " + data);
console.log("API called successfully. Returned data: ", data);
},
function (error) {
console.error(error);
Expand All @@ -59,6 +63,18 @@ api.listFlotiqblogauthor(opts).then(
```
{ data-search-exclude }

Code above is just an example - you should copy code from `docs` folder in your sdk.

To call the code lets just use:


```
node app.js
```
{ data-search-exclude }


### 4. SDK NodeJS common use cases

The Main concept of Flotiq is that your API Specification represents your set of content definitions literally.
Expand Down Expand Up @@ -105,4 +121,4 @@ Finally, you need to build the module:
```
npm run build
```
{ data-search-exclude }
{ data-search-exclude }

0 comments on commit f92cf81

Please sign in to comment.