@linagora/ldap-rest-client 1.0.5 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -38,8 +38,11 @@ const client = new LdapRestClient({
38
38
  baseUrl: 'https://ldap-rest.example.com',
39
39
  });
40
40
 
41
- // Manage users in organization (returns baseDN)
42
- const { baseDN } = await client.organizations.createUser(orgId, userData);
41
+ // Manage users in organization (returns User object)
42
+ const user = await client.organizations.createUser(orgId, userData);
43
+ console.log(user._id); // Access unique identifier
44
+ console.log(user.organizationId); // Access organization ID
45
+
43
46
  await client.organizations.listUsers(orgId, { page: 1, limit: 20 });
44
47
 
45
48
  // Manage groups (returns Group object)
@@ -79,11 +82,12 @@ client.organizations.transferOwnership(orgId, { newOwnerUsername })
79
82
 
80
83
  ### B2B Users (within Organizations)
81
84
  ```typescript
82
- // Returns baseDN of created user
83
- const { baseDN } = await client.organizations.createUser(orgId, userData)
85
+ // Returns full User object with _id and organizationId
86
+ const user = await client.organizations.createUser(orgId, userData)
87
+ console.log(user._id, user.organizationId)
84
88
 
85
- // Returns User object or { success: true }
86
- const result = await client.organizations.updateUser(orgId, userId, updates)
89
+ // Returns updated User object or { success: true }
90
+ const updatedUser = await client.organizations.updateUser(orgId, userId, updates)
87
91
 
88
92
  client.organizations.disableUser(orgId, userId)
89
93
  client.organizations.deleteUser(orgId, userId)
package/dist/index.d.mts CHANGED
@@ -385,6 +385,8 @@ interface User {
385
385
  recoveryEmail?: string;
386
386
  /** Timestamp when password account was locked */
387
387
  pwdAccountLockedTime?: string;
388
+ /** Organization ID for B2B users */
389
+ organizationId?: string;
388
390
  /** User's role in Twake organization ('owner', 'admin', 'moderator', 'member') */
389
391
  twakeOrganizationRole?: string;
390
392
  /** Full name as a single string */
@@ -565,11 +567,9 @@ interface ListUsersResponse {
565
567
  }
566
568
  /**
567
569
  * Response from creating a B2B user in an organization
570
+ * Returns the full user object with all fields populated
568
571
  */
569
- interface CreateB2BUserResponse {
570
- /** Base DN of the created user */
571
- baseDN: string;
572
- }
572
+ type CreateB2BUserResponse = User;
573
573
 
574
574
  /**
575
575
  * Organization domain model representing a B2B organization
@@ -1139,7 +1139,7 @@ declare class OrganizationsResource extends BaseResource {
1139
1139
  *
1140
1140
  * @param {string} organizationId - Organization identifier
1141
1141
  * @param {CreateUserRequest} data - User data including credentials and profile
1142
- * @returns {Promise<CreateB2BUserResponse>} Response with user's baseDN
1142
+ * @returns {Promise<CreateB2BUserResponse>} The created user object with all fields populated
1143
1143
  * @throws {ForbiddenError} When user lacks admin privileges
1144
1144
  * @throws {NotFoundError} When organization is not found
1145
1145
  * @throws {ConflictError} When username/email/phone already exists
@@ -1147,11 +1147,12 @@ declare class OrganizationsResource extends BaseResource {
1147
1147
  *
1148
1148
  * @example
1149
1149
  * ```typescript
1150
- * const result = await client.organizations.createUser('org_abc123', {
1150
+ * const user = await client.organizations.createUser('org_abc123', {
1151
1151
  * cn: 'john.doe',
1152
1152
  * uid: 'john.doe',
1153
1153
  * // ... other user fields
1154
1154
  * });
1155
+ * console.log(user._id); // Access the user's unique identifier
1155
1156
  * ```
1156
1157
  */
1157
1158
  createUser: (organizationId: string, data: CreateUserRequest) => Promise<CreateB2BUserResponse>;
@@ -1163,16 +1164,17 @@ declare class OrganizationsResource extends BaseResource {
1163
1164
  * @param {string} organizationId - Organization identifier
1164
1165
  * @param {string} userId - User identifier (username)
1165
1166
  * @param {UpdateUserRequest} data - Fields to update
1166
- * @returns {Promise<User | { success: true }>} Updated user object or success response
1167
+ * @returns {Promise<User | { success: true }>} The updated user object with all fields populated
1167
1168
  * @throws {NotFoundError} When user or organization is not found
1168
1169
  * @throws {ForbiddenError} When user lacks admin privileges
1169
1170
  * @throws {ApiError} On other API errors
1170
1171
  *
1171
1172
  * @example
1172
1173
  * ```typescript
1173
- * const result = await client.organizations.updateUser('org_abc123', 'john.doe', {
1174
+ * const user = await client.organizations.updateUser('org_abc123', 'john.doe', {
1174
1175
  * mobile: '+33687654321'
1175
1176
  * });
1177
+ * console.log(user); // Access the updated user object
1176
1178
  * ```
1177
1179
  */
1178
1180
  updateUser: (organizationId: string, userId: string, data: UpdateUserRequest) => Promise<User | {
package/dist/index.d.ts CHANGED
@@ -385,6 +385,8 @@ interface User {
385
385
  recoveryEmail?: string;
386
386
  /** Timestamp when password account was locked */
387
387
  pwdAccountLockedTime?: string;
388
+ /** Organization ID for B2B users */
389
+ organizationId?: string;
388
390
  /** User's role in Twake organization ('owner', 'admin', 'moderator', 'member') */
389
391
  twakeOrganizationRole?: string;
390
392
  /** Full name as a single string */
@@ -565,11 +567,9 @@ interface ListUsersResponse {
565
567
  }
566
568
  /**
567
569
  * Response from creating a B2B user in an organization
570
+ * Returns the full user object with all fields populated
568
571
  */
569
- interface CreateB2BUserResponse {
570
- /** Base DN of the created user */
571
- baseDN: string;
572
- }
572
+ type CreateB2BUserResponse = User;
573
573
 
574
574
  /**
575
575
  * Organization domain model representing a B2B organization
@@ -1139,7 +1139,7 @@ declare class OrganizationsResource extends BaseResource {
1139
1139
  *
1140
1140
  * @param {string} organizationId - Organization identifier
1141
1141
  * @param {CreateUserRequest} data - User data including credentials and profile
1142
- * @returns {Promise<CreateB2BUserResponse>} Response with user's baseDN
1142
+ * @returns {Promise<CreateB2BUserResponse>} The created user object with all fields populated
1143
1143
  * @throws {ForbiddenError} When user lacks admin privileges
1144
1144
  * @throws {NotFoundError} When organization is not found
1145
1145
  * @throws {ConflictError} When username/email/phone already exists
@@ -1147,11 +1147,12 @@ declare class OrganizationsResource extends BaseResource {
1147
1147
  *
1148
1148
  * @example
1149
1149
  * ```typescript
1150
- * const result = await client.organizations.createUser('org_abc123', {
1150
+ * const user = await client.organizations.createUser('org_abc123', {
1151
1151
  * cn: 'john.doe',
1152
1152
  * uid: 'john.doe',
1153
1153
  * // ... other user fields
1154
1154
  * });
1155
+ * console.log(user._id); // Access the user's unique identifier
1155
1156
  * ```
1156
1157
  */
1157
1158
  createUser: (organizationId: string, data: CreateUserRequest) => Promise<CreateB2BUserResponse>;
@@ -1163,16 +1164,17 @@ declare class OrganizationsResource extends BaseResource {
1163
1164
  * @param {string} organizationId - Organization identifier
1164
1165
  * @param {string} userId - User identifier (username)
1165
1166
  * @param {UpdateUserRequest} data - Fields to update
1166
- * @returns {Promise<User | { success: true }>} Updated user object or success response
1167
+ * @returns {Promise<User | { success: true }>} The updated user object with all fields populated
1167
1168
  * @throws {NotFoundError} When user or organization is not found
1168
1169
  * @throws {ForbiddenError} When user lacks admin privileges
1169
1170
  * @throws {ApiError} On other API errors
1170
1171
  *
1171
1172
  * @example
1172
1173
  * ```typescript
1173
- * const result = await client.organizations.updateUser('org_abc123', 'john.doe', {
1174
+ * const user = await client.organizations.updateUser('org_abc123', 'john.doe', {
1174
1175
  * mobile: '+33687654321'
1175
1176
  * });
1177
+ * console.log(user); // Access the updated user object
1176
1178
  * ```
1177
1179
  */
1178
1180
  updateUser: (organizationId: string, userId: string, data: UpdateUserRequest) => Promise<User | {
package/dist/index.js CHANGED
@@ -878,7 +878,7 @@ var OrganizationsResource = class extends BaseResource {
878
878
  *
879
879
  * @param {string} organizationId - Organization identifier
880
880
  * @param {CreateUserRequest} data - User data including credentials and profile
881
- * @returns {Promise<CreateB2BUserResponse>} Response with user's baseDN
881
+ * @returns {Promise<CreateB2BUserResponse>} The created user object with all fields populated
882
882
  * @throws {ForbiddenError} When user lacks admin privileges
883
883
  * @throws {NotFoundError} When organization is not found
884
884
  * @throws {ConflictError} When username/email/phone already exists
@@ -886,11 +886,12 @@ var OrganizationsResource = class extends BaseResource {
886
886
  *
887
887
  * @example
888
888
  * ```typescript
889
- * const result = await client.organizations.createUser('org_abc123', {
889
+ * const user = await client.organizations.createUser('org_abc123', {
890
890
  * cn: 'john.doe',
891
891
  * uid: 'john.doe',
892
892
  * // ... other user fields
893
893
  * });
894
+ * console.log(user._id); // Access the user's unique identifier
894
895
  * ```
895
896
  */
896
897
  createUser = async (organizationId, data) => {
@@ -907,16 +908,17 @@ var OrganizationsResource = class extends BaseResource {
907
908
  * @param {string} organizationId - Organization identifier
908
909
  * @param {string} userId - User identifier (username)
909
910
  * @param {UpdateUserRequest} data - Fields to update
910
- * @returns {Promise<User | { success: true }>} Updated user object or success response
911
+ * @returns {Promise<User | { success: true }>} The updated user object with all fields populated
911
912
  * @throws {NotFoundError} When user or organization is not found
912
913
  * @throws {ForbiddenError} When user lacks admin privileges
913
914
  * @throws {ApiError} On other API errors
914
915
  *
915
916
  * @example
916
917
  * ```typescript
917
- * const result = await client.organizations.updateUser('org_abc123', 'john.doe', {
918
+ * const user = await client.organizations.updateUser('org_abc123', 'john.doe', {
918
919
  * mobile: '+33687654321'
919
920
  * });
921
+ * console.log(user); // Access the updated user object
920
922
  * ```
921
923
  */
922
924
  updateUser = async (organizationId, userId, data) => {
package/dist/index.mjs CHANGED
@@ -840,7 +840,7 @@ var OrganizationsResource = class extends BaseResource {
840
840
  *
841
841
  * @param {string} organizationId - Organization identifier
842
842
  * @param {CreateUserRequest} data - User data including credentials and profile
843
- * @returns {Promise<CreateB2BUserResponse>} Response with user's baseDN
843
+ * @returns {Promise<CreateB2BUserResponse>} The created user object with all fields populated
844
844
  * @throws {ForbiddenError} When user lacks admin privileges
845
845
  * @throws {NotFoundError} When organization is not found
846
846
  * @throws {ConflictError} When username/email/phone already exists
@@ -848,11 +848,12 @@ var OrganizationsResource = class extends BaseResource {
848
848
  *
849
849
  * @example
850
850
  * ```typescript
851
- * const result = await client.organizations.createUser('org_abc123', {
851
+ * const user = await client.organizations.createUser('org_abc123', {
852
852
  * cn: 'john.doe',
853
853
  * uid: 'john.doe',
854
854
  * // ... other user fields
855
855
  * });
856
+ * console.log(user._id); // Access the user's unique identifier
856
857
  * ```
857
858
  */
858
859
  createUser = async (organizationId, data) => {
@@ -869,16 +870,17 @@ var OrganizationsResource = class extends BaseResource {
869
870
  * @param {string} organizationId - Organization identifier
870
871
  * @param {string} userId - User identifier (username)
871
872
  * @param {UpdateUserRequest} data - Fields to update
872
- * @returns {Promise<User | { success: true }>} Updated user object or success response
873
+ * @returns {Promise<User | { success: true }>} The updated user object with all fields populated
873
874
  * @throws {NotFoundError} When user or organization is not found
874
875
  * @throws {ForbiddenError} When user lacks admin privileges
875
876
  * @throws {ApiError} On other API errors
876
877
  *
877
878
  * @example
878
879
  * ```typescript
879
- * const result = await client.organizations.updateUser('org_abc123', 'john.doe', {
880
+ * const user = await client.organizations.updateUser('org_abc123', 'john.doe', {
880
881
  * mobile: '+33687654321'
881
882
  * });
883
+ * console.log(user); // Access the updated user object
882
884
  * ```
883
885
  */
884
886
  updateUser = async (organizationId, userId, data) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@linagora/ldap-rest-client",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "TypeScript API client for LDAP-REST",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",