| @@ 99-150 (lines=52) @@ | ||
| 96 | * |
|
| 97 | * @return array |
|
| 98 | */ |
|
| 99 | public function get_item_schema() { |
|
| 100 | $schema = array( |
|
| 101 | '$schema' => 'http://json-schema.org/draft-04/schema#', |
|
| 102 | 'title' => 'product_attribute_term', |
|
| 103 | 'type' => 'object', |
|
| 104 | 'properties' => array( |
|
| 105 | 'id' => array( |
|
| 106 | 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), |
|
| 107 | 'type' => 'integer', |
|
| 108 | 'context' => array( 'view', 'edit' ), |
|
| 109 | 'readonly' => true, |
|
| 110 | ), |
|
| 111 | 'name' => array( |
|
| 112 | 'description' => __( 'Term name.', 'woocommerce' ), |
|
| 113 | 'type' => 'string', |
|
| 114 | 'context' => array( 'view', 'edit' ), |
|
| 115 | 'arg_options' => array( |
|
| 116 | 'sanitize_callback' => 'sanitize_text_field', |
|
| 117 | ), |
|
| 118 | ), |
|
| 119 | 'slug' => array( |
|
| 120 | 'description' => __( 'An alphanumeric identifier for the resource unique to its type.', 'woocommerce' ), |
|
| 121 | 'type' => 'string', |
|
| 122 | 'context' => array( 'view', 'edit' ), |
|
| 123 | 'arg_options' => array( |
|
| 124 | 'sanitize_callback' => 'sanitize_title', |
|
| 125 | ), |
|
| 126 | ), |
|
| 127 | 'description' => array( |
|
| 128 | 'description' => __( 'HTML description of the resource.', 'woocommerce' ), |
|
| 129 | 'type' => 'string', |
|
| 130 | 'context' => array( 'view', 'edit' ), |
|
| 131 | 'arg_options' => array( |
|
| 132 | 'sanitize_callback' => 'wp_filter_post_kses', |
|
| 133 | ), |
|
| 134 | ), |
|
| 135 | 'menu_order' => array( |
|
| 136 | 'description' => __( 'Menu order, used to custom sort the resource.', 'woocommerce' ), |
|
| 137 | 'type' => 'integer', |
|
| 138 | 'context' => array( 'view', 'edit' ), |
|
| 139 | ), |
|
| 140 | 'count' => array( |
|
| 141 | 'description' => __( 'Number of published products for the resource.', 'woocommerce' ), |
|
| 142 | 'type' => 'integer', |
|
| 143 | 'context' => array( 'view', 'edit' ), |
|
| 144 | 'readonly' => true, |
|
| 145 | ), |
|
| 146 | ), |
|
| 147 | ); |
|
| 148 | ||
| 149 | return $this->add_additional_fields_schema( $schema ); |
|
| 150 | } |
|
| 151 | } |
|
| 152 | ||
| @@ 534-581 (lines=48) @@ | ||
| 531 | * |
|
| 532 | * @return array |
|
| 533 | */ |
|
| 534 | public function get_item_schema() { |
|
| 535 | $schema = array( |
|
| 536 | '$schema' => 'http://json-schema.org/draft-04/schema#', |
|
| 537 | 'title' => 'product_review', |
|
| 538 | 'type' => 'object', |
|
| 539 | 'properties' => array( |
|
| 540 | 'id' => array( |
|
| 541 | 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), |
|
| 542 | 'type' => 'integer', |
|
| 543 | 'context' => array( 'view', 'edit' ), |
|
| 544 | 'readonly' => true, |
|
| 545 | ), |
|
| 546 | 'review' => array( |
|
| 547 | 'description' => __( 'The content of the review.', 'woocommerce' ), |
|
| 548 | 'type' => 'string', |
|
| 549 | 'context' => array( 'view', 'edit' ), |
|
| 550 | ), |
|
| 551 | 'date_created' => array( |
|
| 552 | 'description' => __( "The date the review was created, in the site's timezone.", 'woocommerce' ), |
|
| 553 | 'type' => 'date-time', |
|
| 554 | 'context' => array( 'view', 'edit' ), |
|
| 555 | ), |
|
| 556 | 'rating' => array( |
|
| 557 | 'description' => __( 'Review rating (0 to 5).', 'woocommerce' ), |
|
| 558 | 'type' => 'integer', |
|
| 559 | 'context' => array( 'view', 'edit' ), |
|
| 560 | ), |
|
| 561 | 'name' => array( |
|
| 562 | 'description' => __( 'Reviewer name.', 'woocommerce' ), |
|
| 563 | 'type' => 'string', |
|
| 564 | 'context' => array( 'view', 'edit' ), |
|
| 565 | ), |
|
| 566 | 'email' => array( |
|
| 567 | 'description' => __( 'Reviewer email.', 'woocommerce' ), |
|
| 568 | 'type' => 'string', |
|
| 569 | 'context' => array( 'view', 'edit' ), |
|
| 570 | ), |
|
| 571 | 'verified' => array( |
|
| 572 | 'description' => __( 'Shows if the reviewer bought the product or not.', 'woocommerce' ), |
|
| 573 | 'type' => 'boolean', |
|
| 574 | 'context' => array( 'view', 'edit' ), |
|
| 575 | 'readonly' => true, |
|
| 576 | ), |
|
| 577 | ), |
|
| 578 | ); |
|
| 579 | ||
| 580 | return $this->add_additional_fields_schema( $schema ); |
|
| 581 | } |
|
| 582 | ||
| 583 | /** |
|
| 584 | * Get the query params for collections. |
|