@cheqd/ts-proto
Version:
A TypeScript package for all transpiled cheqd ProtoBuf definitions.
521 lines • 18.3 kB
JavaScript
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.6.1
// protoc unknown
// source: cheqd/resource/v2/query.proto
/* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
import { PageRequest, PageResponse } from "../../../cosmos/base/query/v1beta1/pagination.js";
import { FeeParams } from "./fee.js";
import { Metadata, ResourceWithMetadata } from "./resource.js";
function createBaseQueryResourceRequest() {
return { collectionId: "", id: "" };
}
export const QueryResourceRequest = {
encode(message, writer = new BinaryWriter()) {
if (message.collectionId !== "") {
writer.uint32(10).string(message.collectionId);
}
if (message.id !== "") {
writer.uint32(18).string(message.id);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseQueryResourceRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.collectionId = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.id = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
collectionId: isSet(object.collectionId) ? globalThis.String(object.collectionId) : "",
id: isSet(object.id) ? globalThis.String(object.id) : "",
};
},
toJSON(message) {
const obj = {};
if (message.collectionId !== "") {
obj.collectionId = message.collectionId;
}
if (message.id !== "") {
obj.id = message.id;
}
return obj;
},
create(base) {
return QueryResourceRequest.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseQueryResourceRequest();
message.collectionId = object.collectionId ?? "";
message.id = object.id ?? "";
return message;
},
};
function createBaseQueryResourceResponse() {
return { resource: undefined };
}
export const QueryResourceResponse = {
encode(message, writer = new BinaryWriter()) {
if (message.resource !== undefined) {
ResourceWithMetadata.encode(message.resource, writer.uint32(10).fork()).join();
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseQueryResourceResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.resource = ResourceWithMetadata.decode(reader, reader.uint32());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return { resource: isSet(object.resource) ? ResourceWithMetadata.fromJSON(object.resource) : undefined };
},
toJSON(message) {
const obj = {};
if (message.resource !== undefined) {
obj.resource = ResourceWithMetadata.toJSON(message.resource);
}
return obj;
},
create(base) {
return QueryResourceResponse.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseQueryResourceResponse();
message.resource = (object.resource !== undefined && object.resource !== null)
? ResourceWithMetadata.fromPartial(object.resource)
: undefined;
return message;
},
};
function createBaseQueryResourceMetadataRequest() {
return { collectionId: "", id: "" };
}
export const QueryResourceMetadataRequest = {
encode(message, writer = new BinaryWriter()) {
if (message.collectionId !== "") {
writer.uint32(10).string(message.collectionId);
}
if (message.id !== "") {
writer.uint32(18).string(message.id);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseQueryResourceMetadataRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.collectionId = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.id = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
collectionId: isSet(object.collectionId) ? globalThis.String(object.collectionId) : "",
id: isSet(object.id) ? globalThis.String(object.id) : "",
};
},
toJSON(message) {
const obj = {};
if (message.collectionId !== "") {
obj.collectionId = message.collectionId;
}
if (message.id !== "") {
obj.id = message.id;
}
return obj;
},
create(base) {
return QueryResourceMetadataRequest.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseQueryResourceMetadataRequest();
message.collectionId = object.collectionId ?? "";
message.id = object.id ?? "";
return message;
},
};
function createBaseQueryResourceMetadataResponse() {
return { resource: undefined };
}
export const QueryResourceMetadataResponse = {
encode(message, writer = new BinaryWriter()) {
if (message.resource !== undefined) {
Metadata.encode(message.resource, writer.uint32(10).fork()).join();
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseQueryResourceMetadataResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.resource = Metadata.decode(reader, reader.uint32());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return { resource: isSet(object.resource) ? Metadata.fromJSON(object.resource) : undefined };
},
toJSON(message) {
const obj = {};
if (message.resource !== undefined) {
obj.resource = Metadata.toJSON(message.resource);
}
return obj;
},
create(base) {
return QueryResourceMetadataResponse.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseQueryResourceMetadataResponse();
message.resource = (object.resource !== undefined && object.resource !== null)
? Metadata.fromPartial(object.resource)
: undefined;
return message;
},
};
function createBaseQueryCollectionResourcesRequest() {
return { collectionId: "", pagination: undefined };
}
export const QueryCollectionResourcesRequest = {
encode(message, writer = new BinaryWriter()) {
if (message.collectionId !== "") {
writer.uint32(10).string(message.collectionId);
}
if (message.pagination !== undefined) {
PageRequest.encode(message.pagination, writer.uint32(18).fork()).join();
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseQueryCollectionResourcesRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.collectionId = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.pagination = PageRequest.decode(reader, reader.uint32());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
collectionId: isSet(object.collectionId) ? globalThis.String(object.collectionId) : "",
pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined,
};
},
toJSON(message) {
const obj = {};
if (message.collectionId !== "") {
obj.collectionId = message.collectionId;
}
if (message.pagination !== undefined) {
obj.pagination = PageRequest.toJSON(message.pagination);
}
return obj;
},
create(base) {
return QueryCollectionResourcesRequest.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseQueryCollectionResourcesRequest();
message.collectionId = object.collectionId ?? "";
message.pagination = (object.pagination !== undefined && object.pagination !== null)
? PageRequest.fromPartial(object.pagination)
: undefined;
return message;
},
};
function createBaseQueryCollectionResourcesResponse() {
return { resources: [], pagination: undefined };
}
export const QueryCollectionResourcesResponse = {
encode(message, writer = new BinaryWriter()) {
for (const v of message.resources) {
Metadata.encode(v, writer.uint32(10).fork()).join();
}
if (message.pagination !== undefined) {
PageResponse.encode(message.pagination, writer.uint32(18).fork()).join();
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseQueryCollectionResourcesResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.resources.push(Metadata.decode(reader, reader.uint32()));
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.pagination = PageResponse.decode(reader, reader.uint32());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
resources: globalThis.Array.isArray(object?.resources)
? object.resources.map((e) => Metadata.fromJSON(e))
: [],
pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined,
};
},
toJSON(message) {
const obj = {};
if (message.resources?.length) {
obj.resources = message.resources.map((e) => Metadata.toJSON(e));
}
if (message.pagination !== undefined) {
obj.pagination = PageResponse.toJSON(message.pagination);
}
return obj;
},
create(base) {
return QueryCollectionResourcesResponse.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseQueryCollectionResourcesResponse();
message.resources = object.resources?.map((e) => Metadata.fromPartial(e)) || [];
message.pagination = (object.pagination !== undefined && object.pagination !== null)
? PageResponse.fromPartial(object.pagination)
: undefined;
return message;
},
};
function createBaseQueryParamsRequest() {
return {};
}
export const QueryParamsRequest = {
encode(_, writer = new BinaryWriter()) {
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseQueryParamsRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(_) {
return {};
},
toJSON(_) {
const obj = {};
return obj;
},
create(base) {
return QueryParamsRequest.fromPartial(base ?? {});
},
fromPartial(_) {
const message = createBaseQueryParamsRequest();
return message;
},
};
function createBaseQueryParamsResponse() {
return { params: undefined };
}
export const QueryParamsResponse = {
encode(message, writer = new BinaryWriter()) {
if (message.params !== undefined) {
FeeParams.encode(message.params, writer.uint32(10).fork()).join();
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseQueryParamsResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.params = FeeParams.decode(reader, reader.uint32());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return { params: isSet(object.params) ? FeeParams.fromJSON(object.params) : undefined };
},
toJSON(message) {
const obj = {};
if (message.params !== undefined) {
obj.params = FeeParams.toJSON(message.params);
}
return obj;
},
create(base) {
return QueryParamsResponse.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseQueryParamsResponse();
message.params = (object.params !== undefined && object.params !== null)
? FeeParams.fromPartial(object.params)
: undefined;
return message;
},
};
export const QueryServiceName = "cheqd.resource.v2.Query";
export class QueryClientImpl {
rpc;
service;
constructor(rpc, opts) {
this.service = opts?.service || QueryServiceName;
this.rpc = rpc;
this.Resource = this.Resource.bind(this);
this.ResourceMetadata = this.ResourceMetadata.bind(this);
this.CollectionResources = this.CollectionResources.bind(this);
this.Params = this.Params.bind(this);
}
Resource(request) {
const data = QueryResourceRequest.encode(request).finish();
const promise = this.rpc.request(this.service, "Resource", data);
return promise.then((data) => QueryResourceResponse.decode(new BinaryReader(data)));
}
ResourceMetadata(request) {
const data = QueryResourceMetadataRequest.encode(request).finish();
const promise = this.rpc.request(this.service, "ResourceMetadata", data);
return promise.then((data) => QueryResourceMetadataResponse.decode(new BinaryReader(data)));
}
CollectionResources(request) {
const data = QueryCollectionResourcesRequest.encode(request).finish();
const promise = this.rpc.request(this.service, "CollectionResources", data);
return promise.then((data) => QueryCollectionResourcesResponse.decode(new BinaryReader(data)));
}
Params(request) {
const data = QueryParamsRequest.encode(request).finish();
const promise = this.rpc.request(this.service, "Params", data);
return promise.then((data) => QueryParamsResponse.decode(new BinaryReader(data)));
}
}
function isSet(value) {
return value !== null && value !== undefined;
}
//# sourceMappingURL=query.js.map