giantcontext 1.25.0__py3-none-any.whl

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.
@@ -0,0 +1,1779 @@
1
+ """GiantContext Python SDK.
2
+
3
+ Auto-generated from OpenAPI spec. Do not edit manually.
4
+ Run "pnpm generate:sdk" to regenerate.
5
+ """
6
+
7
+ from __future__ import annotations
8
+
9
+ import time
10
+ from typing import Any
11
+ from urllib.parse import quote
12
+
13
+ import httpx
14
+
15
+ __version__ = "1.0.0"
16
+ __all__ = ["GiantContext", "create_giant_context", "GiantContextConfig"]
17
+
18
+
19
+ # ============================================================================
20
+ # Configuration
21
+ # ============================================================================
22
+
23
+
24
+ class GiantContextConfig:
25
+ """Configuration for the GiantContext SDK."""
26
+
27
+ def __init__(
28
+ self,
29
+ api_key: str,
30
+ base_url: str = "https://api.giantcontext.com",
31
+ timeout: float = 30.0,
32
+ ):
33
+ """Initialize SDK configuration.
34
+
35
+ Args:
36
+ api_key: Your API key (starts with gct_)
37
+ base_url: Base URL for the API
38
+ timeout: Request timeout in seconds
39
+ """
40
+ self.api_key = api_key
41
+ self.base_url = base_url.rstrip("/")
42
+ self.timeout = timeout
43
+
44
+
45
+ # ============================================================================
46
+ # HTTP Client
47
+ # ============================================================================
48
+
49
+
50
+ class GiantContextClient:
51
+ """Internal HTTP client with token management."""
52
+
53
+ def __init__(self, config: GiantContextConfig):
54
+ self._config = config
55
+ self._jwt_token: str | None = None
56
+ self._token_expires_at: float = 0
57
+ self._client = httpx.AsyncClient(
58
+ base_url=config.base_url,
59
+ timeout=config.timeout,
60
+ headers={"Content-Type": "application/json"},
61
+ )
62
+
63
+ async def _get_token(self) -> str:
64
+ """Exchange API key for JWT token (cached until expiry)."""
65
+ # Return cached token if still valid (with 60s buffer)
66
+ if self._jwt_token and time.time() < self._token_expires_at - 60:
67
+ return self._jwt_token
68
+
69
+ # Exchange API key for JWT
70
+ response = await self._client.post(
71
+ "/api/auth/token",
72
+ json={"apiKey": self._config.api_key},
73
+ )
74
+ response.raise_for_status()
75
+ data = response.json()
76
+
77
+ self._jwt_token = data["token"]
78
+ # Parse ISO timestamp to epoch
79
+ from datetime import datetime
80
+
81
+ expires_at = datetime.fromisoformat(data["expiresAt"].replace("Z", "+00:00"))
82
+ self._token_expires_at = expires_at.timestamp()
83
+
84
+ return self._jwt_token
85
+
86
+ async def request(
87
+ self,
88
+ endpoint: str,
89
+ method: str = "GET",
90
+ json: dict[str, Any] | None = None,
91
+ params: dict[str, Any] | None = None,
92
+ ) -> Any:
93
+ """Make an authenticated request."""
94
+ token = await self._get_token()
95
+
96
+ response = await self._client.request(
97
+ method=method,
98
+ url=endpoint,
99
+ json=json,
100
+ params=params,
101
+ headers={"Authorization": f"Bearer {token}"},
102
+ )
103
+ response.raise_for_status()
104
+
105
+ if response.status_code == 204:
106
+ return None
107
+ return response.json()
108
+
109
+ async def close(self):
110
+ """Close the HTTP client."""
111
+ await self._client.aclose()
112
+
113
+ async def __aenter__(self):
114
+ return self
115
+
116
+ async def __aexit__(self, *args):
117
+ await self.close()
118
+
119
+
120
+ # ============================================================================
121
+ # Base Resource
122
+ # ============================================================================
123
+
124
+
125
+ class BaseResource:
126
+ """Base class for API resources."""
127
+
128
+ def __init__(self, client: GiantContextClient):
129
+ self._client = client
130
+
131
+ async def _request(
132
+ self,
133
+ endpoint: str,
134
+ method: str = "GET",
135
+ json: dict[str, Any] | None = None,
136
+ params: dict[str, Any] | None = None,
137
+ ) -> Any:
138
+ """Make an authenticated request."""
139
+ return await self._client.request(endpoint, method, json, params)
140
+
141
+
142
+ # ============================================================================
143
+ # Resource Classes
144
+ # ============================================================================
145
+
146
+
147
+ class APIKeysResource(BaseResource):
148
+ """API Keys API methods."""
149
+
150
+ async def list_my_api_keys(self) -> dict[str, Any]:
151
+ """Get my API keys
152
+
153
+ GET /me/api-keys
154
+ """
155
+ endpoint = "/me/api-keys"
156
+ return await self._request(endpoint, method="GET")
157
+
158
+ async def list_organization_api_keys(self, id: str) -> dict[str, Any]:
159
+ """Get organization API keys
160
+
161
+ GET /organizations/{id}/api-keys
162
+ """
163
+ endpoint = f"/organizations/{quote(str(id), safe='')}/api-keys"
164
+ return await self._request(endpoint, method="GET")
165
+
166
+
167
+ class AppMembersResource(BaseResource):
168
+ """App Members API methods."""
169
+
170
+ async def get_app_member(
171
+ self, id: str, project_id: str, app_id: str, member_id: str
172
+ ) -> dict[str, Any]:
173
+ """Get an app member by ID
174
+
175
+ GET /organizations/{id}/projects/{projectId}/apps/{appId}/members/{memberId}
176
+ """
177
+ endpoint = f"/organizations/{quote(str(id), safe='')}/projects/{quote(str(project_id), safe='')}/apps/{quote(str(app_id), safe='')}/members/{quote(str(member_id), safe='')}"
178
+ return await self._request(endpoint, method="GET")
179
+
180
+ async def get_app_members(
181
+ self, id: str, project_id: str, app_id: str
182
+ ) -> dict[str, Any]:
183
+ """Get members of an app
184
+
185
+ GET /organizations/{id}/projects/{projectId}/apps/{appId}/members
186
+ """
187
+ endpoint = f"/organizations/{quote(str(id), safe='')}/projects/{quote(str(project_id), safe='')}/apps/{quote(str(app_id), safe='')}/members"
188
+ return await self._request(endpoint, method="GET")
189
+
190
+
191
+ class BugReportsResource(BaseResource):
192
+ """Bug Reports API methods."""
193
+
194
+ async def list_my_bug_reports(self) -> dict[str, Any]:
195
+ """Get my bug reports
196
+
197
+ GET /me/bug-reports
198
+ """
199
+ endpoint = "/me/bug-reports"
200
+ return await self._request(endpoint, method="GET")
201
+
202
+ async def get_bug_report_comments(self, id: str) -> dict[str, Any]:
203
+ """Get comments for a bug report
204
+
205
+ GET /me/bug-reports/{id}/comments
206
+ """
207
+ endpoint = f"/me/bug-reports/{quote(str(id), safe='')}/comments"
208
+ return await self._request(endpoint, method="GET")
209
+
210
+
211
+ class CRMResource(BaseResource):
212
+ """CRM API methods."""
213
+
214
+ async def get_crm_activity(
215
+ self, organization_id: str, project_id: str, app_id: str, activity_id: str
216
+ ) -> dict[str, Any]:
217
+ """Get activity
218
+
219
+ GET /organizations/{organizationId}/projects/{projectId}/apps/crm/{appId}/activities/{activityId}
220
+ """
221
+ endpoint = f"/organizations/{quote(str(organization_id), safe='')}/projects/{quote(str(project_id), safe='')}/apps/crm/{quote(str(app_id), safe='')}/activities/{quote(str(activity_id), safe='')}"
222
+ return await self._request(endpoint, method="GET")
223
+
224
+ async def get_crm_activities_list(
225
+ self,
226
+ organization_id: str,
227
+ project_id: str,
228
+ app_id: str,
229
+ page: str | None = None,
230
+ page_size: str | None = None,
231
+ search: str | None = None,
232
+ ) -> dict[str, Any]:
233
+ """Get activities
234
+
235
+ GET /organizations/{organizationId}/projects/{projectId}/apps/crm/{appId}/activities
236
+ """
237
+ endpoint = f"/organizations/{quote(str(organization_id), safe='')}/projects/{quote(str(project_id), safe='')}/apps/crm/{quote(str(app_id), safe='')}/activities"
238
+ params = {
239
+ "page": page,
240
+ "pageSize": page_size,
241
+ "search": search,
242
+ }
243
+ params = {k: v for k, v in params.items() if v is not None}
244
+ return await self._request(endpoint, method="GET", params=params)
245
+
246
+ async def get_crm_company_activities(
247
+ self, organization_id: str, project_id: str, app_id: str, company_id: str
248
+ ) -> list[dict[str, Any]]:
249
+ """Get activities for a company
250
+
251
+ GET /organizations/{organizationId}/projects/{projectId}/apps/crm/{appId}/companies/{companyId}/activities
252
+ """
253
+ endpoint = f"/organizations/{quote(str(organization_id), safe='')}/projects/{quote(str(project_id), safe='')}/apps/crm/{quote(str(app_id), safe='')}/companies/{quote(str(company_id), safe='')}/activities"
254
+ return await self._request(endpoint, method="GET")
255
+
256
+ async def get_crm_company_contacts(
257
+ self, organization_id: str, project_id: str, app_id: str, company_id: str
258
+ ) -> list[dict[str, Any]]:
259
+ """Get contacts for a company
260
+
261
+ GET /organizations/{organizationId}/projects/{projectId}/apps/crm/{appId}/companies/{companyId}/contacts
262
+ """
263
+ endpoint = f"/organizations/{quote(str(organization_id), safe='')}/projects/{quote(str(project_id), safe='')}/apps/crm/{quote(str(app_id), safe='')}/companies/{quote(str(company_id), safe='')}/contacts"
264
+ return await self._request(endpoint, method="GET")
265
+
266
+ async def get_crm_company(
267
+ self, organization_id: str, project_id: str, app_id: str, company_id: str
268
+ ) -> dict[str, Any]:
269
+ """Get company
270
+
271
+ GET /organizations/{organizationId}/projects/{projectId}/apps/crm/{appId}/companies/{companyId}
272
+ """
273
+ endpoint = f"/organizations/{quote(str(organization_id), safe='')}/projects/{quote(str(project_id), safe='')}/apps/crm/{quote(str(app_id), safe='')}/companies/{quote(str(company_id), safe='')}"
274
+ return await self._request(endpoint, method="GET")
275
+
276
+ async def get_crm_companies_list(
277
+ self,
278
+ organization_id: str,
279
+ project_id: str,
280
+ app_id: str,
281
+ page: str | None = None,
282
+ page_size: str | None = None,
283
+ search: str | None = None,
284
+ ) -> dict[str, Any]:
285
+ """Get companies
286
+
287
+ GET /organizations/{organizationId}/projects/{projectId}/apps/crm/{appId}/companies
288
+ """
289
+ endpoint = f"/organizations/{quote(str(organization_id), safe='')}/projects/{quote(str(project_id), safe='')}/apps/crm/{quote(str(app_id), safe='')}/companies"
290
+ params = {
291
+ "page": page,
292
+ "pageSize": page_size,
293
+ "search": search,
294
+ }
295
+ params = {k: v for k, v in params.items() if v is not None}
296
+ return await self._request(endpoint, method="GET", params=params)
297
+
298
+ async def get_crm_contact_activities(
299
+ self, organization_id: str, project_id: str, app_id: str, contact_id: str
300
+ ) -> list[dict[str, Any]]:
301
+ """Get activities for a contact
302
+
303
+ GET /organizations/{organizationId}/projects/{projectId}/apps/crm/{appId}/contacts/{contactId}/activities
304
+ """
305
+ endpoint = f"/organizations/{quote(str(organization_id), safe='')}/projects/{quote(str(project_id), safe='')}/apps/crm/{quote(str(app_id), safe='')}/contacts/{quote(str(contact_id), safe='')}/activities"
306
+ return await self._request(endpoint, method="GET")
307
+
308
+ async def get_crm_contact(
309
+ self, organization_id: str, project_id: str, app_id: str, contact_id: str
310
+ ) -> dict[str, Any]:
311
+ """Get contact
312
+
313
+ GET /organizations/{organizationId}/projects/{projectId}/apps/crm/{appId}/contacts/{contactId}
314
+ """
315
+ endpoint = f"/organizations/{quote(str(organization_id), safe='')}/projects/{quote(str(project_id), safe='')}/apps/crm/{quote(str(app_id), safe='')}/contacts/{quote(str(contact_id), safe='')}"
316
+ return await self._request(endpoint, method="GET")
317
+
318
+ async def get_crm_contacts_list(
319
+ self,
320
+ organization_id: str,
321
+ project_id: str,
322
+ app_id: str,
323
+ page: str | None = None,
324
+ page_size: str | None = None,
325
+ search: str | None = None,
326
+ ) -> dict[str, Any]:
327
+ """Get contacts
328
+
329
+ GET /organizations/{organizationId}/projects/{projectId}/apps/crm/{appId}/contacts
330
+ """
331
+ endpoint = f"/organizations/{quote(str(organization_id), safe='')}/projects/{quote(str(project_id), safe='')}/apps/crm/{quote(str(app_id), safe='')}/contacts"
332
+ params = {
333
+ "page": page,
334
+ "pageSize": page_size,
335
+ "search": search,
336
+ }
337
+ params = {k: v for k, v in params.items() if v is not None}
338
+ return await self._request(endpoint, method="GET", params=params)
339
+
340
+
341
+ class ChatResource(BaseResource):
342
+ """Chat API methods."""
343
+
344
+ async def get_chat_conversation(
345
+ self,
346
+ organization_id: str,
347
+ project_id: str,
348
+ app_id: str,
349
+ conversation_id: str,
350
+ cursor: str | None = None,
351
+ cursor_id: str | None = None,
352
+ direction: str | None = None,
353
+ limit: str | None = None,
354
+ ) -> dict[str, Any]:
355
+ """Get chat conversation with paginated messages
356
+
357
+ GET /organizations/{organizationId}/projects/{projectId}/apps/chat/{appId}/conversations/{conversationId}
358
+ """
359
+ endpoint = f"/organizations/{quote(str(organization_id), safe='')}/projects/{quote(str(project_id), safe='')}/apps/chat/{quote(str(app_id), safe='')}/conversations/{quote(str(conversation_id), safe='')}"
360
+ params = {
361
+ "cursor": cursor,
362
+ "cursorId": cursor_id,
363
+ "direction": direction,
364
+ "limit": limit,
365
+ }
366
+ params = {k: v for k, v in params.items() if v is not None}
367
+ return await self._request(endpoint, method="GET", params=params)
368
+
369
+ async def list_chat_conversations(
370
+ self,
371
+ organization_id: str,
372
+ project_id: str,
373
+ app_id: str,
374
+ page: str | None = None,
375
+ page_size: str | None = None,
376
+ search: str | None = None,
377
+ ) -> dict[str, Any]:
378
+ """Get all chat conversations
379
+
380
+ GET /organizations/{organizationId}/projects/{projectId}/apps/chat/{appId}/conversations
381
+ """
382
+ endpoint = f"/organizations/{quote(str(organization_id), safe='')}/projects/{quote(str(project_id), safe='')}/apps/chat/{quote(str(app_id), safe='')}/conversations"
383
+ params = {
384
+ "page": page,
385
+ "pageSize": page_size,
386
+ "search": search,
387
+ }
388
+ params = {k: v for k, v in params.items() if v is not None}
389
+ return await self._request(endpoint, method="GET", params=params)
390
+
391
+
392
+ class DraftsResource(BaseResource):
393
+ """Drafts API methods."""
394
+
395
+ async def edit_draft(self, data: dict[str, Any]) -> dict[str, Any]:
396
+ """Create an edit draft
397
+
398
+ POST /drafts/edit
399
+ """
400
+ endpoint = "/drafts/edit"
401
+ return await self._request(endpoint, method="POST", json=data)
402
+
403
+ async def get_draft(
404
+ self, id: str, project_id: str, draft_id: str
405
+ ) -> dict[str, Any]:
406
+ """Get a draft by ID
407
+
408
+ GET /organizations/{id}/projects/{projectId}/drafts/{draftId}
409
+ """
410
+ endpoint = f"/organizations/{quote(str(id), safe='')}/projects/{quote(str(project_id), safe='')}/drafts/{quote(str(draft_id), safe='')}"
411
+ return await self._request(endpoint, method="GET")
412
+
413
+ async def list_drafts(
414
+ self,
415
+ id: str,
416
+ project_id: str,
417
+ page: str | None = None,
418
+ page_size: str | None = None,
419
+ lite: str | None = None,
420
+ ) -> dict[str, Any]:
421
+ """List drafts for a project
422
+
423
+ GET /organizations/{id}/projects/{projectId}/drafts
424
+ """
425
+ endpoint = f"/organizations/{quote(str(id), safe='')}/projects/{quote(str(project_id), safe='')}/drafts"
426
+ params = {
427
+ "page": page,
428
+ "pageSize": page_size,
429
+ "lite": lite,
430
+ }
431
+ params = {k: v for k, v in params.items() if v is not None}
432
+ return await self._request(endpoint, method="GET", params=params)
433
+
434
+
435
+ class EmailResource(BaseResource):
436
+ """Email API methods."""
437
+
438
+ async def get_email_campaign(
439
+ self, organization_id: str, project_id: str, app_id: str, campaign_id: str
440
+ ) -> dict[str, Any]:
441
+ """Get campaign
442
+
443
+ GET /organizations/{organizationId}/projects/{projectId}/apps/email/{appId}/campaigns/{campaignId}
444
+ """
445
+ endpoint = f"/organizations/{quote(str(organization_id), safe='')}/projects/{quote(str(project_id), safe='')}/apps/email/{quote(str(app_id), safe='')}/campaigns/{quote(str(campaign_id), safe='')}"
446
+ return await self._request(endpoint, method="GET")
447
+
448
+ async def get_email_campaign_sends(
449
+ self,
450
+ organization_id: str,
451
+ project_id: str,
452
+ app_id: str,
453
+ campaign_id: str,
454
+ limit: str | None = None,
455
+ offset: str | None = None,
456
+ ) -> list[dict[str, Any]]:
457
+ """Get campaign sends
458
+
459
+ GET /organizations/{organizationId}/projects/{projectId}/apps/email/{appId}/campaigns/{campaignId}/sends
460
+ """
461
+ endpoint = f"/organizations/{quote(str(organization_id), safe='')}/projects/{quote(str(project_id), safe='')}/apps/email/{quote(str(app_id), safe='')}/campaigns/{quote(str(campaign_id), safe='')}/sends"
462
+ params = {
463
+ "limit": limit,
464
+ "offset": offset,
465
+ }
466
+ params = {k: v for k, v in params.items() if v is not None}
467
+ return await self._request(endpoint, method="GET", params=params)
468
+
469
+ async def get_email_campaigns(
470
+ self,
471
+ organization_id: str,
472
+ project_id: str,
473
+ app_id: str,
474
+ page: str | None = None,
475
+ page_size: str | None = None,
476
+ search: str | None = None,
477
+ ) -> dict[str, Any]:
478
+ """Get campaigns
479
+
480
+ GET /organizations/{organizationId}/projects/{projectId}/apps/email/{appId}/campaigns
481
+ """
482
+ endpoint = f"/organizations/{quote(str(organization_id), safe='')}/projects/{quote(str(project_id), safe='')}/apps/email/{quote(str(app_id), safe='')}/campaigns"
483
+ params = {
484
+ "page": page,
485
+ "pageSize": page_size,
486
+ "search": search,
487
+ }
488
+ params = {k: v for k, v in params.items() if v is not None}
489
+ return await self._request(endpoint, method="GET", params=params)
490
+
491
+ async def get_email(
492
+ self, organization_id: str, project_id: str, app_id: str, email_id: str
493
+ ) -> dict[str, Any]:
494
+ """Get email template
495
+
496
+ GET /organizations/{organizationId}/projects/{projectId}/apps/email/{appId}/emails/{emailId}
497
+ """
498
+ endpoint = f"/organizations/{quote(str(organization_id), safe='')}/projects/{quote(str(project_id), safe='')}/apps/email/{quote(str(app_id), safe='')}/emails/{quote(str(email_id), safe='')}"
499
+ return await self._request(endpoint, method="GET")
500
+
501
+ async def get_emails(
502
+ self,
503
+ organization_id: str,
504
+ project_id: str,
505
+ app_id: str,
506
+ page: str | None = None,
507
+ page_size: str | None = None,
508
+ search: str | None = None,
509
+ ) -> dict[str, Any]:
510
+ """Get email templates
511
+
512
+ GET /organizations/{organizationId}/projects/{projectId}/apps/email/{appId}/emails
513
+ """
514
+ endpoint = f"/organizations/{quote(str(organization_id), safe='')}/projects/{quote(str(project_id), safe='')}/apps/email/{quote(str(app_id), safe='')}/emails"
515
+ params = {
516
+ "page": page,
517
+ "pageSize": page_size,
518
+ "search": search,
519
+ }
520
+ params = {k: v for k, v in params.items() if v is not None}
521
+ return await self._request(endpoint, method="GET", params=params)
522
+
523
+ async def get_email_footer(
524
+ self, organization_id: str, project_id: str, app_id: str, footer_id: str
525
+ ) -> dict[str, Any]:
526
+ """Get email footer
527
+
528
+ GET /organizations/{organizationId}/projects/{projectId}/apps/email/{appId}/footers/{footerId}
529
+ """
530
+ endpoint = f"/organizations/{quote(str(organization_id), safe='')}/projects/{quote(str(project_id), safe='')}/apps/email/{quote(str(app_id), safe='')}/footers/{quote(str(footer_id), safe='')}"
531
+ return await self._request(endpoint, method="GET")
532
+
533
+ async def list_email_footers(
534
+ self,
535
+ organization_id: str,
536
+ project_id: str,
537
+ app_id: str,
538
+ page: str | None = None,
539
+ page_size: str | None = None,
540
+ search: str | None = None,
541
+ ) -> dict[str, Any]:
542
+ """Get email footers
543
+
544
+ GET /organizations/{organizationId}/projects/{projectId}/apps/email/{appId}/footers
545
+ """
546
+ endpoint = f"/organizations/{quote(str(organization_id), safe='')}/projects/{quote(str(project_id), safe='')}/apps/email/{quote(str(app_id), safe='')}/footers"
547
+ params = {
548
+ "page": page,
549
+ "pageSize": page_size,
550
+ "search": search,
551
+ }
552
+ params = {k: v for k, v in params.items() if v is not None}
553
+ return await self._request(endpoint, method="GET", params=params)
554
+
555
+ async def get_email_header(
556
+ self, organization_id: str, project_id: str, app_id: str, header_id: str
557
+ ) -> dict[str, Any]:
558
+ """Get email header
559
+
560
+ GET /organizations/{organizationId}/projects/{projectId}/apps/email/{appId}/headers/{headerId}
561
+ """
562
+ endpoint = f"/organizations/{quote(str(organization_id), safe='')}/projects/{quote(str(project_id), safe='')}/apps/email/{quote(str(app_id), safe='')}/headers/{quote(str(header_id), safe='')}"
563
+ return await self._request(endpoint, method="GET")
564
+
565
+ async def list_email_headers(
566
+ self,
567
+ organization_id: str,
568
+ project_id: str,
569
+ app_id: str,
570
+ page: str | None = None,
571
+ page_size: str | None = None,
572
+ search: str | None = None,
573
+ ) -> dict[str, Any]:
574
+ """Get email headers
575
+
576
+ GET /organizations/{organizationId}/projects/{projectId}/apps/email/{appId}/headers
577
+ """
578
+ endpoint = f"/organizations/{quote(str(organization_id), safe='')}/projects/{quote(str(project_id), safe='')}/apps/email/{quote(str(app_id), safe='')}/headers"
579
+ params = {
580
+ "page": page,
581
+ "pageSize": page_size,
582
+ "search": search,
583
+ }
584
+ params = {k: v for k, v in params.items() if v is not None}
585
+ return await self._request(endpoint, method="GET", params=params)
586
+
587
+ async def get_email_segment_contacts(
588
+ self,
589
+ organization_id: str,
590
+ project_id: str,
591
+ app_id: str,
592
+ segment_id: str,
593
+ limit: str | None = None,
594
+ ) -> list[dict[str, Any]]:
595
+ """Get contacts in segment
596
+
597
+ GET /organizations/{organizationId}/projects/{projectId}/apps/email/{appId}/segments/{segmentId}/contacts
598
+ """
599
+ endpoint = f"/organizations/{quote(str(organization_id), safe='')}/projects/{quote(str(project_id), safe='')}/apps/email/{quote(str(app_id), safe='')}/segments/{quote(str(segment_id), safe='')}/contacts"
600
+ params = {
601
+ "limit": limit,
602
+ }
603
+ params = {k: v for k, v in params.items() if v is not None}
604
+ return await self._request(endpoint, method="GET", params=params)
605
+
606
+ async def get_email_segment_count(
607
+ self, organization_id: str, project_id: str, app_id: str, segment_id: str
608
+ ) -> dict[str, Any]:
609
+ """Get segment contact count
610
+
611
+ GET /organizations/{organizationId}/projects/{projectId}/apps/email/{appId}/segments/{segmentId}/count
612
+ """
613
+ endpoint = f"/organizations/{quote(str(organization_id), safe='')}/projects/{quote(str(project_id), safe='')}/apps/email/{quote(str(app_id), safe='')}/segments/{quote(str(segment_id), safe='')}/count"
614
+ return await self._request(endpoint, method="GET")
615
+
616
+ async def get_email_segment(
617
+ self, organization_id: str, project_id: str, app_id: str, segment_id: str
618
+ ) -> dict[str, Any]:
619
+ """Get email segment
620
+
621
+ GET /organizations/{organizationId}/projects/{projectId}/apps/email/{appId}/segments/{segmentId}
622
+ """
623
+ endpoint = f"/organizations/{quote(str(organization_id), safe='')}/projects/{quote(str(project_id), safe='')}/apps/email/{quote(str(app_id), safe='')}/segments/{quote(str(segment_id), safe='')}"
624
+ return await self._request(endpoint, method="GET")
625
+
626
+ async def list_email_segments(
627
+ self,
628
+ organization_id: str,
629
+ project_id: str,
630
+ app_id: str,
631
+ page: str | None = None,
632
+ page_size: str | None = None,
633
+ search: str | None = None,
634
+ ) -> dict[str, Any]:
635
+ """Get email segments
636
+
637
+ GET /organizations/{organizationId}/projects/{projectId}/apps/email/{appId}/segments
638
+ """
639
+ endpoint = f"/organizations/{quote(str(organization_id), safe='')}/projects/{quote(str(project_id), safe='')}/apps/email/{quote(str(app_id), safe='')}/segments"
640
+ params = {
641
+ "page": page,
642
+ "pageSize": page_size,
643
+ "search": search,
644
+ }
645
+ params = {k: v for k, v in params.items() if v is not None}
646
+ return await self._request(endpoint, method="GET", params=params)
647
+
648
+
649
+ class FeatureRequestsResource(BaseResource):
650
+ """Feature Requests API methods."""
651
+
652
+ async def get_popular_feature_requests(
653
+ self,
654
+ limit: str | None = None,
655
+ offset: str | None = None,
656
+ status: str | None = None,
657
+ ) -> dict[str, Any]:
658
+ """Get popular feature requests
659
+
660
+ GET /me/feature-requests/popular
661
+ """
662
+ endpoint = "/me/feature-requests/popular"
663
+ params = {
664
+ "limit": limit,
665
+ "offset": offset,
666
+ "status": status,
667
+ }
668
+ params = {k: v for k, v in params.items() if v is not None}
669
+ return await self._request(endpoint, method="GET", params=params)
670
+
671
+ async def list_my_feature_requests(self) -> dict[str, Any]:
672
+ """Get my feature requests
673
+
674
+ GET /me/feature-requests
675
+ """
676
+ endpoint = "/me/feature-requests"
677
+ return await self._request(endpoint, method="GET")
678
+
679
+ async def get_feature_request_comments(self, id: str) -> dict[str, Any]:
680
+ """Get comments for a feature request
681
+
682
+ GET /me/feature-requests/{id}/comments
683
+ """
684
+ endpoint = f"/me/feature-requests/{quote(str(id), safe='')}/comments"
685
+ return await self._request(endpoint, method="GET")
686
+
687
+
688
+ class FormsResource(BaseResource):
689
+ """Forms API methods."""
690
+
691
+ async def get_form(
692
+ self, organization_id: str, project_id: str, app_id: str, form_id: str
693
+ ) -> dict[str, Any]:
694
+ """Get form
695
+
696
+ GET /organizations/{organizationId}/projects/{projectId}/apps/forms/{appId}/forms/{formId}
697
+ """
698
+ endpoint = f"/organizations/{quote(str(organization_id), safe='')}/projects/{quote(str(project_id), safe='')}/apps/forms/{quote(str(app_id), safe='')}/forms/{quote(str(form_id), safe='')}"
699
+ return await self._request(endpoint, method="GET")
700
+
701
+ async def get_form_submission(
702
+ self,
703
+ organization_id: str,
704
+ project_id: str,
705
+ app_id: str,
706
+ form_id: str,
707
+ submission_id: str,
708
+ ) -> dict[str, Any]:
709
+ """Get form submission
710
+
711
+ GET /organizations/{organizationId}/projects/{projectId}/apps/forms/{appId}/forms/{formId}/submissions/{submissionId}
712
+ """
713
+ endpoint = f"/organizations/{quote(str(organization_id), safe='')}/projects/{quote(str(project_id), safe='')}/apps/forms/{quote(str(app_id), safe='')}/forms/{quote(str(form_id), safe='')}/submissions/{quote(str(submission_id), safe='')}"
714
+ return await self._request(endpoint, method="GET")
715
+
716
+ async def get_form_submissions(
717
+ self,
718
+ organization_id: str,
719
+ project_id: str,
720
+ app_id: str,
721
+ form_id: str,
722
+ page: str | None = None,
723
+ page_size: str | None = None,
724
+ search: str | None = None,
725
+ ) -> dict[str, Any]:
726
+ """Get form submissions
727
+
728
+ GET /organizations/{organizationId}/projects/{projectId}/apps/forms/{appId}/forms/{formId}/submissions
729
+ """
730
+ endpoint = f"/organizations/{quote(str(organization_id), safe='')}/projects/{quote(str(project_id), safe='')}/apps/forms/{quote(str(app_id), safe='')}/forms/{quote(str(form_id), safe='')}/submissions"
731
+ params = {
732
+ "page": page,
733
+ "pageSize": page_size,
734
+ "search": search,
735
+ }
736
+ params = {k: v for k, v in params.items() if v is not None}
737
+ return await self._request(endpoint, method="GET", params=params)
738
+
739
+ async def get_forms_list(
740
+ self,
741
+ organization_id: str,
742
+ project_id: str,
743
+ app_id: str,
744
+ page: str | None = None,
745
+ page_size: str | None = None,
746
+ search: str | None = None,
747
+ ) -> dict[str, Any]:
748
+ """Get forms
749
+
750
+ GET /organizations/{organizationId}/projects/{projectId}/apps/forms/{appId}/forms
751
+ """
752
+ endpoint = f"/organizations/{quote(str(organization_id), safe='')}/projects/{quote(str(project_id), safe='')}/apps/forms/{quote(str(app_id), safe='')}/forms"
753
+ params = {
754
+ "page": page,
755
+ "pageSize": page_size,
756
+ "search": search,
757
+ }
758
+ params = {k: v for k, v in params.items() if v is not None}
759
+ return await self._request(endpoint, method="GET", params=params)
760
+
761
+
762
+ class IdeasResource(BaseResource):
763
+ """Ideas API methods."""
764
+
765
+ async def approve_idea(
766
+ self, id: str, project_id: str, idea_id: str, data: dict[str, Any]
767
+ ) -> dict[str, Any]:
768
+ """Approve a Mind idea
769
+
770
+ POST /organizations/{id}/projects/{projectId}/ideas/{ideaId}/approve
771
+ """
772
+ endpoint = f"/organizations/{quote(str(id), safe='')}/projects/{quote(str(project_id), safe='')}/ideas/{quote(str(idea_id), safe='')}/approve"
773
+ return await self._request(endpoint, method="POST", json=data)
774
+
775
+ async def dismiss_idea(
776
+ self, id: str, project_id: str, idea_id: str, data: dict[str, Any]
777
+ ) -> dict[str, Any]:
778
+ """Dismiss a Mind idea
779
+
780
+ POST /organizations/{id}/projects/{projectId}/ideas/{ideaId}/dismiss
781
+ """
782
+ endpoint = f"/organizations/{quote(str(id), safe='')}/projects/{quote(str(project_id), safe='')}/ideas/{quote(str(idea_id), safe='')}/dismiss"
783
+ return await self._request(endpoint, method="POST", json=data)
784
+
785
+ async def get_idea(self, id: str, project_id: str, idea_id: str) -> dict[str, Any]:
786
+ """Get a Mind idea
787
+
788
+ GET /organizations/{id}/projects/{projectId}/ideas/{ideaId}
789
+ """
790
+ endpoint = f"/organizations/{quote(str(id), safe='')}/projects/{quote(str(project_id), safe='')}/ideas/{quote(str(idea_id), safe='')}"
791
+ return await self._request(endpoint, method="GET")
792
+
793
+ async def list_ideas(self, id: str, project_id: str) -> dict[str, Any]:
794
+ """List Mind ideas for a project
795
+
796
+ GET /organizations/{id}/projects/{projectId}/ideas
797
+ """
798
+ endpoint = f"/organizations/{quote(str(id), safe='')}/projects/{quote(str(project_id), safe='')}/ideas"
799
+ return await self._request(endpoint, method="GET")
800
+
801
+
802
+ class InvitationsResource(BaseResource):
803
+ """Invitations API methods."""
804
+
805
+ async def get_organization_invitation(
806
+ self, id: str, invitation_id: str
807
+ ) -> dict[str, Any]:
808
+ """Get an invitation by ID
809
+
810
+ GET /organizations/{id}/invitations/{invitationId}
811
+ """
812
+ endpoint = f"/organizations/{quote(str(id), safe='')}/invitations/{quote(str(invitation_id), safe='')}"
813
+ return await self._request(endpoint, method="GET")
814
+
815
+ async def get_organization_invitations(self, id: str) -> dict[str, Any]:
816
+ """Get organization invitations
817
+
818
+ GET /organizations/{id}/invitations
819
+ """
820
+ endpoint = f"/organizations/{quote(str(id), safe='')}/invitations"
821
+ return await self._request(endpoint, method="GET")
822
+
823
+
824
+ class MeResource(BaseResource):
825
+ """Me API methods."""
826
+
827
+ async def get_my_suspension_messages(self) -> list[dict[str, Any]]:
828
+ """Get my suspension appeal messages
829
+
830
+ GET /me/suspension-messages
831
+ """
832
+ endpoint = "/me/suspension-messages"
833
+ return await self._request(endpoint, method="GET")
834
+
835
+ async def get_my_notifications(
836
+ self,
837
+ page: str | None = None,
838
+ page_size: str | None = None,
839
+ search: str | None = None,
840
+ status: str | None = None,
841
+ ) -> dict[str, Any]:
842
+ """Get my notifications
843
+
844
+ GET /me/notifications
845
+ """
846
+ endpoint = "/me/notifications"
847
+ params = {
848
+ "page": page,
849
+ "pageSize": page_size,
850
+ "search": search,
851
+ "status": status,
852
+ }
853
+ params = {k: v for k, v in params.items() if v is not None}
854
+ return await self._request(endpoint, method="GET", params=params)
855
+
856
+ async def get_my_organizations(self) -> list[dict[str, Any]]:
857
+ """Get organizations I belong to
858
+
859
+ GET /me/organizations
860
+ """
861
+ endpoint = "/me/organizations"
862
+ return await self._request(endpoint, method="GET")
863
+
864
+ async def get_my_invitations(self) -> dict[str, Any]:
865
+ """Get my pending invitations
866
+
867
+ GET /me/invitations
868
+ """
869
+ endpoint = "/me/invitations"
870
+ return await self._request(endpoint, method="GET")
871
+
872
+ async def get_my_activities(
873
+ self,
874
+ page: str | None = None,
875
+ page_size: str | None = None,
876
+ lite: str | None = None,
877
+ ) -> dict[str, Any]:
878
+ """Get my activity history
879
+
880
+ GET /me/activities
881
+ """
882
+ endpoint = "/me/activities"
883
+ params = {
884
+ "page": page,
885
+ "pageSize": page_size,
886
+ "lite": lite,
887
+ }
888
+ params = {k: v for k, v in params.items() if v is not None}
889
+ return await self._request(endpoint, method="GET", params=params)
890
+
891
+ async def get_me(self) -> dict[str, Any]:
892
+ """Get current user profile and permissions
893
+
894
+ GET /me
895
+ """
896
+ endpoint = "/me"
897
+ return await self._request(endpoint, method="GET")
898
+
899
+
900
+ class OrganizationMembersResource(BaseResource):
901
+ """Organization Members API methods."""
902
+
903
+ async def get_member_project_memberships(
904
+ self, id: str, member_id: str
905
+ ) -> list[dict[str, Any]]:
906
+ """Get member project memberships
907
+
908
+ GET /organizations/{id}/members/{memberId}/project-memberships
909
+ """
910
+ endpoint = f"/organizations/{quote(str(id), safe='')}/members/{quote(str(member_id), safe='')}/project-memberships"
911
+ return await self._request(endpoint, method="GET")
912
+
913
+ async def get_organization_member_activities(
914
+ self,
915
+ id: str,
916
+ member_id: str,
917
+ page: str | None = None,
918
+ page_size: str | None = None,
919
+ lite: str | None = None,
920
+ ) -> dict[str, Any]:
921
+ """Get member activities
922
+
923
+ GET /organizations/{id}/members/{memberId}/activities
924
+ """
925
+ endpoint = f"/organizations/{quote(str(id), safe='')}/members/{quote(str(member_id), safe='')}/activities"
926
+ params = {
927
+ "page": page,
928
+ "pageSize": page_size,
929
+ "lite": lite,
930
+ }
931
+ params = {k: v for k, v in params.items() if v is not None}
932
+ return await self._request(endpoint, method="GET", params=params)
933
+
934
+ async def get_organization_member(self, id: str, member_id: str) -> dict[str, Any]:
935
+ """Get a member by ID
936
+
937
+ GET /organizations/{id}/members/{memberId}
938
+ """
939
+ endpoint = f"/organizations/{quote(str(id), safe='')}/members/{quote(str(member_id), safe='')}"
940
+ return await self._request(endpoint, method="GET")
941
+
942
+ async def get_organization_members(
943
+ self,
944
+ id: str,
945
+ page: str | None = None,
946
+ page_size: str | None = None,
947
+ lite: str | None = None,
948
+ ) -> dict[str, Any]:
949
+ """Get organization members
950
+
951
+ GET /organizations/{id}/members
952
+ """
953
+ endpoint = f"/organizations/{quote(str(id), safe='')}/members"
954
+ params = {
955
+ "page": page,
956
+ "pageSize": page_size,
957
+ "lite": lite,
958
+ }
959
+ params = {k: v for k, v in params.items() if v is not None}
960
+ return await self._request(endpoint, method="GET", params=params)
961
+
962
+
963
+ class OrganizationsResource(BaseResource):
964
+ """Organizations API methods."""
965
+
966
+ async def get_service_account(self, id: str, account_id: str) -> dict[str, Any]:
967
+ """Get a service account
968
+
969
+ GET /organizations/{id}/service-accounts/{accountId}
970
+ """
971
+ endpoint = f"/organizations/{quote(str(id), safe='')}/service-accounts/{quote(str(account_id), safe='')}"
972
+ return await self._request(endpoint, method="GET")
973
+
974
+ async def list_service_accounts(self, id: str) -> dict[str, Any]:
975
+ """Get organization service accounts
976
+
977
+ GET /organizations/{id}/service-accounts
978
+ """
979
+ endpoint = f"/organizations/{quote(str(id), safe='')}/service-accounts"
980
+ return await self._request(endpoint, method="GET")
981
+
982
+ async def get_organization_by_slug(self, slug: str) -> dict[str, Any]:
983
+ """Get organization by slug
984
+
985
+ GET /organizations/by-slug/{slug}
986
+ """
987
+ endpoint = f"/organizations/by-slug/{quote(str(slug), safe='')}"
988
+ return await self._request(endpoint, method="GET")
989
+
990
+ async def get_organization(self, id: str) -> dict[str, Any]:
991
+ """Get an organization by ID
992
+
993
+ GET /organizations/{id}
994
+ """
995
+ endpoint = f"/organizations/{quote(str(id), safe='')}"
996
+ return await self._request(endpoint, method="GET")
997
+
998
+
999
+ class OtherResource(BaseResource):
1000
+ """Other API methods."""
1001
+
1002
+ async def get_kb_article(
1003
+ self, organization_id: str, project_id: str, app_id: str, article_id: str
1004
+ ) -> dict[str, Any]:
1005
+ """Get KB article
1006
+
1007
+ GET /organizations/{organizationId}/projects/{projectId}/apps/kb/{appId}/articles/{articleId}
1008
+ """
1009
+ endpoint = f"/organizations/{quote(str(organization_id), safe='')}/projects/{quote(str(project_id), safe='')}/apps/kb/{quote(str(app_id), safe='')}/articles/{quote(str(article_id), safe='')}"
1010
+ return await self._request(endpoint, method="GET")
1011
+
1012
+ async def list_kb_articles(
1013
+ self,
1014
+ organization_id: str,
1015
+ project_id: str,
1016
+ app_id: str,
1017
+ page: str | None = None,
1018
+ page_size: str | None = None,
1019
+ category_id: str | None = None,
1020
+ status: str | None = None,
1021
+ search: str | None = None,
1022
+ ) -> dict[str, Any]:
1023
+ """Get KB articles
1024
+
1025
+ GET /organizations/{organizationId}/projects/{projectId}/apps/kb/{appId}/articles
1026
+ """
1027
+ endpoint = f"/organizations/{quote(str(organization_id), safe='')}/projects/{quote(str(project_id), safe='')}/apps/kb/{quote(str(app_id), safe='')}/articles"
1028
+ params = {
1029
+ "page": page,
1030
+ "pageSize": page_size,
1031
+ "categoryId": category_id,
1032
+ "status": status,
1033
+ "search": search,
1034
+ }
1035
+ params = {k: v for k, v in params.items() if v is not None}
1036
+ return await self._request(endpoint, method="GET", params=params)
1037
+
1038
+ async def get_kb_category(
1039
+ self, organization_id: str, project_id: str, app_id: str, category_id: str
1040
+ ) -> dict[str, Any]:
1041
+ """Get KB category
1042
+
1043
+ GET /organizations/{organizationId}/projects/{projectId}/apps/kb/{appId}/categories/{categoryId}
1044
+ """
1045
+ endpoint = f"/organizations/{quote(str(organization_id), safe='')}/projects/{quote(str(project_id), safe='')}/apps/kb/{quote(str(app_id), safe='')}/categories/{quote(str(category_id), safe='')}"
1046
+ return await self._request(endpoint, method="GET")
1047
+
1048
+ async def list_kb_categories(
1049
+ self, organization_id: str, project_id: str, app_id: str
1050
+ ) -> list[dict[str, Any]]:
1051
+ """Get KB categories
1052
+
1053
+ GET /organizations/{organizationId}/projects/{projectId}/apps/kb/{appId}/categories
1054
+ """
1055
+ endpoint = f"/organizations/{quote(str(organization_id), safe='')}/projects/{quote(str(project_id), safe='')}/apps/kb/{quote(str(app_id), safe='')}/categories"
1056
+ return await self._request(endpoint, method="GET")
1057
+
1058
+ async def get_kb_settings(
1059
+ self, organization_id: str, project_id: str, app_id: str
1060
+ ) -> dict[str, Any]:
1061
+ """Get KB settings
1062
+
1063
+ GET /organizations/{organizationId}/projects/{projectId}/apps/kb/{appId}/settings
1064
+ """
1065
+ endpoint = f"/organizations/{quote(str(organization_id), safe='')}/projects/{quote(str(project_id), safe='')}/apps/kb/{quote(str(app_id), safe='')}/settings"
1066
+ return await self._request(endpoint, method="GET")
1067
+
1068
+
1069
+ class ProjectAppsResource(BaseResource):
1070
+ """Project Apps API methods."""
1071
+
1072
+ async def get_project_app_by_slug(
1073
+ self, id: str, project_id: str, app_slug: str
1074
+ ) -> dict[str, Any]:
1075
+ """Get a project app by slug
1076
+
1077
+ GET /organizations/{id}/projects/{projectId}/apps/by-slug/{appSlug}
1078
+ """
1079
+ endpoint = f"/organizations/{quote(str(id), safe='')}/projects/{quote(str(project_id), safe='')}/apps/by-slug/{quote(str(app_slug), safe='')}"
1080
+ return await self._request(endpoint, method="GET")
1081
+
1082
+ async def get_project_app(
1083
+ self, id: str, project_id: str, app_id: str
1084
+ ) -> dict[str, Any]:
1085
+ """Get a project app by ID
1086
+
1087
+ GET /organizations/{id}/projects/{projectId}/apps/{appId}
1088
+ """
1089
+ endpoint = f"/organizations/{quote(str(id), safe='')}/projects/{quote(str(project_id), safe='')}/apps/{quote(str(app_id), safe='')}"
1090
+ return await self._request(endpoint, method="GET")
1091
+
1092
+ async def get_deleted_project_apps(
1093
+ self, id: str, project_id: str
1094
+ ) -> list[dict[str, Any]]:
1095
+ """Get deleted apps in trash
1096
+
1097
+ GET /organizations/{id}/projects/{projectId}/apps/trash
1098
+ """
1099
+ endpoint = f"/organizations/{quote(str(id), safe='')}/projects/{quote(str(project_id), safe='')}/apps/trash"
1100
+ return await self._request(endpoint, method="GET")
1101
+
1102
+ async def get_project_apps(self, id: str, project_id: str) -> dict[str, Any]:
1103
+ """Get apps in a project
1104
+
1105
+ GET /organizations/{id}/projects/{projectId}/apps
1106
+ """
1107
+ endpoint = f"/organizations/{quote(str(id), safe='')}/projects/{quote(str(project_id), safe='')}/apps"
1108
+ return await self._request(endpoint, method="GET")
1109
+
1110
+
1111
+ class ProjectBrandingResource(BaseResource):
1112
+ """Project Branding API methods."""
1113
+
1114
+ async def get_project_branding(
1115
+ self, id: str, project_id: str, branding_id: str
1116
+ ) -> dict[str, Any]:
1117
+ """Get project branding
1118
+
1119
+ GET /organizations/{id}/projects/{projectId}/brandings/{brandingId}
1120
+ """
1121
+ endpoint = f"/organizations/{quote(str(id), safe='')}/projects/{quote(str(project_id), safe='')}/brandings/{quote(str(branding_id), safe='')}"
1122
+ return await self._request(endpoint, method="GET")
1123
+
1124
+ async def list_project_brandings(self, id: str, project_id: str) -> dict[str, Any]:
1125
+ """Get project brandings
1126
+
1127
+ GET /organizations/{id}/projects/{projectId}/brandings
1128
+ """
1129
+ endpoint = f"/organizations/{quote(str(id), safe='')}/projects/{quote(str(project_id), safe='')}/brandings"
1130
+ return await self._request(endpoint, method="GET")
1131
+
1132
+
1133
+ class ProjectDomainsResource(BaseResource):
1134
+ """Project Domains API methods."""
1135
+
1136
+ async def get_domain_verification_instructions(
1137
+ self, id: str, project_id: str, domain_id: str
1138
+ ) -> dict[str, Any]:
1139
+ """Get domain verification instructions
1140
+
1141
+ GET /organizations/{id}/projects/{projectId}/domains/{domainId}/verification
1142
+ """
1143
+ endpoint = f"/organizations/{quote(str(id), safe='')}/projects/{quote(str(project_id), safe='')}/domains/{quote(str(domain_id), safe='')}/verification"
1144
+ return await self._request(endpoint, method="GET")
1145
+
1146
+ async def list_project_domains(
1147
+ self, id: str, project_id: str
1148
+ ) -> list[dict[str, Any]]:
1149
+ """Get all domains for a project
1150
+
1151
+ GET /organizations/{id}/projects/{projectId}/domains
1152
+ """
1153
+ endpoint = f"/organizations/{quote(str(id), safe='')}/projects/{quote(str(project_id), safe='')}/domains"
1154
+ return await self._request(endpoint, method="GET")
1155
+
1156
+
1157
+ class ProjectFilesResource(BaseResource):
1158
+ """Project Files API methods."""
1159
+
1160
+ async def get_file_references(
1161
+ self, id: str, project_id: str, file_id: str
1162
+ ) -> list[dict[str, Any]]:
1163
+ """Get all places where a file is referenced
1164
+
1165
+ GET /organizations/{id}/projects/{projectId}/files/{fileId}/references
1166
+ """
1167
+ endpoint = f"/organizations/{quote(str(id), safe='')}/projects/{quote(str(project_id), safe='')}/files/{quote(str(file_id), safe='')}/references"
1168
+ return await self._request(endpoint, method="GET")
1169
+
1170
+ async def get_file_folder(
1171
+ self, id: str, project_id: str, folder_id: str
1172
+ ) -> dict[str, Any]:
1173
+ """Get a file folder
1174
+
1175
+ GET /organizations/{id}/projects/{projectId}/files/folders/{folderId}
1176
+ """
1177
+ endpoint = f"/organizations/{quote(str(id), safe='')}/projects/{quote(str(project_id), safe='')}/files/folders/{quote(str(folder_id), safe='')}"
1178
+ return await self._request(endpoint, method="GET")
1179
+
1180
+ async def get_file(self, id: str, project_id: str, file_id: str) -> dict[str, Any]:
1181
+ """Get a file
1182
+
1183
+ GET /organizations/{id}/projects/{projectId}/files/{fileId}
1184
+ """
1185
+ endpoint = f"/organizations/{quote(str(id), safe='')}/projects/{quote(str(project_id), safe='')}/files/{quote(str(file_id), safe='')}"
1186
+ return await self._request(endpoint, method="GET")
1187
+
1188
+ async def get_file_folders(self, id: str, project_id: str) -> list[dict[str, Any]]:
1189
+ """Get file folders in a project
1190
+
1191
+ GET /organizations/{id}/projects/{projectId}/files/folders
1192
+ """
1193
+ endpoint = f"/organizations/{quote(str(id), safe='')}/projects/{quote(str(project_id), safe='')}/files/folders"
1194
+ return await self._request(endpoint, method="GET")
1195
+
1196
+ async def ingest_file(
1197
+ self, id: str, project_id: str, data: dict[str, Any]
1198
+ ) -> dict[str, Any]:
1199
+ """Create a file from text or image content
1200
+
1201
+ POST /organizations/{id}/projects/{projectId}/files/ingest
1202
+ """
1203
+ endpoint = f"/organizations/{quote(str(id), safe='')}/projects/{quote(str(project_id), safe='')}/files/ingest"
1204
+ return await self._request(endpoint, method="POST", json=data)
1205
+
1206
+ async def search_project_files(
1207
+ self, id: str, project_id: str, query: str, limit: str | None = None
1208
+ ) -> list[dict[str, Any]]:
1209
+ """Search files by content
1210
+
1211
+ GET /organizations/{id}/projects/{projectId}/files/search
1212
+ """
1213
+ endpoint = f"/organizations/{quote(str(id), safe='')}/projects/{quote(str(project_id), safe='')}/files/search"
1214
+ params = {
1215
+ "query": query,
1216
+ "limit": limit,
1217
+ }
1218
+ params = {k: v for k, v in params.items() if v is not None}
1219
+ return await self._request(endpoint, method="GET", params=params)
1220
+
1221
+ async def list_file_trash(self, id: str, project_id: str) -> list[dict[str, Any]]:
1222
+ """Get items in trash
1223
+
1224
+ GET /organizations/{id}/projects/{projectId}/files/trash
1225
+ """
1226
+ endpoint = f"/organizations/{quote(str(id), safe='')}/projects/{quote(str(project_id), safe='')}/files/trash"
1227
+ return await self._request(endpoint, method="GET")
1228
+
1229
+ async def get_files(
1230
+ self,
1231
+ id: str,
1232
+ project_id: str,
1233
+ page: str | None = None,
1234
+ page_size: str | None = None,
1235
+ search: str | None = None,
1236
+ folder_id: str | None = None,
1237
+ ) -> dict[str, Any]:
1238
+ """Get files in a project
1239
+
1240
+ GET /organizations/{id}/projects/{projectId}/files
1241
+ """
1242
+ endpoint = f"/organizations/{quote(str(id), safe='')}/projects/{quote(str(project_id), safe='')}/files"
1243
+ params = {
1244
+ "page": page,
1245
+ "pageSize": page_size,
1246
+ "search": search,
1247
+ "folderId": folder_id,
1248
+ }
1249
+ params = {k: v for k, v in params.items() if v is not None}
1250
+ return await self._request(endpoint, method="GET", params=params)
1251
+
1252
+
1253
+ class ProjectMembersResource(BaseResource):
1254
+ """Project Members API methods."""
1255
+
1256
+ async def get_project_member(
1257
+ self, id: str, project_id: str, member_id: str
1258
+ ) -> dict[str, Any]:
1259
+ """Get a project member by ID
1260
+
1261
+ GET /organizations/{id}/projects/{projectId}/members/{memberId}
1262
+ """
1263
+ endpoint = f"/organizations/{quote(str(id), safe='')}/projects/{quote(str(project_id), safe='')}/members/{quote(str(member_id), safe='')}"
1264
+ return await self._request(endpoint, method="GET")
1265
+
1266
+ async def get_project_members(
1267
+ self,
1268
+ id: str,
1269
+ project_id: str,
1270
+ page: str | None = None,
1271
+ page_size: str | None = None,
1272
+ ) -> dict[str, Any]:
1273
+ """Get project members
1274
+
1275
+ GET /organizations/{id}/projects/{projectId}/members
1276
+ """
1277
+ endpoint = f"/organizations/{quote(str(id), safe='')}/projects/{quote(str(project_id), safe='')}/members"
1278
+ params = {
1279
+ "page": page,
1280
+ "pageSize": page_size,
1281
+ }
1282
+ params = {k: v for k, v in params.items() if v is not None}
1283
+ return await self._request(endpoint, method="GET", params=params)
1284
+
1285
+
1286
+ class ProjectTrashResource(BaseResource):
1287
+ """Project Trash API methods."""
1288
+
1289
+ async def get_project_trash_item(
1290
+ self, id: str, project_id: str, trash_id: str
1291
+ ) -> dict[str, Any]:
1292
+ """Get a single trash item
1293
+
1294
+ GET /organizations/{id}/projects/{projectId}/trash/{trashId}
1295
+ """
1296
+ endpoint = f"/organizations/{quote(str(id), safe='')}/projects/{quote(str(project_id), safe='')}/trash/{quote(str(trash_id), safe='')}"
1297
+ return await self._request(endpoint, method="GET")
1298
+
1299
+ async def list_project_trash(
1300
+ self,
1301
+ id: str,
1302
+ project_id: str,
1303
+ type: str | None = None,
1304
+ page: str | None = None,
1305
+ page_size: str | None = None,
1306
+ search: str | None = None,
1307
+ ) -> dict[str, Any]:
1308
+ """Get all items in project trash
1309
+
1310
+ GET /organizations/{id}/projects/{projectId}/trash
1311
+ """
1312
+ endpoint = f"/organizations/{quote(str(id), safe='')}/projects/{quote(str(project_id), safe='')}/trash"
1313
+ params = {
1314
+ "type": type,
1315
+ "page": page,
1316
+ "pageSize": page_size,
1317
+ "search": search,
1318
+ }
1319
+ params = {k: v for k, v in params.items() if v is not None}
1320
+ return await self._request(endpoint, method="GET", params=params)
1321
+
1322
+
1323
+ class ProjectsResource(BaseResource):
1324
+ """Projects API methods."""
1325
+
1326
+ async def get_project_by_slug(self, id: str, project_slug: str) -> dict[str, Any]:
1327
+ """Get project by slug
1328
+
1329
+ GET /organizations/{id}/projects/by-slug/{projectSlug}
1330
+ """
1331
+ endpoint = f"/organizations/{quote(str(id), safe='')}/projects/by-slug/{quote(str(project_slug), safe='')}"
1332
+ return await self._request(endpoint, method="GET")
1333
+
1334
+ async def get_project_urls(self, id: str, project_id: str) -> dict[str, Any]:
1335
+ """Get all project URLs
1336
+
1337
+ GET /organizations/{id}/projects/{projectId}/urls
1338
+ """
1339
+ endpoint = f"/organizations/{quote(str(id), safe='')}/projects/{quote(str(project_id), safe='')}/urls"
1340
+ return await self._request(endpoint, method="GET")
1341
+
1342
+ async def get_project(self, id: str, project_id: str) -> dict[str, Any]:
1343
+ """Get a project by ID
1344
+
1345
+ GET /organizations/{id}/projects/{projectId}
1346
+ """
1347
+ endpoint = f"/organizations/{quote(str(id), safe='')}/projects/{quote(str(project_id), safe='')}"
1348
+ return await self._request(endpoint, method="GET")
1349
+
1350
+ async def get_projects(
1351
+ self,
1352
+ id: str,
1353
+ page: str | None = None,
1354
+ page_size: str | None = None,
1355
+ search: str | None = None,
1356
+ ) -> dict[str, Any]:
1357
+ """Get projects in an organization
1358
+
1359
+ GET /organizations/{id}/projects
1360
+ """
1361
+ endpoint = f"/organizations/{quote(str(id), safe='')}/projects"
1362
+ params = {
1363
+ "page": page,
1364
+ "pageSize": page_size,
1365
+ "search": search,
1366
+ }
1367
+ params = {k: v for k, v in params.items() if v is not None}
1368
+ return await self._request(endpoint, method="GET", params=params)
1369
+
1370
+
1371
+ class WebsiteResource(BaseResource):
1372
+ """Website API methods."""
1373
+
1374
+ async def get_website_consent_settings(
1375
+ self, organization_id: str, project_id: str, app_id: str
1376
+ ) -> dict[str, Any]:
1377
+ """Get consent settings
1378
+
1379
+ GET /organizations/{organizationId}/projects/{projectId}/apps/website/{appId}/consent
1380
+ """
1381
+ endpoint = f"/organizations/{quote(str(organization_id), safe='')}/projects/{quote(str(project_id), safe='')}/apps/website/{quote(str(app_id), safe='')}/consent"
1382
+ return await self._request(endpoint, method="GET")
1383
+
1384
+ async def get_website_dialog(
1385
+ self, organization_id: str, project_id: str, app_id: str, dialog_id: str
1386
+ ) -> dict[str, Any]:
1387
+ """Get dialog
1388
+
1389
+ GET /organizations/{organizationId}/projects/{projectId}/apps/website/{appId}/dialogs/{dialogId}
1390
+ """
1391
+ endpoint = f"/organizations/{quote(str(organization_id), safe='')}/projects/{quote(str(project_id), safe='')}/apps/website/{quote(str(app_id), safe='')}/dialogs/{quote(str(dialog_id), safe='')}"
1392
+ return await self._request(endpoint, method="GET")
1393
+
1394
+ async def list_website_dialogs(
1395
+ self,
1396
+ organization_id: str,
1397
+ project_id: str,
1398
+ app_id: str,
1399
+ page: str | None = None,
1400
+ page_size: str | None = None,
1401
+ search: str | None = None,
1402
+ lite: str | None = None,
1403
+ ) -> dict[str, Any]:
1404
+ """Get dialogs
1405
+
1406
+ GET /organizations/{organizationId}/projects/{projectId}/apps/website/{appId}/dialogs
1407
+ """
1408
+ endpoint = f"/organizations/{quote(str(organization_id), safe='')}/projects/{quote(str(project_id), safe='')}/apps/website/{quote(str(app_id), safe='')}/dialogs"
1409
+ params = {
1410
+ "page": page,
1411
+ "pageSize": page_size,
1412
+ "search": search,
1413
+ "lite": lite,
1414
+ }
1415
+ params = {k: v for k, v in params.items() if v is not None}
1416
+ return await self._request(endpoint, method="GET", params=params)
1417
+
1418
+ async def get_website_custom_domain(
1419
+ self, organization_id: str, project_id: str, app_id: str, domain_id: str
1420
+ ) -> dict[str, Any]:
1421
+ """Get custom domain
1422
+
1423
+ GET /organizations/{organizationId}/projects/{projectId}/apps/website/{appId}/domains/{domainId}
1424
+ """
1425
+ endpoint = f"/organizations/{quote(str(organization_id), safe='')}/projects/{quote(str(project_id), safe='')}/apps/website/{quote(str(app_id), safe='')}/domains/{quote(str(domain_id), safe='')}"
1426
+ return await self._request(endpoint, method="GET")
1427
+
1428
+ async def list_website_custom_domains(
1429
+ self, organization_id: str, project_id: str, app_id: str
1430
+ ) -> list[dict[str, Any]]:
1431
+ """Get custom domains
1432
+
1433
+ GET /organizations/{organizationId}/projects/{projectId}/apps/website/{appId}/domains
1434
+ """
1435
+ endpoint = f"/organizations/{quote(str(organization_id), safe='')}/projects/{quote(str(project_id), safe='')}/apps/website/{quote(str(app_id), safe='')}/domains"
1436
+ return await self._request(endpoint, method="GET")
1437
+
1438
+ async def get_website_footer(
1439
+ self, organization_id: str, project_id: str, app_id: str, footer_id: str
1440
+ ) -> dict[str, Any]:
1441
+ """Get website footer
1442
+
1443
+ GET /organizations/{organizationId}/projects/{projectId}/apps/website/{appId}/footers/{footerId}
1444
+ """
1445
+ endpoint = f"/organizations/{quote(str(organization_id), safe='')}/projects/{quote(str(project_id), safe='')}/apps/website/{quote(str(app_id), safe='')}/footers/{quote(str(footer_id), safe='')}"
1446
+ return await self._request(endpoint, method="GET")
1447
+
1448
+ async def list_website_footers(
1449
+ self,
1450
+ organization_id: str,
1451
+ project_id: str,
1452
+ app_id: str,
1453
+ page: str | None = None,
1454
+ page_size: str | None = None,
1455
+ search: str | None = None,
1456
+ lite: str | None = None,
1457
+ ) -> dict[str, Any]:
1458
+ """Get website footers
1459
+
1460
+ GET /organizations/{organizationId}/projects/{projectId}/apps/website/{appId}/footers
1461
+ """
1462
+ endpoint = f"/organizations/{quote(str(organization_id), safe='')}/projects/{quote(str(project_id), safe='')}/apps/website/{quote(str(app_id), safe='')}/footers"
1463
+ params = {
1464
+ "page": page,
1465
+ "pageSize": page_size,
1466
+ "search": search,
1467
+ "lite": lite,
1468
+ }
1469
+ params = {k: v for k, v in params.items() if v is not None}
1470
+ return await self._request(endpoint, method="GET", params=params)
1471
+
1472
+ async def get_website_header(
1473
+ self, organization_id: str, project_id: str, app_id: str, header_id: str
1474
+ ) -> dict[str, Any]:
1475
+ """Get website header
1476
+
1477
+ GET /organizations/{organizationId}/projects/{projectId}/apps/website/{appId}/headers/{headerId}
1478
+ """
1479
+ endpoint = f"/organizations/{quote(str(organization_id), safe='')}/projects/{quote(str(project_id), safe='')}/apps/website/{quote(str(app_id), safe='')}/headers/{quote(str(header_id), safe='')}"
1480
+ return await self._request(endpoint, method="GET")
1481
+
1482
+ async def list_website_headers(
1483
+ self,
1484
+ organization_id: str,
1485
+ project_id: str,
1486
+ app_id: str,
1487
+ page: str | None = None,
1488
+ page_size: str | None = None,
1489
+ search: str | None = None,
1490
+ lite: str | None = None,
1491
+ ) -> dict[str, Any]:
1492
+ """Get website headers
1493
+
1494
+ GET /organizations/{organizationId}/projects/{projectId}/apps/website/{appId}/headers
1495
+ """
1496
+ endpoint = f"/organizations/{quote(str(organization_id), safe='')}/projects/{quote(str(project_id), safe='')}/apps/website/{quote(str(app_id), safe='')}/headers"
1497
+ params = {
1498
+ "page": page,
1499
+ "pageSize": page_size,
1500
+ "search": search,
1501
+ "lite": lite,
1502
+ }
1503
+ params = {k: v for k, v in params.items() if v is not None}
1504
+ return await self._request(endpoint, method="GET", params=params)
1505
+
1506
+ async def get_website_page(
1507
+ self, organization_id: str, project_id: str, app_id: str, page_id: str
1508
+ ) -> dict[str, Any]:
1509
+ """Get website page
1510
+
1511
+ GET /organizations/{organizationId}/projects/{projectId}/apps/website/{appId}/pages/{pageId}
1512
+ """
1513
+ endpoint = f"/organizations/{quote(str(organization_id), safe='')}/projects/{quote(str(project_id), safe='')}/apps/website/{quote(str(app_id), safe='')}/pages/{quote(str(page_id), safe='')}"
1514
+ return await self._request(endpoint, method="GET")
1515
+
1516
+ async def get_website_pages(
1517
+ self,
1518
+ organization_id: str,
1519
+ project_id: str,
1520
+ app_id: str,
1521
+ page: str | None = None,
1522
+ page_size: str | None = None,
1523
+ search: str | None = None,
1524
+ lite: str | None = None,
1525
+ ) -> dict[str, Any]:
1526
+ """Get website pages
1527
+
1528
+ GET /organizations/{organizationId}/projects/{projectId}/apps/website/{appId}/pages
1529
+ """
1530
+ endpoint = f"/organizations/{quote(str(organization_id), safe='')}/projects/{quote(str(project_id), safe='')}/apps/website/{quote(str(app_id), safe='')}/pages"
1531
+ params = {
1532
+ "page": page,
1533
+ "pageSize": page_size,
1534
+ "search": search,
1535
+ "lite": lite,
1536
+ }
1537
+ params = {k: v for k, v in params.items() if v is not None}
1538
+ return await self._request(endpoint, method="GET", params=params)
1539
+
1540
+ async def get_website_post(
1541
+ self, organization_id: str, project_id: str, app_id: str, post_id: str
1542
+ ) -> dict[str, Any]:
1543
+ """Get blog post
1544
+
1545
+ GET /organizations/{organizationId}/projects/{projectId}/apps/website/{appId}/posts/{postId}
1546
+ """
1547
+ endpoint = f"/organizations/{quote(str(organization_id), safe='')}/projects/{quote(str(project_id), safe='')}/apps/website/{quote(str(app_id), safe='')}/posts/{quote(str(post_id), safe='')}"
1548
+ return await self._request(endpoint, method="GET")
1549
+
1550
+ async def get_website_posts(
1551
+ self,
1552
+ organization_id: str,
1553
+ project_id: str,
1554
+ app_id: str,
1555
+ page: str | None = None,
1556
+ page_size: str | None = None,
1557
+ search: str | None = None,
1558
+ lite: str | None = None,
1559
+ ) -> dict[str, Any]:
1560
+ """Get blog posts
1561
+
1562
+ GET /organizations/{organizationId}/projects/{projectId}/apps/website/{appId}/posts
1563
+ """
1564
+ endpoint = f"/organizations/{quote(str(organization_id), safe='')}/projects/{quote(str(project_id), safe='')}/apps/website/{quote(str(app_id), safe='')}/posts"
1565
+ params = {
1566
+ "page": page,
1567
+ "pageSize": page_size,
1568
+ "search": search,
1569
+ "lite": lite,
1570
+ }
1571
+ params = {k: v for k, v in params.items() if v is not None}
1572
+ return await self._request(endpoint, method="GET", params=params)
1573
+
1574
+ async def get_website_app_settings(
1575
+ self, organization_id: str, project_id: str, app_id: str
1576
+ ) -> dict[str, Any]:
1577
+ """Get website settings
1578
+
1579
+ GET /organizations/{organizationId}/projects/{projectId}/apps/website/{appId}/settings
1580
+ """
1581
+ endpoint = f"/organizations/{quote(str(organization_id), safe='')}/projects/{quote(str(project_id), safe='')}/apps/website/{quote(str(app_id), safe='')}/settings"
1582
+ return await self._request(endpoint, method="GET")
1583
+
1584
+ async def get_website_sidebar(
1585
+ self, organization_id: str, project_id: str, app_id: str, sidebar_id: str
1586
+ ) -> dict[str, Any]:
1587
+ """Get website sidebar
1588
+
1589
+ GET /organizations/{organizationId}/projects/{projectId}/apps/website/{appId}/sidebars/{sidebarId}
1590
+ """
1591
+ endpoint = f"/organizations/{quote(str(organization_id), safe='')}/projects/{quote(str(project_id), safe='')}/apps/website/{quote(str(app_id), safe='')}/sidebars/{quote(str(sidebar_id), safe='')}"
1592
+ return await self._request(endpoint, method="GET")
1593
+
1594
+ async def list_website_sidebars(
1595
+ self,
1596
+ organization_id: str,
1597
+ project_id: str,
1598
+ app_id: str,
1599
+ page: str | None = None,
1600
+ page_size: str | None = None,
1601
+ search: str | None = None,
1602
+ lite: str | None = None,
1603
+ ) -> dict[str, Any]:
1604
+ """Get website sidebars
1605
+
1606
+ GET /organizations/{organizationId}/projects/{projectId}/apps/website/{appId}/sidebars
1607
+ """
1608
+ endpoint = f"/organizations/{quote(str(organization_id), safe='')}/projects/{quote(str(project_id), safe='')}/apps/website/{quote(str(app_id), safe='')}/sidebars"
1609
+ params = {
1610
+ "page": page,
1611
+ "pageSize": page_size,
1612
+ "search": search,
1613
+ "lite": lite,
1614
+ }
1615
+ params = {k: v for k, v in params.items() if v is not None}
1616
+ return await self._request(endpoint, method="GET", params=params)
1617
+
1618
+ async def get_website_tags(
1619
+ self, organization_id: str, project_id: str, app_id: str
1620
+ ) -> list[str]:
1621
+ """Get website tags
1622
+
1623
+ GET /organizations/{organizationId}/projects/{projectId}/apps/website/{appId}/tags
1624
+ """
1625
+ endpoint = f"/organizations/{quote(str(organization_id), safe='')}/projects/{quote(str(project_id), safe='')}/apps/website/{quote(str(app_id), safe='')}/tags"
1626
+ return await self._request(endpoint, method="GET")
1627
+
1628
+ async def get_website_template(
1629
+ self, organization_id: str, project_id: str, app_id: str, template_id: str
1630
+ ) -> dict[str, Any]:
1631
+ """Get website template
1632
+
1633
+ GET /organizations/{organizationId}/projects/{projectId}/apps/website/{appId}/templates/{templateId}
1634
+ """
1635
+ endpoint = f"/organizations/{quote(str(organization_id), safe='')}/projects/{quote(str(project_id), safe='')}/apps/website/{quote(str(app_id), safe='')}/templates/{quote(str(template_id), safe='')}"
1636
+ return await self._request(endpoint, method="GET")
1637
+
1638
+ async def list_website_templates(
1639
+ self,
1640
+ organization_id: str,
1641
+ project_id: str,
1642
+ app_id: str,
1643
+ page: str | None = None,
1644
+ page_size: str | None = None,
1645
+ search: str | None = None,
1646
+ lite: str | None = None,
1647
+ ) -> dict[str, Any]:
1648
+ """Get website templates
1649
+
1650
+ GET /organizations/{organizationId}/projects/{projectId}/apps/website/{appId}/templates
1651
+ """
1652
+ endpoint = f"/organizations/{quote(str(organization_id), safe='')}/projects/{quote(str(project_id), safe='')}/apps/website/{quote(str(app_id), safe='')}/templates"
1653
+ params = {
1654
+ "page": page,
1655
+ "pageSize": page_size,
1656
+ "search": search,
1657
+ "lite": lite,
1658
+ }
1659
+ params = {k: v for k, v in params.items() if v is not None}
1660
+ return await self._request(endpoint, method="GET", params=params)
1661
+
1662
+ async def get_website_tracking_settings(
1663
+ self, organization_id: str, project_id: str, app_id: str
1664
+ ) -> dict[str, Any]:
1665
+ """Get tracking settings
1666
+
1667
+ GET /organizations/{organizationId}/projects/{projectId}/apps/website/{appId}/tracking
1668
+ """
1669
+ endpoint = f"/organizations/{quote(str(organization_id), safe='')}/projects/{quote(str(project_id), safe='')}/apps/website/{quote(str(app_id), safe='')}/tracking"
1670
+ return await self._request(endpoint, method="GET")
1671
+
1672
+ async def get_website_urls(
1673
+ self, organization_id: str, project_id: str, app_id: str
1674
+ ) -> dict[str, Any]:
1675
+ """Get existing website page URLs
1676
+
1677
+ GET /organizations/{organizationId}/projects/{projectId}/apps/website/{appId}/urls
1678
+ """
1679
+ endpoint = f"/organizations/{quote(str(organization_id), safe='')}/projects/{quote(str(project_id), safe='')}/apps/website/{quote(str(app_id), safe='')}/urls"
1680
+ return await self._request(endpoint, method="GET")
1681
+
1682
+
1683
+ # ============================================================================
1684
+ # Main SDK Class
1685
+ # ============================================================================
1686
+
1687
+
1688
+ class GiantContext:
1689
+ """GiantContext SDK client.
1690
+
1691
+ Example:
1692
+ >>> async with create_giant_context(api_key="gct_...") as gc:
1693
+ ... orgs = await gc.organizations.get_organizations()
1694
+ ... print(orgs)
1695
+ """
1696
+
1697
+ api_keys: APIKeysResource
1698
+ app_members: AppMembersResource
1699
+ bug_reports: BugReportsResource
1700
+ crm: CRMResource
1701
+ chat: ChatResource
1702
+ drafts: DraftsResource
1703
+ email: EmailResource
1704
+ feature_requests: FeatureRequestsResource
1705
+ forms: FormsResource
1706
+ ideas: IdeasResource
1707
+ invitations: InvitationsResource
1708
+ me: MeResource
1709
+ organization_members: OrganizationMembersResource
1710
+ organizations: OrganizationsResource
1711
+ other: OtherResource
1712
+ project_apps: ProjectAppsResource
1713
+ project_branding: ProjectBrandingResource
1714
+ project_domains: ProjectDomainsResource
1715
+ project_files: ProjectFilesResource
1716
+ project_members: ProjectMembersResource
1717
+ project_trash: ProjectTrashResource
1718
+ projects: ProjectsResource
1719
+ website: WebsiteResource
1720
+
1721
+ def __init__(self, config: GiantContextConfig):
1722
+ """Initialize the SDK with configuration."""
1723
+ self._client = GiantContextClient(config)
1724
+ self.api_keys = APIKeysResource(self._client)
1725
+ self.app_members = AppMembersResource(self._client)
1726
+ self.bug_reports = BugReportsResource(self._client)
1727
+ self.crm = CRMResource(self._client)
1728
+ self.chat = ChatResource(self._client)
1729
+ self.drafts = DraftsResource(self._client)
1730
+ self.email = EmailResource(self._client)
1731
+ self.feature_requests = FeatureRequestsResource(self._client)
1732
+ self.forms = FormsResource(self._client)
1733
+ self.ideas = IdeasResource(self._client)
1734
+ self.invitations = InvitationsResource(self._client)
1735
+ self.me = MeResource(self._client)
1736
+ self.organization_members = OrganizationMembersResource(self._client)
1737
+ self.organizations = OrganizationsResource(self._client)
1738
+ self.other = OtherResource(self._client)
1739
+ self.project_apps = ProjectAppsResource(self._client)
1740
+ self.project_branding = ProjectBrandingResource(self._client)
1741
+ self.project_domains = ProjectDomainsResource(self._client)
1742
+ self.project_files = ProjectFilesResource(self._client)
1743
+ self.project_members = ProjectMembersResource(self._client)
1744
+ self.project_trash = ProjectTrashResource(self._client)
1745
+ self.projects = ProjectsResource(self._client)
1746
+ self.website = WebsiteResource(self._client)
1747
+
1748
+ async def close(self):
1749
+ """Close the SDK client."""
1750
+ await self._client.close()
1751
+
1752
+ async def __aenter__(self):
1753
+ return self
1754
+
1755
+ async def __aexit__(self, *args):
1756
+ await self.close()
1757
+
1758
+
1759
+ def create_giant_context(
1760
+ api_key: str,
1761
+ base_url: str = "https://api.giantcontext.com",
1762
+ timeout: float = 30.0,
1763
+ ) -> GiantContext:
1764
+ """Create a GiantContext SDK instance.
1765
+
1766
+ Args:
1767
+ api_key: Your API key (starts with gct_)
1768
+ base_url: Base URL for the API
1769
+ timeout: Request timeout in seconds
1770
+
1771
+ Returns:
1772
+ GiantContext SDK instance
1773
+
1774
+ Example:
1775
+ >>> gc = create_giant_context(api_key="gct_...")
1776
+ >>> orgs = await gc.organizations.get_organizations()
1777
+ """
1778
+ config = GiantContextConfig(api_key=api_key, base_url=base_url, timeout=timeout)
1779
+ return GiantContext(config)