Skip to content

Commit

Permalink
feat(refactor): openapi endpoint paths
Browse files Browse the repository at this point in the history
Signed-off-by: AzaharaC <a.castano.benito@accenture.com>
  • Loading branch information
AzaharaC authored and petermetz committed Mar 5, 2021
1 parent ffc608b commit 261c17b
Show file tree
Hide file tree
Showing 21 changed files with 189 additions and 169 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,12 @@
"paths": {
"/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/deploy-contract-solidity-bytecode": {
"post": {
"x-hyperledger-cactus": {
"http": {
"verbLowerCase": "post",
"path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/deploy-contract-solidity-bytecode"
}
},
"operationId": "apiV1BesuDeployContractSolidityBytecode",
"summary": "Deploys the bytecode of a Solidity contract.",
"parameters": [],
Expand Down Expand Up @@ -586,6 +592,12 @@
},
"/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/run-transaction": {
"post": {
"x-hyperledger-cactus": {
"http": {
"verbLowerCase": "post",
"path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/run-transaction"
}
},
"operationId": "apiV1BesuRunTransaction",
"summary": "Executes a transaction on a besu ledger",
"parameters": [],
Expand Down Expand Up @@ -614,6 +626,12 @@
},
"/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/invoke-contract": {
"post": {
"x-hyperledger-cactus": {
"http": {
"verbLowerCase": "post",
"path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/invoke-contract"
}
},
"operationId": "apiV1BesuInvokeContract",
"summary": "Invokeds a contract on a besu ledger",
"parameters": [],
Expand Down Expand Up @@ -642,6 +660,12 @@
},
"/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/sign-transaction": {
"post": {
"x-hyperledger-cactus": {
"http": {
"verbLowerCase": "post",
"path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/sign-transaction"
}
},
"operationId": "signTransactionV1",
"summary": "Obtain signatures of ledger from the corresponding transaction hash.",
"description": "Obtain signatures of ledger from the corresponding transaction hash.",
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import {

import { registerWebServiceEndpoint } from "@hyperledger/cactus-core";

import { DeployContractSolidityBytecodeEndpoint as Constants } from "./deploy-contract-solidity-bytecode-endpoint-constants";
import { PluginLedgerConnectorBesu } from "../plugin-ledger-connector-besu";
import { DeployContractSolidityBytecodeV1Request } from "../generated/openapi/typescript-axios";
import OAS from "../../json/openapi.json";

export interface IDeployContractSolidityBytecodeOptions {
logLevel?: LogLevelDesc;
Expand All @@ -43,12 +43,24 @@ export class DeployContractSolidityBytecodeEndpoint
this.log = LoggerProvider.getOrCreate({ level, label });
}

public getOasPath() {
return OAS.paths[
"/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/deploy-contract-solidity-bytecode"
];
}

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

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

public getOperationId(): string {
return this.getOasPath().post.operationId;
}

public registerExpress(app: Express): IWebServiceEndpoint {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { registerWebServiceEndpoint } from "@hyperledger/cactus-core";

import { PluginLedgerConnectorBesu } from "../plugin-ledger-connector-besu";

import { InvokeContractEndpoint as Constants } from "./invoke-contract-endpoint-constants";
import OAS from "../../json/openapi.json";

export interface IInvokeContractEndpointOptions {
logLevel?: LogLevelDesc;
Expand All @@ -40,12 +40,24 @@ export class InvokeContractEndpoint implements IWebServiceEndpoint {
this.log = LoggerProvider.getOrCreate({ level, label });
}

public getOasPath() {
return OAS.paths[
"/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/invoke-contract"
];
}

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

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

public getOperationId(): string {
return this.getOasPath().post.operationId;
}

registerExpress(webApp: Express): IWebServiceEndpoint {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { registerWebServiceEndpoint } from "@hyperledger/cactus-core";

import { PluginLedgerConnectorBesu } from "../plugin-ledger-connector-besu";

import { RunTransactionEndpoint as Constants } from "./run-transaction-endpoint-constants";
import OAS from "../../json/openapi.json";

export interface IRunTransactionEndpointOptions {
logLevel?: LogLevelDesc;
Expand All @@ -40,12 +40,24 @@ export class RunTransactionEndpoint implements IWebServiceEndpoint {
this.log = LoggerProvider.getOrCreate({ level, label });
}

public getOasPath() {
return OAS.paths[
"/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/run-transaction"
];
}

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

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

public getOperationId(): string {
return this.getOasPath().post.operationId;
}

registerExpress(webApp: Express): IWebServiceEndpoint {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import {

import { SignTransactionRequest } from "../generated/openapi/typescript-axios/api";

import { BesuSignTransactionEndpointV1 as Constants } from "./sign-transaction-endpoint-constants";
import { PluginLedgerConnectorBesu } from "../plugin-ledger-connector-besu";
import OAS from "../../json/openapi.json";

export interface IBesuSignTransactionEndpointOptions {
connector: PluginLedgerConnectorBesu;
Expand All @@ -42,12 +42,24 @@ export class BesuSignTransactionEndpointV1 implements IWebServiceEndpoint {
return this.handleRequest.bind(this);
}

public getOasPath() {
return OAS.paths[
"/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/sign-transaction"
];
}

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

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

public getOperationId(): string {
return this.getOasPath().post.operationId;
}

registerExpress(app: Express): IWebServiceEndpoint {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,12 @@
"paths": {
"/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/run-transaction": {
"post": {
"x-hyperledger-cactus": {
"http": {
"verbLowerCase": "post",
"path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/run-transaction"
}
},
"operationId": "runTransactionV1",
"summary": "Runs a transaction on a Fabric ledger.",
"description": "",
Expand Down Expand Up @@ -329,6 +335,12 @@
},
"/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/deploy-contract-go-source": {
"post": {
"x-hyperledger-cactus": {
"http": {
"verbLowerCase": "post",
"path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/deploy-contract-go-source"
}
},
"operationId": "deployContractGoSourceV1",
"summary": "Deploys a chaincode contract in the form of a go sources.",
"parameters": [],
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import {

import { registerWebServiceEndpoint } from "@hyperledger/cactus-core";

import { DeployContractGoSourceEndpointV1 as Constants } from "./deploy-contract-go-source-endpoint-constants";
import { PluginLedgerConnectorFabric } from "../plugin-ledger-connector-fabric";
import OAS from "../../json/openapi.json";

export interface IDeployContractGoSourceEndpointV1Options {
logLevel?: LogLevelDesc;
Expand Down Expand Up @@ -46,12 +46,24 @@ export class DeployContractGoSourceEndpointV1 implements IWebServiceEndpoint {
return this.handleRequest.bind(this);
}

public getOasPath() {
return OAS.paths[
"/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/deploy-contract-go-source"
];
}

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

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

public getOperationId(): string {
return this.getOasPath().post.operationId;
}

public registerExpress(app: Express): IWebServiceEndpoint {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import {

import { registerWebServiceEndpoint } from "@hyperledger/cactus-core";

import { RunTransactionEndpointV1 as Constants } from "./run-transaction-endpoint-constants";
import { PluginLedgerConnectorFabric } from "../plugin-ledger-connector-fabric";
import { RunTransactionRequest } from "../generated/openapi/typescript-axios";
import OAS from "../../json/openapi.json";

export interface IRunTransactionEndpointV1Options {
logLevel?: LogLevelDesc;
Expand All @@ -42,12 +42,24 @@ export class RunTransactionEndpointV1 implements IWebServiceEndpoint {
return this.handleRequest.bind(this);
}

public getOasPath() {
return OAS.paths[
"/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/run-transaction"
];
}

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

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

public getOperationId(): string {
return this.getOasPath().post.operationId;
}

public registerExpress(app: Express): IWebServiceEndpoint {
Expand Down

0 comments on commit 261c17b

Please sign in to comment.