WordPress.org

Make WordPress Core

Changeset 43442 for branches/4.9


Ignore:
Timestamp:
07/13/2018 06:13:27 AM (16 months ago)
Author:
pento
Message:

REST API: Expose revision count and last revision ID on Post response

So that REST API clients can show appropriate UI for a post's revisions, it needs to know how many revisions the post has, and what the latest revision ID is.

Merge of [43439] and [43441] to the 4.9 branch.

Props kadamwhite, danielbachhuber, birgire, TimothyBlynJacobs, pento.
Fixes #44321.

Location:
branches/4.9
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/4.9

  • branches/4.9/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php

    r43438 r43442  
    16681668
    16691669        if ( in_array( $post->post_type, array( 'post', 'page' ), true ) || post_type_supports( $post->post_type, 'revisions' ) ) {
     1670            $revisions       = wp_get_post_revisions( $post->ID, array( 'fields' => 'ids' ) );
     1671            $revisions_count = count( $revisions );
     1672
    16701673            $links['version-history'] = array(
    1671                 'href' => rest_url( trailingslashit( $base ) . $post->ID . '/revisions' ),
    1672             );
     1674                'href'  => rest_url( trailingslashit( $base ) . $post->ID . '/revisions' ),
     1675                'count' => $revisions_count,
     1676            );
     1677
     1678            if ( $revisions_count > 0 ) {
     1679                $last_revision = array_shift( $revisions );
     1680
     1681                $links['predecessor-version'] = array(
     1682                    'href' => rest_url( trailingslashit( $base ) . $post->ID . '/revisions/' . $last_revision ),
     1683                    'id'   => $last_revision,
     1684                );
     1685            }
     1686
    16731687        }
    16741688
  • branches/4.9/tests/phpunit/tests/rest-api/rest-posts-controller.php

    r43438 r43442  
    10911091
    10921092        $this->assertEquals( rest_url( '/wp/v2/posts/' . self::$post_id . '/revisions' ), $links['version-history'][0]['href'] );
     1093        $this->assertEquals( 0, $links['version-history'][0]['attributes']['count'] );
     1094        $this->assertFalse( isset( $links['predecessor-version'] ) );
    10931095
    10941096        $attachments_url = rest_url( '/wp/v2/media' );
     
    11161118        $category_url = add_query_arg( 'post', self::$post_id, rest_url( '/wp/v2/categories' ) );
    11171119        $this->assertEquals( $category_url, $cat_link['href'] );
     1120    }
     1121
     1122    public function test_get_item_links_predecessor() {
     1123        wp_update_post(
     1124            array(
     1125                'post_content' => 'This content is marvelous.',
     1126                'ID'           => self::$post_id,
     1127            )
     1128        );
     1129        $revisions  = wp_get_post_revisions( self::$post_id );
     1130        $revision_1 = array_pop( $revisions );
     1131
     1132        $request  = new WP_REST_Request( 'GET', sprintf( '/wp/v2/posts/%d', self::$post_id ) );
     1133        $response = rest_get_server()->dispatch( $request );
     1134
     1135        $links = $response->get_links();
     1136
     1137        $this->assertEquals( rest_url( '/wp/v2/posts/' . self::$post_id . '/revisions' ), $links['version-history'][0]['href'] );
     1138        $this->assertEquals( 1, $links['version-history'][0]['attributes']['count'] );
     1139
     1140        $this->assertEquals( rest_url( '/wp/v2/posts/' . self::$post_id . '/revisions/' . $revision_1->ID ), $links['predecessor-version'][0]['href'] );
     1141        $this->assertEquals( $revision_1->ID, $links['predecessor-version'][0]['attributes']['id'] );
    11181142    }
    11191143
  • branches/4.9/tests/phpunit/tests/rest-api/rest-schema-setup.php

    r41678 r43442  
    426426        'oembeds.author_url' => 'http://example.org',
    427427        'oembeds.html' => '<blockquote class="wp-embedded-content">...</blockquote>...',
    428         'PostsCollection.0.id' => 3,
    429         'PostsCollection.0.guid.rendered' => 'http://example.org/?p=3',
    430         'PostsCollection.0.link' => 'http://example.org/?p=3',
    431         'PostsCollection.0._links.self.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/posts/3',
     428        'PostsCollection.0.id' => 4,
     429        'PostsCollection.0.guid.rendered' => 'http://example.org/?p=4',
     430        'PostsCollection.0.link' => 'http://example.org/?p=4',
     431        'PostsCollection.0._links.self.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/posts/4',
    432432        'PostsCollection.0._links.collection.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/posts',
    433433        'PostsCollection.0._links.about.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/types/post',
    434         'PostsCollection.0._links.replies.0.href' => 'http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3',
    435         'PostsCollection.0._links.version-history.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/posts/3/revisions',
    436         'PostsCollection.0._links.wp:attachment.0.href' => 'http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3',
    437         'PostsCollection.0._links.wp:term.0.href' => 'http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3',
    438         'PostsCollection.0._links.wp:term.1.href' => 'http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3',
    439         'PostModel.id' => 3,
    440         'PostModel.guid.rendered' => 'http://example.org/?p=3',
    441         'PostModel.link' => 'http://example.org/?p=3',
     434        'PostsCollection.0._links.replies.0.href' => 'http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4',
     435        'PostsCollection.0._links.version-history.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/posts/4/revisions',
     436        'PostsCollection.0._links.predecessor-version.0.id' => 5,
     437        'PostsCollection.0._links.predecessor-version.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/posts/4/revisions/5',
     438        'PostsCollection.0._links.wp:attachment.0.href' => 'http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4',
     439        'PostsCollection.0._links.wp:term.0.href' => 'http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4',
     440        'PostsCollection.0._links.wp:term.1.href' => 'http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4',
     441        'PostModel.id' => 4,
     442        'PostModel.guid.rendered' => 'http://example.org/?p=4',
     443        'PostModel.link' => 'http://example.org/?p=4',
    442444        'postRevisions.0.author' => 2,
    443         'postRevisions.0.id' => 4,
    444         'postRevisions.0.parent' => 3,
    445         'postRevisions.0.slug' => '3-revision-v1',
    446         'postRevisions.0.guid.rendered' => 'http://example.org/?p=4',
    447         'postRevisions.0._links.parent.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/posts/3',
     445        'postRevisions.0.id' => 5,
     446        'postRevisions.0.parent' => 4,
     447        'postRevisions.0.slug' => '4-revision-v1',
     448        'postRevisions.0.guid.rendered' => 'http://example.org/?p=5',
     449        'postRevisions.0._links.parent.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/posts/4',
    448450        'revision.author' => 2,
    449         'revision.id' => 4,
    450         'revision.parent' => 3,
    451         'revision.slug' => '3-revision-v1',
    452         'revision.guid.rendered' => 'http://example.org/?p=4',
    453         'PagesCollection.0.id' => 5,
    454         'PagesCollection.0.guid.rendered' => 'http://example.org/?page_id=5',
    455         'PagesCollection.0.link' => 'http://example.org/?page_id=5',
    456         'PagesCollection.0._links.self.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/pages/5',
     451        'revision.id' => 5,
     452        'revision.parent' => 4,
     453        'revision.slug' => '4-revision-v1',
     454        'revision.guid.rendered' => 'http://example.org/?p=5',
     455        'PagesCollection.0.id' => 6,
     456        'PagesCollection.0.guid.rendered' => 'http://example.org/?page_id=6',
     457        'PagesCollection.0.link' => 'http://example.org/?page_id=6',
     458        'PagesCollection.0._links.self.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/pages/6',
    457459        'PagesCollection.0._links.collection.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/pages',
    458460        'PagesCollection.0._links.about.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/types/page',
    459         'PagesCollection.0._links.replies.0.href' => 'http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5',
    460         'PagesCollection.0._links.version-history.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/pages/5/revisions',
    461         'PagesCollection.0._links.wp:attachment.0.href' => 'http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5',
    462         'PageModel.id' => 5,
    463         'PageModel.guid.rendered' => 'http://example.org/?page_id=5',
    464         'PageModel.link' => 'http://example.org/?page_id=5',
     461        'PagesCollection.0._links.replies.0.href' => 'http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6',
     462        'PagesCollection.0._links.version-history.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/pages/6/revisions',
     463        'PagesCollection.0._links.predecessor-version.0.id' => 7,
     464        'PagesCollection.0._links.predecessor-version.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/pages/6/revisions/7',
     465        'PagesCollection.0._links.wp:attachment.0.href' => 'http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6',
     466        'PageModel.id' => 6,
     467        'PageModel.guid.rendered' => 'http://example.org/?page_id=6',
     468        'PageModel.link' => 'http://example.org/?page_id=6',
    465469        'pageRevisions.0.author' => 2,
    466         'pageRevisions.0.id' => 6,
    467         'pageRevisions.0.parent' => 5,
    468         'pageRevisions.0.slug' => '5-revision-v1',
    469         'pageRevisions.0.guid.rendered' => 'http://example.org/?p=6',
    470         'pageRevisions.0._links.parent.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/pages/5',
     470        'pageRevisions.0.id' => 7,
     471        'pageRevisions.0.parent' => 6,
     472        'pageRevisions.0.slug' => '6-revision-v1',
     473        'pageRevisions.0.guid.rendered' => 'http://example.org/?p=7',
     474        'pageRevisions.0._links.parent.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/pages/6',
    471475        'pageRevision.author' => 2,
    472         'pageRevision.id' => 6,
    473         'pageRevision.parent' => 5,
    474         'pageRevision.slug' => '5-revision-v1',
    475         'pageRevision.guid.rendered' => 'http://example.org/?p=6',
    476         'MediaCollection.0.id' => 7,
    477         'MediaCollection.0.guid.rendered' => 'http://example.org/?attachment_id=7',
    478         'MediaCollection.0.link' => 'http://example.org/?attachment_id=7',
     476        'pageRevision.id' => 7,
     477        'pageRevision.parent' => 6,
     478        'pageRevision.slug' => '6-revision-v1',
     479        'pageRevision.guid.rendered' => 'http://example.org/?p=7',
     480        'MediaCollection.0.id' => 8,
     481        'MediaCollection.0.guid.rendered' => 'http://example.org/?attachment_id=8',
     482        'MediaCollection.0.link' => 'http://example.org/?attachment_id=8',
    479483        'MediaCollection.0.description.rendered' => '<p class="attachment"><!-- <a...><img.../></a> --></p>',
    480484        'MediaCollection.0.source_url' => 'http://example.org/wp-content/uploads//tmp/canola.jpg',
    481         'MediaCollection.0._links.self.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/media/7',
     485        'MediaCollection.0._links.self.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/media/8',
    482486        'MediaCollection.0._links.collection.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/media',
    483487        'MediaCollection.0._links.about.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/types/attachment',
    484         'MediaCollection.0._links.replies.0.href' => 'http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7',
    485         'MediaModel.id' => 7,
    486         'MediaModel.guid.rendered' => 'http://example.org/?attachment_id=7',
    487         'MediaModel.link' => 'http://example.org/?attachment_id=7',
     488        'MediaCollection.0._links.replies.0.href' => 'http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8',
     489        'MediaModel.id' => 8,
     490        'MediaModel.guid.rendered' => 'http://example.org/?attachment_id=8',
     491        'MediaModel.link' => 'http://example.org/?attachment_id=8',
    488492        'MediaModel.description.rendered' => '<p class="attachment"><!-- <a...><img.../></a> --></p>',
    489493        'MediaModel.source_url' => 'http://example.org/wp-content/uploads//tmp/canola.jpg',
     
    533537        'me.link' => 'http://example.org/?author=2',
    534538        'CommentsCollection.0.id' => 2,
    535         'CommentsCollection.0.post' => 3,
    536         'CommentsCollection.0.link' => 'http://example.org/?p=3#comment-2',
     539        'CommentsCollection.0.post' => 4,
     540        'CommentsCollection.0.link' => 'http://example.org/?p=4#comment-2',
    537541        'CommentsCollection.0._links.self.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/comments/2',
    538542        'CommentsCollection.0._links.collection.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/comments',
    539         'CommentsCollection.0._links.up.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/posts/3',
     543        'CommentsCollection.0._links.up.0.href' => 'http://example.org/index.php?rest_route=/wp/v2/posts/4',
    540544        'CommentModel.id' => 2,
    541         'CommentModel.post' => 3,
    542         'CommentModel.link' => 'http://example.org/?p=3#comment-2',
     545        'CommentModel.post' => 4,
     546        'CommentModel.link' => 'http://example.org/?p=4#comment-2',
    543547        'settings.title' => 'Test Blog',
    544548        'settings.url' => 'http://example.org',
  • branches/4.9/tests/qunit/fixtures/wp-api-generated.js

    r43072 r43442  
    35353535mockedApiResponse.PostsCollection = [
    35363536    {
    3537         "id": 3,
     3537        "id": 4,
    35383538        "date": "2017-02-14T00:00:00",
    35393539        "date_gmt": "2017-02-14T00:00:00",
    35403540        "guid": {
    3541             "rendered": "http://example.org/?p=3"
     3541            "rendered": "http://example.org/?p=4"
    35423542        },
    35433543        "modified": "2017-02-14T00:00:00",
     
    35463546        "status": "publish",
    35473547        "type": "post",
    3548         "link": "http://example.org/?p=3",
     3548        "link": "http://example.org/?p=4",
    35493549        "title": {
    35503550            "rendered": "REST API Client Fixture: Post"
     
    35753575            "self": [
    35763576                {
    3577                     "href": "http://example.org/index.php?rest_route=/wp/v2/posts/3"
     3577                    "href": "http://example.org/index.php?rest_route=/wp/v2/posts/4"
    35783578                }
    35793579            ],
     
    35913591                {
    35923592                    "embeddable": true,
    3593                     "href": "http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3"
     3593                    "href": "http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4"
    35943594                }
    35953595            ],
    35963596            "version-history": [
    35973597                {
    3598                     "href": "http://example.org/index.php?rest_route=/wp/v2/posts/3/revisions"
     3598                    "count": 1,
     3599                    "href": "http://example.org/index.php?rest_route=/wp/v2/posts/4/revisions"
     3600                }
     3601            ],
     3602            "predecessor-version": [
     3603                {
     3604                    "id": 5,
     3605                    "href": "http://example.org/index.php?rest_route=/wp/v2/posts/4/revisions/5"
    35993606                }
    36003607            ],
    36013608            "wp:attachment": [
    36023609                {
    3603                     "href": "http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3"
     3610                    "href": "http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4"
    36043611                }
    36053612            ],
     
    36083615                    "taxonomy": "category",
    36093616                    "embeddable": true,
    3610                     "href": "http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3"
     3617                    "href": "http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4"
    36113618                },
    36123619                {
    36133620                    "taxonomy": "post_tag",
    36143621                    "embeddable": true,
    3615                     "href": "http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3"
     3622                    "href": "http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4"
    36163623                }
    36173624            ],
     
    36283635
    36293636mockedApiResponse.PostModel = {
    3630     "id": 3,
     3637    "id": 4,
    36313638    "date": "2017-02-14T00:00:00",
    36323639    "date_gmt": "2017-02-14T00:00:00",
    36333640    "guid": {
    3634         "rendered": "http://example.org/?p=3"
     3641        "rendered": "http://example.org/?p=4"
    36353642    },
    36363643    "modified": "2017-02-14T00:00:00",
     
    36393646    "status": "publish",
    36403647    "type": "post",
    3641     "link": "http://example.org/?p=3",
     3648    "link": "http://example.org/?p=4",
    36423649    "title": {
    36433650        "rendered": "REST API Client Fixture: Post"
     
    36723679        "date": "2017-02-14T00:00:00",
    36733680        "date_gmt": "2017-02-14T00:00:00",
    3674         "id": 4,
     3681        "id": 5,
    36753682        "modified": "2017-02-14T00:00:00",
    36763683        "modified_gmt": "2017-02-14T00:00:00",
    3677         "parent": 3,
    3678         "slug": "3-revision-v1",
     3684        "parent": 4,
     3685        "slug": "4-revision-v1",
    36793686        "guid": {
    3680             "rendered": "http://example.org/?p=4"
     3687            "rendered": "http://example.org/?p=5"
    36813688        },
    36823689        "title": {
     
    36923699            "parent": [
    36933700                {
    3694                     "href": "http://example.org/index.php?rest_route=/wp/v2/posts/3"
     3701                    "href": "http://example.org/index.php?rest_route=/wp/v2/posts/4"
    36953702                }
    36963703            ]
     
    37033710    "date": "2017-02-14T00:00:00",
    37043711    "date_gmt": "2017-02-14T00:00:00",
    3705     "id": 4,
     3712    "id": 5,
    37063713    "modified": "2017-02-14T00:00:00",
    37073714    "modified_gmt": "2017-02-14T00:00:00",
    3708     "parent": 3,
    3709     "slug": "3-revision-v1",
     3715    "parent": 4,
     3716    "slug": "4-revision-v1",
    37103717    "guid": {
    3711         "rendered": "http://example.org/?p=4"
     3718        "rendered": "http://example.org/?p=5"
    37123719    },
    37133720    "title": {
     
    37243731mockedApiResponse.PagesCollection = [
    37253732    {
    3726         "id": 5,
     3733        "id": 6,
    37273734        "date": "2017-02-14T00:00:00",
    37283735        "date_gmt": "2017-02-14T00:00:00",
    37293736        "guid": {
    3730             "rendered": "http://example.org/?page_id=5"
     3737            "rendered": "http://example.org/?page_id=6"
    37313738        },
    37323739        "modified": "2017-02-14T00:00:00",
     
    37353742        "status": "publish",
    37363743        "type": "page",
    3737         "link": "http://example.org/?page_id=5",
     3744        "link": "http://example.org/?page_id=6",
    37383745        "title": {
    37393746            "rendered": "REST API Client Fixture: Page"
     
    37603767            "self": [
    37613768                {
    3762                     "href": "http://example.org/index.php?rest_route=/wp/v2/pages/5"
     3769                    "href": "http://example.org/index.php?rest_route=/wp/v2/pages/6"
    37633770                }
    37643771            ],
     
    37763783                {
    37773784                    "embeddable": true,
    3778                     "href": "http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5"
     3785                    "href": "http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6"
    37793786                }
    37803787            ],
    37813788            "version-history": [
    37823789                {
    3783                     "href": "http://example.org/index.php?rest_route=/wp/v2/pages/5/revisions"
     3790                    "count": 1,
     3791                    "href": "http://example.org/index.php?rest_route=/wp/v2/pages/6/revisions"
     3792                }
     3793            ],
     3794            "predecessor-version": [
     3795                {
     3796                    "id": 7,
     3797                    "href": "http://example.org/index.php?rest_route=/wp/v2/pages/6/revisions/7"
    37843798                }
    37853799            ],
    37863800            "wp:attachment": [
    37873801                {
    3788                     "href": "http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5"
     3802                    "href": "http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6"
    37893803                }
    37903804            ],
     
    38013815
    38023816mockedApiResponse.PageModel = {
    3803     "id": 5,
     3817    "id": 6,
    38043818    "date": "2017-02-14T00:00:00",
    38053819    "date_gmt": "2017-02-14T00:00:00",
    38063820    "guid": {
    3807         "rendered": "http://example.org/?page_id=5"
     3821        "rendered": "http://example.org/?page_id=6"
    38083822    },
    38093823    "modified": "2017-02-14T00:00:00",
     
    38123826    "status": "publish",
    38133827    "type": "page",
    3814     "link": "http://example.org/?page_id=5",
     3828    "link": "http://example.org/?page_id=6",
    38153829    "title": {
    38163830        "rendered": "REST API Client Fixture: Page"
     
    38413855        "date": "2017-02-14T00:00:00",
    38423856        "date_gmt": "2017-02-14T00:00:00",
    3843         "id": 6,
     3857        "id": 7,
    38443858        "modified": "2017-02-14T00:00:00",
    38453859        "modified_gmt": "2017-02-14T00:00:00",
    3846         "parent": 5,
    3847         "slug": "5-revision-v1",
     3860        "parent": 6,
     3861        "slug": "6-revision-v1",
    38483862        "guid": {
    3849             "rendered": "http://example.org/?p=6"
     3863            "rendered": "http://example.org/?p=7"
    38503864        },
    38513865        "title": {
     
    38613875            "parent": [
    38623876                {
    3863                     "href": "http://example.org/index.php?rest_route=/wp/v2/pages/5"
     3877                    "href": "http://example.org/index.php?rest_route=/wp/v2/pages/6"
    38643878                }
    38653879            ]
     
    38723886    "date": "2017-02-14T00:00:00",
    38733887    "date_gmt": "2017-02-14T00:00:00",
    3874     "id": 6,
     3888    "id": 7,
    38753889    "modified": "2017-02-14T00:00:00",
    38763890    "modified_gmt": "2017-02-14T00:00:00",
    3877     "parent": 5,
    3878     "slug": "5-revision-v1",
     3891    "parent": 6,
     3892    "slug": "6-revision-v1",
    38793893    "guid": {
    3880         "rendered": "http://example.org/?p=6"
     3894        "rendered": "http://example.org/?p=7"
    38813895    },
    38823896    "title": {
     
    38933907mockedApiResponse.MediaCollection = [
    38943908    {
    3895         "id": 7,
     3909        "id": 8,
    38963910        "date": "2017-02-14T00:00:00",
    38973911        "date_gmt": "2017-02-14T00:00:00",
    38983912        "guid": {
    3899             "rendered": "http://example.org/?attachment_id=7"
     3913            "rendered": "http://example.org/?attachment_id=8"
    39003914        },
    39013915        "modified": "2017-02-14T00:00:00",
     
    39043918        "status": "inherit",
    39053919        "type": "attachment",
    3906         "link": "http://example.org/?attachment_id=7",
     3920        "link": "http://example.org/?attachment_id=8",
    39073921        "title": {
    39083922            "rendered": "REST API Client Fixture: Attachment"
     
    39303944            "self": [
    39313945                {
    3932                     "href": "http://example.org/index.php?rest_route=/wp/v2/media/7"
     3946                    "attributes": [],
     3947                    "href": "http://example.org/index.php?rest_route=/wp/v2/media/8"
    39333948                }
    39343949            ],
    39353950            "collection": [
    39363951                {
     3952                    "attributes": [],
    39373953                    "href": "http://example.org/index.php?rest_route=/wp/v2/media"
    39383954                }
     
    39403956            "about": [
    39413957                {
     3958                    "attributes": [],
    39423959                    "href": "http://example.org/index.php?rest_route=/wp/v2/types/attachment"
    39433960                }
     
    39453962            "replies": [
    39463963                {
    3947                     "embeddable": true,
    3948                     "href": "http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7"
     3964                    "attributes": {
     3965                        "embeddable": true
     3966                    },
     3967                    "href": "http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8"
    39493968                }
    39503969            ]
     
    39543973
    39553974mockedApiResponse.MediaModel = {
    3956     "id": 7,
     3975    "id": 8,
    39573976    "date": "2017-02-14T00:00:00",
    39583977    "date_gmt": "2017-02-14T00:00:00",
    39593978    "guid": {
    3960         "rendered": "http://example.org/?attachment_id=7"
     3979        "rendered": "http://example.org/?attachment_id=8"
    39613980    },
    39623981    "modified": "2017-02-14T00:00:00",
     
    39653984    "status": "inherit",
    39663985    "type": "attachment",
    3967     "link": "http://example.org/?attachment_id=7",
     3986    "link": "http://example.org/?attachment_id=8",
    39683987    "title": {
    39693988        "rendered": "REST API Client Fixture: Attachment"
     
    44614480    {
    44624481        "id": 2,
    4463         "post": 3,
     4482        "post": 4,
    44644483        "parent": 0,
    44654484        "author": 0,
     
    44714490            "rendered": "<p>This is a comment</p>\n"
    44724491        },
    4473         "link": "http://example.org/?p=3#comment-2",
     4492        "link": "http://example.org/?p=4#comment-2",
    44744493        "status": "approved",
    44754494        "type": "comment",
     
    44974516                    "embeddable": true,
    44984517                    "post_type": "post",
    4499                     "href": "http://example.org/index.php?rest_route=/wp/v2/posts/3"
     4518                    "href": "http://example.org/index.php?rest_route=/wp/v2/posts/4"
    45004519                }
    45014520            ]
     
    45064525mockedApiResponse.CommentModel = {
    45074526    "id": 2,
    4508     "post": 3,
     4527    "post": 4,
    45094528    "parent": 0,
    45104529    "author": 0,
     
    45164535        "rendered": "<p>This is a comment</p>\n"
    45174536    },
    4518     "link": "http://example.org/?p=3#comment-2",
     4537    "link": "http://example.org/?p=4#comment-2",
    45194538    "status": "approved",
    45204539    "type": "comment",
Note: See TracChangeset for help on using the changeset viewer.