Skip to content

Commit

Permalink
SWI-6181 Update User Agent Header
Browse files Browse the repository at this point in the history
  • Loading branch information
ckoegel committed Nov 8, 2024
1 parent 573544f commit 67e1dae
Show file tree
Hide file tree
Showing 5 changed files with 123 additions and 2 deletions.
2 changes: 2 additions & 0 deletions base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import globalAxios from 'axios';

export const BASE_PATH = "http://localhost".replace(/\/+$/, "");

globalAxios.defaults.headers.common['User-Agent'] = "OpenAPI-Generator/1.0.0-dev/typescript-axios";

/**
*
* @export
Expand Down
118 changes: 118 additions & 0 deletions custom_templates/baseApi.mustache
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
/* tslint:disable */
/* eslint-disable */
{{>licenseInfo}}

import type { Configuration } from './configuration';
// Some imports not used depending on template conditions
// @ts-ignore
import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios';
import globalAxios from 'axios';

export const BASE_PATH = "{{{basePath}}}".replace(/\/+$/, "");

globalAxios.defaults.headers.common['User-Agent'] = "OpenAPI-Generator{{#npmVersion}}/{{npmVersion}}{{/npmVersion}}/typescript-axios";

/**
*
* @export
*/
export const COLLECTION_FORMATS = {
csv: ",",
ssv: " ",
tsv: "\t",
pipes: "|",
};

/**
*
* @export
* @interface RequestArgs
*/
export interface RequestArgs {
url: string;
options: RawAxiosRequestConfig;
}

/**
*
* @export
* @class BaseAPI
*/
export class BaseAPI {
protected configuration: Configuration | undefined;
constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) {
if (configuration) {
this.configuration = configuration;
this.basePath = configuration.basePath ?? basePath;
}
}
};

/**
*
* @export
* @class RequiredError
* @extends {Error}
*/
export class RequiredError extends Error {
constructor(public field: string, msg?: string) {
super(msg);
this.name = "RequiredError"
}
}

interface ServerMap {
[key: string]: {
url: string,
description: string,
}[];
}

/**
*
* @export
*/
export const operationServerMap: ServerMap = {
{{#apiInfo}}
{{#apis}}
{{#operations}}
{{#operation}}
{{#servers}}
{{#-first}}
"{{{classname}}}.{{{nickname}}}": [
{{/-first}}
{
url: "{{{url}}}",
description: "{{{description}}}{{^description}}No description provided{{/description}}",
{{#variables}}
{{#-first}}
variables: {
{{/-first}}
{{{name}}}: {
description: "{{{description}}}{{^description}}No description provided{{/description}}",
default_value: "{{{defaultValue}}}",
{{#enumValues}}
{{#-first}}
enum_values: [
{{/-first}}
"{{{.}}}"{{^-last}},{{/-last}}
{{#-last}}
]
{{/-last}}
{{/enumValues}}
}{{^-last}},{{/-last}}
{{#-last}}
}
{{/-last}}
{{/variables}}
}{{^-last}},{{/-last}}
{{#-last}}
],
{{/-last}}
{{/servers}}
{{/operation}}
{{/operations}}
{{/apis}}
{{/apiInfo}}
}
1 change: 1 addition & 0 deletions openapi-config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
npmName: bandwidth-sdk
npmVersion: 1.0.0-dev
withSeparateModelsAndApi: true
modelPackage: models
apiPackage: api
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bandwidth-sdk",
"version": "1.0.0",
"version": "1.0.0-dev",
"description": "OpenAPI client for bandwidth-sdk",
"author": "OpenAPI-Generator Contributors",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/api/calls-api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('CallsApi', () => {
const config = new Configuration({
username: BW_USERNAME,
password: BW_PASSWORD,
basePath: 'http://127.0.0.1:4010'
basePath: 'https://7235edb724fcd6354723b9d89367dc50.m.pipedream.net'
});
const callsApi = new CallsApi(config);

Expand Down

0 comments on commit 67e1dae

Please sign in to comment.