Skip to content

Commit

Permalink
feat(bungee-hermes): process view functionality
Browse files Browse the repository at this point in the history
Signed-off-by: eduv09 <[email protected]>
  • Loading branch information
eduv09 committed Apr 11, 2024
1 parent 2e1417d commit 4a08b12
Show file tree
Hide file tree
Showing 11 changed files with 864 additions and 10 deletions.
67 changes: 66 additions & 1 deletion packages/cactus-plugin-bungee-hermes/src/main/json/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
},
"CreateViewResponse":{
"type":"object",
"description": "This is the response for a viewRequests",
"description": "This is the response for a CreateViewRequest or ProcessViewRequest",
"properties": {
"view":{
"type":"string",
Expand Down Expand Up @@ -182,6 +182,30 @@
}
},
"example": {"serializedViews": ["View 1", "View2"], "mergePolicy": "undefined" }
},
"ProcessViewRequest":{
"type":"object",
"description": "This is the input for a mergeViewRequest",
"required": ["serializedView", "policyId", "policyArguments"],
"properties": {
"serializedView":{
"type": "string",
"nullable": false,
"example": "View object stringified"
},
"policyId":{
"type": "string",
"example": "Identifier of the mergePolicy to use"
},
"policyArguments":{
"type": "array",
"description": "Arguments for the privacy policy function. Order is important",
"items":{
"type": "string"
}
}
},
"example": {"serializedView": "View 1", "policyId": "policy 1", "policyArguments": ["stateId"]}
}
}
},
Expand Down Expand Up @@ -370,6 +394,47 @@
}
}
}
},
"/api/v1/plugins/@hyperledger/cactus-plugin-bungee-hermes/process-view": {
"get": {
"x-hyperledger-cacti": {
"http": {
"verbLowerCase": "get",
"path": "/api/v1/plugins/@hyperledger/cactus-plugin-bungee-hermes/process-view"
}
},
"operationId": "processViewV1",
"summary": "Creates a Blockchain View.",
"description": "",
"parameters": [],
"requestBody": {
"required": true,
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProcessViewRequest"
}
}
}
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateViewResponse"
},
"example": {"view": "Object", "signature":"signature of Object"}
}
}
},
"404": {
"description": "Could not complete request."
}
}
}
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export interface CreateViewRequestNetworkDetails {
'participant': string;
}
/**
* This is the response for a viewRequests
* This is the response for a CreateViewRequest or ProcessViewRequest
* @export
* @interface CreateViewResponse
*/
Expand Down Expand Up @@ -161,6 +161,31 @@ export interface MergeViewsResponse {
*/
'signature'?: string;
}
/**
* This is the input for a mergeViewRequest
* @export
* @interface ProcessViewRequest
*/
export interface ProcessViewRequest {
/**
*
* @type {string}
* @memberof ProcessViewRequest
*/
'serializedView': string;
/**
*
* @type {string}
* @memberof ProcessViewRequest
*/
'policyId': string;
/**
* Arguments for the privacy policy function. Order is important
* @type {Array<string>}
* @memberof ProcessViewRequest
*/
'policyArguments': Array<string>;
}
/**
* Set of transaction or state proofs and merkle tree root for verification
* @export
Expand Down Expand Up @@ -332,6 +357,42 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati
options: localVarRequestOptions,
};
},
/**
*
* @summary Creates a Blockchain View.
* @param {ProcessViewRequest} processViewRequest
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
processViewV1: async (processViewRequest: ProcessViewRequest, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'processViewRequest' is not null or undefined
assertParamExists('processViewV1', 'processViewRequest', processViewRequest)
const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-bungee-hermes/process-view`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}

const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;



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

setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
localVarRequestOptions.data = serializeDataIfNeeded(processViewRequest, localVarRequestOptions, configuration)

return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
*
* @summary Checks validity of merkle tree root given an input
Expand Down Expand Up @@ -420,6 +481,17 @@ export const DefaultApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = await localVarAxiosParamCreator.mergeViewsV1(mergeViewsRequest, options);
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
},
/**
*
* @summary Creates a Blockchain View.
* @param {ProcessViewRequest} processViewRequest
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async processViewV1(processViewRequest: ProcessViewRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<CreateViewResponse>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.processViewV1(processViewRequest, options);
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
},
/**
*
* @summary Checks validity of merkle tree root given an input
Expand Down Expand Up @@ -479,6 +551,16 @@ export const DefaultApiFactory = function (configuration?: Configuration, basePa
mergeViewsV1(mergeViewsRequest: MergeViewsRequest, options?: any): AxiosPromise<MergeViewsResponse> {
return localVarFp.mergeViewsV1(mergeViewsRequest, options).then((request) => request(axios, basePath));
},
/**
*
* @summary Creates a Blockchain View.
* @param {ProcessViewRequest} processViewRequest
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
processViewV1(processViewRequest: ProcessViewRequest, options?: any): AxiosPromise<CreateViewResponse> {
return localVarFp.processViewV1(processViewRequest, options).then((request) => request(axios, basePath));
},
/**
*
* @summary Checks validity of merkle tree root given an input
Expand Down Expand Up @@ -545,6 +627,18 @@ export class DefaultApi extends BaseAPI {
return DefaultApiFp(this.configuration).mergeViewsV1(mergeViewsRequest, options).then((request) => request(this.axios, this.basePath));
}

/**
*
* @summary Creates a Blockchain View.
* @param {ProcessViewRequest} processViewRequest
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof DefaultApi
*/
public processViewV1(processViewRequest: ProcessViewRequest, options?: AxiosRequestConfig) {
return DefaultApiFp(this.configuration).processViewV1(processViewRequest, options).then((request) => request(this.axios, this.basePath));
}

/**
*
* @summary Checks validity of merkle tree root given an input
Expand Down
Loading

0 comments on commit 4a08b12

Please sign in to comment.