Skip to content

Commit b77f340

Browse files
Merge pull request #71 from QuickDevelopment/update-4.0.0
4.0.0: Fix types remove most fetchMany
2 parents 8c3603f + f1e519f commit b77f340

File tree

13 files changed

+14
-176
lines changed

13 files changed

+14
-176
lines changed

lib/Api/Category.ts

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,7 @@ export default class Category<T = CategoryDataType[] | CategoryDataType> extends
2323
* console.log(category);
2424
* })
2525
*/
26-
public async fetch(): Promise<T> {
27-
return this.get();
28-
}
29-
30-
/**
31-
* Fetch multiple categories.
32-
* @since 3.0.0
33-
* @example
34-
* import { Category } from "@quickdevelopment/wp-js";
35-
*
36-
* const categories = new Category();
37-
*
38-
* categories.fetchMany().then((categories) => {
39-
* console.log(categories);
40-
* })
41-
*/
42-
public async fetchMany(): Promise<T[]> {
26+
public async fetch(): Promise<T | T[]> {
4327
return this.get();
4428
}
4529
}

lib/Api/Comment.ts

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,7 @@ export default class Comment<T = CommentDataType[] | CommentDataType> extends WP
2323
* console.log(comment);
2424
* })
2525
*/
26-
public async fetch(): Promise<T> {
27-
return this.get();
28-
}
29-
30-
/**
31-
* Fetch multiple comments.
32-
* @since 3.0.0
33-
* @example
34-
* import { Comment } from "@quickdevelopment/wp-js";
35-
*
36-
* const comments = new Comment();
37-
*
38-
* comments.fetchMany().then((comments) => {
39-
* console.log(comments);
40-
* })
41-
*/
42-
public async fetchMany(): Promise<T[]> {
26+
public async fetch(): Promise<T | T[]> {
4327
return this.get();
4428
}
4529
}

lib/Api/Media.ts

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,7 @@ export default class Media<T = MediaDataType[] | MediaDataType> extends WPJSBase
2323
* console.log(media)
2424
* })
2525
*/
26-
public async fetch(): Promise<T> {
27-
return this.get();
28-
}
29-
30-
/**
31-
* Fetch multiple media.
32-
* @since 3.0.0
33-
* @example
34-
* import {Media} from "@quickdevelopment/wp-js";
35-
*
36-
* const media = new Media();
37-
*
38-
* media.fetchMany().then((media) => {
39-
* console.log(media)
40-
* })
41-
*/
42-
public async fetchMany(): Promise<T[]> {
26+
public async fetch(): Promise<T | T[]> {
4327
return this.get();
4428
}
4529
}

lib/Api/Page.ts

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,7 @@ export default class Page<T = PageDataType[] | PageDataType> extends WPJSBase<T>
2323
* console.log(page)
2424
* })
2525
*/
26-
public async fetch(): Promise<T> {
27-
return this.get();
28-
}
29-
30-
/**
31-
* Fetch multiple pages.
32-
* @since 3.0.0
33-
* @example
34-
* import {Page} from "@quickdevelopment/wp-js";
35-
*
36-
* const pages = new Page();
37-
*
38-
* pages.fetchMany().then((pages) => {
39-
* console.log(pages)
40-
* })
41-
*/
42-
public async fetchMany(): Promise<T[]> {
26+
public async fetch(): Promise<T | T[]> {
4327
return this.get();
4428
}
4529
}

lib/Api/Post.ts

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -121,23 +121,7 @@ export default class Post<T = PostDataType[] | PostDataType> extends WPJSBase<T>
121121
* console.log(post)
122122
* })
123123
*/
124-
public async fetch(): Promise<T> {
125-
return this.get();
126-
}
127-
128-
/**
129-
* Get multiple posts.
130-
* @since 3.0.0
131-
* @example
132-
* import {Post} from "@quickdevelopment/wp-js";
133-
*
134-
* const posts = new Post();
135-
*
136-
* posts.fetchMany().then((posts) => {
137-
* console.log(posts)
138-
* })
139-
*/
140-
public async fetchMany(): Promise<T[]> {
124+
public async fetch(): Promise<T | T[]> {
141125
return this.get();
142126
}
143127
}

lib/Api/Status.ts

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,7 @@ export default class Status<T = StatusDataType[] | StatusDataType> extends WPJSB
2323
* console.log(data);
2424
* });
2525
*/
26-
public async fetch(): Promise<T> {
27-
return this.get();
28-
}
29-
30-
/**
31-
* Fetch many statuses.
32-
*
33-
* @since 3.0.0
34-
* @example
35-
* import { Status } from '@quickdevelopment/wp-js';
36-
*
37-
* const status = new Status();
38-
*
39-
* status.fetchMany().then((data) => {
40-
* console.log(data);
41-
* });
42-
*/
43-
public async fetchMany(): Promise<T[]> {
26+
public async fetch(): Promise<T | T[]> {
4427
return this.get();
4528
}
4629
}

lib/Api/Tag.ts

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,7 @@ export default class Tag<T = PostTagDataType[] | PostTagDataType> extends WPJSBa
2323
* console.log(data);
2424
* })
2525
*/
26-
public async fetch(): Promise<T> {
27-
return this.get();
28-
}
29-
30-
/**
31-
* Fetch many tags.
32-
* @since 3.0.0
33-
* @example
34-
* import { Tag } from '@quickdevelopment/wp-js';
35-
*
36-
* const tag = new Tag();
37-
*
38-
* tag.fetchMany().then((data) => {
39-
* console.log(data);
40-
* })
41-
*/
42-
public async fetchMany(): Promise<T[]> {
26+
public async fetch(): Promise<T | T[]> {
4327
return this.get();
4428
}
4529
}

lib/Api/Taxonomy.ts

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,7 @@ export default class Taxonomy<T = TaxonomyDataType[] | TaxonomyDataType> extends
2323
* console.log(data);
2424
* });
2525
*/
26-
public async fetch(): Promise<T> {
27-
return this.get();
28-
}
29-
30-
/**
31-
* Fetch many taxonomies.
32-
*
33-
* @since 3.0.0
34-
* @example
35-
* import { Taxonomy } from '@quickdevelopment/wp-js';
36-
*
37-
* const taxonomy = new Taxonomy();
38-
*
39-
* taxonomy.fetchMany().then((data) => {
40-
* console.log(data);
41-
* });
42-
*/
43-
public async fetchMany(): Promise<T[]> {
26+
public async fetch(): Promise<T | T[]> {
4427
return this.get();
4528
}
4629
}

lib/Api/Type.ts

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,7 @@ export default class Type<T = TypeDataType[] | TypeDataType> extends WPJSBase<T>
2323
* console.log(type);
2424
* });
2525
*/
26-
public async fetch(): Promise<T> {
27-
return this.get();
28-
}
29-
30-
/**
31-
* Fetch multiple types.
32-
* @since 3.0.0
33-
* @example
34-
* import { Type } from "@quickdevelopment/wp-js";
35-
*
36-
* const types = new Type();
37-
*
38-
* types.fetchMany().then((types) => {
39-
* console.log(types);
40-
* })
41-
*/
42-
public async fetchMany(): Promise<T[]> {
26+
public async fetch(): Promise<T | T[]> {
4327
return this.get();
4428
}
4529
}

lib/Api/User.ts

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -42,23 +42,7 @@ export default class User<T = UserDataType[] | UserDataType> extends WPJSBase<T>
4242
* console.log(user);
4343
* })
4444
*/
45-
public async fetch(): Promise<T> {
46-
return this.get();
47-
}
48-
49-
/**
50-
* Get multiple users.
51-
* @since 3.0.5
52-
* @example
53-
* import {User} from "@quickdevelopment/wp-js";
54-
*
55-
* const users = new User();
56-
*
57-
* users.fetchMany().then((users) => {
58-
* console.log(users);
59-
* })
60-
*/
61-
public async fetchMany(): Promise<T[]> {
45+
public async fetch(): Promise<T | T[]> {
6246
return this.get();
6347
}
6448
}

0 commit comments

Comments
 (0)