-
Notifications
You must be signed in to change notification settings - Fork 79
Expand file tree
/
Copy pathPosts.ts
More file actions
55 lines (53 loc) · 1.88 KB
/
Posts.ts
File metadata and controls
55 lines (53 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { IWpApiPosts } from './interfaces';
import { WpApiLoader } from './Loaders';
import { WpApiParent } from './Parent';
@Injectable()
export class WpApiPosts extends WpApiParent implements IWpApiPosts {
constructor(
public wpApiLoader: WpApiLoader,
public http: HttpClient
) {
super(wpApiLoader, http);
}
getList(options = {}) {
return this.httpGet(`/posts`, options)
}
get(postId: number, options = {}) {
return this.httpGet(`/posts/${postId}`, options)
}
create(body = {}, options = {}) {
return this.httpPost(`/posts`, body, options)
}
update(postId: number, body = {}, options = {}) {
return this.httpPost(`/posts/${postId}`, body, options)
}
delete(postId: number, options = {}) {
return this.httpDelete(`/posts/${postId}`, options)
}
getMetaList(postId: number, options = {}) {
return this.httpGet(`/posts/${postId}/meta`, options)
}
getMeta(postId: number, metaId: number, options = {}) {
return this.httpGet(`/posts/${postId}/meta/${metaId}`, options)
}
getRevisionList(postId: number, options = {}) {
return this.httpGet(`/posts/${postId}/revisions`, options)
}
getRevision(postId: number, revisionId: number, options = {}) {
return this.httpGet(`/posts/${postId}/revisions/${revisionId}`, options)
}
getCategoryList(postId: number, options = {}) {
return this.httpGet(`/posts/${postId}/terms/category`, options)
}
getCategory(postId: number, categoryId: number, options = {}) {
return this.httpGet(`/posts/${postId}/terms/category/${categoryId}`, options)
}
getTagList(postId: number, options = {}) {
return this.httpGet(`/posts/${postId}/terms/tag`, options)
}
getTag(postId: number, tagId: number, options = {}) {
return this.httpGet(`/posts/${postId}/terms/tag/${tagId}`, options)
}
}