Skip to content

Commit

Permalink
refactor(sdk): shorten SDK method names
Browse files Browse the repository at this point in the history
Fixes hyperledger-cacti#163

Signed-off-by: Youngone Lee <youngone.lee@accenture.com>
  • Loading branch information
Leeyoungone authored and petermetz committed Jul 20, 2021
1 parent 506002c commit ec99555
Show file tree
Hide file tree
Showing 82 changed files with 546 additions and 557 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@
},
"/api/v1/plugins/@hyperledger/cactus-example-carbon-accounting-backend/dao-token/get-allowance": {
"post": {
"operationId": "daoTokenGetAllowance",
"operationId": "daoTokenGetAllowanceV1",
"summary": "Get the number of tokens `spender` is approved to spend on behalf of `account`",
"x-hyperledger-cactus": {
"http": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
daoTokenGetAllowance: async (daoTokenGetAllowanceRequest?: DaoTokenGetAllowanceRequest, options: any = {}): Promise<RequestArgs> => {
daoTokenGetAllowanceV1: async (daoTokenGetAllowanceRequest?: DaoTokenGetAllowanceRequest, options: any = {}): Promise<RequestArgs> => {
const localVarPath = `/api/v1/plugins/@hyperledger/cactus-example-carbon-accounting-backend/dao-token/get-allowance`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
Expand Down Expand Up @@ -271,8 +271,8 @@ export const DefaultApiFp = function(configuration?: Configuration) {
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async daoTokenGetAllowance(daoTokenGetAllowanceRequest?: DaoTokenGetAllowanceRequest, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<DaoTokenGetAllowanceResponse>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.daoTokenGetAllowance(daoTokenGetAllowanceRequest, options);
async daoTokenGetAllowanceV1(daoTokenGetAllowanceRequest?: DaoTokenGetAllowanceRequest, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<DaoTokenGetAllowanceResponse>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.daoTokenGetAllowanceV1(daoTokenGetAllowanceRequest, options);
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
},
/**
Expand Down Expand Up @@ -303,8 +303,8 @@ export const DefaultApiFactory = function (configuration?: Configuration, basePa
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
daoTokenGetAllowance(daoTokenGetAllowanceRequest?: DaoTokenGetAllowanceRequest, options?: any): AxiosPromise<DaoTokenGetAllowanceResponse> {
return localVarFp.daoTokenGetAllowance(daoTokenGetAllowanceRequest, options).then((request) => request(axios, basePath));
daoTokenGetAllowanceV1(daoTokenGetAllowanceRequest?: DaoTokenGetAllowanceRequest, options?: any): AxiosPromise<DaoTokenGetAllowanceResponse> {
return localVarFp.daoTokenGetAllowanceV1(daoTokenGetAllowanceRequest, options).then((request) => request(axios, basePath));
},
/**
*
Expand Down Expand Up @@ -334,8 +334,8 @@ export class DefaultApi extends BaseAPI {
* @throws {RequiredError}
* @memberof DefaultApi
*/
public daoTokenGetAllowance(daoTokenGetAllowanceRequest?: DaoTokenGetAllowanceRequest, options?: any) {
return DefaultApiFp(this.configuration).daoTokenGetAllowance(daoTokenGetAllowanceRequest, options).then((request) => request(this.axios, this.basePath));
public daoTokenGetAllowanceV1(daoTokenGetAllowanceRequest?: DaoTokenGetAllowanceRequest, options?: any) {
return DefaultApiFp(this.configuration).daoTokenGetAllowanceV1(daoTokenGetAllowanceRequest, options).then((request) => request(this.axios, this.basePath));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,17 @@ test("Supply chain backend API calls can be executed", async (t: Test) => {

const { besuApiClient, fabricApiClient, quorumApiClient } = startResult;

const metricsResB = await besuApiClient.getPrometheusExporterMetricsV1();
const metricsResB = await besuApiClient.getPrometheusMetricsV1();
t.ok(metricsResB, "besu metrics res truthy OK");
t.true(metricsResB.status > 199, "metricsResB.status > 199 true OK");
t.true(metricsResB.status < 300, "metricsResB.status < 300 true OK");

const metricsResF = await fabricApiClient.getPrometheusExporterMetricsV1();
const metricsResF = await fabricApiClient.getPrometheusMetricsV1();
t.ok(metricsResF, "fabric metrics res truthy OK");
t.true(metricsResF.status > 199, "metricsResF.status > 199 true OK");
t.true(metricsResF.status < 300, "metricsResF.status < 300 true OK");

const metricsResQ = await quorumApiClient.getPrometheusExporterMetricsV1();
const metricsResQ = await quorumApiClient.getPrometheusMetricsV1();
t.ok(metricsResQ, "quorum metrics res truthy OK");
t.true(metricsResQ.status > 199, "metricsResQ.status > 199 true OK");
t.true(metricsResQ.status < 300, "metricsResQ.status < 300 true OK");
Expand All @@ -97,7 +97,7 @@ test("Supply chain backend API calls can be executed", async (t: Test) => {
supplyChainApiClientC,
} = startResult;

const listBambooHarvestRes = await supplyChainApiClientA.apiV1ListBambooHarvest();
const listBambooHarvestRes = await supplyChainApiClientA.listBambooHarvestV1();
t.ok(listBambooHarvestRes, "listBambooHarvestRes truthy OK");
t.true(
listBambooHarvestRes.status > 199,
Expand All @@ -108,7 +108,7 @@ test("Supply chain backend API calls can be executed", async (t: Test) => {
"listBambooHarvestRes status < 300 truthy OK",
);

const listBookshelfRes = await supplyChainApiClientB.apiV1ListBookshelf();
const listBookshelfRes = await supplyChainApiClientB.listBookshelfV1();
t.ok(listBookshelfRes, "listBookshelfRes truthy OK");
t.true(
listBookshelfRes.status > 199,
Expand All @@ -119,7 +119,7 @@ test("Supply chain backend API calls can be executed", async (t: Test) => {
"listBookshelfRes status < 300 truthy OK",
);

const listShipmentRes = await supplyChainApiClientC.apiV1ListShipment();
const listShipmentRes = await supplyChainApiClientC.listShipmentV1();
t.ok(listShipmentRes, "listShipmentRes truthy OK");
t.true(
listShipmentRes.status > 199,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
"nullable": false,
"default": [],
"items": {
"$ref": "#/components/schema/BambooHarvest",
"$ref": "#/components/schemas/BambooHarvest",
"minItems": 0,
"maxItems": 65535
}
Expand Down Expand Up @@ -184,7 +184,7 @@
"nullable": false,
"default": [],
"items": {
"$ref": "#/components/schema/Bookshelf",
"$ref": "#/components/schemas/Bookshelf",
"minItems": 0,
"maxItems": 65535
}
Expand Down Expand Up @@ -227,7 +227,7 @@
"nullable": false,
"default": [],
"items": {
"$ref": "#/components/schema/Shipment",
"$ref": "#/components/schemas/Shipment",
"minItems": 0,
"maxItems": 65535
}
Expand All @@ -239,7 +239,7 @@
"paths": {
"/api/v1/plugins/@hyperledger/cactus-example-supply-chain-backend/insert-bookshelf": {
"post": {
"operationId": "apiV1InsertBookshelf",
"operationId": "insertBookshelfV1",
"summary": "Inserts the provided Bookshelf entity to the ledger.",
"parameters": [],
"requestBody": {
Expand Down Expand Up @@ -267,7 +267,7 @@
},
"/api/v1/plugins/@hyperledger/cactus-example-supply-chain-backend/list-bookshelf": {
"get": {
"operationId": "apiV1ListBookshelf",
"operationId": "listBookshelfV1",
"summary": "Lists all the Bookshelf entities stored on the ledger.",
"parameters": [],
"responses": {
Expand All @@ -292,7 +292,7 @@
"path": "/api/v1/plugins/@hyperledger/cactus-example-supply-chain-backend/insert-shipment"
}
},
"operationId": "apiV1InsertShipment",
"operationId": "insertShipmentV1",
"summary": "Inserts the provided Shipment entity to the ledger.",
"parameters": [],
"requestBody": {
Expand Down Expand Up @@ -326,7 +326,7 @@
"path": "/api/v1/plugins/@hyperledger/cactus-example-supply-chain-backend/list-shipment"
}
},
"operationId": "apiV1ListShipment",
"operationId": "listShipmentV1",
"summary": "Lists all the Shipments entities stored on the ledger.",
"parameters": [],
"responses": {
Expand All @@ -345,7 +345,7 @@
},
"/api/v1/plugins/@hyperledger/cactus-example-supply-chain-backend/insert-bamboo-harvest": {
"post": {
"operationId": "apiV1InsertBambooHarvest",
"operationId": "insertBambooHarvestV1",
"summary": "Inserts the provided BambooHarvest entity to the ledger.",
"parameters": [],
"requestBody": {
Expand Down Expand Up @@ -373,7 +373,7 @@
},
"/api/v1/plugins/@hyperledger/cactus-example-supply-chain-backend/list-bamboo-harvest": {
"get": {
"operationId": "apiV1ListBambooHarvest",
"operationId": "listBambooHarvestV1",
"summary": "Lists all the BambooHarvest entities stored on the ledger.",
"parameters": [],
"responses": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@ export class InsertBambooHarvestEndpoint {

public static readonly HTTP_VERB_LOWER_CASE: string = "post";

public static readonly OPENAPI_OPERATION_ID: string =
"apiV1InsertBambooHarvest";
public static readonly OPENAPI_OPERATION_ID: string = "insertBambooHarvestV1";
}
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export class InsertBambooHarvestEndpoint implements IWebServiceEndpoint {

const {
data: { success, callOutput, transactionReceipt },
} = await this.opts.apiClient.apiV1QuorumInvokeContract({
} = await this.opts.apiClient.invokeContractV1({
contractName: this.opts.contractName,
invocationType: EthContractInvocationType.Send,
methodName: "insertRecord",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ export class InsertBookshelfEndpoint {

public static readonly HTTP_VERB_LOWER_CASE: string = "post";

public static readonly OPENAPI_OPERATION_ID: string = "apiV1InsertBookshelf";
public static readonly OPENAPI_OPERATION_ID: string = "insertBookshelfV1";
}
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export class InsertBookshelfEndpoint implements IWebServiceEndpoint {

const {
data: { callOutput, transactionReceipt },
} = await this.opts.besuApi.apiV1BesuInvokeContract({
} = await this.opts.besuApi.invokeContractV1({
contractName: this.opts.contractName,
invocationType: EthContractInvocationType.Send,
methodName: "insertRecord",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ export class ListBambooHarvestEndpoint {

public static readonly HTTP_VERB_LOWER_CASE = "get";

public static readonly OPENAPI_OPERATION_ID = "apiV1ListBambooHarvest";
public static readonly OPENAPI_OPERATION_ID = "listBambooHarvestV1";
}
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export class ListBambooHarvestEndpoint implements IWebServiceEndpoint {
try {
this.log.debug(`${tag}`);

const { data } = await this.opts.apiClient.apiV1QuorumInvokeContract({
const { data } = await this.opts.apiClient.invokeContractV1({
contractName: this.opts.contractName,
invocationType: EthContractInvocationType.Call,
methodName: "getAllRecords",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ export class ListBookshelfEndpoint {

public static readonly HTTP_VERB_LOWER_CASE = "get";

public static readonly OPENAPI_OPERATION_ID = "apiV1ListBookshelf";
public static readonly OPENAPI_OPERATION_ID = "listBookshelfV1";
}
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export class ListBookshelfEndpoint implements IWebServiceEndpoint {
try {
this.log.debug(`${tag}`);

const { data } = await this.opts.besuApi.apiV1BesuInvokeContract({
const { data } = await this.opts.besuApi.invokeContractV1({
contractName: this.opts.contractName,
invocationType: EthContractInvocationType.Call,
methodName: "getAllRecords",
Expand Down
Loading

0 comments on commit ec99555

Please sign in to comment.