@zitadel/node
Version:
Library for API access to ZITADEL. Provides compiled gRPC service clients and helpers for applications and service accounts.
575 lines (574 loc) • 20.1 kB
JavaScript
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.7.0
// protoc unknown
// source: zitadel/org/v2beta/org_service.proto
/* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
import { Details } from "../../object/v2beta/object.js";
import { AddHumanUserRequest } from "../../user/v2beta/user_service.js";
export const protobufPackage = "zitadel.org.v2beta";
function createBaseAddOrganizationRequest() {
return { name: "", admins: [] };
}
export const AddOrganizationRequest = {
encode(message, writer = new BinaryWriter()) {
if (message.name !== "") {
writer.uint32(10).string(message.name);
}
for (const v of message.admins) {
AddOrganizationRequest_Admin.encode(v, 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 = createBaseAddOrganizationRequest();
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.admins.push(AddOrganizationRequest_Admin.decode(reader, reader.uint32()));
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
name: isSet(object.name) ? globalThis.String(object.name) : "",
admins: globalThis.Array.isArray(object?.admins)
? object.admins.map((e) => AddOrganizationRequest_Admin.fromJSON(e))
: [],
};
},
toJSON(message) {
const obj = {};
if (message.name !== "") {
obj.name = message.name;
}
if (message.admins?.length) {
obj.admins = message.admins.map((e) => AddOrganizationRequest_Admin.toJSON(e));
}
return obj;
},
create(base) {
return AddOrganizationRequest.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseAddOrganizationRequest();
message.name = object.name ?? "";
message.admins = object.admins?.map((e) => AddOrganizationRequest_Admin.fromPartial(e)) || [];
return message;
},
};
function createBaseAddOrganizationRequest_Admin() {
return { userId: undefined, human: undefined, roles: [] };
}
export const AddOrganizationRequest_Admin = {
encode(message, writer = new BinaryWriter()) {
if (message.userId !== undefined) {
writer.uint32(10).string(message.userId);
}
if (message.human !== undefined) {
AddHumanUserRequest.encode(message.human, writer.uint32(18).fork()).join();
}
for (const v of message.roles) {
writer.uint32(26).string(v);
}
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 = createBaseAddOrganizationRequest_Admin();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.userId = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.human = AddHumanUserRequest.decode(reader, reader.uint32());
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.roles.push(reader.string());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
userId: isSet(object.userId) ? globalThis.String(object.userId) : undefined,
human: isSet(object.human) ? AddHumanUserRequest.fromJSON(object.human) : undefined,
roles: globalThis.Array.isArray(object?.roles) ? object.roles.map((e) => globalThis.String(e)) : [],
};
},
toJSON(message) {
const obj = {};
if (message.userId !== undefined) {
obj.userId = message.userId;
}
if (message.human !== undefined) {
obj.human = AddHumanUserRequest.toJSON(message.human);
}
if (message.roles?.length) {
obj.roles = message.roles;
}
return obj;
},
create(base) {
return AddOrganizationRequest_Admin.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseAddOrganizationRequest_Admin();
message.userId = object.userId ?? undefined;
message.human = (object.human !== undefined && object.human !== null)
? AddHumanUserRequest.fromPartial(object.human)
: undefined;
message.roles = object.roles?.map((e) => e) || [];
return message;
},
};
function createBaseAddOrganizationResponse() {
return { details: undefined, organizationId: "", createdAdmins: [] };
}
export const AddOrganizationResponse = {
encode(message, writer = new BinaryWriter()) {
if (message.details !== undefined) {
Details.encode(message.details, writer.uint32(10).fork()).join();
}
if (message.organizationId !== "") {
writer.uint32(18).string(message.organizationId);
}
for (const v of message.createdAdmins) {
AddOrganizationResponse_CreatedAdmin.encode(v, writer.uint32(26).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 = createBaseAddOrganizationResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.details = Details.decode(reader, reader.uint32());
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.organizationId = reader.string();
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.createdAdmins.push(AddOrganizationResponse_CreatedAdmin.decode(reader, reader.uint32()));
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
details: isSet(object.details) ? Details.fromJSON(object.details) : undefined,
organizationId: isSet(object.organizationId) ? globalThis.String(object.organizationId) : "",
createdAdmins: globalThis.Array.isArray(object?.createdAdmins)
? object.createdAdmins.map((e) => AddOrganizationResponse_CreatedAdmin.fromJSON(e))
: [],
};
},
toJSON(message) {
const obj = {};
if (message.details !== undefined) {
obj.details = Details.toJSON(message.details);
}
if (message.organizationId !== "") {
obj.organizationId = message.organizationId;
}
if (message.createdAdmins?.length) {
obj.createdAdmins = message.createdAdmins.map((e) => AddOrganizationResponse_CreatedAdmin.toJSON(e));
}
return obj;
},
create(base) {
return AddOrganizationResponse.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseAddOrganizationResponse();
message.details = (object.details !== undefined && object.details !== null)
? Details.fromPartial(object.details)
: undefined;
message.organizationId = object.organizationId ?? "";
message.createdAdmins = object.createdAdmins?.map((e) => AddOrganizationResponse_CreatedAdmin.fromPartial(e)) || [];
return message;
},
};
function createBaseAddOrganizationResponse_CreatedAdmin() {
return { userId: "", emailCode: undefined, phoneCode: undefined };
}
export const AddOrganizationResponse_CreatedAdmin = {
encode(message, writer = new BinaryWriter()) {
if (message.userId !== "") {
writer.uint32(10).string(message.userId);
}
if (message.emailCode !== undefined) {
writer.uint32(18).string(message.emailCode);
}
if (message.phoneCode !== undefined) {
writer.uint32(26).string(message.phoneCode);
}
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 = createBaseAddOrganizationResponse_CreatedAdmin();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.userId = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.emailCode = reader.string();
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.phoneCode = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
userId: isSet(object.userId) ? globalThis.String(object.userId) : "",
emailCode: isSet(object.emailCode) ? globalThis.String(object.emailCode) : undefined,
phoneCode: isSet(object.phoneCode) ? globalThis.String(object.phoneCode) : undefined,
};
},
toJSON(message) {
const obj = {};
if (message.userId !== "") {
obj.userId = message.userId;
}
if (message.emailCode !== undefined) {
obj.emailCode = message.emailCode;
}
if (message.phoneCode !== undefined) {
obj.phoneCode = message.phoneCode;
}
return obj;
},
create(base) {
return AddOrganizationResponse_CreatedAdmin.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseAddOrganizationResponse_CreatedAdmin();
message.userId = object.userId ?? "";
message.emailCode = object.emailCode ?? undefined;
message.phoneCode = object.phoneCode ?? undefined;
return message;
},
};
export const OrganizationServiceDefinition = {
name: "OrganizationService",
fullName: "zitadel.org.v2beta.OrganizationService",
methods: {
/** Create a new organization and grant the user(s) permission to manage it */
addOrganization: {
name: "AddOrganization",
requestType: AddOrganizationRequest,
requestStream: false,
responseType: AddOrganizationResponse,
responseStream: false,
options: {
_unknownFields: {
8338: [
Buffer.from([
180,
1,
18,
22,
67,
114,
101,
97,
116,
101,
32,
97,
110,
32,
79,
114,
103,
97,
110,
105,
122,
97,
116,
105,
111,
110,
26,
140,
1,
67,
114,
101,
97,
116,
101,
32,
97,
32,
110,
101,
119,
32,
111,
114,
103,
97,
110,
105,
122,
97,
116,
105,
111,
110,
32,
119,
105,
116,
104,
32,
97,
110,
32,
97,
100,
109,
105,
110,
105,
115,
116,
114,
97,
116,
105,
118,
101,
32,
117,
115,
101,
114,
46,
32,
73,
102,
32,
110,
111,
32,
115,
112,
101,
99,
105,
102,
105,
99,
32,
114,
111,
108,
101,
115,
32,
97,
114,
101,
32,
115,
101,
110,
116,
32,
102,
111,
114,
32,
116,
104,
101,
32,
117,
115,
101,
114,
115,
44,
32,
116,
104,
101,
121,
32,
119,
105,
108,
108,
32,
98,
101,
32,
103,
114,
97,
110,
116,
101,
100,
32,
116,
104,
101,
32,
114,
111,
108,
101,
32,
79,
82,
71,
95,
79,
87,
78,
69,
82,
46,
74,
11,
10,
3,
50,
48,
48,
18,
4,
10,
2,
79,
75,
]),
],
400010: [Buffer.from([19, 10, 12, 10, 10, 111, 114, 103, 46, 99, 114, 101, 97, 116, 101, 18, 3, 8, 201, 1])],
578365826: [
Buffer.from([
26,
58,
1,
42,
34,
21,
47,
118,
50,
98,
101,
116,
97,
47,
111,
114,
103,
97,
110,
105,
122,
97,
116,
105,
111,
110,
115,
]),
],
},
},
},
},
};
function isSet(value) {
return value !== null && value !== undefined;
}