Skip to content

Commit

Permalink
Merge pull request #9 from liblaber/v1.0.0-1711120515666
Browse files Browse the repository at this point in the history
liblab SDK update v1.0.0
  • Loading branch information
david-liblab authored Mar 22, 2024
2 parents 5e4fa38 + eeabcab commit 2ba3045
Show file tree
Hide file tree
Showing 73 changed files with 611 additions and 388 deletions.
20 changes: 17 additions & 3 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
// This file was generated by liblab | https://liblab.com/ | https://liblab.com

{
"env": {
"browser": true,
"commonjs": true,
"es2021": true
},
"extends": ["airbnb-base", "airbnb-typescript/base", "prettier"],
"extends": [
"airbnb-base",
"airbnb-typescript/base",
"prettier"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module",
"project": "./tsconfig.eslint.json"
},
"plugins": ["@typescript-eslint", "prettier"],
"plugins": [
"@typescript-eslint",
"prettier"
],
"rules": {
"no-console": "off",
"max-len": [
Expand All @@ -31,7 +40,12 @@
"settings": {
"import/resolver": {
"node": {
"extensions": [".js", ".jsx", ".ts", ".tsx"]
"extensions": [
".js",
".jsx",
".ts",
".tsx"
]
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/build-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ jobs:
runs-on: ubuntu-latest

steps:

- name: Checkout Repository & Submo
uses: actions/checkout@v2
with:
Expand All @@ -31,3 +32,4 @@ jobs:

- name: Run Test & Coverage check
run: npm run test

3 changes: 2 additions & 1 deletion .github/workflows/release-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
node-version: '16'
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm publish --access public
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# This file was generated by liblab | https://liblab.com/ | https://liblab.com

# Logs
logs
*.log
Expand Down
24 changes: 17 additions & 7 deletions .manifest.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,34 @@
{
"liblabVersion": "1.1.41",
"date": "2024-03-22T13:04:28.295Z",
"date": "2024-03-22T15:15:03.183Z",
"config": {
"authentication": {
"access": {
"prefix": "Bearer"
}
},
"deliveryType": "zip",
"languages": ["typescript"],
"languages": [
"typescript"
],
"inputFileName": "/tmp/resources/spec/open-api-spec.json",
"environmentVariables": [],
"fileOutput": "/tmp",
"tempDir": "/tmp/liblab-codegen-1.1.41-RUQ6PG",
"tempDir": "/tmp/liblab-codegen-1.1.41-LFE9YH",
"inferServiceNames": false,
"httpLibrary": {
"name": "axios",
"packages": {
"axios": "^1.0.0"
},
"languages": ["javascript", "typescript"]
"languages": [
"javascript",
"typescript"
]
},
"auth": ["bearer"],
"auth": [
"bearer"
],
"privateRepo": false,
"githubRef": "",
"sdkName": "Petstoresdk",
Expand All @@ -40,12 +47,15 @@
"npmName": "dwjs",
"npmOrg": "dworg",
"injectedModels": [],
"includeWatermark": true,
"license": {
"type": "MIT",
"name": "MIT",
"url": "https://opensource.org/licenses/MIT"
},
"ignoreFiles": [".devcontainer"],
"ignoreFiles": [
".devcontainer"
],
"alwaysInitializeOptionals": false,
"environments": [],
"reservedKeywords": {},
Expand Down Expand Up @@ -152,4 +162,4 @@
"tsconfig.eslint.json",
"tsconfig.json"
]
}
}
2 changes: 2 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// This file was generated by liblab | https://liblab.com/ | https://liblab.com

{
"printWidth": 100,
"tabWidth": 2,
Expand Down
78 changes: 33 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,55 +1,38 @@
# Petstoresdk Typescript SDK 1.0.0

The Typescript SDK for Petstoresdk.

- API version: 1.0.0
- SDK version: 1.0.0

## Table of Contents

- [Installation](#installation)
- [Authentication](#authentication)
- [Access Token](#access-token)
- [Access Token](#access-token)
- [API Endpoint Services](#api-endpoint-services)
- [API Models](#api-models)
- [Sample Usage](#sample-usage)
- [Petstoresdk Services](#petstoresdk-services)
- [License](#license)

## Installation

```sh
npm install dwjs
npm install dwjs
```

## Authentication

To see whether an endpoint needs a specific type of authentication check the endpoint's documentation.

### Access Token

The Petstoresdk API uses access tokens as a form of authentication. You can set the access token when initializing the SDK through the constructor:

```
const sdk = new Petstoresdk('YOUR_ACCESS_TOKEN')
```

Or through the `setAccessToken` method:

```
const sdk = new Petstoresdk()
sdk.setAccessToken('YOUR_ACCESS_TOKEN')
```

You can also set it for each service individually:

```
const sdk = new Petstoresdk()
sdk.pets.setAccessToken('YOUR_ACCESS_TOKEN')
```

## Sample Usage

Here is a simple program demonstrating usage of this SDK. It can also be found in the `examples/src/index.ts` file in this directory.

When running the sample make sure to use `npm install` to install all the dependencies.
Expand All @@ -70,55 +53,55 @@ const sdk = new Petstoresdk({ accessToken: process.env.PETSTORESDK_ACCESS_TOKEN
console.error(error.message);
}
})();


```

# Petstoresdk Services

A list of all services and services methods.

- Services

- [Pets](#pets)

- [Pets](#pets)
- [All Methods](#all-methods)


## Pets

| Method | Description |
| :-------------------------- | :---------------------- |
| [createPets](#createpets) | Create a pet |
| [listPets](#listpets) | List all pets |
| Method | Description|
| :-------- | :----------|
| [createPets](#createpets) | Create a pet |
| [listPets](#listpets) | List all pets |
| [showPetById](#showpetbyid) | Info for a specific pet |




## All Methods

### **createPets**

### **createPets**
Create a pet

- HTTP Method: POST
- Endpoint: /pets

**Required Parameters**

| input | object | Request body. |



**Return Type**

Returns a dict object.

**Example Usage Code Snippet**

```Typescript
import { Petstoresdk } from '@dworg/dwjs';


const sdk = new Petstoresdk({ accessToken: process.env.PETSTORESDK_ACCESS_TOKEN });

(async () => {
const input = {"id":-67521967,"name":"name","tag":"tag"};
const input = {"id":-72189192,"name":"name","tag":"tag"};
const result = await sdk.pets
.createPets(input);
console.log(result);
Expand All @@ -127,26 +110,25 @@ const sdk = new Petstoresdk({ accessToken: process.env.PETSTORESDK_ACCESS_TOKEN
```

### **listPets**

List all pets

- HTTP Method: GET
- Endpoint: /pets


**Optional Parameters**

Optional parameters are passed as part of the last parameter to the method. Ex. {optionalParam1 : 'value1', optionalParam2: 'value2'}

| Name | Type | Description |
| :---- | :----- | :--------------------------------------------- |
| Name | Type| Description |
| :-------- | :----------| :----------|
| limit | number | How many items to return at one time (max 100) |


**Return Type**

Pets

**Example Usage Code Snippet**

```Typescript
import { Petstoresdk } from '@dworg/dwjs';

Expand All @@ -155,31 +137,30 @@ const sdk = new Petstoresdk({ accessToken: process.env.PETSTORESDK_ACCESS_TOKEN

(async () => {
const result = await sdk.pets
.listPets({ limit: -47508293 });
.listPets({ limit: -75416899 });
console.log(result);
})();

```

### **showPetById**

Info for a specific pet

- HTTP Method: GET
- Endpoint: /pets/{petId}

**Required Parameters**

| Name | Type | Description |
| :---- | :----- | :---------------------------- |
| Name | Type| Description |
| :-------- | :----------| :----------|
| petId | string | The id of the pet to retrieve |



**Return Type**

Pet

**Example Usage Code Snippet**

```Typescript
import { Petstoresdk } from '@dworg/dwjs';

Expand All @@ -194,6 +175,13 @@ const sdk = new Petstoresdk({ accessToken: process.env.PETSTORESDK_ACCESS_TOKEN

```

## License


<!-- This file was generated by liblab | https://liblab.com/ | https://liblab.com -->


## License
License: MIT. See license in LICENSE.

<!-- This file was generated by liblab | https://liblab.com/ | https://liblab.com -->

2 changes: 2 additions & 0 deletions examples/.env.example
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# This file was generated by liblab | https://liblab.com/ | https://liblab.com

PETSTORESDK_TOKEN=
4 changes: 0 additions & 4 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,23 @@
# @dworg/dwjs-example

A basic example of how to use the @dworg/dwjs package.

## Installation

In the event `@dworg/dwjs` is not published to npm, you can install it locally by running the following command in the examples folder:

```sh
npm run setup
```

This will rebuild the parent package and install it locally.

Otherwise you can install it from npm:

```sh
npm install @dworg/dwjs
```

## Usage

To run the example, run the following command in the examples folder:

```sh
npm run start
```
Loading

0 comments on commit 2ba3045

Please sign in to comment.