Skip to content

Commit

Permalink
feat: generate new library from updated openapi file
Browse files Browse the repository at this point in the history
  • Loading branch information
paigen11 committed Sep 11, 2023
1 parent 1f02857 commit 339a6e1
Show file tree
Hide file tree
Showing 10 changed files with 526 additions and 46 deletions.
3 changes: 3 additions & 0 deletions src/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ docs/Route.md
docs/RouteApi.md
docs/RouteLogsApi.md
docs/RouteSchema.md
docs/Slack.md
docs/Snowflake.md
docs/SnowflakeTransform.md
docs/Thingworx.md
Expand Down Expand Up @@ -164,10 +165,12 @@ src/model/Radresponder.js
src/model/Role.js
src/model/Route.js
src/model/RouteSchema.js
src/model/Slack.js
src/model/Snowflake.js
src/model/SnowflakeTransform.js
src/model/Thingworx.js
src/model/TowerLocation.js
src/model/Twilio.js
src/model/UpdateFleetRequest.js
src/model/UserDbRoute.js
test/model/Slack.spec.js
1 change: 1 addition & 0 deletions src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ All URIs are relative to *https://api.notefile.net*
- [NotehubJs.Role](docs/Role.md)
- [NotehubJs.Route](docs/Route.md)
- [NotehubJs.RouteSchema](docs/RouteSchema.md)
- [NotehubJs.Slack](docs/Slack.md)
- [NotehubJs.Snowflake](docs/Snowflake.md)
- [NotehubJs.SnowflakeTransform](docs/SnowflakeTransform.md)
- [NotehubJs.Thingworx](docs/Thingworx.md)
Expand Down
4 changes: 4 additions & 0 deletions src/docs/Route.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,7 @@
- `thingworx` (value: `"thingworx"`)

- `snowflake` (value: `"snowflake"`)

- `slack-bearer` (value: `"slack-bearer"`)

- `slack-webhook` (value: `"slack-webhook"`)
83 changes: 44 additions & 39 deletions src/docs/RouteSchema.md

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions src/docs/Slack.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# NotehubJs.Slack

## Properties

| Name | Type | Description | Notes |
| -------------- | ----------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------- |
| **fleets** | **[String]** | list of Fleet UIDs to apply route to, if any. If empty, applies to all Fleets | [optional] |
| **filter** | [**HttpFilter**](HttpFilter.md) | | [optional] |
| **transform** | [**SnowflakeTransform**](SnowflakeTransform.md) | | [optional] |
| **throttleMs** | **Number** | Minimum time between requests in Miliseconds | [optional] |
| **timeout** | **Number** | Timeout in seconds for each request | [optional] [default to 15] |
| **slackType** | **String** | The type of Slack message. Must be one of \"slack-bearer\" for Bearer Token or \"slack-webhook\" for Webhook messages | [optional] |
| **bearer** | **String** | The Bearer Token for Slack messaging, if the \"slack-bearer\" type is selected | [optional] |
| **channel** | **String** | The Channel ID for Bearer Token method, if the \"slack-bearer\" type is selected | [optional] |
| **webhookUrl** | **String** | The Webhook URL for Slack Messaging if the \"slack-webhook\" type is selected | [optional] |
| **text** | **String** | The simple text message to be sent, if the blocks message field is not in use. Placeholders are available for this field. | [optional] |
| **blocks** | **String** | The Blocks message to be sent. If populated, this field overrides the text field within the Slack Messaging API. Placeholders are available for this field. | [optional] |
7 changes: 7 additions & 0 deletions src/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ import Radresponder from "./model/Radresponder";
import Role from "./model/Role";
import Route from "./model/Route";
import RouteSchema from "./model/RouteSchema";
import Slack from "./model/Slack";
import Snowflake from "./model/Snowflake";
import SnowflakeTransform from "./model/SnowflakeTransform";
import Thingworx from "./model/Thingworx";
Expand Down Expand Up @@ -505,6 +506,12 @@ export {
*/
RouteSchema,

/**
* The Slack model constructor.
* @property {module:model/Slack}
*/
Slack,

/**
* The Snowflake model constructor.
* @property {module:model/Snowflake}
Expand Down
12 changes: 12 additions & 0 deletions src/src/model/Route.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,18 @@ Route["RouteTypeEnum"] = {
* @const
*/
snowflake: "snowflake",

/**
* value: "slack-bearer"
* @const
*/
"slack-bearer": "slack-bearer",

/**
* value: "slack-webhook"
* @const
*/
"slack-webhook": "slack-webhook",
};

export default Route;
64 changes: 57 additions & 7 deletions src/src/model/RouteSchema.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import HttpFilter from "./HttpFilter";
import Mqtt from "./Mqtt";
import Proxy from "./Proxy";
import Radresponder from "./Radresponder";
import Slack from "./Slack";
import Snowflake from "./Snowflake";
import SnowflakeTransform from "./SnowflakeTransform";
import Thingworx from "./Thingworx";
Expand All @@ -33,7 +34,7 @@ class RouteSchema {
/**
* Constructs a new <code>RouteSchema</code>.
* @alias module:model/RouteSchema
* @param {(module:model/Aws|module:model/Azure|module:model/Google|module:model/Http|module:model/Mqtt|module:model/Proxy|module:model/Radresponder|module:model/Snowflake|module:model/Thingworx)} instance The actual instance to initialize RouteSchema.
* @param {(module:model/Aws|module:model/Azure|module:model/Google|module:model/Http|module:model/Mqtt|module:model/Proxy|module:model/Radresponder|module:model/Slack|module:model/Snowflake|module:model/Thingworx)} instance The actual instance to initialize RouteSchema.
*/
constructor(instance = null) {
if (instance === null) {
Expand Down Expand Up @@ -186,15 +187,31 @@ class RouteSchema {
errorMessages.push("Failed to construct Snowflake: " + err);
}

try {
if (typeof instance === "Slack") {
this.actualInstance = instance;
} else {
// plain JS object
// validate the object
Slack.validateJSON(instance); // throw an exception if no match
// create Slack from JS object
this.actualInstance = Slack.constructFromObject(instance);
}
match++;
} catch (err) {
// json data failed to deserialize into Slack
errorMessages.push("Failed to construct Slack: " + err);
}

if (match > 1) {
throw new Error(
"Multiple matches found constructing `RouteSchema` with oneOf schemas Aws, Azure, Google, Http, Mqtt, Proxy, Radresponder, Snowflake, Thingworx. Input: " +
"Multiple matches found constructing `RouteSchema` with oneOf schemas Aws, Azure, Google, Http, Mqtt, Proxy, Radresponder, Slack, Snowflake, Thingworx. Input: " +
JSON.stringify(instance)
);
} else if (match === 0) {
this.actualInstance = null; // clear the actual instance in case there are multiple matches
throw new Error(
"No match found constructing `RouteSchema` with oneOf schemas Aws, Azure, Google, Http, Mqtt, Proxy, Radresponder, Snowflake, Thingworx. Details: " +
"No match found constructing `RouteSchema` with oneOf schemas Aws, Azure, Google, Http, Mqtt, Proxy, Radresponder, Slack, Snowflake, Thingworx. Details: " +
errorMessages.join(", ")
);
} else {
Expand All @@ -215,16 +232,16 @@ class RouteSchema {
}

/**
* Gets the actaul instance, which can be <code>Aws</code>, <code>Azure</code>, <code>Google</code>, <code>Http</code>, <code>Mqtt</code>, <code>Proxy</code>, <code>Radresponder</code>, <code>Snowflake</code>, <code>Thingworx</code>.
* @return {(module:model/Aws|module:model/Azure|module:model/Google|module:model/Http|module:model/Mqtt|module:model/Proxy|module:model/Radresponder|module:model/Snowflake|module:model/Thingworx)} The actual instance.
* Gets the actaul instance, which can be <code>Aws</code>, <code>Azure</code>, <code>Google</code>, <code>Http</code>, <code>Mqtt</code>, <code>Proxy</code>, <code>Radresponder</code>, <code>Slack</code>, <code>Snowflake</code>, <code>Thingworx</code>.
* @return {(module:model/Aws|module:model/Azure|module:model/Google|module:model/Http|module:model/Mqtt|module:model/Proxy|module:model/Radresponder|module:model/Slack|module:model/Snowflake|module:model/Thingworx)} The actual instance.
*/
getActualInstance() {
return this.actualInstance;
}

/**
* Sets the actaul instance, which can be <code>Aws</code>, <code>Azure</code>, <code>Google</code>, <code>Http</code>, <code>Mqtt</code>, <code>Proxy</code>, <code>Radresponder</code>, <code>Snowflake</code>, <code>Thingworx</code>.
* @param {(module:model/Aws|module:model/Azure|module:model/Google|module:model/Http|module:model/Mqtt|module:model/Proxy|module:model/Radresponder|module:model/Snowflake|module:model/Thingworx)} obj The actual instance.
* Sets the actaul instance, which can be <code>Aws</code>, <code>Azure</code>, <code>Google</code>, <code>Http</code>, <code>Mqtt</code>, <code>Proxy</code>, <code>Radresponder</code>, <code>Slack</code>, <code>Snowflake</code>, <code>Thingworx</code>.
* @param {(module:model/Aws|module:model/Azure|module:model/Google|module:model/Http|module:model/Mqtt|module:model/Proxy|module:model/Radresponder|module:model/Slack|module:model/Snowflake|module:model/Thingworx)} obj The actual instance.
*/
setActualInstance(obj) {
this.actualInstance =
Expand Down Expand Up @@ -266,6 +283,7 @@ RouteSchema.prototype["filter"] = undefined;
RouteSchema.prototype["transform"] = undefined;

/**
* Minimum time between requests in Miliseconds
* @member {Number} throttle_ms
*/
RouteSchema.prototype["throttle_ms"] = undefined;
Expand Down Expand Up @@ -382,6 +400,7 @@ RouteSchema.prototype["message_group_id"] = undefined;
RouteSchema.prototype["message_deduplication_id"] = undefined;

/**
* The Channel ID for Bearer Token method, if the \"slack-bearer\" type is selected
* @member {String} channel
*/
RouteSchema.prototype["channel"] = undefined;
Expand Down Expand Up @@ -452,6 +471,36 @@ RouteSchema.prototype["user_name"] = undefined;
*/
RouteSchema.prototype["pem"] = undefined;

/**
* The type of Slack message. Must be one of \"slack-bearer\" for Bearer Token or \"slack-webhook\" for Webhook messages
* @member {String} slack_type
*/
RouteSchema.prototype["slack_type"] = undefined;

/**
* The Bearer Token for Slack messaging, if the \"slack-bearer\" type is selected
* @member {String} bearer
*/
RouteSchema.prototype["bearer"] = undefined;

/**
* The Webhook URL for Slack Messaging if the \"slack-webhook\" type is selected
* @member {String} webhook_url
*/
RouteSchema.prototype["webhook_url"] = undefined;

/**
* The simple text message to be sent, if the blocks message field is not in use. Placeholders are available for this field.
* @member {String} text
*/
RouteSchema.prototype["text"] = undefined;

/**
* The Blocks message to be sent. If populated, this field overrides the text field within the Slack Messaging API. Placeholders are available for this field.
* @member {String} blocks
*/
RouteSchema.prototype["blocks"] = undefined;

RouteSchema.OneOf = [
"Aws",
"Azure",
Expand All @@ -460,6 +509,7 @@ RouteSchema.OneOf = [
"Mqtt",
"Proxy",
"Radresponder",
"Slack",
"Snowflake",
"Thingworx",
];
Expand Down
Loading

0 comments on commit 339a6e1

Please sign in to comment.