@publishq/sdk 0.0.3 → 0.0.5

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/README.md CHANGED
@@ -99,6 +99,7 @@ await publishq.workspaces.get('<workspace-id>');
99
99
  const { data: media } = await publishq.media.upload({ file });
100
100
  await publishq.media.list({ mediaTypes: ['IMAGE'] });
101
101
  await publishq.media.get('<media-id>');
102
+ await publishq.media.delete('<media-id>'); // 409 while a draft or scheduled post uses it
102
103
  ```
103
104
 
104
105
  ## Scopes
@@ -114,7 +115,7 @@ returns `403`.
114
115
  | `workspaces:read` | `workspaces.list`, `workspaces.get` |
115
116
  | `workspaces:write` | `workspaces.create` |
116
117
  | `media:read` | `media.list`, `media.get` |
117
- | `media:write` | `media.upload`, `media.createUpload`, `media.completeUpload` |
118
+ | `media:write` | `media.upload`, `media.createUpload`, `media.completeUpload`, `media.delete` |
118
119
 
119
120
  ## Configuration
120
121
 
package/dist/index.cjs CHANGED
@@ -56,6 +56,8 @@ __export(index_exports, {
56
56
  zCreateWorkspaceBody: () => zCreateWorkspaceBody,
57
57
  zCreateWorkspaceRequest: () => zCreateWorkspaceRequest,
58
58
  zCreateWorkspaceResponse: () => zCreateWorkspaceResponse,
59
+ zDeleteMediaPath: () => zDeleteMediaPath,
60
+ zDeleteMediaResponse: () => zDeleteMediaResponse,
59
61
  zDeletePostPath: () => zDeletePostPath,
60
62
  zDeletePostResponse: () => zDeletePostResponse,
61
63
  zFacebookPlatformSpecificSettings: () => zFacebookPlatformSpecificSettings,
@@ -1109,6 +1111,18 @@ var Media = class {
1109
1111
  }
1110
1112
  });
1111
1113
  }
1114
+ /**
1115
+ * Delete media
1116
+ *
1117
+ * Deletes a media file from your media library and from storage. Returns no body on success. A file attached to a draft or scheduled post, or used as its thumbnail, is refused with 409 until that post is published or deleted. Posts already published on a platform are not affected.
1118
+ */
1119
+ static deleteMedia(options) {
1120
+ return (options.client ?? client).delete({
1121
+ security: [{ scheme: "bearer", type: "http" }],
1122
+ url: "/media/{id}",
1123
+ ...options
1124
+ });
1125
+ }
1112
1126
  /**
1113
1127
  * Get media
1114
1128
  *
@@ -2026,6 +2040,12 @@ var zListMediaQuery = z.object({
2026
2040
  var zListMediaResponse = zMediaListResponse;
2027
2041
  var zUploadMediaBody = zUploadMediaRequest;
2028
2042
  var zUploadMediaResponse = zMedia;
2043
+ var zDeleteMediaPath = z.object({
2044
+ id: z.uuid()
2045
+ });
2046
+ var zDeleteMediaResponse = z.void().register(z.globalRegistry, {
2047
+ description: "Media deleted successfully"
2048
+ });
2029
2049
  var zGetMediaPath = z.object({
2030
2050
  id: z.uuid()
2031
2051
  });
@@ -2224,7 +2244,9 @@ function createMediaNamespace(client2) {
2224
2244
  /** Add a file sent to a `createUpload` URL to the media library now and return it. Optional: using the ID in a post does the same. Wraps `Media.completeMediaUpload`. */
2225
2245
  completeUpload: (id) => preserveApiError(Media.completeMediaUpload({ client: client2, path: { id } })),
2226
2246
  /** Get one media file by ID. Wraps `Media.getMedia`. */
2227
- get: (id) => preserveApiError(Media.getMedia({ client: client2, path: { id } }))
2247
+ get: (id) => preserveApiError(Media.getMedia({ client: client2, path: { id } })),
2248
+ /** Delete a media file from the library and from storage. Refused with 409 while a draft or scheduled post uses it. Wraps `Media.deleteMedia`. */
2249
+ delete: (id) => preserveApiError(Media.deleteMedia({ client: client2, path: { id } }))
2228
2250
  };
2229
2251
  }
2230
2252
  var index_default = PublishQ;
@@ -2255,6 +2277,8 @@ var index_default = PublishQ;
2255
2277
  zCreateWorkspaceBody,
2256
2278
  zCreateWorkspaceRequest,
2257
2279
  zCreateWorkspaceResponse,
2280
+ zDeleteMediaPath,
2281
+ zDeleteMediaResponse,
2258
2282
  zDeletePostPath,
2259
2283
  zDeletePostResponse,
2260
2284
  zFacebookPlatformSpecificSettings,