Posts
Import the module into your project:
// app.module.ts
import { WordpressPostsModule } from '@juicyllama/app-wordpress'
@Module({
imports: [WordpressPostsModule],
})
export class AppModule {}
Inject the service into your project:
// app.service.ts
import { WordpressPostsService } from '@juicyllama/app-wordpress'
@Injectable()
export class AppService {
constructor(
@Inject(forwardRef(() => WordpressPostsService)) private readonly wordpressPostsService: WordpressPostsService,
) {}
}
Methods
The following methods are available:
Create
const result = await this.wordpressPostsService.create({
data: WordpressCreatePost,
config: wordpressConfigDto,
})
Example
const options = {
data: <WordpressCreatePost>{
title: 'Hello World',
content: 'This is my first post!',
},
config: <wordpressConfigDto>{
WORDPRESS_URL: 'https://example.com',
WORDPRESS_USERNAME: 'username',
WORDPRESS_APPLICATION_PASSWORD: 'password',
},
}
const result = await this.wordpressPostsService.create(data)
//do your thing with the result
FindAll
const result = await this.wordpressPostsService.findAll({
arguments: WordpressListPosts,
config: wordpressConfigDto,
})
FindOne
const result = await this.wordpressPostsService.findOne({
postId: number,
arguments: WordpressGetPost,
config: wordpressConfigDto,
})
Update
const result = await this.wordpressPostsService.update({
postId: number,
data: WordpressUpdatePost,
config: wordpressConfigDto,
})
Remove
const result = await this.wordpressPostsService.remove({
postId: number,
config: wordpressConfigDto,
})
WordPress
The WordPress app is a nestjs wrapper around the WordPress Rest API. It provides a consistent interface for interacting with WordPress within the confines of our framework.
AI
The AI module allows you to leverage the power of AI in your application. It provides a consistent interface for interacting with AI within the confines of our framework.