Skip to content

Commit

Permalink
Add CA Functionality - generated files
Browse files Browse the repository at this point in the history
  • Loading branch information
robert-cronin committed Sep 24, 2020
1 parent bd805c6 commit 0926c7e
Show file tree
Hide file tree
Showing 46 changed files with 15,266 additions and 35,453 deletions.
3 changes: 3 additions & 0 deletions api/generated/client/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
wwwroot/*.js
node_modules
typings
25 changes: 25 additions & 0 deletions api/generated/client/.swagger-codegen-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Swagger Codegen Ignore
# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen

# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.

# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
#ApiClient.cs

# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux

# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux

# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md

git_push.sh
1 change: 1 addition & 0 deletions api/generated/client/.swagger-codegen/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.3.1
281 changes: 281 additions & 0 deletions api/generated/client/api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,281 @@
/// <reference path="./custom.d.ts" />
// tslint:disable
/**
* Polykey API
* Optional multiline or single-line description in [CommonMark](http://commonmark.org/help/) or HTML.
*
* OpenAPI spec version: 0.1.9
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/


import * as url from "url";
import * as portableFetch from "portable-fetch";
import { Configuration } from "./configuration";

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

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

/**
*
* @export
* @interface FetchAPI
*/
export interface FetchAPI {
(url: string, init?: any): Promise<Response>;
}

/**
*
* @export
* @interface FetchArgs
*/
export interface FetchArgs {
url: string;
options: any;
}

/**
*
* @export
* @class BaseAPI
*/
export class BaseAPI {
protected configuration: Configuration;

constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected fetch: FetchAPI = portableFetch) {
if (configuration) {
this.configuration = configuration;
this.basePath = configuration.basePath || this.basePath;
}
}
};

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

/**
* A JSON object containing a certificate signing request
* @export
* @interface CSRBody
*/
export interface CSRBody {
/**
*
* @type {string}
* @memberof CSRBody
*/
publicKey: string;
/**
*
* @type {string}
* @memberof CSRBody
*/
csr: string;
}

/**
* A JSON object containing the root certificate
* @export
* @interface RootCertBody
*/
export interface RootCertBody {
/**
*
* @type {string}
* @memberof RootCertBody
*/
rootCert: string;
}


/**
* DefaultApi - fetch parameter creator
* @export
*/
export const DefaultApiFetchParamCreator = function (configuration?: Configuration) {
return {
/**
* Request a certificate from the polykey node CA
* @param {CSRBody} body Sign a certificate from a client
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
caCertificateSigningRequestPost(body: CSRBody, options: any = {}): FetchArgs {
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new RequiredError('body','Required parameter body was null or undefined when calling caCertificateSigningRequestPost.');
}
const localVarPath = `/ca/certificate_signing_request`;
const localVarUrlObj = url.parse(localVarPath, true);
const localVarRequestOptions = Object.assign({ method: 'POST' }, options);
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;

localVarHeaderParameter['Content-Type'] = 'application/json';

localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query);
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers);
const needsSerialization = (<any>"CSRBody" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.body = needsSerialization ? JSON.stringify(body || {}) : (body || "");

return {
url: url.format(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Returns the root certificate for the polykey node.
* @summary Returns the root certificate.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
caRootCertificateGet(options: any = {}): FetchArgs {
const localVarPath = `/ca/root_certificate`;
const localVarUrlObj = url.parse(localVarPath, true);
const localVarRequestOptions = Object.assign({ method: 'GET' }, options);
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;

localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query);
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers);

return {
url: url.format(localVarUrlObj),
options: localVarRequestOptions,
};
},
}
};

/**
* DefaultApi - functional programming interface
* @export
*/
export const DefaultApiFp = function(configuration?: Configuration) {
return {
/**
* Request a certificate from the polykey node CA
* @param {CSRBody} body Sign a certificate from a client
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
caCertificateSigningRequestPost(body: CSRBody, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise<CSRBody> {
const localVarFetchArgs = DefaultApiFetchParamCreator(configuration).caCertificateSigningRequestPost(body, options);
return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => {
return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => {
if (response.status >= 200 && response.status < 300) {
return response.json();
} else {
throw response;
}
});
};
},
/**
* Returns the root certificate for the polykey node.
* @summary Returns the root certificate.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
caRootCertificateGet(options?: any): (fetch?: FetchAPI, basePath?: string) => Promise<RootCertBody> {
const localVarFetchArgs = DefaultApiFetchParamCreator(configuration).caRootCertificateGet(options);
return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => {
return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => {
if (response.status >= 200 && response.status < 300) {
return response.json();
} else {
throw response;
}
});
};
},
}
};

/**
* DefaultApi - factory interface
* @export
*/
export const DefaultApiFactory = function (configuration?: Configuration, fetch?: FetchAPI, basePath?: string) {
return {
/**
* Request a certificate from the polykey node CA
* @param {CSRBody} body Sign a certificate from a client
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
caCertificateSigningRequestPost(body: CSRBody, options?: any) {
return DefaultApiFp(configuration).caCertificateSigningRequestPost(body, options)(fetch, basePath);
},
/**
* Returns the root certificate for the polykey node.
* @summary Returns the root certificate.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
caRootCertificateGet(options?: any) {
return DefaultApiFp(configuration).caRootCertificateGet(options)(fetch, basePath);
},
};
};

/**
* DefaultApi - object-oriented interface
* @export
* @class DefaultApi
* @extends {BaseAPI}
*/
export class DefaultApi extends BaseAPI {
/**
* Request a certificate from the polykey node CA
* @param {} body Sign a certificate from a client
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof DefaultApi
*/
public caCertificateSigningRequestPost(body: CSRBody, options?: any) {
return DefaultApiFp(this.configuration).caCertificateSigningRequestPost(body, options)(this.fetch, this.basePath);
}

/**
* Returns the root certificate for the polykey node.
* @summary Returns the root certificate.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof DefaultApi
*/
public caRootCertificateGet(options?: any) {
return DefaultApiFp(this.configuration).caRootCertificateGet(options)(this.fetch, this.basePath);
}

}

66 changes: 66 additions & 0 deletions api/generated/client/configuration.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// tslint:disable
/**
* Polykey API
* Optional multiline or single-line description in [CommonMark](http://commonmark.org/help/) or HTML.
*
* OpenAPI spec version: 0.1.9
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/


export interface ConfigurationParameters {
apiKey?: string | ((name: string) => string);
username?: string;
password?: string;
accessToken?: string | ((name: string, scopes?: string[]) => string);
basePath?: string;
}

export class Configuration {
/**
* parameter for apiKey security
* @param name security name
* @memberof Configuration
*/
apiKey?: string | ((name: string) => string);
/**
* parameter for basic security
*
* @type {string}
* @memberof Configuration
*/
username?: string;
/**
* parameter for basic security
*
* @type {string}
* @memberof Configuration
*/
password?: string;
/**
* parameter for oauth2 security
* @param name security name
* @param scopes oauth2 scope
* @memberof Configuration
*/
accessToken?: string | ((name: string, scopes?: string[]) => string);
/**
* override base path
*
* @type {string}
* @memberof Configuration
*/
basePath?: string;

constructor(param: ConfigurationParameters = {}) {
this.apiKey = param.apiKey;
this.username = param.username;
this.password = param.password;
this.accessToken = param.accessToken;
this.basePath = param.basePath;
}
}
1 change: 1 addition & 0 deletions api/generated/client/custom.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
declare module 'portable-fetch';
Loading

0 comments on commit 0926c7e

Please sign in to comment.