twitter-openapi-typescript 0.0.55 → 0.0.57

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 (86) hide show
  1. package/LICENSE +31 -31
  2. package/LICENSE.AGPL +660 -660
  3. package/README.md +75 -75
  4. package/dist/src/api.d.ts +3 -3
  5. package/dist/src/api.d.ts.map +1 -1
  6. package/dist/src/api.js +161 -295
  7. package/dist/src/api.js.map +1 -1
  8. package/dist/src/apis/defaultApi.d.ts +2 -2
  9. package/dist/src/apis/defaultApi.d.ts.map +1 -1
  10. package/dist/src/apis/defaultApi.js +39 -114
  11. package/dist/src/apis/defaultApi.js.map +1 -1
  12. package/dist/src/apis/initialStateApi.js +2 -5
  13. package/dist/src/apis/initialStateApi.js.map +1 -1
  14. package/dist/src/apis/postApi.d.ts +2 -2
  15. package/dist/src/apis/postApi.d.ts.map +1 -1
  16. package/dist/src/apis/postApi.js +140 -251
  17. package/dist/src/apis/postApi.js.map +1 -1
  18. package/dist/src/apis/tweetApi.d.ts +6 -3
  19. package/dist/src/apis/tweetApi.d.ts.map +1 -1
  20. package/dist/src/apis/tweetApi.js +237 -342
  21. package/dist/src/apis/tweetApi.js.map +1 -1
  22. package/dist/src/apis/userApi.d.ts +3 -3
  23. package/dist/src/apis/userApi.d.ts.map +1 -1
  24. package/dist/src/apis/userApi.js +43 -108
  25. package/dist/src/apis/userApi.js.map +1 -1
  26. package/dist/src/apis/userListApi.d.ts +3 -3
  27. package/dist/src/apis/userListApi.d.ts.map +1 -1
  28. package/dist/src/apis/userListApi.js +97 -183
  29. package/dist/src/apis/userListApi.js.map +1 -1
  30. package/dist/src/apis/usersApi.d.ts +3 -3
  31. package/dist/src/apis/usersApi.d.ts.map +1 -1
  32. package/dist/src/apis/usersApi.js +28 -91
  33. package/dist/src/apis/usersApi.js.map +1 -1
  34. package/dist/src/apis/v11GetApi.d.ts +3 -3
  35. package/dist/src/apis/v11GetApi.d.ts.map +1 -1
  36. package/dist/src/apis/v11GetApi.js +3 -4
  37. package/dist/src/apis/v11GetApi.js.map +1 -1
  38. package/dist/src/apis/v11PostApi.d.ts +3 -3
  39. package/dist/src/apis/v11PostApi.d.ts.map +1 -1
  40. package/dist/src/apis/v11PostApi.js +50 -84
  41. package/dist/src/apis/v11PostApi.js.map +1 -1
  42. package/dist/src/apis/v20GetApi.d.ts +3 -3
  43. package/dist/src/apis/v20GetApi.d.ts.map +1 -1
  44. package/dist/src/apis/v20GetApi.js +3 -4
  45. package/dist/src/apis/v20GetApi.js.map +1 -1
  46. package/dist/src/index.d.ts +4 -4
  47. package/dist/src/index.js +4 -4
  48. package/dist/src/models/response.d.ts +1 -1
  49. package/dist/src/models/response.d.ts.map +1 -1
  50. package/dist/src/models/timeline.d.ts +1 -1
  51. package/dist/src/models/timeline.d.ts.map +1 -1
  52. package/dist/src/models/utils.d.ts +2 -2
  53. package/dist/src/models/utils.d.ts.map +1 -1
  54. package/dist/src/utils/api.d.ts +1 -1
  55. package/dist/src/utils/api.d.ts.map +1 -1
  56. package/dist/src/utils/api.js +68 -85
  57. package/dist/src/utils/api.js.map +1 -1
  58. package/package.json +37 -42
  59. package/dist/a.d.ts +0 -2
  60. package/dist/a.d.ts.map +0 -1
  61. package/dist/a.js +0 -60
  62. package/dist/a.js.map +0 -1
  63. package/dist/src/tid/constants.d.ts +0 -35
  64. package/dist/src/tid/constants.d.ts.map +0 -1
  65. package/dist/src/tid/constants.js +0 -42
  66. package/dist/src/tid/constants.js.map +0 -1
  67. package/dist/src/tid/cubic_curve.d.ts +0 -7
  68. package/dist/src/tid/cubic_curve.d.ts.map +0 -1
  69. package/dist/src/tid/cubic_curve.js +0 -53
  70. package/dist/src/tid/cubic_curve.js.map +0 -1
  71. package/dist/src/tid/interpolate.d.ts +0 -2
  72. package/dist/src/tid/interpolate.d.ts.map +0 -1
  73. package/dist/src/tid/interpolate.js +0 -17
  74. package/dist/src/tid/interpolate.js.map +0 -1
  75. package/dist/src/tid/rotation.d.ts +0 -2
  76. package/dist/src/tid/rotation.d.ts.map +0 -1
  77. package/dist/src/tid/rotation.js +0 -8
  78. package/dist/src/tid/rotation.js.map +0 -1
  79. package/dist/src/tid/transaction.d.ts +0 -26
  80. package/dist/src/tid/transaction.d.ts.map +0 -1
  81. package/dist/src/tid/transaction.js +0 -259
  82. package/dist/src/tid/transaction.js.map +0 -1
  83. package/dist/src/tid/util.d.ts +0 -4
  84. package/dist/src/tid/util.d.ts.map +0 -1
  85. package/dist/src/tid/util.js +0 -49
  86. package/dist/src/tid/util.js.map +0 -1
package/README.md CHANGED
@@ -1,75 +1,75 @@
1
- # twitter-openapi-typescript
2
-
3
- ## Setup
4
-
5
- ```sh
6
- npm i twitter-openapi-typescript
7
- ```
8
-
9
- ## Usage
10
-
11
- ```typescript
12
- import { TwitterOpenApi } from 'twitter-openapi-typescript';
13
-
14
- const api = new TwitterOpenApi();
15
- const client = await api.getGuestClient();
16
- const response = await client.getUserApi().getUserByScreenName({ screenName: 'elonmusk' });
17
- const userLegacy = response.data?.user?.legacy;
18
- if (userLegacy) {
19
- console.log(userLegacy.screenName);
20
- console.log(`followCount: ${userLegacy.friendsCount} followersCount: ${userLegacy.followersCount}`);
21
- } else {
22
- console.log('User not found');
23
- }
24
- ```
25
-
26
- ### Login
27
-
28
- ```typescript
29
- // ct0 and authToken will also work but it is recommended to set all cookies.
30
- const client = await api.getClientFromCookies({
31
- ct0: '<csrf_token>',
32
- auth_token: '<auth_token>',
33
- });
34
- ```
35
-
36
- ### Multiple OS
37
-
38
- The Token can only be used on the same OS that issued the Token
39
- In other words, if the sec-ch-ua-platform does not match, the Token cannot be used.
40
- This library uses the Linux Chrome header by default.
41
- To use Token issued by Windows, do the following.
42
-
43
- ```typescript
44
- const api = new TwitterOpenApi();
45
- api.setAdditionalApiHeaders({
46
- 'sec-ch-ua-platform': '"Windows"',
47
- });
48
- ```
49
-
50
- ### List of APIs
51
-
52
- You should read the Test case.
53
-
54
- <https://github.com/fa0311/twitter-openapi-typescript/tree/master/twitter-openapi-typescript/test/api>
55
-
56
- ### Customize in detail
57
-
58
- Most values exist as static variables. There is no need to change them.
59
- Changing them could result in account suspension.
60
- For advanced customization, use the
61
- You can also use the `TwitterOpenApiClient` class directly
62
-
63
- ```typescript
64
- import { TwitterOpenApi } from 'twitter-openapi-typescript';
65
- TwitterOpenApi.fetchApi = fetch.bind(globalThis);
66
- TwitterOpenApi.twitter = 'https://x.com/home';
67
- TwitterOpenApi.bearer = 'xxxx';
68
- ```
69
-
70
- ## License
71
-
72
- This project is dual licensed. You can choose one of the following licenses:
73
-
74
- - [Custom License](./LICENSE)
75
- - [GNU Affero General Public License v3.0](./LICENSE.AGPL)
1
+ # twitter-openapi-typescript
2
+
3
+ ## Setup
4
+
5
+ ```sh
6
+ npm i twitter-openapi-typescript
7
+ ```
8
+
9
+ ## Usage
10
+
11
+ ```typescript
12
+ import { TwitterOpenApi } from 'twitter-openapi-typescript';
13
+
14
+ const api = new TwitterOpenApi();
15
+ const client = await api.getGuestClient();
16
+ const response = await client.getUserApi().getUserByScreenName({ screenName: 'elonmusk' });
17
+ const userLegacy = response.data?.user?.legacy;
18
+ if (userLegacy) {
19
+ console.log(userLegacy.screenName);
20
+ console.log(`followCount: ${userLegacy.friendsCount} followersCount: ${userLegacy.followersCount}`);
21
+ } else {
22
+ console.log('User not found');
23
+ }
24
+ ```
25
+
26
+ ### Login
27
+
28
+ ```typescript
29
+ // ct0 and authToken will also work but it is recommended to set all cookies.
30
+ const client = await api.getClientFromCookies({
31
+ ct0: '<csrf_token>',
32
+ auth_token: '<auth_token>',
33
+ });
34
+ ```
35
+
36
+ ### Multiple OS
37
+
38
+ The Token can only be used on the same OS that issued the Token
39
+ In other words, if the sec-ch-ua-platform does not match, the Token cannot be used.
40
+ This library uses the Linux Chrome header by default.
41
+ To use Token issued by Windows, do the following.
42
+
43
+ ```typescript
44
+ const api = new TwitterOpenApi();
45
+ api.setAdditionalApiHeaders({
46
+ 'sec-ch-ua-platform': '"Windows"',
47
+ });
48
+ ```
49
+
50
+ ### List of APIs
51
+
52
+ You should read the Test case.
53
+
54
+ <https://github.com/fa0311/twitter-openapi-typescript/tree/master/twitter-openapi-typescript/test/api>
55
+
56
+ ### Customize in detail
57
+
58
+ Most values exist as static variables. There is no need to change them.
59
+ Changing them could result in account suspension.
60
+ For advanced customization, use the
61
+ You can also use the `TwitterOpenApiClient` class directly
62
+
63
+ ```typescript
64
+ import { TwitterOpenApi } from 'twitter-openapi-typescript';
65
+ TwitterOpenApi.fetchApi = fetch.bind(globalThis);
66
+ TwitterOpenApi.twitter = 'https://x.com/home';
67
+ TwitterOpenApi.bearer = 'xxxx';
68
+ ```
69
+
70
+ ## License
71
+
72
+ This project is dual licensed. You can choose one of the following licenses:
73
+
74
+ - [Custom License](./LICENSE)
75
+ - [GNU Affero General Public License v3.0](./LICENSE.AGPL)
package/dist/src/api.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { DefaultApiUtils, InitialStateApiUtils, PostApiUtils, TweetApiUtils, UserApiUtils, UserListApiUtils, V11GetApiUtils, V11PostApiUtils, V20GetApiUtils } from './apis';
2
- import type { DefaultFlag } from './models';
3
1
  import * as i from 'twitter-openapi-typescript-generated';
2
+ import { DefaultApiUtils, InitialStateApiUtils, PostApiUtils, TweetApiUtils, UserApiUtils, UserListApiUtils, V11GetApiUtils, V11PostApiUtils, V20GetApiUtils } from './apis/index.js';
3
+ import type { DefaultFlag } from './models/index.js';
4
4
  import { UsersApiUtils } from './apis/usersApi';
5
- import { InitOverridesType } from './utils';
5
+ import type { InitOverridesType } from './utils';
6
6
  export declare class TwitterOpenApi {
7
7
  static hash: string;
8
8
  static url: string;
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,cAAc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