beamsocial 0.20.2 → 0.21.1

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.
@@ -26,5 +26,6 @@ export declare class Post {
26
26
  remove_comment(id: string): Promise<void>;
27
27
  report(): Promise<void>;
28
28
  delete(): Promise<void>;
29
+ edit(content: string, visibility?: "me" | "friends" | "followers" | "everyone", is_ai?: boolean, is_nudity?: boolean): Promise<void>;
29
30
  edit_flags(flags: Flag[] | Record<Flag, boolean>): Promise<void>;
30
31
  }
@@ -178,6 +178,46 @@ export class Post {
178
178
  }
179
179
  });
180
180
  }
181
+ edit(content_1) {
182
+ return __awaiter(this, arguments, void 0, function* (content, visibility = "followers", is_ai = false, is_nudity = false) {
183
+ try {
184
+ const res = yield axios.put(this.__url + '/edit', {
185
+ content: content,
186
+ visibility: visibility
187
+ }, {
188
+ withCredentials: true,
189
+ params: {
190
+ is_ai,
191
+ is_nudity
192
+ }
193
+ });
194
+ return;
195
+ }
196
+ catch (err) {
197
+ if (axios.isAxiosError(err) && err.response) {
198
+ const res = err.response;
199
+ if (res.status == 401) {
200
+ throw new Error('NotLoggedIn');
201
+ }
202
+ else if (res.status == 403) {
203
+ throw new Error('Forbidden');
204
+ }
205
+ else if (res.status == 404) {
206
+ throw new Error('PostNotFound');
207
+ }
208
+ else if (res.status == 413) {
209
+ throw new Error('PostTooLong');
210
+ }
211
+ else {
212
+ throw new Error('Error');
213
+ }
214
+ }
215
+ else {
216
+ throw err;
217
+ }
218
+ }
219
+ });
220
+ }
181
221
  edit_flags(flags) {
182
222
  return __awaiter(this, void 0, void 0, function* () {
183
223
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "beamsocial",
3
- "version": "0.20.2",
3
+ "version": "0.21.1",
4
4
  "type": "module",
5
5
  "description": "API-wrapper pour Beam",
6
6
  "main": "index.js",