UNPKG

@zitadel/node

Version:

Library for API access to ZITADEL. Provides compiled gRPC service clients and helpers for applications and service accounts.

1,485 lines 52.6 kB
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
//   protoc-gen-ts_proto  v2.7.5
//   protoc               unknown
// source: zitadel/internal_permission/v2beta/internal_permission_service.proto
/* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
import Long from "long";
import { Timestamp } from "../../../google/protobuf/timestamp.js";
import { PaginationRequest, PaginationResponse } from "../../filter/v2beta/filter.js";
import { Administrator, administratorFieldNameFromJSON, administratorFieldNameToJSON, AdministratorSearchFilter, } from "./query.js";
export const protobufPackage = "zitadel.internal_permission.v2beta";
function createBaseListAdministratorsRequest() {
    return { pagination: undefined, sortingColumn: undefined, filters: [] };
}
export const ListAdministratorsRequest = {
    encode(message, writer = new BinaryWriter()) {
        if (message.pagination !== undefined) {
            PaginationRequest.encode(message.pagination, writer.uint32(10).fork()).join();
        }
        if (message.sortingColumn !== undefined) {
            writer.uint32(16).int32(message.sortingColumn);
        }
        for (const v of message.filters) {
            AdministratorSearchFilter.encode(v, writer.uint32(26).fork()).join();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseListAdministratorsRequest();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 10) {
                        break;
                    }
                    message.pagination = PaginationRequest.decode(reader, reader.uint32());
                    continue;
                }
                case 2: {
                    if (tag !== 16) {
                        break;
                    }
                    message.sortingColumn = reader.int32();
                    continue;
                }
                case 3: {
                    if (tag !== 26) {
                        break;
                    }
                    message.filters.push(AdministratorSearchFilter.decode(reader, reader.uint32()));
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            pagination: isSet(object.pagination) ? PaginationRequest.fromJSON(object.pagination) : undefined,
            sortingColumn: isSet(object.sortingColumn) ? administratorFieldNameFromJSON(object.sortingColumn) : undefined,
            filters: globalThis.Array.isArray(object?.filters)
                ? object.filters.map((e) => AdministratorSearchFilter.fromJSON(e))
                : [],
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.pagination !== undefined) {
            obj.pagination = PaginationRequest.toJSON(message.pagination);
        }
        if (message.sortingColumn !== undefined) {
            obj.sortingColumn = administratorFieldNameToJSON(message.sortingColumn);
        }
        if (message.filters?.length) {
            obj.filters = message.filters.map((e) => AdministratorSearchFilter.toJSON(e));
        }
        return obj;
    },
    create(base) {
        return ListAdministratorsRequest.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseListAdministratorsRequest();
        message.pagination = (object.pagination !== undefined && object.pagination !== null)
            ? PaginationRequest.fromPartial(object.pagination)
            : undefined;
        message.sortingColumn = object.sortingColumn ?? undefined;
        message.filters = object.filters?.map((e) => AdministratorSearchFilter.fromPartial(e)) || [];
        return message;
    },
};
function createBaseListAdministratorsResponse() {
    return { pagination: undefined, administrators: [] };
}
export const ListAdministratorsResponse = {
    encode(message, writer = new BinaryWriter()) {
        if (message.pagination !== undefined) {
            PaginationResponse.encode(message.pagination, writer.uint32(10).fork()).join();
        }
        for (const v of message.administrators) {
            Administrator.encode(v, writer.uint32(18).fork()).join();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseListAdministratorsResponse();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 10) {
                        break;
                    }
                    message.pagination = PaginationResponse.decode(reader, reader.uint32());
                    continue;
                }
                case 2: {
                    if (tag !== 18) {
                        break;
                    }
                    message.administrators.push(Administrator.decode(reader, reader.uint32()));
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            pagination: isSet(object.pagination) ? PaginationResponse.fromJSON(object.pagination) : undefined,
            administrators: globalThis.Array.isArray(object?.administrators)
                ? object.administrators.map((e) => Administrator.fromJSON(e))
                : [],
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.pagination !== undefined) {
            obj.pagination = PaginationResponse.toJSON(message.pagination);
        }
        if (message.administrators?.length) {
            obj.administrators = message.administrators.map((e) => Administrator.toJSON(e));
        }
        return obj;
    },
    create(base) {
        return ListAdministratorsResponse.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseListAdministratorsResponse();
        message.pagination = (object.pagination !== undefined && object.pagination !== null)
            ? PaginationResponse.fromPartial(object.pagination)
            : undefined;
        message.administrators = object.administrators?.map((e) => Administrator.fromPartial(e)) || [];
        return message;
    },
};
function createBaseGetAdministratorRequest() {
    return { id: "" };
}
export const GetAdministratorRequest = {
    encode(message, writer = new BinaryWriter()) {
        if (message.id !== "") {
            writer.uint32(10).string(message.id);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseGetAdministratorRequest();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 10) {
                        break;
                    }
                    message.id = reader.string();
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return { id: isSet(object.id) ? globalThis.String(object.id) : "" };
    },
    toJSON(message) {
        const obj = {};
        if (message.id !== "") {
            obj.id = message.id;
        }
        return obj;
    },
    create(base) {
        return GetAdministratorRequest.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseGetAdministratorRequest();
        message.id = object.id ?? "";
        return message;
    },
};
function createBaseGetAdministratorResponse() {
    return { administrator: undefined };
}
export const GetAdministratorResponse = {
    encode(message, writer = new BinaryWriter()) {
        if (message.administrator !== undefined) {
            Administrator.encode(message.administrator, writer.uint32(10).fork()).join();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseGetAdministratorResponse();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 10) {
                        break;
                    }
                    message.administrator = Administrator.decode(reader, reader.uint32());
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return { administrator: isSet(object.administrator) ? Administrator.fromJSON(object.administrator) : undefined };
    },
    toJSON(message) {
        const obj = {};
        if (message.administrator !== undefined) {
            obj.administrator = Administrator.toJSON(message.administrator);
        }
        return obj;
    },
    create(base) {
        return GetAdministratorResponse.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseGetAdministratorResponse();
        message.administrator = (object.administrator !== undefined && object.administrator !== null)
            ? Administrator.fromPartial(object.administrator)
            : undefined;
        return message;
    },
};
function createBaseCreateAdministratorRequest() {
    return { userId: "", resource: undefined, roles: [] };
}
export const CreateAdministratorRequest = {
    encode(message, writer = new BinaryWriter()) {
        if (message.userId !== "") {
            writer.uint32(10).string(message.userId);
        }
        if (message.resource !== undefined) {
            ResourceType.encode(message.resource, 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);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseCreateAdministratorRequest();
        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.resource = ResourceType.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) : "",
            resource: isSet(object.resource) ? ResourceType.fromJSON(object.resource) : undefined,
            roles: globalThis.Array.isArray(object?.roles) ? object.roles.map((e) => globalThis.String(e)) : [],
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.userId !== "") {
            obj.userId = message.userId;
        }
        if (message.resource !== undefined) {
            obj.resource = ResourceType.toJSON(message.resource);
        }
        if (message.roles?.length) {
            obj.roles = message.roles;
        }
        return obj;
    },
    create(base) {
        return CreateAdministratorRequest.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseCreateAdministratorRequest();
        message.userId = object.userId ?? "";
        message.resource = (object.resource !== undefined && object.resource !== null)
            ? ResourceType.fromPartial(object.resource)
            : undefined;
        message.roles = object.roles?.map((e) => e) || [];
        return message;
    },
};
function createBaseResourceType() {
    return { instance: undefined, organizationId: undefined, projectId: undefined, projectGrant: undefined };
}
export const ResourceType = {
    encode(message, writer = new BinaryWriter()) {
        if (message.instance !== undefined) {
            writer.uint32(8).bool(message.instance);
        }
        if (message.organizationId !== undefined) {
            writer.uint32(18).string(message.organizationId);
        }
        if (message.projectId !== undefined) {
            writer.uint32(26).string(message.projectId);
        }
        if (message.projectGrant !== undefined) {
            ResourceType_ProjectGrant.encode(message.projectGrant, writer.uint32(34).fork()).join();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseResourceType();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 8) {
                        break;
                    }
                    message.instance = reader.bool();
                    continue;
                }
                case 2: {
                    if (tag !== 18) {
                        break;
                    }
                    message.organizationId = reader.string();
                    continue;
                }
                case 3: {
                    if (tag !== 26) {
                        break;
                    }
                    message.projectId = reader.string();
                    continue;
                }
                case 4: {
                    if (tag !== 34) {
                        break;
                    }
                    message.projectGrant = ResourceType_ProjectGrant.decode(reader, reader.uint32());
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            instance: isSet(object.instance) ? globalThis.Boolean(object.instance) : undefined,
            organizationId: isSet(object.organizationId) ? globalThis.String(object.organizationId) : undefined,
            projectId: isSet(object.projectId) ? globalThis.String(object.projectId) : undefined,
            projectGrant: isSet(object.projectGrant) ? ResourceType_ProjectGrant.fromJSON(object.projectGrant) : undefined,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.instance !== undefined) {
            obj.instance = message.instance;
        }
        if (message.organizationId !== undefined) {
            obj.organizationId = message.organizationId;
        }
        if (message.projectId !== undefined) {
            obj.projectId = message.projectId;
        }
        if (message.projectGrant !== undefined) {
            obj.projectGrant = ResourceType_ProjectGrant.toJSON(message.projectGrant);
        }
        return obj;
    },
    create(base) {
        return ResourceType.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseResourceType();
        message.instance = object.instance ?? undefined;
        message.organizationId = object.organizationId ?? undefined;
        message.projectId = object.projectId ?? undefined;
        message.projectGrant = (object.projectGrant !== undefined && object.projectGrant !== null)
            ? ResourceType_ProjectGrant.fromPartial(object.projectGrant)
            : undefined;
        return message;
    },
};
function createBaseResourceType_ProjectGrant() {
    return { projectId: "", projectGrantId: "" };
}
export const ResourceType_ProjectGrant = {
    encode(message, writer = new BinaryWriter()) {
        if (message.projectId !== "") {
            writer.uint32(10).string(message.projectId);
        }
        if (message.projectGrantId !== "") {
            writer.uint32(18).string(message.projectGrantId);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseResourceType_ProjectGrant();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 10) {
                        break;
                    }
                    message.projectId = reader.string();
                    continue;
                }
                case 2: {
                    if (tag !== 18) {
                        break;
                    }
                    message.projectGrantId = reader.string();
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            projectId: isSet(object.projectId) ? globalThis.String(object.projectId) : "",
            projectGrantId: isSet(object.projectGrantId) ? globalThis.String(object.projectGrantId) : "",
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.projectId !== "") {
            obj.projectId = message.projectId;
        }
        if (message.projectGrantId !== "") {
            obj.projectGrantId = message.projectGrantId;
        }
        return obj;
    },
    create(base) {
        return ResourceType_ProjectGrant.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseResourceType_ProjectGrant();
        message.projectId = object.projectId ?? "";
        message.projectGrantId = object.projectGrantId ?? "";
        return message;
    },
};
function createBaseCreateAdministratorResponse() {
    return { creationDate: undefined };
}
export const CreateAdministratorResponse = {
    encode(message, writer = new BinaryWriter()) {
        if (message.creationDate !== undefined) {
            Timestamp.encode(toTimestamp(message.creationDate), writer.uint32(10).fork()).join();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseCreateAdministratorResponse();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 10) {
                        break;
                    }
                    message.creationDate = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return { creationDate: isSet(object.creationDate) ? fromJsonTimestamp(object.creationDate) : undefined };
    },
    toJSON(message) {
        const obj = {};
        if (message.creationDate !== undefined) {
            obj.creationDate = message.creationDate.toISOString();
        }
        return obj;
    },
    create(base) {
        return CreateAdministratorResponse.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseCreateAdministratorResponse();
        message.creationDate = object.creationDate ?? undefined;
        return message;
    },
};
function createBaseUpdateAdministratorRequest() {
    return { userId: "", resource: undefined, roles: [] };
}
export const UpdateAdministratorRequest = {
    encode(message, writer = new BinaryWriter()) {
        if (message.userId !== "") {
            writer.uint32(10).string(message.userId);
        }
        if (message.resource !== undefined) {
            ResourceType.encode(message.resource, 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);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseUpdateAdministratorRequest();
        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.resource = ResourceType.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) : "",
            resource: isSet(object.resource) ? ResourceType.fromJSON(object.resource) : undefined,
            roles: globalThis.Array.isArray(object?.roles) ? object.roles.map((e) => globalThis.String(e)) : [],
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.userId !== "") {
            obj.userId = message.userId;
        }
        if (message.resource !== undefined) {
            obj.resource = ResourceType.toJSON(message.resource);
        }
        if (message.roles?.length) {
            obj.roles = message.roles;
        }
        return obj;
    },
    create(base) {
        return UpdateAdministratorRequest.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseUpdateAdministratorRequest();
        message.userId = object.userId ?? "";
        message.resource = (object.resource !== undefined && object.resource !== null)
            ? ResourceType.fromPartial(object.resource)
            : undefined;
        message.roles = object.roles?.map((e) => e) || [];
        return message;
    },
};
function createBaseUpdateAdministratorResponse() {
    return { changeDate: undefined };
}
export const UpdateAdministratorResponse = {
    encode(message, writer = new BinaryWriter()) {
        if (message.changeDate !== undefined) {
            Timestamp.encode(toTimestamp(message.changeDate), writer.uint32(10).fork()).join();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseUpdateAdministratorResponse();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 10) {
                        break;
                    }
                    message.changeDate = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return { changeDate: isSet(object.changeDate) ? fromJsonTimestamp(object.changeDate) : undefined };
    },
    toJSON(message) {
        const obj = {};
        if (message.changeDate !== undefined) {
            obj.changeDate = message.changeDate.toISOString();
        }
        return obj;
    },
    create(base) {
        return UpdateAdministratorResponse.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseUpdateAdministratorResponse();
        message.changeDate = object.changeDate ?? undefined;
        return message;
    },
};
function createBaseDeleteAdministratorRequest() {
    return { userId: "", resource: undefined };
}
export const DeleteAdministratorRequest = {
    encode(message, writer = new BinaryWriter()) {
        if (message.userId !== "") {
            writer.uint32(10).string(message.userId);
        }
        if (message.resource !== undefined) {
            ResourceType.encode(message.resource, writer.uint32(18).fork()).join();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseDeleteAdministratorRequest();
        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.resource = ResourceType.decode(reader, reader.uint32());
                    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) : "",
            resource: isSet(object.resource) ? ResourceType.fromJSON(object.resource) : undefined,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.userId !== "") {
            obj.userId = message.userId;
        }
        if (message.resource !== undefined) {
            obj.resource = ResourceType.toJSON(message.resource);
        }
        return obj;
    },
    create(base) {
        return DeleteAdministratorRequest.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseDeleteAdministratorRequest();
        message.userId = object.userId ?? "";
        message.resource = (object.resource !== undefined && object.resource !== null)
            ? ResourceType.fromPartial(object.resource)
            : undefined;
        return message;
    },
};
function createBaseDeleteAdministratorResponse() {
    return { deletionDate: undefined };
}
export const DeleteAdministratorResponse = {
    encode(message, writer = new BinaryWriter()) {
        if (message.deletionDate !== undefined) {
            Timestamp.encode(toTimestamp(message.deletionDate), writer.uint32(10).fork()).join();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseDeleteAdministratorResponse();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 10) {
                        break;
                    }
                    message.deletionDate = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return { deletionDate: isSet(object.deletionDate) ? fromJsonTimestamp(object.deletionDate) : undefined };
    },
    toJSON(message) {
        const obj = {};
        if (message.deletionDate !== undefined) {
            obj.deletionDate = message.deletionDate.toISOString();
        }
        return obj;
    },
    create(base) {
        return DeleteAdministratorResponse.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseDeleteAdministratorResponse();
        message.deletionDate = object.deletionDate ?? undefined;
        return message;
    },
};
export const InternalPermissionServiceDefinition = {
    name: "InternalPermissionService",
    fullName: "zitadel.internal_permission.v2beta.InternalPermissionService",
    methods: {
        /**
         * ListAdministrators returns all administrators and its roles matching the request and necessary permissions.
         *
         * Required permissions depend on the resource type:
         *   - "iam.member.read" for instance administrators
         *   - "org.member.read" for organization administrators
         *   - "project.member.read" for project administrators
         *   - "project.grant.member.read" for project grant administrators
         *   - no permissions required for listing own administrator roles
         */
        listAdministrators: {
            name: "ListAdministrators",
            requestType: ListAdministratorsRequest,
            requestStream: false,
            responseType: ListAdministratorsResponse,
            responseStream: false,
            options: {
                _unknownFields: {
                    8338: [
                        Buffer.from([
                            87,
                            74,
                            56,
                            10,
                            3,
                            50,
                            48,
                            48,
                            18,
                            49,
                            10,
                            47,
                            65,
                            32,
                            108,
                            105,
                            115,
                            116,
                            32,
                            111,
                            102,
                            32,
                            97,
                            108,
                            108,
                            32,
                            97,
                            100,
                            109,
                            105,
                            110,
                            105,
                            115,
                            116,
                            114,
                            97,
                            116,
                            111,
                            114,
                            115,
                            32,
                            109,
                            97,
                            116,
                            99,
                            104,
                            105,
                            110,
                            103,
                            32,
                            116,
                            104,
                            101,
                            32,
                            113,
                            117,
                            101,
                            114,
                            121,
                            74,
                            27,
                            10,
                            3,
                            52,
                            48,
                            48,
                            18,
                            20,
                            10,
                            18,
                            105,
                            110,
                            118,
                            97,
                            108,
                            105,
                            100,
                            32,
                            108,
                            105,
                            115,
                            116,
                            32,
                            113,
                            117,
                            101,
                            114,
                            121,
                        ]),
                    ],
                    400010: [Buffer.from([17, 10, 15, 10, 13, 97, 117, 116, 104, 101, 110, 116, 105, 99, 97, 116, 101, 100])],
                    578365826: [
                        Buffer.from([
                            34,
                            58,
                            1,
                            42,
                            34,
                            29,
                            47,
                            118,
                            50,
                            98,
                            101,
                            116,
                            97,
                            47,
                            97,
                            100,
                            109,
                            105,
                            110,
                            105,
                            115,
                            116,
                            114,
                            97,
                            116,
                            111,
                            114,
                            115,
                            47,
                            115,
                            101,
                            97,
                            114,
                            99,
                            104,
                        ]),
                    ],
                },
            },
        },
        /**
         * CreateAdministrator grants a administrator role to a user for a specific resource.
         *
         * Note that the roles are specific to the resource type.
         * This means that if you want to grant a user the administrator role for an organization and a project,
         * you need to create two administrator roles.
         *
         * Required permissions depend on the resource type:
         *   - "iam.member.write" for instance administrators
         *   - "org.member.write" for organization administrators
         *   - "project.member.write" for project administrators
         *   - "project.grant.member.write" for project grant administrators
         */
        createAdministrator: {
            name: "CreateAdministrator",
            requestType: CreateAdministratorRequest,
            requestStream: false,
            responseType: CreateAdministratorResponse,
            responseStream: false,
            options: {
                _unknownFields: {
                    8338: [
                        Buffer.from([
                            99,
                            74,
                            43,
                            10,
                            3,
                            50,
                            48,
                            48,
                            18,
                            36,
                            10,
                            34,
                            65,
                            100,
                            109,
                            105,
                            110,
                            105,
                            115,
                            116,
                            114,
                            97,
                            116,
                            111,
                            114,
                            32,
                            99,
                            114,
                            101,
                            97,
                            116,
                            101,
                            100,
                            32,
                            115,
                            117,
                            99,
                            99,
                            101,
                            115,
                            115,
                            102,
                            117,
                            108,
                            108,
                            121,
                            74,
                            52,
                            10,
                            3,
                            52,
                            48,
                            57,
                            18,
                            45,
                            10,
                            43,
                            84,
                            104,
                            101,
                            32,
                            97,
                            100,
                            109,
                            105,
                            110,
                            105,
                            115,
                            116,
                            114,
                            97,
                            116,
                            111,
                            114,
                            32,
                            116,
                            111,
                            32,
                            99,
                            114,
                            101,
                            97,
                            116,
                            101,
                            32,
                            97,
                            108,
                            114,
                            101,
                            97,
                            100,
                            121,
                            32,
                            101,
                            120,
                            105,
                            115,
                            116,
                            115,
                            46,
                        ]),
                    ],
                    400010: [Buffer.from([17, 10, 15, 10, 13, 97, 117, 116, 104, 101, 110, 116, 105, 99, 97, 116, 101, 100])],
                    578365826: [
                        Buffer.from([
                            27,
                            58,
                            1,
                            42,
                            34,
                            22,
                            47,
                            118,
                            50,
                            98,
                            101,
                            116,
                            97,
                            47,
                            97,
                            100,
                            109,
                            105,
                            110,
                            105,
                            115,
                            116,
                            114,
                            97,
                            116,
                            111,
                            114,
                            115,
                        ]),
                    ],
                },
            },
        },
        /**
         * UpdateAdministrator updates the specific administrator role.
         *
         * Note that any role previously granted to the user and not present in the request will be revoked.
         *
         * Required permissions depend on the resource type:
         *   - "iam.member.write" for instance administrators
         *   - "org.member.write" for organization administrators
         *   - "project.member.write" for project administrators
         *   - "project.grant.member.write" for project grant administrators
         */
        updateAdministrator: {
            name: "UpdateAdministrator",
            requestType: UpdateAdministratorRequest,
            requestStream: false,
            responseType: UpdateAdministratorResponse,
            responseStream: false,
            options: {
                _unknownFields: {
                    8338: [
                        Buffer.from([
                            117,
                            74,
                            61,
                            10,
                            3,
                            50,
                            48,
                            48,
                            18,
                            54,
                            10,
                            52,
                            65,
                            100,
                            109,
                            105,
                            110,
                            105,
                            115,
                            116,
                            114,
                            97,
                            116,
                            111,
                            114,
                            32,
                            115,
                            117,
                            99,
                            99,
                            101,
                            115,
                            115,
                            102,
                            117,
                            108,
                            108,
                            121,
                            32,
                            117,
                            112,
                            100,
                            97,
                            116,
                            101,
                            100,
                            32,
                            111,
                            114,
                            32,
                            108,
                            101,
                            102,
                            116,
                            32,
                            117,
                            110,
                            99,
                            104,
                            97,
                            110,
                            103,
                            101,
                            100,
                            74,
                            52,
                            10,
                            3,
                            52,
                            48,
                            52,
                            18,
                            45,
                            10,
                            43,
                            84,
                            104,
                            101,
                            32,
                            97,
                            100,
                            109,
                            105,
                            110,
                            105,
                            115,
                            116,
                            114,
                            97,
                            116,
                            111,
                            114,
                            32,
                            116,
                            111,
                            32,
                            117,
                            112,
                            100,
                            97,
                            116,
                            101,
                            32,
                            100,
                            111,
                            101,
                            115,
                            32,
                            110,
                            111,
                            116,
                            32,
                            101,
                            120,
                            105,
                            115,
                            116,
                            46,
                        ]),
                    ],
                    400010: [Buffer.from([17, 10, 15, 10, 13, 97, 117, 116, 104, 101, 110, 116, 105, 99, 97, 116, 101, 100])],
                    578365826: [
                        Buffer.from([
                            37,
                            58,
                            1,
                            42,
                            34,
                            32,
                            47,
                            118,
                            50,
                            98,
                            101,
                            116,
                            97,
                            47,
                            97,
                            100,
                            109,
                            105,
                            110,
                            105,
                            115,
                            116,
                            114,
                            97,
                            116,
                            111,
                            114,
                            115,
                            47,
                            123,
                            117,
                            115,
                            101,
                            114,
                            95,
                            105,
                            100,
                            125,
                        ]),
                    ],
                },
            },
        },
        /**
         * DeleteAdministrator revokes a administrator role from a user.
         *
         * In case the administrator role is not found, the request will return a successful response as
         * the desired state is already achieved.
         * You can check the deletion date in the response to verify if the administrator role was deleted during the request.
         *
         * Required permissions depend on the resource type:
         *   - "iam.member.delete" for instance administrators
         *   - "org.member.delete" for organization administrators
         *   - "project.member.delete" for project administrators
         *   - "project.grant.member.delete" for project grant administrators
         */
        deleteAdministrator: {
            name: "DeleteAdministrator",
            requestType: DeleteAdministratorRequest,
            requestStream: false,
            responseType: DeleteAdministratorResponse,
            responseStream: false,
            options: {
                _unknownFields: {
                    8338: [
                        Buffer.from([
                            45,
                            74,
                            43,
                            10,
                            3,
                            50,
                            48,
                            48,
                            18,
                            36,
                            10,
                            34,
                            65,
                            100,
                            109,
                            105,
                            110,
                            105,
                            115,
                            116,
                            114,
                            97,
                            116,
                            111,
                            114,
                            32,
                            100,
                            101,
                            108,
                            101,
                            116,
                            101,
                            100,
                            32,
                            115,
                            117,
                            99,
                            99,
                            101,
                            115,
                            115,
                            102,
                            117,
                            108,
                            108,
                            121,
                        ]),
                    ],
                    400010: [Buffer.from([17, 10, 15, 10, 13, 97, 117, 116, 104, 101, 110, 116, 105, 99, 97, 116, 101, 100])],
                    578365826: [
                        Buffer.from([
                            34,
                            42,
                            32,
                            47,
                            118,
                            50,
                            98,
                            101,
                            116,
                            97,
                            47,
                            97,
                            100,
                            109,
                            105,
                            110,
                            105,
                            115,
                            116,
                            114,
                            97,
                            116,
                            111,
                            114,
                            115,
                            47,
                            123,
                            117,
                            115,
                            101,
                            114,
                            95,
                            105,
                            100,
                            125,
                        ]),
                    ],
                },
            },
        },
    },
};
function toTimestamp(date) {
    const seconds = numberToLong(Math.trunc(date.getTime() / 1_000));
    const nanos = (date.getTime() % 1_000) * 1_000_000;
    return { seconds, nanos };
}
function fromTimestamp(t) {
    let millis = (t.seconds.toNumber() || 0) * 1_000;
    millis += (t.nanos || 0) / 1_000_000;
    return new globalThis.Date(millis);
}
function fromJsonTimestamp(o) {
    if (o instanceof globalThis.Date) {
        return o;
    }
    else if (typeof o === "string") {
        return new globalThis.Date(o);
    }
    else {
        return fromTimestamp(Timestamp.fromJSON(o));
    }
}
function numberToLong(number) {
    return Long.fromNumber(number);
}
function isSet(value) {
    return value !== null && value !== undefined;
}