xdk 0.1.0

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 (37) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +21 -0
  3. data/README.md +123 -0
  4. data/lib/xdk/client.rb +410 -0
  5. data/lib/xdk/clients/account_activity_client.rb +109 -0
  6. data/lib/xdk/clients/account_client.rb +53 -0
  7. data/lib/xdk/clients/activity_client.rb +119 -0
  8. data/lib/xdk/clients/articles_client.rb +54 -0
  9. data/lib/xdk/clients/bots_client.rb +138 -0
  10. data/lib/xdk/clients/broadcasts_client.rb +854 -0
  11. data/lib/xdk/clients/calls_client.rb +255 -0
  12. data/lib/xdk/clients/chat_client.rb +1017 -0
  13. data/lib/xdk/clients/communities_client.rb +69 -0
  14. data/lib/xdk/clients/community_notes_client.rb +147 -0
  15. data/lib/xdk/clients/compliance_client.rb +157 -0
  16. data/lib/xdk/clients/connections_client.rb +102 -0
  17. data/lib/xdk/clients/direct_messages_client.rb +269 -0
  18. data/lib/xdk/clients/general_client.rb +34 -0
  19. data/lib/xdk/clients/lists_client.rb +245 -0
  20. data/lib/xdk/clients/media_client.rb +400 -0
  21. data/lib/xdk/clients/news_client.rb +67 -0
  22. data/lib/xdk/clients/posts_client.rb +596 -0
  23. data/lib/xdk/clients/spaces_client.rb +222 -0
  24. data/lib/xdk/clients/stream_client.rb +690 -0
  25. data/lib/xdk/clients/trends_client.rb +81 -0
  26. data/lib/xdk/clients/usage_client.rb +57 -0
  27. data/lib/xdk/clients/users_client.rb +1280 -0
  28. data/lib/xdk/clients/webhooks_client.rb +164 -0
  29. data/lib/xdk/errors.rb +69 -0
  30. data/lib/xdk/http_client.rb +126 -0
  31. data/lib/xdk/oauth1.rb +183 -0
  32. data/lib/xdk/oauth2_pkce.rb +156 -0
  33. data/lib/xdk/paginator.rb +41 -0
  34. data/lib/xdk/streaming.rb +294 -0
  35. data/lib/xdk/version.rb +9 -0
  36. data/lib/xdk.rb +62 -0
  37. metadata +84 -0
@@ -0,0 +1,255 @@
1
+ # AUTO-GENERATED FILE - DO NOT EDIT
2
+ # This file was automatically generated by the XDK build tool.
3
+ # Any manual changes will be overwritten on the next generation.
4
+ # frozen_string_literal: true
5
+
6
+ require "uri"
7
+
8
+ module Xdk
9
+ module Clients
10
+ # Auto-generated calls client for the X API v2.
11
+ class CallsClient
12
+ def initialize(client)
13
+ @client = client
14
+ end
15
+
16
+ # Join a Call
17
+ def join_call(id:, body:)
18
+ path = +"/2/calls/{id}/join"
19
+ path.gsub!("{id}", URI.encode_www_form_component(id.to_s))
20
+
21
+ query = {}
22
+
23
+ headers = {}
24
+ @client.execute_request(
25
+ method: "POST",
26
+ path: path,
27
+ schemes: ["OAuth2UserToken"],
28
+ query: query,
29
+ headers: headers,
30
+ body: body,
31
+ binary_request: false,
32
+ binary_response: false
33
+ )
34
+ end
35
+
36
+ # Respond to a Scheduled Call
37
+ def respond_to_scheduled_call(id:, body:)
38
+ path = +"/2/calls/scheduled/{id}/rsvp"
39
+ path.gsub!("{id}", URI.encode_www_form_component(id.to_s))
40
+
41
+ query = {}
42
+
43
+ headers = {}
44
+ @client.execute_request(
45
+ method: "POST",
46
+ path: path,
47
+ schemes: ["OAuth2UserToken", "UserToken"],
48
+ query: query,
49
+ headers: headers,
50
+ body: body,
51
+ binary_request: false,
52
+ binary_response: false
53
+ )
54
+ end
55
+
56
+ # Leave a Call
57
+ def leave_call(id:)
58
+ path = +"/2/calls/{id}/leave"
59
+ path.gsub!("{id}", URI.encode_www_form_component(id.to_s))
60
+
61
+ query = {}
62
+
63
+ headers = {}
64
+ @client.execute_request(
65
+ method: "POST",
66
+ path: path,
67
+ schemes: ["OAuth2UserToken"],
68
+ query: query,
69
+ headers: headers,
70
+ binary_response: false
71
+ )
72
+ end
73
+
74
+ # Create a Call
75
+ def create_call(body:)
76
+ path = +"/2/calls"
77
+
78
+ query = {}
79
+
80
+ headers = {}
81
+ @client.execute_request(
82
+ method: "POST",
83
+ path: path,
84
+ schemes: ["OAuth2UserToken", "UserToken"],
85
+ query: query,
86
+ headers: headers,
87
+ body: body,
88
+ binary_request: false,
89
+ binary_response: false
90
+ )
91
+ end
92
+
93
+ # Get a Call
94
+ def get_call(id:, call_fields: nil, expansions: nil, user_fields: nil)
95
+ path = +"/2/calls/{id}"
96
+ path.gsub!("{id}", URI.encode_www_form_component(id.to_s))
97
+
98
+ query = {}
99
+ unless call_fields.nil?
100
+ query["call.fields"] = call_fields.is_a?(Array) ? call_fields.map(&:to_s).join(",") : call_fields.to_s
101
+ end
102
+ unless expansions.nil?
103
+ query["expansions"] = expansions.is_a?(Array) ? expansions.map(&:to_s).join(",") : expansions.to_s
104
+ end
105
+ unless user_fields.nil?
106
+ query["user.fields"] = user_fields.is_a?(Array) ? user_fields.map(&:to_s).join(",") : user_fields.to_s
107
+ end
108
+
109
+ headers = {}
110
+ @client.execute_request(
111
+ method: "GET",
112
+ path: path,
113
+ schemes: ["OAuth2UserToken", "UserToken"],
114
+ query: query,
115
+ headers: headers,
116
+ binary_response: false
117
+ )
118
+ end
119
+
120
+ # Get a Scheduled Call
121
+ def get_scheduled_call(id:, scheduled_call_fields: nil, expansions: nil, call_fields: nil, user_fields: nil)
122
+ path = +"/2/calls/scheduled/{id}"
123
+ path.gsub!("{id}", URI.encode_www_form_component(id.to_s))
124
+
125
+ query = {}
126
+ unless scheduled_call_fields.nil?
127
+ query["scheduled_call.fields"] = scheduled_call_fields.is_a?(Array) ? scheduled_call_fields.map(&:to_s).join(",") : scheduled_call_fields.to_s
128
+ end
129
+ unless expansions.nil?
130
+ query["expansions"] = expansions.is_a?(Array) ? expansions.map(&:to_s).join(",") : expansions.to_s
131
+ end
132
+ unless call_fields.nil?
133
+ query["call.fields"] = call_fields.is_a?(Array) ? call_fields.map(&:to_s).join(",") : call_fields.to_s
134
+ end
135
+ unless user_fields.nil?
136
+ query["user.fields"] = user_fields.is_a?(Array) ? user_fields.map(&:to_s).join(",") : user_fields.to_s
137
+ end
138
+
139
+ headers = {}
140
+ @client.execute_request(
141
+ method: "GET",
142
+ path: path,
143
+ schemes: ["OAuth2UserToken", "UserToken"],
144
+ query: query,
145
+ headers: headers,
146
+ binary_response: false
147
+ )
148
+ end
149
+
150
+ # Update a Scheduled Call
151
+ def update_scheduled_call(id:, body:)
152
+ path = +"/2/calls/scheduled/{id}"
153
+ path.gsub!("{id}", URI.encode_www_form_component(id.to_s))
154
+
155
+ query = {}
156
+
157
+ headers = {}
158
+ @client.execute_request(
159
+ method: "PUT",
160
+ path: path,
161
+ schemes: ["OAuth2UserToken", "UserToken"],
162
+ query: query,
163
+ headers: headers,
164
+ body: body,
165
+ binary_request: false,
166
+ binary_response: false
167
+ )
168
+ end
169
+
170
+ # Cancel a Scheduled Call
171
+ def cancel_scheduled_call(id:, scope: nil, occurrence_start_time: nil, notify_invitees: nil)
172
+ path = +"/2/calls/scheduled/{id}"
173
+ path.gsub!("{id}", URI.encode_www_form_component(id.to_s))
174
+
175
+ query = {}
176
+ unless scope.nil?
177
+ query["scope"] = scope.to_s
178
+ end
179
+ unless occurrence_start_time.nil?
180
+ query["occurrence_start_time"] = occurrence_start_time.to_s
181
+ end
182
+ unless notify_invitees.nil?
183
+ query["notify_invitees"] = notify_invitees.to_s.downcase
184
+ end
185
+
186
+ headers = {}
187
+ @client.execute_request(
188
+ method: "DELETE",
189
+ path: path,
190
+ schemes: ["OAuth2UserToken", "UserToken"],
191
+ query: query,
192
+ headers: headers,
193
+ binary_response: false
194
+ )
195
+ end
196
+
197
+ # List Scheduled Calls
198
+ def list_scheduled(start_time: nil, end_time: nil, max_results: nil, scheduled_call_fields: nil, expansions: nil, call_fields: nil, user_fields: nil)
199
+ path = +"/2/calls/scheduled"
200
+
201
+ query = {}
202
+ unless start_time.nil?
203
+ query["start_time"] = start_time.to_s
204
+ end
205
+ unless end_time.nil?
206
+ query["end_time"] = end_time.to_s
207
+ end
208
+ unless max_results.nil?
209
+ query["max_results"] = max_results.to_s
210
+ end
211
+ unless scheduled_call_fields.nil?
212
+ query["scheduled_call.fields"] = scheduled_call_fields.is_a?(Array) ? scheduled_call_fields.map(&:to_s).join(",") : scheduled_call_fields.to_s
213
+ end
214
+ unless expansions.nil?
215
+ query["expansions"] = expansions.is_a?(Array) ? expansions.map(&:to_s).join(",") : expansions.to_s
216
+ end
217
+ unless call_fields.nil?
218
+ query["call.fields"] = call_fields.is_a?(Array) ? call_fields.map(&:to_s).join(",") : call_fields.to_s
219
+ end
220
+ unless user_fields.nil?
221
+ query["user.fields"] = user_fields.is_a?(Array) ? user_fields.map(&:to_s).join(",") : user_fields.to_s
222
+ end
223
+
224
+ headers = {}
225
+ @client.execute_request(
226
+ method: "GET",
227
+ path: path,
228
+ schemes: ["OAuth2UserToken", "UserToken"],
229
+ query: query,
230
+ headers: headers,
231
+ binary_response: false
232
+ )
233
+ end
234
+
235
+ # Schedule a Call
236
+ def schedule_call(body:)
237
+ path = +"/2/calls/scheduled"
238
+
239
+ query = {}
240
+
241
+ headers = {}
242
+ @client.execute_request(
243
+ method: "POST",
244
+ path: path,
245
+ schemes: ["OAuth2UserToken", "UserToken"],
246
+ query: query,
247
+ headers: headers,
248
+ body: body,
249
+ binary_request: false,
250
+ binary_response: false
251
+ )
252
+ end
253
+ end
254
+ end
255
+ end