@37signals/basecamp 0.2.2 → 0.2.3

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 (35) hide show
  1. package/README.md +39 -14
  2. package/dist/client.d.ts +3 -1
  3. package/dist/client.d.ts.map +1 -1
  4. package/dist/client.js +65 -45
  5. package/dist/client.js.map +1 -1
  6. package/dist/generated/metadata.json +28 -1
  7. package/dist/generated/openapi-stripped.json +242 -1
  8. package/dist/generated/path-mapping.d.ts.map +1 -1
  9. package/dist/generated/path-mapping.js +2 -0
  10. package/dist/generated/path-mapping.js.map +1 -1
  11. package/dist/generated/path-mapping.ts +2 -0
  12. package/dist/generated/schema.d.ts +174 -1
  13. package/dist/generated/services/campfires.d.ts +32 -0
  14. package/dist/generated/services/campfires.d.ts.map +1 -1
  15. package/dist/generated/services/campfires.js +58 -0
  16. package/dist/generated/services/campfires.js.map +1 -1
  17. package/dist/generated/services/campfires.ts +75 -0
  18. package/dist/oauth/discovery.d.ts.map +1 -1
  19. package/dist/oauth/discovery.js +1 -0
  20. package/dist/oauth/discovery.js.map +1 -1
  21. package/dist/oauth/interactive-login.d.ts.map +1 -1
  22. package/dist/oauth/interactive-login.js +3 -2
  23. package/dist/oauth/interactive-login.js.map +1 -1
  24. package/dist/oauth/types.d.ts +2 -0
  25. package/dist/oauth/types.d.ts.map +1 -1
  26. package/dist/services/base.d.ts +3 -1
  27. package/dist/services/base.d.ts.map +1 -1
  28. package/dist/services/base.js +8 -5
  29. package/dist/services/base.js.map +1 -1
  30. package/package.json +1 -1
  31. package/src/generated/metadata.json +28 -1
  32. package/src/generated/openapi-stripped.json +242 -1
  33. package/src/generated/path-mapping.ts +2 -0
  34. package/src/generated/schema.d.ts +174 -1
  35. package/src/generated/services/campfires.ts +75 -0
@@ -474,6 +474,29 @@ export interface paths {
474
474
  patch?: never;
475
475
  trace?: never;
476
476
  };
477
+ "/chats/{campfireId}/uploads.json": {
478
+ parameters: {
479
+ query?: never;
480
+ header?: never;
481
+ path?: never;
482
+ cookie?: never;
483
+ };
484
+ /**
485
+ * @description List uploaded files in a campfire
486
+ *
487
+ * **Pagination**: Uses Link header (RFC5988). Follow the `next` rel URL
488
+ * to fetch additional pages. X-Total-Count header provides total count.
489
+ */
490
+ get: operations["ListCampfireUploads"];
491
+ put?: never;
492
+ /** @description Upload a file to a campfire */
493
+ post: operations["CreateCampfireUpload"];
494
+ delete?: never;
495
+ options?: never;
496
+ head?: never;
497
+ patch?: never;
498
+ trace?: never;
499
+ };
477
500
  "/circles/people.json": {
478
501
  parameters: {
479
502
  query?: never;
@@ -2229,6 +2252,7 @@ export interface components {
2229
2252
  creator: components["schemas"]["Person"];
2230
2253
  topic?: string;
2231
2254
  lines_url?: string;
2255
+ files_url?: string;
2232
2256
  };
2233
2257
  CampfireLine: {
2234
2258
  /** Format: int64 */
@@ -2243,7 +2267,8 @@ export interface components {
2243
2267
  url: string;
2244
2268
  app_url: string;
2245
2269
  bookmark_url?: string;
2246
- content: string;
2270
+ content?: string;
2271
+ attachments?: components["schemas"]["CampfireLineAttachment"][];
2247
2272
  parent: components["schemas"]["RecordingParent"];
2248
2273
  bucket: components["schemas"]["TodoBucket"];
2249
2274
  creator: components["schemas"]["Person"];
@@ -2251,6 +2276,15 @@ export interface components {
2251
2276
  boosts_count?: number;
2252
2277
  boosts_url?: string;
2253
2278
  };
2279
+ CampfireLineAttachment: {
2280
+ title?: string;
2281
+ url?: string;
2282
+ filename?: string;
2283
+ content_type?: string;
2284
+ /** Format: int64 */
2285
+ byte_size?: number;
2286
+ download_url?: string;
2287
+ };
2254
2288
  Card: {
2255
2289
  /** Format: int64 */
2256
2290
  id: number;
@@ -2504,6 +2538,12 @@ export interface components {
2504
2538
  content_type?: string;
2505
2539
  };
2506
2540
  CreateCampfireLineResponseContent: components["schemas"]["CampfireLine"];
2541
+ /**
2542
+ * @description Raw binary content of the file. Set the Content-Type header to match
2543
+ * the file's media type (e.g. "image/png", "application/pdf").
2544
+ */
2545
+ CreateCampfireUploadInputPayload: string;
2546
+ CreateCampfireUploadResponseContent: components["schemas"]["CampfireLine"];
2507
2547
  CreateCardColumnRequestContent: {
2508
2548
  title: string;
2509
2549
  description?: string;
@@ -2857,6 +2897,7 @@ export interface components {
2857
2897
  ListAnswersResponseContent: components["schemas"]["QuestionAnswer"][];
2858
2898
  ListAssignablePeopleResponseContent: components["schemas"]["Person"][];
2859
2899
  ListCampfireLinesResponseContent: components["schemas"]["CampfireLine"][];
2900
+ ListCampfireUploadsResponseContent: components["schemas"]["CampfireLine"][];
2860
2901
  ListCampfiresResponseContent: components["schemas"]["Campfire"][];
2861
2902
  ListCardsResponseContent: components["schemas"]["Card"][];
2862
2903
  ListChatbotsResponseContent: components["schemas"]["Chatbot"][];
@@ -6375,6 +6416,138 @@ export interface operations {
6375
6416
  };
6376
6417
  };
6377
6418
  };
6419
+ ListCampfireUploads: {
6420
+ parameters: {
6421
+ query?: never;
6422
+ header?: never;
6423
+ path: {
6424
+ campfireId: number;
6425
+ };
6426
+ cookie?: never;
6427
+ };
6428
+ requestBody?: never;
6429
+ responses: {
6430
+ /** @description ListCampfireUploads 200 response */
6431
+ 200: {
6432
+ headers: {
6433
+ [name: string]: unknown;
6434
+ };
6435
+ content: {
6436
+ "application/json": components["schemas"]["ListCampfireUploadsResponseContent"];
6437
+ };
6438
+ };
6439
+ /** @description UnauthorizedError 401 response */
6440
+ 401: {
6441
+ headers: {
6442
+ [name: string]: unknown;
6443
+ };
6444
+ content: {
6445
+ "application/json": components["schemas"]["UnauthorizedErrorResponseContent"];
6446
+ };
6447
+ };
6448
+ /** @description ForbiddenError 403 response */
6449
+ 403: {
6450
+ headers: {
6451
+ [name: string]: unknown;
6452
+ };
6453
+ content: {
6454
+ "application/json": components["schemas"]["ForbiddenErrorResponseContent"];
6455
+ };
6456
+ };
6457
+ /** @description RateLimitError 429 response */
6458
+ 429: {
6459
+ headers: {
6460
+ [name: string]: unknown;
6461
+ };
6462
+ content: {
6463
+ "application/json": components["schemas"]["RateLimitErrorResponseContent"];
6464
+ };
6465
+ };
6466
+ /** @description InternalServerError 500 response */
6467
+ 500: {
6468
+ headers: {
6469
+ [name: string]: unknown;
6470
+ };
6471
+ content: {
6472
+ "application/json": components["schemas"]["InternalServerErrorResponseContent"];
6473
+ };
6474
+ };
6475
+ };
6476
+ };
6477
+ CreateCampfireUpload: {
6478
+ parameters: {
6479
+ query: {
6480
+ /** @description Filename for the uploaded file (e.g. "report.pdf"). */
6481
+ name: string;
6482
+ };
6483
+ header?: never;
6484
+ path: {
6485
+ campfireId: number;
6486
+ };
6487
+ cookie?: never;
6488
+ };
6489
+ requestBody: {
6490
+ content: {
6491
+ "application/octet-stream": components["schemas"]["CreateCampfireUploadInputPayload"];
6492
+ };
6493
+ };
6494
+ responses: {
6495
+ /** @description CreateCampfireUpload 201 response */
6496
+ 201: {
6497
+ headers: {
6498
+ [name: string]: unknown;
6499
+ };
6500
+ content: {
6501
+ "application/json": components["schemas"]["CreateCampfireUploadResponseContent"];
6502
+ };
6503
+ };
6504
+ /** @description UnauthorizedError 401 response */
6505
+ 401: {
6506
+ headers: {
6507
+ [name: string]: unknown;
6508
+ };
6509
+ content: {
6510
+ "application/json": components["schemas"]["UnauthorizedErrorResponseContent"];
6511
+ };
6512
+ };
6513
+ /** @description ForbiddenError 403 response */
6514
+ 403: {
6515
+ headers: {
6516
+ [name: string]: unknown;
6517
+ };
6518
+ content: {
6519
+ "application/json": components["schemas"]["ForbiddenErrorResponseContent"];
6520
+ };
6521
+ };
6522
+ /** @description ValidationError 422 response */
6523
+ 422: {
6524
+ headers: {
6525
+ [name: string]: unknown;
6526
+ };
6527
+ content: {
6528
+ "application/json": components["schemas"]["ValidationErrorResponseContent"];
6529
+ };
6530
+ };
6531
+ /** @description RateLimitError 429 response */
6532
+ 429: {
6533
+ headers: {
6534
+ [name: string]: unknown;
6535
+ };
6536
+ content: {
6537
+ "application/json": components["schemas"]["RateLimitErrorResponseContent"];
6538
+ };
6539
+ };
6540
+ /** @description InternalServerError 500 response */
6541
+ 500: {
6542
+ headers: {
6543
+ [name: string]: unknown;
6544
+ };
6545
+ content: {
6546
+ "application/json": components["schemas"]["InternalServerErrorResponseContent"];
6547
+ };
6548
+ };
6549
+ };
6550
+ };
6378
6551
  ListPingablePeople: {
6379
6552
  parameters: {
6380
6553
  query?: never;
@@ -69,6 +69,12 @@ export interface CreateLineCampfireRequest {
69
69
  contentType?: string;
70
70
  }
71
71
 
72
+ /**
73
+ * Options for listUploads.
74
+ */
75
+ export interface ListUploadsCampfireOptions extends PaginationOptions {
76
+ }
77
+
72
78
 
73
79
  // =============================================================================
74
80
  // Service
@@ -430,4 +436,73 @@ export class CampfiresService extends BaseService {
430
436
  })
431
437
  );
432
438
  }
439
+
440
+ /**
441
+ * List uploaded files in a campfire
442
+ * @param campfireId - The campfire ID
443
+ * @param options - Optional query parameters
444
+ * @returns All CampfireLine across all pages, with .meta.totalCount
445
+ *
446
+ * @example
447
+ * ```ts
448
+ * const result = await client.campfires.listUploads(123);
449
+ * ```
450
+ */
451
+ async listUploads(campfireId: number, options?: ListUploadsCampfireOptions): Promise<ListResult<CampfireLine>> {
452
+ return this.requestPaginated(
453
+ {
454
+ service: "Campfires",
455
+ operation: "ListCampfireUploads",
456
+ resourceType: "campfire_upload",
457
+ isMutation: false,
458
+ resourceId: campfireId,
459
+ },
460
+ () =>
461
+ this.client.GET("/chats/{campfireId}/uploads.json", {
462
+ params: {
463
+ path: { campfireId },
464
+ },
465
+ })
466
+ , options
467
+ );
468
+ }
469
+
470
+ /**
471
+ * Upload a file to a campfire
472
+ * @param campfireId - The campfire ID
473
+ * @param data - Binary file data to upload
474
+ * @param contentType - MIME type of the file (e.g., "image/png", "application/pdf")
475
+ * @param name - Filename for the uploaded file (e.g. "report.pdf").
476
+ * @returns The CampfireLine
477
+ * @throws {BasecampError} If required fields are missing or invalid
478
+ *
479
+ * @example
480
+ * ```ts
481
+ * const result = await client.campfires.createUpload(123, fileData, "image/png", "name");
482
+ * ```
483
+ */
484
+ async createUpload(campfireId: number, data: ArrayBuffer | Uint8Array | string, contentType: string, name: string): Promise<CampfireLine> {
485
+ const response = await this.request(
486
+ {
487
+ service: "Campfires",
488
+ operation: "CreateCampfireUpload",
489
+ resourceType: "campfire_upload",
490
+ isMutation: true,
491
+ resourceId: campfireId,
492
+ },
493
+ () =>
494
+ this.client.POST("/chats/{campfireId}/uploads.json", {
495
+ params: {
496
+ path: { campfireId },
497
+ query: { name: name },
498
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
499
+ header: { "Content-Type": contentType } as any,
500
+ },
501
+ body: data as unknown as string,
502
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
503
+ bodySerializer: (body: unknown) => body as any,
504
+ })
505
+ );
506
+ return response;
507
+ }
433
508
  }