@foru-ms/sdk 1.2.0 → 1.2.2

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
@@ -6,13 +6,13 @@ This SDK is fully typed and provides a comprehensive interface to the Foru.ms AP
6
6
 
7
7
  ## Features
8
8
 
9
- **Fully Typed** - Complete TypeScript support with detailed type definitions
10
- 🔄 **Auto Retry** - Automatic retry logic for rate limits and server errors
11
- 📄 **Easy Pagination** - Built-in helpers for cursor-based pagination
12
- 🚨 **Rich Error Classes** - Specific error types for better error handling
13
- 🔐 **Webhook Verification** - Built-in signature verification for webhooks
14
- 📊 **Rate Limit Tracking** - Automatic tracking of API rate limits
15
- 📚 **Comprehensive Examples** - Detailed examples for common use cases
9
+ **Fully Typed** - Complete TypeScript support with detailed type definitions
10
+ **Auto Retry** - Automatic retry logic for rate limits and server errors
11
+ **Easy Pagination** - Built-in helpers for cursor-based pagination
12
+ **Rich Error Classes** - Specific error types for better error handling
13
+ **Webhook Verification** - Built-in signature verification for webhooks
14
+ **Rate Limit Tracking** - Automatic tracking of API rate limits
15
+ **Comprehensive Examples** - Detailed examples for common use cases
16
16
 
17
17
  ## Installation
18
18
 
@@ -183,9 +183,11 @@ Check the `/examples` directory for detailed examples:
183
183
  * `me()`: Get specific details of the currently authenticated user.
184
184
  * `forgotPassword(email: string)`: Initiate password reset flow.
185
185
  * `resetPassword(payload: { password: string; oldPassword?: string; email?: string; token?: string })`: Reset password using token or old password.
186
+ * `getSecurity()`: Get account security information for the authenticated user. Returns IP addresses, registration date, last seen timestamp, and verification status. **Requires authentication token.**
186
187
 
187
188
  ### Threads (`client.threads`)
188
189
 
190
+
189
191
  * `list(params: { limit?: number; filter?: 'newest' | 'oldest'; tagId?: string; cursor?: string })`: List threads.
190
192
  * `create(payload: CreateThreadPayload)`: Create a new thread.
191
193
  * `retrieve(id: string)`: Get a thread by ID.
@@ -341,6 +343,7 @@ import {
341
343
  RegisterPayload,
342
344
  User,
343
345
  LoginResponse,
346
+ SecurityInfo,
344
347
 
345
348
  // Thread Types
346
349
  Thread,
@@ -504,21 +507,28 @@ We welcome contributions! Please see our contributing guidelines for more inform
504
507
 
505
508
  ## Support
506
509
 
507
- - 📧 Email: support@foru.ms
508
- - 📚 Documentation: https://docs.foru.ms
509
- - 🐛 Issues: https://github.com/foru-ms/sdk/issues
510
+ - Support: https://foru.ms/support
511
+ - Documentation: https://docs.foru.ms
512
+ - Issues: https://github.com/foru-ms/sdk/issues
510
513
 
511
514
  ## Changelog
512
515
 
516
+ ### v1.2.1
517
+ - README.md formatting and updates
518
+
513
519
  ### v1.2.0
514
520
  - Added custom error classes for better error handling
515
521
  - Added automatic retry logic with exponential backoff
516
522
  - Added pagination helpers for easy iteration
517
523
  - Added webhook signature verification
518
- - Added 22 new endpoints
524
+ - Added new endpoints
525
+ - Enhanced documentation and examples
526
+
527
+ ### v1.1.0
528
+ - Added new endpoints
519
529
  - Enhanced documentation and examples
520
530
 
521
- ### v1.x
531
+ ### v1.0.0
522
532
  - Initial SDK release with core functionality
523
533
 
524
534
  ## License
@@ -21,4 +21,13 @@ export declare class AuthResource {
21
21
  }): Promise<{
22
22
  message: string;
23
23
  }>;
24
+ /**
25
+ * Get account security information for the authenticated user.
26
+ * This includes IP addresses, registration date, last seen timestamp, and verification status.
27
+ * Requires authentication token.
28
+ *
29
+ * @returns Promise<SecurityInfo> Security information including IPs and account activity
30
+ * @throws {ApiError} If not authenticated or user not found
31
+ */
32
+ getSecurity(): Promise<import('../types').SecurityInfo>;
24
33
  }
@@ -45,5 +45,18 @@ class AuthResource {
45
45
  body: JSON.stringify(body),
46
46
  });
47
47
  }
48
+ /**
49
+ * Get account security information for the authenticated user.
50
+ * This includes IP addresses, registration date, last seen timestamp, and verification status.
51
+ * Requires authentication token.
52
+ *
53
+ * @returns Promise<SecurityInfo> Security information including IPs and account activity
54
+ * @throws {ApiError} If not authenticated or user not found
55
+ */
56
+ async getSecurity() {
57
+ return this.client.request('/auth/security', {
58
+ method: 'GET',
59
+ });
60
+ }
48
61
  }
49
62
  exports.AuthResource = AuthResource;
package/dist/types.d.ts CHANGED
@@ -113,6 +113,16 @@ export interface PostListResponse {
113
113
  export interface LoginResponse {
114
114
  token: string;
115
115
  }
116
+ export interface SecurityInfo {
117
+ userId: string;
118
+ username: string;
119
+ registrationIp: string;
120
+ registrationDate: string;
121
+ lastIp: string;
122
+ lastSeenAt: string;
123
+ isOnline: boolean;
124
+ emailVerified: boolean;
125
+ }
116
126
  export type ThreadFilter = 'newest' | 'oldest';
117
127
  export type InteractionType = 'created' | 'liked' | 'disliked' | 'upvoted' | 'downvoted' | 'subscribed';
118
128
  export interface Tag {
@@ -54,12 +54,24 @@ async function main() {
54
54
  });
55
55
  console.log('Password reset successful');
56
56
 
57
- // Example 5: Check Authentication Status
57
+ // Example 5: Get Account Security Information
58
+ console.log('\n=== Account Security Info ===');
59
+ const securityInfo = await client.auth.getSecurity();
60
+ console.log('User ID:', securityInfo.userId);
61
+ console.log('Username:', securityInfo.username);
62
+ console.log('Registration IP:', securityInfo.registrationIp);
63
+ console.log('Registration Date:', new Date(securityInfo.registrationDate).toLocaleDateString());
64
+ console.log('Last IP:', securityInfo.lastIp);
65
+ console.log('Last Seen:', new Date(securityInfo.lastSeenAt).toLocaleString());
66
+ console.log('Is Online:', securityInfo.isOnline);
67
+ console.log('Email Verified:', securityInfo.emailVerified);
68
+
69
+ // Example 6: Check Authentication Status
58
70
  console.log('\n=== Authentication Status ===');
59
71
  console.log('Is authenticated:', client.isAuthenticated());
60
72
  console.log('Current token:', client.token);
61
73
 
62
- // Example 6: Logout (clear token)
74
+ // Example 7: Logout (clear token)
63
75
  console.log('\n=== Logout ===');
64
76
  client.clearToken();
65
77
  console.log('Token cleared');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@foru-ms/sdk",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "JavaScript SDK for Foru.ms",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -61,4 +61,18 @@ export class AuthResource {
61
61
  body: JSON.stringify(body),
62
62
  });
63
63
  }
64
+
65
+ /**
66
+ * Get account security information for the authenticated user.
67
+ * This includes IP addresses, registration date, last seen timestamp, and verification status.
68
+ * Requires authentication token.
69
+ *
70
+ * @returns Promise<SecurityInfo> Security information including IPs and account activity
71
+ * @throws {ApiError} If not authenticated or user not found
72
+ */
73
+ async getSecurity(): Promise<import('../types').SecurityInfo> {
74
+ return this.client.request<import('../types').SecurityInfo>('/auth/security', {
75
+ method: 'GET',
76
+ });
77
+ }
64
78
  }
package/src/types.ts CHANGED
@@ -128,6 +128,17 @@ export interface LoginResponse {
128
128
  token: string;
129
129
  }
130
130
 
131
+ export interface SecurityInfo {
132
+ userId: string;
133
+ username: string;
134
+ registrationIp: string;
135
+ registrationDate: string;
136
+ lastIp: string;
137
+ lastSeenAt: string;
138
+ isOnline: boolean;
139
+ emailVerified: boolean;
140
+ }
141
+
131
142
  export type ThreadFilter = 'newest' | 'oldest';
132
143
  export type InteractionType = 'created' | 'liked' | 'disliked' | 'upvoted' | 'downvoted' | 'subscribed';
133
144