async createEntity()

in src/lib/service/custos-service/custos-service-entities/index.js [28:54]


    async createEntity({clientId, entityId, parentId, name, description, type, ownerId, fullText, binaryData, secretType, password}) {
        if (type === "SECRET") {
            entityId = await this.custosService.entities.secrets.createSecret({
                type: secretType, clientId, description, ownerId, password
            })
        }

        const axiosInstance = await this.custosService.axiosInstance;
        await axiosInstance.post(
            `${CustosService.ENDPOINTS.SHARING}/entity`,
            {
                "client_id": clientId,
                "entity": {
                    "id": entityId,
                    "parent_id": parentId,
                    "name": name,
                    "description": description,
                    "type": type,
                    "owner_id": ownerId,
                    "full_text": fullText,
                    "binary_data": binaryData
                }
            }
        );

        return entityId;
    }