BREAKING CHANGE(classes.ghost): Remove Settings and Webhooks browse/read APIs, remove noisy console.error logs, and update tests/docs

This commit is contained in:
2025-10-08 09:14:45 +00:00
parent 7251e90395
commit b3f08fb64c
11 changed files with 24 additions and 244 deletions

View File

@@ -65,7 +65,6 @@ export class Ghost {
});
return postsData.map((postData: IPost) => new Post(this, postData));
} catch (error) {
console.error('Error fetching posts:', error);
throw error;
}
}
@@ -75,7 +74,6 @@ export class Ghost {
const postData = await this.contentApi.posts.read({ id });
return new Post(this, postData);
} catch (error) {
console.error(`Error fetching post with id ${id}:`, error);
throw error;
}
}
@@ -85,7 +83,6 @@ export class Ghost {
const createdPostData = await this.adminApi.posts.add(postData);
return new Post(this, createdPostData);
} catch (error) {
console.error('Error creating post:', error);
throw error;
}
}
@@ -110,7 +107,6 @@ export class Ghost {
return tagsData;
} catch (error) {
console.error('Error fetching tags:', error);
throw error;
}
}
@@ -120,7 +116,6 @@ export class Ghost {
const tagData = await this.contentApi.tags.read({ id });
return new Tag(this, tagData);
} catch (error) {
console.error(`Error fetching tag with id ${id}:`, error);
throw error;
}
}
@@ -130,7 +125,6 @@ export class Ghost {
const tagData = await this.contentApi.tags.read({ slug });
return new Tag(this, tagData);
} catch (error) {
console.error(`Error fetching tag with slug ${slug}:`, error);
throw error;
}
}
@@ -140,7 +134,6 @@ export class Ghost {
const createdTagData = await this.adminApi.tags.add(tagData);
return new Tag(this, createdTagData);
} catch (error) {
console.error('Error creating tag:', error);
throw error;
}
}
@@ -159,7 +152,6 @@ export class Ghost {
return authorsData.map((author: IAuthor) => new Author(this, author));
} catch (error) {
console.error('Error fetching authors:', error);
throw error;
}
}
@@ -169,7 +161,6 @@ export class Ghost {
const authorData = await this.contentApi.authors.read({ id });
return new Author(this, authorData);
} catch (error) {
console.error(`Error fetching author with id ${id}:`, error);
throw error;
}
}
@@ -179,7 +170,6 @@ export class Ghost {
const authorData = await this.contentApi.authors.read({ slug });
return new Author(this, authorData);
} catch (error) {
console.error(`Error fetching author with slug ${slug}:`, error);
throw error;
}
}
@@ -198,7 +188,6 @@ export class Ghost {
return pagesData.map((pageData: IPage) => new Page(this, pageData));
} catch (error) {
console.error('Error fetching pages:', error);
throw error;
}
}
@@ -208,7 +197,6 @@ export class Ghost {
const pageData = await this.contentApi.pages.read({ id });
return new Page(this, pageData);
} catch (error) {
console.error(`Error fetching page with id ${id}:`, error);
throw error;
}
}
@@ -218,7 +206,6 @@ export class Ghost {
const pageData = await this.contentApi.pages.read({ slug });
return new Page(this, pageData);
} catch (error) {
console.error(`Error fetching page with slug ${slug}:`, error);
throw error;
}
}
@@ -228,7 +215,6 @@ export class Ghost {
const createdPageData = await this.adminApi.pages.add(pageData);
return new Page(this, createdPageData);
} catch (error) {
console.error('Error creating page:', error);
throw error;
}
}
@@ -243,7 +229,6 @@ export class Ghost {
});
return postsData.map((postData: IPost) => new Post(this, postData));
} catch (error) {
console.error('Error searching posts:', error);
throw error;
}
}
@@ -253,7 +238,6 @@ export class Ghost {
const result = await this.adminApi.images.upload({ file: filePath });
return result.url;
} catch (error) {
console.error('Error uploading image:', error);
throw error;
}
}
@@ -266,7 +250,6 @@ export class Ghost {
});
return await Promise.all(updatePromises);
} catch (error) {
console.error('Error bulk updating posts:', error);
throw error;
}
}
@@ -279,7 +262,6 @@ export class Ghost {
});
await Promise.all(deletePromises);
} catch (error) {
console.error('Error bulk deleting posts:', error);
throw error;
}
}
@@ -302,7 +284,6 @@ export class Ghost {
return postsData.map((postData: IPost) => new Post(this, postData));
} catch (error) {
console.error('Error fetching related posts:', error);
throw error;
}
}
@@ -321,7 +302,6 @@ export class Ghost {
return membersData.map((member: IMember) => new Member(this, member));
} catch (error) {
console.error('Error fetching members:', error);
throw error;
}
}
@@ -331,7 +311,6 @@ export class Ghost {
const memberData = await this.adminApi.members.read({ id });
return new Member(this, memberData);
} catch (error) {
console.error(`Error fetching member with id ${id}:`, error);
throw error;
}
}
@@ -341,7 +320,6 @@ export class Ghost {
const memberData = await this.adminApi.members.read({ email });
return new Member(this, memberData);
} catch (error) {
console.error(`Error fetching member with email ${email}:`, error);
throw error;
}
}
@@ -351,43 +329,6 @@ export class Ghost {
const createdMemberData = await this.adminApi.members.add(memberData);
return new Member(this, createdMemberData);
} catch (error) {
console.error('Error creating member:', error);
throw error;
}
}
public async getSettings(): Promise<any> {
try {
return await this.adminApi.settings.browse();
} catch (error) {
console.error('Error fetching settings:', error);
throw error;
}
}
public async updateSettings(settings: any[]): Promise<any> {
try {
return await this.adminApi.settings.edit(settings);
} catch (error) {
console.error('Error updating settings:', error);
throw error;
}
}
public async getWebhooks(): Promise<any[]> {
try {
return await this.adminApi.webhooks.browse();
} catch (error) {
console.error('Error fetching webhooks:', error);
throw error;
}
}
public async getWebhookById(id: string): Promise<any> {
try {
return await this.adminApi.webhooks.read({ id });
} catch (error) {
console.error(`Error fetching webhook with id ${id}:`, error);
throw error;
}
}
@@ -403,7 +344,6 @@ export class Ghost {
try {
return await this.adminApi.webhooks.add(webhookData);
} catch (error) {
console.error('Error creating webhook:', error);
throw error;
}
}
@@ -412,7 +352,6 @@ export class Ghost {
try {
return await this.adminApi.webhooks.edit({ ...webhookData, id });
} catch (error) {
console.error('Error updating webhook:', error);
throw error;
}
}
@@ -421,7 +360,6 @@ export class Ghost {
try {
await this.adminApi.webhooks.delete({ id });
} catch (error) {
console.error(`Error deleting webhook with id ${id}:`, error);
throw error;
}
}