Skip to content

Commit

Permalink
Merge branch 'main' into feat-1122
Browse files Browse the repository at this point in the history
  • Loading branch information
petermetz authored Jul 23, 2021
2 parents 1fa4d1f + 250197f commit a8f6dcf
Show file tree
Hide file tree
Showing 9 changed files with 70 additions and 70 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,12 @@
"/api/v1/plugins/@hyperledger/cactus-example-supply-chain-backend/insert-bookshelf": {
"post": {
"operationId": "insertBookshelfV1",
"x-hyperledger-cactus": {
"http": {
"verbLowerCase": "post",
"path": "/api/v1/plugins/@hyperledger/cactus-example-supply-chain-backend/insert-bookshelf"
}
},
"summary": "Inserts the provided Bookshelf entity to the ledger.",
"parameters": [],
"requestBody": {
Expand Down Expand Up @@ -268,6 +274,12 @@
"/api/v1/plugins/@hyperledger/cactus-example-supply-chain-backend/list-bookshelf": {
"get": {
"operationId": "listBookshelfV1",
"x-hyperledger-cactus": {
"http": {
"verbLowerCase": "get",
"path": "/api/v1/plugins/@hyperledger/cactus-example-supply-chain-backend/list-bookshelf"
}
},
"summary": "Lists all the Bookshelf entities stored on the ledger.",
"parameters": [],
"responses": {
Expand Down Expand Up @@ -346,6 +358,12 @@
"/api/v1/plugins/@hyperledger/cactus-example-supply-chain-backend/insert-bamboo-harvest": {
"post": {
"operationId": "insertBambooHarvestV1",
"x-hyperledger-cactus": {
"http": {
"verbLowerCase": "post",
"path": "/api/v1/plugins/@hyperledger/cactus-example-supply-chain-backend/insert-bamboo-harvest"
}
},
"summary": "Inserts the provided BambooHarvest entity to the ledger.",
"parameters": [],
"requestBody": {
Expand Down Expand Up @@ -374,6 +392,12 @@
"/api/v1/plugins/@hyperledger/cactus-example-supply-chain-backend/list-bamboo-harvest": {
"get": {
"operationId": "listBambooHarvestV1",
"x-hyperledger-cactus": {
"http": {
"verbLowerCase": "get",
"path": "/api/v1/plugins/@hyperledger/cactus-example-supply-chain-backend/list-bamboo-harvest"
}
},
"summary": "Lists all the BambooHarvest entities stored on the ledger.",
"parameters": [],
"responses": {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
Web3SigningCredential,
} from "@hyperledger/cactus-plugin-ledger-connector-quorum";

import { InsertBambooHarvestEndpoint as Constants } from "./insert-bamboo-harvest-endpoint-constants";
import OAS from "../../../json/openapi.json";
import { InsertBambooHarvestRequest } from "../../generated/openapi/typescript-axios";

export interface IInsertBambooHarvestEndpointOptions {
Expand All @@ -43,21 +43,16 @@ const K_DEFAULT_AUTHORIZATION_OPTIONS: IEndpointAuthzOptions = {
};

export class InsertBambooHarvestEndpoint implements IWebServiceEndpoint {
public static readonly HTTP_PATH = Constants.HTTP_PATH;

public static readonly HTTP_VERB_LOWER_CASE = Constants.HTTP_VERB_LOWER_CASE;

public static readonly OPENAPI_OPERATION_ID = Constants.OPENAPI_OPERATION_ID;

public static readonly CLASS_NAME = "InsertBambooHarvestEndpoint";

private readonly log: Logger;
private readonly authorizationOptionsProvider: AuthorizationOptionsProvider;

public get className(): string {
return InsertBambooHarvestEndpoint.CLASS_NAME;
}

private readonly authorizationOptionsProvider: AuthorizationOptionsProvider;

constructor(public readonly opts: IInsertBambooHarvestEndpointOptions) {
const fnTag = `${this.className}#constructor()`;
Checks.truthy(opts, `${fnTag} arg options`);
Expand All @@ -80,6 +75,12 @@ export class InsertBambooHarvestEndpoint implements IWebServiceEndpoint {
this.log.debug(`Instantiated ${this.className} OK`);
}

public getOasPath() {
return OAS.paths[
"/api/v1/plugins/@hyperledger/cactus-example-supply-chain-backend/insert-bamboo-harvest"
];
}

getAuthorizationOptionsProvider(): IAsyncProvider<IEndpointAuthzOptions> {
return this.authorizationOptionsProvider;
}
Expand All @@ -92,11 +93,13 @@ export class InsertBambooHarvestEndpoint implements IWebServiceEndpoint {
}

public getVerbLowerCase(): string {
return InsertBambooHarvestEndpoint.HTTP_VERB_LOWER_CASE;
const apiPath = this.getOasPath();
return apiPath.post["x-hyperledger-cactus"].http.verbLowerCase;
}

public getPath(): string {
return InsertBambooHarvestEndpoint.HTTP_PATH;
const apiPath = this.getOasPath();
return apiPath.post["x-hyperledger-cactus"].http.path;
}

public getExpressRequestHandler(): IExpressRequestHandler {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
Web3SigningCredential,
} from "@hyperledger/cactus-plugin-ledger-connector-besu";

import { InsertBookshelfEndpoint as Constants } from "./insert-bookshelf-endpoint-constants";
import OAS from "../../../json/openapi.json";
import { InsertBookshelfRequest } from "../../generated/openapi/typescript-axios/index";

export interface IInsertBookshelfEndpointOptions {
Expand All @@ -33,20 +33,13 @@ export interface IInsertBookshelfEndpointOptions {
}

export class InsertBookshelfEndpoint implements IWebServiceEndpoint {
public static readonly HTTP_PATH = Constants.HTTP_PATH;

public static readonly HTTP_VERB_LOWER_CASE = Constants.HTTP_VERB_LOWER_CASE;

public static readonly OPENAPI_OPERATION_ID = Constants.OPENAPI_OPERATION_ID;

public static readonly CLASS_NAME = "InsertBookshelfEndpoint";

private readonly log: Logger;

public get className(): string {
return InsertBookshelfEndpoint.CLASS_NAME;
}

constructor(public readonly opts: IInsertBookshelfEndpointOptions) {
const fnTag = `${this.className}#constructor()`;
Checks.truthy(opts, `${fnTag} arg options`);
Expand All @@ -63,6 +56,12 @@ export class InsertBookshelfEndpoint implements IWebServiceEndpoint {
this.log = LoggerProvider.getOrCreate({ level, label });
}

public getOasPath() {
return OAS.paths[
"/api/v1/plugins/@hyperledger/cactus-example-supply-chain-backend/insert-bookshelf"
];
}

getAuthorizationOptionsProvider(): IAsyncProvider<IEndpointAuthzOptions> {
// TODO: make this an injectable dependency in the constructor
return {
Expand All @@ -81,11 +80,13 @@ export class InsertBookshelfEndpoint implements IWebServiceEndpoint {
}

public getVerbLowerCase(): string {
return InsertBookshelfEndpoint.HTTP_VERB_LOWER_CASE;
const apiPath = this.getOasPath();
return apiPath.post["x-hyperledger-cactus"].http.verbLowerCase;
}

public getPath(): string {
return InsertBookshelfEndpoint.HTTP_PATH;
const apiPath = this.getOasPath();
return apiPath.post["x-hyperledger-cactus"].http.path;
}

public getExpressRequestHandler(): IExpressRequestHandler {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
Web3SigningCredentialType,
} from "@hyperledger/cactus-plugin-ledger-connector-quorum";

import { ListBambooHarvestEndpoint as Constants } from "./list-bamboo-harvest-endpoint-constants";
import OAS from "../../../json/openapi.json";
import { BambooHarvestConverter } from "../../model/converter/bamboo-harvest-converter";

export interface IListBambooHarvestEndpointOptions {
Expand All @@ -31,12 +31,6 @@ export interface IListBambooHarvestEndpointOptions {
}

export class ListBambooHarvestEndpoint implements IWebServiceEndpoint {
public static readonly HTTP_PATH = Constants.HTTP_PATH;

public static readonly HTTP_VERB_LOWER_CASE = Constants.HTTP_VERB_LOWER_CASE;

public static readonly OPENAPI_OPERATION_ID = Constants.OPENAPI_OPERATION_ID;

public static readonly CLASS_NAME = "ListBambooHarvestEndpoint";

private readonly log: Logger;
Expand All @@ -61,6 +55,12 @@ export class ListBambooHarvestEndpoint implements IWebServiceEndpoint {
this.log = LoggerProvider.getOrCreate({ level, label });
}

public getOasPath() {
return OAS.paths[
"/api/v1/plugins/@hyperledger/cactus-example-supply-chain-backend/list-bamboo-harvest"
];
}

getAuthorizationOptionsProvider(): IAsyncProvider<IEndpointAuthzOptions> {
// TODO: make this an injectable dependency in the constructor
return {
Expand All @@ -79,11 +79,13 @@ export class ListBambooHarvestEndpoint implements IWebServiceEndpoint {
}

public getVerbLowerCase(): string {
return ListBambooHarvestEndpoint.HTTP_VERB_LOWER_CASE;
const apiPath = this.getOasPath();
return apiPath.get["x-hyperledger-cactus"].http.verbLowerCase;
}

public getPath(): string {
return ListBambooHarvestEndpoint.HTTP_PATH;
const apiPath = this.getOasPath();
return apiPath.get["x-hyperledger-cactus"].http.path;
}

public getExpressRequestHandler(): IExpressRequestHandler {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
Web3SigningCredentialType,
} from "@hyperledger/cactus-plugin-ledger-connector-besu";

import { ListBookshelfEndpoint as Constants } from "./list-bookshelf-endpoint-constants";
import OAS from "../../../json/openapi.json";
import { BookshelfConverter } from "../../model/converter/bookshelf-converter";

export interface IListBookshelfEndpointOptions {
Expand All @@ -32,12 +32,6 @@ export interface IListBookshelfEndpointOptions {
}

export class ListBookshelfEndpoint implements IWebServiceEndpoint {
public static readonly HTTP_PATH = Constants.HTTP_PATH;

public static readonly HTTP_VERB_LOWER_CASE = Constants.HTTP_VERB_LOWER_CASE;

public static readonly OPENAPI_OPERATION_ID = Constants.OPENAPI_OPERATION_ID;

public static readonly CLASS_NAME = "ListBookshelfEndpoint";

private readonly log: Logger;
Expand All @@ -59,6 +53,12 @@ export class ListBookshelfEndpoint implements IWebServiceEndpoint {
this.log = LoggerProvider.getOrCreate({ level, label });
}

public getOasPath() {
return OAS.paths[
"/api/v1/plugins/@hyperledger/cactus-example-supply-chain-backend/list-bookshelf"
];
}

getAuthorizationOptionsProvider(): IAsyncProvider<IEndpointAuthzOptions> {
// TODO: make this an injectable dependency in the constructor
return {
Expand All @@ -77,11 +77,13 @@ export class ListBookshelfEndpoint implements IWebServiceEndpoint {
}

public getVerbLowerCase(): string {
return ListBookshelfEndpoint.HTTP_VERB_LOWER_CASE;
const apiPath = this.getOasPath();
return apiPath.get["x-hyperledger-cactus"].http.verbLowerCase;
}

public getPath(): string {
return ListBookshelfEndpoint.HTTP_PATH;
const apiPath = this.getOasPath();
return apiPath.get["x-hyperledger-cactus"].http.path;
}

public getExpressRequestHandler(): IExpressRequestHandler {
Expand Down

0 comments on commit a8f6dcf

Please sign in to comment.