@proxima-nexus/sdk-typescript 2.0.0 → 2.0.1

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.
Files changed (3) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +173 -159
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -5,6 +5,12 @@ All notable changes to the Proxima Nexus TypeScript SDK are documented in this f
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [2.0.1] - 2025-01-29
9
+
10
+ ### Changed
11
+
12
+ - Updated README.md to reflect version 2.0.0 API changes, including method renames, updated method signatures, and connection operation examples
13
+
8
14
  ## [2.0.0] - 2025-01-29
9
15
 
10
16
  ### Breaking Changes
package/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  TypeScript SDK for the Proxima Nexus Data Plane API.
4
4
 
5
+ > **Note:** This SDK version 2.0.0 includes breaking changes. See the [CHANGELOG.md](./CHANGELOG.md) for migration details.
6
+
5
7
  ## Installation
6
8
 
7
9
  ```bash
@@ -29,88 +31,88 @@ async function main() {
29
31
  try {
30
32
  // Create a user
31
33
  const createResponse = await client.users.create({
32
- createUserDto: {
33
- userId: 'user-123',
34
- displayName: 'John Doe',
35
- requesterUserId: 'requester-123',
36
- visibility: 'public',
37
- gender: 'male',
38
- birthDate: '1990-01-01',
39
- location: {
40
- latitude: 40.7128,
41
- longitude: -74.006,
42
- name: 'New York, NY'
43
- }
44
- },
34
+ userId: 'user-123',
35
+ displayName: 'John Doe',
36
+ visibility: 'public',
37
+ gender: 'male',
38
+ birthDate: '1990-01-01',
39
+ location: {
40
+ latitude: 40.7128,
41
+ longitude: -74.006,
42
+ name: 'New York, NY'
43
+ }
45
44
  });
46
45
  console.log('Created user:', createResponse.data);
47
46
 
48
47
  // Search users
49
- const searchResponse = await client.users.search({
50
- displayName: 'John',
51
- latitude: 40.7128,
52
- longitude: -74.006,
53
- radius: 5000,
54
- limit: 10,
55
- });
48
+ const searchResponse = await client.users.search(
49
+ 'John', // displayName
50
+ 40.7128, // latitude
51
+ -74.006, // longitude
52
+ 5000, // radius
53
+ undefined, // minLatitude
54
+ undefined, // maxLatitude
55
+ undefined, // minLongitude
56
+ undefined, // maxLongitude
57
+ 10, // limit
58
+ 'requester-123' // xProximaNexusRequesterUserId (optional)
59
+ );
56
60
  console.log('Found users:', searchResponse.data);
57
61
 
58
62
  // Get user by ID
59
- const user = await client.users.findOne({
60
- userId: 'user-123',
61
- });
63
+ const user = await client.users.get('user-123', 'requester-123');
62
64
  console.log('User details:', user.data);
63
65
 
64
66
  // Update a user
65
- const updated = await client.users.update({
66
- userId: 'user-123',
67
- updateUserDto: {
68
- requesterUserId: 'requester-123',
67
+ const updated = await client.users.update(
68
+ 'user-123',
69
+ 'requester-123',
70
+ {
69
71
  displayName: 'John Smith',
70
72
  gender: 'male',
71
73
  birthDate: '1990-01-01',
72
- },
73
- });
74
+ }
75
+ );
74
76
  console.log('Updated user:', updated.data);
75
77
 
76
78
  // Delete a user
77
- await client.users.remove({
78
- userId: 'user-123',
79
- });
79
+ await client.users.remove('user-123', 'requester-123');
80
80
 
81
81
  // Get a batch of users
82
- const batchUsers = await client.users.getBatch({
83
- getUsersDto: {
84
- userIds: ['user-1', 'user-2', 'user-3'],
85
- },
86
- });
82
+ const batchUsers = await client.users.getBatch(
83
+ { userIds: ['user-1', 'user-2', 'user-3'] },
84
+ 'requester-123'
85
+ );
87
86
  console.log('Batch users:', batchUsers.data);
88
87
 
89
- // Friend operations
90
- const friends = await client.users.getFriends({
91
- userId: 'user-123',
92
- });
93
- console.log('Friends:', friends.data);
94
-
95
- await client.users.addFriend({
96
- userId: 'user-123',
97
- friendUserId: 'friend-456',
98
- });
99
-
100
- await client.users.removeFriend({
101
- userId: 'user-123',
102
- friendUserId: 'friend-456',
103
- });
88
+ // Connection operations
89
+ const connections = await client.users.getConnections(
90
+ 'user-123',
91
+ undefined, // state filter (optional)
92
+ undefined, // type filter (optional)
93
+ 'requester-123' // xProximaNexusRequesterUserId (optional)
94
+ );
95
+ console.log('Connections:', connections.data);
96
+
97
+ await client.users.putConnection(
98
+ 'user-123',
99
+ 'friend-456',
100
+ 'requester-123',
101
+ { type: 'friend' } // MutateUserConnectionDto
102
+ );
103
+
104
+ await client.users.deleteConnection(
105
+ 'user-123',
106
+ 'friend-456',
107
+ 'friend', // type: 'friend' | 'blocked'
108
+ 'requester-123'
109
+ );
104
110
 
105
111
  // Get user's groups and events
106
- const groups = await client.users.getGroups({
107
- userId: 'user-123',
108
- });
112
+ const groups = await client.users.getGroups('user-123', 'requester-123');
109
113
  console.log('User groups:', groups.data);
110
114
 
111
- const events = await client.users.getEvents({
112
- userId: 'user-123',
113
- });
115
+ const events = await client.users.getEvents('user-123', 'requester-123');
114
116
  console.log('User events:', events.data);
115
117
  } catch (error: any) {
116
118
  console.error('API Error:', error.message);
@@ -129,77 +131,84 @@ async function main() {
129
131
  try {
130
132
  // Create an event
131
133
  const event = await client.events.create({
132
- createEventDto: {
133
- eventId: 'event-123',
134
- displayName: 'Tech Meetup',
135
- requesterUserId: 'user-123',
136
- visibility: 'public',
137
- startTime: '2024-12-01T18:00:00Z',
138
- endTime: '2024-12-01T22:00:00Z',
139
- type: 'meetup',
140
- location: {
141
- latitude: 40.7128,
142
- longitude: -74.006,
143
- name: 'New York, NY'
144
- },
145
- description: 'Monthly tech meetup',
134
+ eventId: 'event-123',
135
+ displayName: 'Tech Meetup',
136
+ visibility: 'public',
137
+ startTime: '2024-12-01T18:00:00Z',
138
+ endTime: '2024-12-01T22:00:00Z',
139
+ type: 'meetup',
140
+ location: {
141
+ latitude: 40.7128,
142
+ longitude: -74.006,
143
+ name: 'New York, NY'
146
144
  },
145
+ description: 'Monthly tech meetup',
147
146
  });
148
147
  console.log('Created event:', event.data);
149
148
 
150
149
  // Search events
151
- const events = await client.events.search({
152
- displayName: 'Tech',
153
- latitude: 40.7128,
154
- longitude: -74.006,
155
- radius: 10000,
156
- limit: 50,
157
- });
150
+ const events = await client.events.search(
151
+ 'Tech', // displayName
152
+ 40.7128, // latitude
153
+ -74.006, // longitude
154
+ 10000, // radius
155
+ undefined, // minLatitude
156
+ undefined, // maxLatitude
157
+ undefined, // minLongitude
158
+ undefined, // maxLongitude
159
+ 50, // limit
160
+ 'user-123' // xProximaNexusRequesterUserId (optional)
161
+ );
158
162
  console.log('Found events:', events.data);
159
163
 
160
164
  // Get an event by ID
161
- const eventDetails = await client.events.findOne({
162
- eventId: 'event-123',
163
- });
165
+ const eventDetails = await client.events.get('event-123', 'user-123');
164
166
  console.log('Event details:', eventDetails.data);
165
167
 
166
168
  // Update an event
167
- const updatedEvent = await client.events.update({
168
- eventId: 'event-123',
169
- updateEventDto: {
170
- requesterUserId: 'user-123',
169
+ const updatedEvent = await client.events.update(
170
+ 'event-123',
171
+ 'user-123',
172
+ {
171
173
  displayName: 'Tech Meetup 2024',
172
174
  startTime: '2024-12-01T18:00:00Z',
173
175
  endTime: '2024-12-01T23:00:00Z',
174
176
  type: 'meetup',
175
- },
176
- });
177
+ }
178
+ );
177
179
  console.log('Updated event:', updatedEvent.data);
178
180
 
179
181
  // Delete an event
180
- await client.events.remove({
181
- eventId: 'event-123',
182
- requesterUserId: 'user-123',
183
- });
182
+ await client.events.remove('event-123', 'user-123');
184
183
 
185
184
  // Get a batch of events
186
- const batchEvents = await client.events.getBatch({
187
- getEventsDto: {
188
- eventIds: ['event-1', 'event-2', 'event-3'],
189
- },
190
- });
185
+ const batchEvents = await client.events.getBatch(
186
+ { eventIds: ['event-1', 'event-2', 'event-3'] },
187
+ 'user-123'
188
+ );
191
189
  console.log('Batch events:', batchEvents.data);
192
190
 
193
- // Attendee operations
194
- const attendees = await client.events.getAttendees({
195
- eventId: 'event-123',
196
- });
197
- console.log('Attendees:', attendees.data);
198
-
199
- await client.events.addAttendee({
200
- eventId: 'event-123',
201
- userId: 'user-456',
202
- });
191
+ // Connection operations
192
+ const connections = await client.events.getConnections(
193
+ 'event-123',
194
+ undefined, // type filter (optional)
195
+ 'user-123' // xProximaNexusRequesterUserId (optional)
196
+ );
197
+ console.log('Connections:', connections.data);
198
+
199
+ await client.events.addConnection(
200
+ 'event-123',
201
+ 'user-456',
202
+ 'user-123',
203
+ { type: 'attendee' } // MutateEventEntityConnectionDto
204
+ );
205
+
206
+ await client.events.removeConnection(
207
+ 'event-123',
208
+ 'user-456',
209
+ 'user-123',
210
+ { type: 'attendee' } // MutateEventEntityConnectionDto
211
+ );
203
212
  } catch (error: any) {
204
213
  console.error('API Error:', error.message);
205
214
  if (error.response) {
@@ -217,78 +226,79 @@ async function main() {
217
226
  try {
218
227
  // Create a group
219
228
  const group = await client.groups.create({
220
- createGroupDto: {
221
- groupId: 'group-123',
222
- displayName: 'Music Lovers',
223
- requesterUserId: 'user-123',
224
- visibility: 'public',
225
- type: 'club',
226
- description: 'A group for music enthusiasts',
227
- },
229
+ groupId: 'group-123',
230
+ displayName: 'Music Lovers',
231
+ visibility: 'public',
232
+ type: 'open', // enum: 'open' | 'request' | 'invite'
233
+ description: 'A group for music enthusiasts',
228
234
  });
229
235
  console.log('Created group:', group.data);
230
236
 
231
237
  // Search groups
232
- const groups = await client.groups.search({
233
- displayName: 'Music',
234
- latitude: 40.7128,
235
- longitude: -74.006,
236
- radius: 5000,
237
- limit: 100,
238
- });
238
+ const groups = await client.groups.search(
239
+ 'Music', // displayName
240
+ 40.7128, // latitude
241
+ -74.006, // longitude
242
+ 5000, // radius
243
+ undefined, // minLatitude
244
+ undefined, // maxLatitude
245
+ undefined, // minLongitude
246
+ undefined, // maxLongitude
247
+ 100, // limit
248
+ 'user-123' // xProximaNexusRequesterUserId (optional)
249
+ );
239
250
  console.log('Found groups:', groups.data);
240
251
 
241
252
  // Get a group by ID
242
- const groupDetails = await client.groups.findOne({
243
- groupId: 'group-123',
244
- });
253
+ const groupDetails = await client.groups.get('group-123', 'user-123');
245
254
  console.log('Group details:', groupDetails.data);
246
255
 
247
256
  // Update a group
248
- const updatedGroup = await client.groups.update({
249
- groupId: 'group-123',
250
- updateGroupDto: {
251
- requesterUserId: 'user-123',
257
+ const updatedGroup = await client.groups.update(
258
+ 'group-123',
259
+ 'user-123',
260
+ {
252
261
  displayName: 'Music Enthusiasts',
253
- type: 'club',
254
- },
255
- });
262
+ type: 'open',
263
+ }
264
+ );
256
265
  console.log('Updated group:', updatedGroup.data);
257
266
 
258
267
  // Delete a group
259
- await client.groups.remove({
260
- groupId: 'group-123',
261
- requesterUserId: 'user-123',
262
- });
268
+ await client.groups.remove('group-123', 'user-123');
263
269
 
264
270
  // Get a batch of groups
265
- const batchGroups = await client.groups.getBatch({
266
- getGroupsDto: {
267
- groupIds: ['group-1', 'group-2', 'group-3'],
268
- },
269
- });
271
+ const batchGroups = await client.groups.getBatch(
272
+ { groupIds: ['group-1', 'group-2', 'group-3'] },
273
+ 'user-123'
274
+ );
270
275
  console.log('Batch groups:', batchGroups.data);
271
276
 
272
- // Member operations
273
- const members = await client.groups.getMembers({
274
- groupId: 'group-123',
275
- });
276
- console.log('Members:', members.data);
277
-
278
- await client.groups.addMember({
279
- groupId: 'group-123',
280
- userId: 'user-456',
281
- });
282
-
283
- await client.groups.removeMember({
284
- groupId: 'group-123',
285
- userId: 'user-456',
286
- });
277
+ // Connection operations
278
+ const connections = await client.groups.getConnections(
279
+ 'group-123',
280
+ undefined, // state filter (optional)
281
+ undefined, // type filter (optional)
282
+ 'user-123' // xProximaNexusRequesterUserId (optional)
283
+ );
284
+ console.log('Connections:', connections.data);
285
+
286
+ await client.groups.addConnection(
287
+ 'group-123',
288
+ 'user-456',
289
+ 'user-123',
290
+ { type: 'member' } // MutateGroupEntityConnectionDto
291
+ );
292
+
293
+ await client.groups.removeConnection(
294
+ 'group-123',
295
+ 'user-456',
296
+ 'user-123',
297
+ { type: 'member' } // MutateGroupEntityConnectionDto
298
+ );
287
299
 
288
300
  // Get group's events
289
- const groupEvents = await client.groups.getEvents({
290
- groupId: 'group-123',
291
- });
301
+ const groupEvents = await client.groups.getEvents('group-123', 'user-123');
292
302
  console.log('Group events:', groupEvents.data);
293
303
  } catch (error: any) {
294
304
  console.error('API Error:', error.message);
@@ -300,6 +310,10 @@ async function main() {
300
310
  }
301
311
  ```
302
312
 
313
+ ## Requester User ID
314
+
315
+ In version 2.0.0, the requester user ID is passed as a method parameter (`xProximaNexusRequesterUserId`) rather than in request bodies. This parameter is optional for most operations but required for operations that modify entities (create, update, delete) or when accessing non-public entities.
316
+
303
317
  ## Configuration
304
318
 
305
319
  The `ProximaNexusClientConfig` interface supports the following options:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proxima-nexus/sdk-typescript",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "TypeScript SDK for Proxima Nexus Data Plane API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",