skedyul 0.2.113 → 0.2.115

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/.build-stamp CHANGED
@@ -1 +1 @@
1
- 1769752729799
1
+ 1769757790864
@@ -381,6 +381,28 @@ export interface FileUrlResponse {
381
381
  /** ISO timestamp when the URL expires */
382
382
  expiresAt: string;
383
383
  }
384
+ /**
385
+ * Parameters for file.upload
386
+ */
387
+ export interface FileUploadParams {
388
+ /** File content - Buffer or base64-encoded string */
389
+ content: Buffer | string;
390
+ /** Original filename */
391
+ name: string;
392
+ /** MIME type of the file */
393
+ mimeType: string;
394
+ /** Optional path prefix for organization (e.g., 'attachments', 'images') */
395
+ path?: string;
396
+ }
397
+ /**
398
+ * Response from file.upload
399
+ */
400
+ export interface FileUploadResult {
401
+ /** File ID (fl_xxx format) */
402
+ id: string;
403
+ /** Public URL (null for private files) */
404
+ url: string | null;
405
+ }
384
406
  export declare const file: {
385
407
  /**
386
408
  * Get a temporary download URL for an app-scoped file.
@@ -398,6 +420,32 @@ export declare const file: {
398
420
  * ```
399
421
  */
400
422
  getUrl(fileId: string): Promise<FileUrlResponse>;
423
+ /**
424
+ * Upload file content and create a File record.
425
+ *
426
+ * Files are scoped to the app installation and stored privately.
427
+ * Use file.getUrl() to generate a temporary download URL when needed.
428
+ *
429
+ * @example
430
+ * ```ts
431
+ * // Upload a file from a Buffer
432
+ * const buffer = await downloadFromExternalUrl(url)
433
+ * const { id } = await file.upload({
434
+ * content: buffer,
435
+ * name: 'document.pdf',
436
+ * mimeType: 'application/pdf',
437
+ * })
438
+ *
439
+ * // Upload with a path prefix for organization
440
+ * const { id } = await file.upload({
441
+ * content: imageBuffer,
442
+ * name: 'photo.jpg',
443
+ * mimeType: 'image/jpeg',
444
+ * path: 'attachments',
445
+ * })
446
+ * ```
447
+ */
448
+ upload(params: FileUploadParams): Promise<FileUploadResult>;
401
449
  };
402
450
  /**
403
451
  * Response from webhook.create
@@ -427,6 +427,44 @@ exports.file = {
427
427
  });
428
428
  return data;
429
429
  },
430
+ /**
431
+ * Upload file content and create a File record.
432
+ *
433
+ * Files are scoped to the app installation and stored privately.
434
+ * Use file.getUrl() to generate a temporary download URL when needed.
435
+ *
436
+ * @example
437
+ * ```ts
438
+ * // Upload a file from a Buffer
439
+ * const buffer = await downloadFromExternalUrl(url)
440
+ * const { id } = await file.upload({
441
+ * content: buffer,
442
+ * name: 'document.pdf',
443
+ * mimeType: 'application/pdf',
444
+ * })
445
+ *
446
+ * // Upload with a path prefix for organization
447
+ * const { id } = await file.upload({
448
+ * content: imageBuffer,
449
+ * name: 'photo.jpg',
450
+ * mimeType: 'image/jpeg',
451
+ * path: 'attachments',
452
+ * })
453
+ * ```
454
+ */
455
+ async upload(params) {
456
+ // Convert Buffer to base64 string for transport
457
+ const content = typeof params.content === 'string'
458
+ ? params.content
459
+ : params.content.toString('base64');
460
+ const { data } = await callCore('file.upload', {
461
+ content,
462
+ name: params.name,
463
+ mimeType: params.mimeType,
464
+ ...(params.path ? { path: params.path } : {}),
465
+ });
466
+ return data;
467
+ },
430
468
  };
431
469
  exports.webhook = {
432
470
  /**
package/dist/index.d.ts CHANGED
@@ -4,7 +4,7 @@ export * from './schemas';
4
4
  export { server } from './server';
5
5
  export { z };
6
6
  export { workplace, communicationChannel, instance, token, file, webhook, resource, contactAssociationLink, configure, getConfig, runWithConfig, } from './core/client';
7
- export type { InstanceContext, InstanceData, InstanceMeta, InstancePagination, InstanceListResult, InstanceListArgs, FileUrlResponse, WebhookCreateResult, WebhookListItem, WebhookDeleteByNameOptions, WebhookListOptions, ResourceLinkParams, ResourceLinkResult, ContactAssociationLinkCreateParams, ContactAssociationLinkCreateResult, } from './core/client';
7
+ export type { InstanceContext, InstanceData, InstanceMeta, InstancePagination, InstanceListResult, InstanceListArgs, FileUrlResponse, FileUploadParams, FileUploadResult, WebhookCreateResult, WebhookListItem, WebhookDeleteByNameOptions, WebhookListOptions, ResourceLinkParams, ResourceLinkResult, ContactAssociationLinkCreateParams, ContactAssociationLinkCreateResult, } from './core/client';
8
8
  declare const _default: {
9
9
  z: typeof z;
10
10
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skedyul",
3
- "version": "0.2.113",
3
+ "version": "0.2.115",
4
4
  "description": "The Skedyul SDK for Node.js",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",