summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony G. Basile <blueness@gentoo.org>2016-07-28 23:29:30 -0400
committerAnthony G. Basile <blueness@gentoo.org>2016-07-28 23:29:30 -0400
commit5c4552fad98db23b2698e8a598bf20f42cb430ef (patch)
tree61fc1f692646288704376f32d914eeef152e375e /plugins/jetpack/json-endpoints.php
parentUpdate plugin jecpack to 4.0.4 (diff)
downloadblogs-gentoo-5c4552fad98db23b2698e8a598bf20f42cb430ef.tar.gz
blogs-gentoo-5c4552fad98db23b2698e8a598bf20f42cb430ef.tar.bz2
blogs-gentoo-5c4552fad98db23b2698e8a598bf20f42cb430ef.zip
Update plugin jetpack to 4.1.1
Diffstat (limited to 'plugins/jetpack/json-endpoints.php')
-rw-r--r--plugins/jetpack/json-endpoints.php162
1 files changed, 160 insertions, 2 deletions
diff --git a/plugins/jetpack/json-endpoints.php b/plugins/jetpack/json-endpoints.php
index a735e04a..a8ea54aa 100644
--- a/plugins/jetpack/json-endpoints.php
+++ b/plugins/jetpack/json-endpoints.php
@@ -31,17 +31,21 @@ require_once( $json_endpoints_dir . 'class.wpcom-json-api-list-embeds-endpoint.p
require_once( $json_endpoints_dir . 'class.wpcom-json-api-get-site-endpoint.php' );
require_once( $json_endpoints_dir . 'class.wpcom-json-api-get-taxonomies-endpoint.php' );
require_once( $json_endpoints_dir . 'class.wpcom-json-api-get-taxonomy-endpoint.php' );
+require_once( $json_endpoints_dir . 'class.wpcom-json-api-get-term-endpoint.php' );
require_once( $json_endpoints_dir . 'class.wpcom-json-api-list-comments-endpoint.php' );
require_once( $json_endpoints_dir . 'class.wpcom-json-api-list-media-endpoint.php' );
require_once( $json_endpoints_dir . 'class.wpcom-json-api-list-post-types-endpoint.php' );
+require_once( $json_endpoints_dir . 'class.wpcom-json-api-list-post-type-taxonomies-endpoint.php' );
require_once( $json_endpoints_dir . 'class.wpcom-json-api-list-posts-endpoint.php' );
require_once( $json_endpoints_dir . 'class.wpcom-json-api-list-roles-endpoint.php' );
+require_once( $json_endpoints_dir . 'class.wpcom-json-api-list-terms-endpoint.php' );
require_once( $json_endpoints_dir . 'class.wpcom-json-api-list-users-endpoint.php' );
require_once( $json_endpoints_dir . 'class.wpcom-json-api-site-user-endpoint.php' );
require_once( $json_endpoints_dir . 'class.wpcom-json-api-update-comment-endpoint.php' );
require_once( $json_endpoints_dir . 'class.wpcom-json-api-update-media-endpoint.php' );
require_once( $json_endpoints_dir . 'class.wpcom-json-api-update-post-endpoint.php' );
require_once( $json_endpoints_dir . 'class.wpcom-json-api-update-taxonomy-endpoint.php' );
+require_once( $json_endpoints_dir . 'class.wpcom-json-api-update-term-endpoint.php' );
require_once( $json_endpoints_dir . 'class.wpcom-json-api-update-user-endpoint.php' );
require_once( $json_endpoints_dir . 'class.wpcom-json-api-upload-media-endpoint.php' );
require_once( $json_endpoints_dir . 'class.wpcom-json-api-site-settings-endpoint.php' );
@@ -201,6 +205,22 @@ new WPCOM_JSON_API_List_Post_Types_Endpoint( array (
)
) );
+new WPCOM_JSON_API_List_Post_Type_Taxonomies_Endpoint( array (
+ 'description' => 'Get a list of taxonomies associated with a post type.',
+ 'group' => 'taxonomy',
+ 'stat' => 'sites:X:post-types:X:taxonomies',
+ 'method' => 'GET',
+ 'path' => '/sites/%s/post-types/%s/taxonomies',
+ 'path_labels' => array(
+ '$site' => '(int|string) Site ID or domain',
+ '$post_type' => '(string) Post type',
+ ),
+ 'response_format' => array(
+ 'found' => '(int) The number of taxonomies found',
+ 'taxonomies' => '(array:taxonomy) A list of available taxonomies',
+ )
+) );
+
/*
* Shortcode endpoints
*/
@@ -528,7 +548,7 @@ new WPCOM_JSON_API_Update_Post_Endpoint( array(
'description' => 'Create a post.',
'group' => 'posts',
'stat' => 'posts:new',
- 'new_version' => '1.1',
+ 'new_version' => '1.2',
'max_version' => '1',
'method' => 'POST',
'path' => '/sites/%s/posts/new',
@@ -595,6 +615,7 @@ new WPCOM_JSON_API_Update_Post_v1_1_Endpoint( array(
'description' => 'Create a post.',
'group' => 'posts',
'stat' => 'posts:new',
+ 'new_version' => '1.2',
'min_version' => '1.1',
'max_version' => '1.1',
'method' => 'POST',
@@ -628,6 +649,7 @@ new WPCOM_JSON_API_Update_Post_v1_1_Endpoint( array(
'password' => '(string) The plaintext password protecting the post, or, more likely, the empty string if the post is not password protected.',
'parent' => "(int) The post ID of the new post's parent.",
'type' => "(string) The post type. Defaults to 'post'. Post types besides post and page need to be whitelisted using the <code>rest_api_allowed_post_types</code> filter.",
+ 'terms' => '(object) Mapping of taxonomy to comma-separated list or array of terms (name or id)',
'categories' => "(array|string) Comma-separated list or array of categories (name or id)",
'tags' => "(array|string) Comma-separated list or array of tags (name or id)",
'format' => array_merge( array( 'default' => 'Use default post format' ), get_post_format_strings() ),
@@ -698,8 +720,10 @@ new WPCOM_JSON_API_Update_Post_v1_2_Endpoint( array(
'password' => '(string) The plaintext password protecting the post, or, more likely, the empty string if the post is not password protected.',
'parent' => "(int) The post ID of the new post's parent.",
'type' => "(string) The post type. Defaults to 'post'. Post types besides post and page need to be whitelisted using the <code>rest_api_allowed_post_types</code> filter.",
+ 'terms' => '(object) Mapping of taxonomy to comma-separated list or array of term names',
'categories' => "(array|string) Comma-separated list or array of category names",
'tags' => "(array|string) Comma-separated list or array of tag names",
+ 'terms_by_id' => '(object) Mapping of taxonomy to comma-separated list or array of term IDs',
'categories_by_id' => "(array|string) Comma-separated list or array of category IDs",
'tags_by_id' => "(array|string) Comma-separated list or array of tag IDs",
'format' => array_merge( array( 'default' => 'Use default post format' ), get_post_format_strings() ),
@@ -737,7 +761,7 @@ new WPCOM_JSON_API_Update_Post_Endpoint( array(
'description' => 'Edit a post.',
'group' => 'posts',
'stat' => 'posts:1:POST',
- 'new_version' => '1.1',
+ 'new_version' => '1.2',
'max_version' => '1',
'method' => 'POST',
'path' => '/sites/%s/posts/%d',
@@ -760,6 +784,7 @@ new WPCOM_JSON_API_Update_Post_Endpoint( array(
'private' => 'Privately publish the post.',
'draft' => 'Save the post as a draft.',
'pending' => 'Mark the post as pending editorial approval.',
+ 'trash' => 'Set the post as trashed.',
),
'sticky' => array(
'false' => 'Post is not marked as sticky.',
@@ -802,6 +827,7 @@ new WPCOM_JSON_API_Update_Post_v1_1_Endpoint( array(
'description' => 'Edit a post.',
'group' => 'posts',
'stat' => 'posts:1:POST',
+ 'new_version' => '1.2',
'min_version' => '1.1',
'max_version' => '1.1',
'method' => 'POST',
@@ -826,6 +852,7 @@ new WPCOM_JSON_API_Update_Post_v1_1_Endpoint( array(
'draft' => 'Save the post as a draft.',
'future' => 'Schedule the post (alias for publish; you must also set a future date).',
'pending' => 'Mark the post as pending editorial approval.',
+ 'trash' => 'Set the post as trashed.',
),
'sticky' => array(
'false' => 'Post is not marked as sticky.',
@@ -833,6 +860,7 @@ new WPCOM_JSON_API_Update_Post_v1_1_Endpoint( array(
),
'password' => '(string) The plaintext password protecting the post, or, more likely, the empty string if the post is not password protected.',
'parent' => "(int) The post ID of the new post's parent.",
+ 'terms' => '(object) Mapping of taxonomy to comma-separated list or array of terms (name or id)',
'categories' => "(array|string) Comma-separated list or array of categories (name or id)",
'tags' => "(array|string) Comma-separated list or array of tags (name or id)",
'format' => array_merge( array( 'default' => 'Use default post format' ), get_post_format_strings() ),
@@ -892,6 +920,7 @@ new WPCOM_JSON_API_Update_Post_v1_2_Endpoint( array(
'draft' => 'Save the post as a draft.',
'future' => 'Schedule the post (alias for publish; you must also set a future date).',
'pending' => 'Mark the post as pending editorial approval.',
+ 'trash' => 'Set the post as trashed.',
),
'sticky' => array(
'false' => 'Post is not marked as sticky.',
@@ -899,6 +928,8 @@ new WPCOM_JSON_API_Update_Post_v1_2_Endpoint( array(
),
'password' => '(string) The plaintext password protecting the post, or, more likely, the empty string if the post is not password protected.',
'parent' => "(int) The post ID of the new post's parent.",
+ 'terms' => '(object) Mapping of taxonomy to comma-separated list or array of term names',
+ 'terms_by_id' => '(object) Mapping of taxonomy to comma-separated list or array of term IDs',
'categories' => "(array|string) Comma-separated list or array of category names",
'categories_by_id' => "(array|string) Comma-separated list or array of category IDs",
'tags' => "(array|string) Comma-separated list or array of tag names",
@@ -1909,6 +1940,133 @@ new WPCOM_JSON_API_Update_Taxonomy_Endpoint( array(
)
) );
+new WPCOM_JSON_API_List_Terms_Endpoint( array(
+ 'description' => 'Get a list of a site\'s terms by taxonomy.',
+ 'group' => 'taxonomy',
+ 'stat' => 'terms',
+ 'method' => 'GET',
+ 'path' => '/sites/%s/taxonomies/%s/terms',
+ 'path_labels' => array(
+ '$site' => '(int|string) Site ID or domain',
+ '$taxonomy' => '(string) Taxonomy',
+ ),
+ 'query_parameters' => array(
+ 'number' => '(int=100) The number of terms to return. Limit: 1000.',
+ 'offset' => '(int=0) 0-indexed offset.',
+ 'page' => '(int) Return the Nth 1-indexed page of terms. Takes precedence over the <code>offset</code> parameter.',
+ 'search' => '(string) Limit response to include only terms whose names or slugs match the provided search query.',
+ 'order' => array(
+ 'ASC' => 'Return terms in ascending order.',
+ 'DESC' => 'Return terms in descending order.',
+ ),
+ 'order_by' => array(
+ 'name' => 'Order by the name of each tag.',
+ 'count' => 'Order by the number of posts in each tag.',
+ ),
+ ),
+ 'response_format' => array(
+ 'found' => '(int) The number of terms returned.',
+ 'terms' => '(array) Array of tag objects.',
+ ),
+ 'example_request' => 'https://public-api.wordpress.com/rest/v1/sites/en.blog.wordpress.com/taxonomies/post_tags/terms?number=5'
+) );
+
+new WPCOM_JSON_API_Get_Term_Endpoint( array(
+ 'description' => 'Get information about a single term.',
+ 'group' => 'taxonomy',
+ 'stat' => 'terms:1',
+ 'method' => 'GET',
+ 'path' => '/sites/%s/taxonomies/%s/terms/slug:%s',
+ 'path_labels' => array(
+ '$site' => '(int|string) Site ID or domain',
+ '$taxonomy' => '(string) Taxonomy',
+ '$slug' => '(string) Term slug',
+ ),
+ 'response_format' => array(
+ 'ID' => '(int) The term ID.',
+ 'name' => '(string) The name of the term.',
+ 'slug' => '(string) The slug of the term.',
+ 'description' => '(string) The description of the term.',
+ 'post_count' => '(int) The number of posts using this term.',
+ 'parent' => '(int) The parent ID for the term, if hierarchical.',
+ ),
+ 'example_request' => 'https://public-api.wordpress.com/rest/v1/sites/en.blog.wordpress.com/taxonomies/post_tag/terms/slug:wordpresscom'
+) );
+
+new WPCOM_JSON_API_Update_Term_Endpoint( array(
+ 'description' => 'Create a new term.',
+ 'group' => 'taxonomy',
+ 'stat' => 'terms:new',
+ 'method' => 'POST',
+ 'path' => '/sites/%s/taxonomies/%s/terms/new',
+ 'path_labels' => array(
+ '$site' => '(int|string) Site ID or domain',
+ '$taxonomy' => '(string) Taxonomy',
+ ),
+ 'request_format' => array(
+ 'name' => '(string) Name of the term',
+ 'description' => '(string) A description of the term',
+ ),
+ 'example_request' => 'https://public-api.wordpress.com/rest/v1/sites/82974409/taxonomies/post_tag/terms/new',
+ 'example_request_data' => array(
+ 'headers' => array(
+ 'authorization' => 'Bearer YOUR_API_TOKEN'
+ ),
+ 'body' => array(
+ 'name' => 'Ribs & Chicken'
+ )
+ )
+) );
+
+new WPCOM_JSON_API_Update_Term_Endpoint( array(
+ 'description' => 'Edit a term.',
+ 'group' => 'taxonomy',
+ 'stat' => 'terms:1:POST',
+ 'method' => 'POST',
+ 'path' => '/sites/%s/taxonomies/%s/terms/slug:%s',
+ 'path_labels' => array(
+ '$site' => '(int|string) Site ID or domain',
+ '$taxonomy' => '(string) Taxonomy',
+ '$slug' => '(string) The term slug',
+ ),
+ 'request_format' => array(
+ 'name' => '(string) Name of the term',
+ 'description' => '(string) A description of the term',
+ ),
+ 'example_request' => 'https://public-api.wordpress.com/rest/v1/sites/82974409/taxonomies/post_tag/terms/slug:testing-term',
+ 'example_request_data' => array(
+ 'headers' => array(
+ 'authorization' => 'Bearer YOUR_API_TOKEN'
+ ),
+ 'body' => array(
+ 'description' => 'The most delicious'
+ )
+ )
+) );
+
+new WPCOM_JSON_API_Update_Term_Endpoint( array(
+ 'description' => 'Delete a term.',
+ 'group' => 'taxonomy',
+ 'stat' => 'terms:1:delete',
+ 'method' => 'POST',
+ 'path' => '/sites/%s/taxonomies/%s/terms/slug:%s/delete',
+ 'path_labels' => array(
+ '$site' => '(int|string) Site ID or domain',
+ '$taxonomy' => '(string) Taxonomy',
+ '$slug' => '(string) The term slug',
+ ),
+ 'response_format' => array(
+ 'slug' => '(string) The slug of the deleted term',
+ 'success' => '(bool) Whether the operation was successful',
+ ),
+ 'example_request' => 'https://public-api.wordpress.com/rest/v1/sites/82974409/taxonomies/post_tag/terms/slug:$term/delete',
+ 'example_request_data' => array(
+ 'headers' => array(
+ 'authorization' => 'Bearer YOUR_API_TOKEN'
+ ),
+ )
+) );
+
new WPCOM_JSON_API_List_Roles_Endpoint( array(
'description' => 'List the user roles of a site.',
'group' => '__do_not_document',