UNPKG

@aneoconsultingfr/armonik.api

Version:

gRPC API to interact with ArmoniK built for the web

378 lines (375 loc) 11.3 kB
import { sortDirectionFromJSON, sortDirectionToJSON } from "./chunk-CVDQVHKV.mjs"; import { Filters } from "./chunk-VUUNCROX.mjs"; import { ApplicationField } from "./chunk-TNBTJKQ3.mjs"; // src/generated/applications_common.ts import _m0 from "protobufjs/minimal.js"; var protobufPackage = "armonik.api.grpc.v1.applications"; function createBaseApplicationRaw() { return { name: "", version: "", namespace: "", service: "" }; } var ApplicationRaw = { encode(message, writer = _m0.Writer.create()) { if (message.name !== "") { writer.uint32(10).string(message.name); } if (message.version !== "") { writer.uint32(18).string(message.version); } if (message.namespace !== "") { writer.uint32(26).string(message.namespace); } if (message.service !== "") { writer.uint32(34).string(message.service); } return writer; }, decode(input, length) { const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === void 0 ? reader.len : reader.pos + length; const message = createBaseApplicationRaw(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: if (tag !== 10) { break; } message.name = reader.string(); continue; case 2: if (tag !== 18) { break; } message.version = reader.string(); continue; case 3: if (tag !== 26) { break; } message.namespace = reader.string(); continue; case 4: if (tag !== 34) { break; } message.service = reader.string(); continue; } if ((tag & 7) === 4 || tag === 0) { break; } reader.skipType(tag & 7); } return message; }, fromJSON(object) { return { name: isSet(object.name) ? String(object.name) : "", version: isSet(object.version) ? String(object.version) : "", namespace: isSet(object.namespace) ? String(object.namespace) : "", service: isSet(object.service) ? String(object.service) : "" }; }, toJSON(message) { const obj = {}; if (message.name !== "") { obj.name = message.name; } if (message.version !== "") { obj.version = message.version; } if (message.namespace !== "") { obj.namespace = message.namespace; } if (message.service !== "") { obj.service = message.service; } return obj; }, create(base) { return ApplicationRaw.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseApplicationRaw(); message.name = object.name ?? ""; message.version = object.version ?? ""; message.namespace = object.namespace ?? ""; message.service = object.service ?? ""; return message; } }; function createBaseListApplicationsRequest() { return { page: 0, pageSize: 0, filters: void 0, sort: void 0 }; } var ListApplicationsRequest = { encode(message, writer = _m0.Writer.create()) { if (message.page !== 0) { writer.uint32(8).int32(message.page); } if (message.pageSize !== 0) { writer.uint32(16).int32(message.pageSize); } if (message.filters !== void 0) { Filters.encode(message.filters, writer.uint32(26).fork()).ldelim(); } if (message.sort !== void 0) { ListApplicationsRequest_Sort.encode(message.sort, writer.uint32(34).fork()).ldelim(); } return writer; }, decode(input, length) { const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === void 0 ? reader.len : reader.pos + length; const message = createBaseListApplicationsRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: if (tag !== 8) { break; } message.page = reader.int32(); continue; case 2: if (tag !== 16) { break; } message.pageSize = reader.int32(); continue; case 3: if (tag !== 26) { break; } message.filters = Filters.decode(reader, reader.uint32()); continue; case 4: if (tag !== 34) { break; } message.sort = ListApplicationsRequest_Sort.decode(reader, reader.uint32()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } reader.skipType(tag & 7); } return message; }, fromJSON(object) { return { page: isSet(object.page) ? Number(object.page) : 0, pageSize: isSet(object.pageSize) ? Number(object.pageSize) : 0, filters: isSet(object.filters) ? Filters.fromJSON(object.filters) : void 0, sort: isSet(object.sort) ? ListApplicationsRequest_Sort.fromJSON(object.sort) : void 0 }; }, toJSON(message) { const obj = {}; if (message.page !== 0) { obj.page = Math.round(message.page); } if (message.pageSize !== 0) { obj.pageSize = Math.round(message.pageSize); } if (message.filters !== void 0) { obj.filters = Filters.toJSON(message.filters); } if (message.sort !== void 0) { obj.sort = ListApplicationsRequest_Sort.toJSON(message.sort); } return obj; }, create(base) { return ListApplicationsRequest.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseListApplicationsRequest(); message.page = object.page ?? 0; message.pageSize = object.pageSize ?? 0; message.filters = object.filters !== void 0 && object.filters !== null ? Filters.fromPartial(object.filters) : void 0; message.sort = object.sort !== void 0 && object.sort !== null ? ListApplicationsRequest_Sort.fromPartial(object.sort) : void 0; return message; } }; function createBaseListApplicationsRequest_Sort() { return { fields: [], direction: 0 }; } var ListApplicationsRequest_Sort = { encode(message, writer = _m0.Writer.create()) { for (const v of message.fields) { ApplicationField.encode(v, writer.uint32(10).fork()).ldelim(); } if (message.direction !== 0) { writer.uint32(16).int32(message.direction); } return writer; }, decode(input, length) { const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === void 0 ? reader.len : reader.pos + length; const message = createBaseListApplicationsRequest_Sort(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: if (tag !== 10) { break; } message.fields.push(ApplicationField.decode(reader, reader.uint32())); continue; case 2: if (tag !== 16) { break; } message.direction = reader.int32(); continue; } if ((tag & 7) === 4 || tag === 0) { break; } reader.skipType(tag & 7); } return message; }, fromJSON(object) { return { fields: Array.isArray(object == null ? void 0 : object.fields) ? object.fields.map((e) => ApplicationField.fromJSON(e)) : [], direction: isSet(object.direction) ? sortDirectionFromJSON(object.direction) : 0 }; }, toJSON(message) { var _a; const obj = {}; if ((_a = message.fields) == null ? void 0 : _a.length) { obj.fields = message.fields.map((e) => ApplicationField.toJSON(e)); } if (message.direction !== 0) { obj.direction = sortDirectionToJSON(message.direction); } return obj; }, create(base) { return ListApplicationsRequest_Sort.fromPartial(base ?? {}); }, fromPartial(object) { var _a; const message = createBaseListApplicationsRequest_Sort(); message.fields = ((_a = object.fields) == null ? void 0 : _a.map((e) => ApplicationField.fromPartial(e))) || []; message.direction = object.direction ?? 0; return message; } }; function createBaseListApplicationsResponse() { return { applications: [], page: 0, pageSize: 0, total: 0 }; } var ListApplicationsResponse = { encode(message, writer = _m0.Writer.create()) { for (const v of message.applications) { ApplicationRaw.encode(v, writer.uint32(10).fork()).ldelim(); } if (message.page !== 0) { writer.uint32(16).int32(message.page); } if (message.pageSize !== 0) { writer.uint32(24).int32(message.pageSize); } if (message.total !== 0) { writer.uint32(32).int32(message.total); } return writer; }, decode(input, length) { const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === void 0 ? reader.len : reader.pos + length; const message = createBaseListApplicationsResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: if (tag !== 10) { break; } message.applications.push(ApplicationRaw.decode(reader, reader.uint32())); continue; case 2: if (tag !== 16) { break; } message.page = reader.int32(); continue; case 3: if (tag !== 24) { break; } message.pageSize = reader.int32(); continue; case 4: if (tag !== 32) { break; } message.total = reader.int32(); continue; } if ((tag & 7) === 4 || tag === 0) { break; } reader.skipType(tag & 7); } return message; }, fromJSON(object) { return { applications: Array.isArray(object == null ? void 0 : object.applications) ? object.applications.map((e) => ApplicationRaw.fromJSON(e)) : [], page: isSet(object.page) ? Number(object.page) : 0, pageSize: isSet(object.pageSize) ? Number(object.pageSize) : 0, total: isSet(object.total) ? Number(object.total) : 0 }; }, toJSON(message) { var _a; const obj = {}; if ((_a = message.applications) == null ? void 0 : _a.length) { obj.applications = message.applications.map((e) => ApplicationRaw.toJSON(e)); } if (message.page !== 0) { obj.page = Math.round(message.page); } if (message.pageSize !== 0) { obj.pageSize = Math.round(message.pageSize); } if (message.total !== 0) { obj.total = Math.round(message.total); } return obj; }, create(base) { return ListApplicationsResponse.fromPartial(base ?? {}); }, fromPartial(object) { var _a; const message = createBaseListApplicationsResponse(); message.applications = ((_a = object.applications) == null ? void 0 : _a.map((e) => ApplicationRaw.fromPartial(e))) || []; message.page = object.page ?? 0; message.pageSize = object.pageSize ?? 0; message.total = object.total ?? 0; return message; } }; function isSet(value) { return value !== null && value !== void 0; } export { protobufPackage, ApplicationRaw, ListApplicationsRequest, ListApplicationsRequest_Sort, ListApplicationsResponse };