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 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266
<?php
namespace WPGraphQL\Type\Comment\Connection;
use GraphQL\Type\Definition\EnumType;
use WPGraphQL\Type\WPEnumType;
use WPGraphQL\Type\WPInputObjectType;
use WPGraphQL\Types;
class CommentConnectionArgs extends WPInputObjectType {
public static $fields;
private static $comments_orderby_enum;
public function __construct( $config = [] ) {
$config['name'] = 'CommentArgs';
$config['fields'] = self::fields();
parent::__construct( $config );
}
private static function fields() {
if ( null === self::$fields ) :
$fields = [
'authorEmail' => [
'type' => Types::string(),
'description' => __( 'Comment author email address.', 'wp-graphql' ),
],
'authorUrl' => [
'type' => Types::string(),
'description' => __( 'Comment author URL.', 'wp-graphql' ),
],
'authorIn' => [
'type' => Types::list_of( Types::int() ),
'description' => __( 'Array of author IDs to include comments for.', 'wp-graphql' ),
],
'authorNotIn' => [
'type' => Types::list_of( Types::int() ),
'description' => __( 'Array of author IDs to exclude comments for.', 'wp-graphql' ),
],
'commentIn' => [
'type' => Types::list_of( Types::int() ),
'description' => __( 'Array of comment IDs to include.', 'wp-graphql' ),
],
'commentNotIn' => [
'type' => Types::list_of( Types::int() ),
'description' => __( 'Array of IDs of users whose unapproved comments will be returned by the
query regardless of status.', 'wp-graphql' ),
],
'includeUnapproved' => [
'type' => Types::list_of( Types::int() ),
'description' => __( 'Array of author IDs to include comments for.', 'wp-graphql' ),
],
'karma' => [
'type' => Types::int(),
'description' => __( 'Karma score to retrieve matching comments for.', 'wp-graphql' ),
],
'orderby' => [
'type' => self::comments_orderby_enum(),
'description' => __( 'Field to order the comments by.', 'wp-graphql' ),
],
'order' => [
'type' => new WPEnumType([
'name' => 'CommentsOrder',
'values' => [
'ASC' => [
'value' => 'ASC',
],
'DESC' => [
'value' => 'DESC',
],
],
'defaultValue' => 'DESC',
]),
],
'parent' => [
'type' => Types::int(),
'description' => __( 'Parent ID of comment to retrieve children of.', 'wp-graphql' ),
],
'parentIn' => [
'type' => Types::list_of( Types::int() ),
'description' => __( 'Array of parent IDs of comments to retrieve children for.', 'wp-graphql' ),
],
'parentNotIn' => [
'type' => Types::list_of( Types::int() ),
'description' => __( 'Array of parent IDs of comments *not* to retrieve children
for.', 'wp-graphql' ),
],
'contentAuthorIn' => [
'type' => Types::list_of( Types::int() ),
'description' => __( 'Array of author IDs to retrieve comments for.', 'wp-graphql' ),
],
'contentAuthorNotIn' => [
'type' => Types::list_of( Types::int() ),
'description' => __( 'Array of author IDs *not* to retrieve comments for.', 'wp-graphql' ),
],
'contentId' => [
'type' => Types::int(),
'description' => __( 'Limit results to those affiliated with a given content object
ID.', 'wp-graphql' ),
],
'contentIdIn' => [
'type' => Types::list_of( Types::int() ),
'description' => __( 'Array of content object IDs to include affiliated comments
for.', 'wp-graphql' ),
],
'contentIdNotIn' => [
'type' => Types::list_of( Types::int() ),
'description' => __( 'Array of content object IDs to exclude affiliated comments
for.', 'wp-graphql' ),
],
'contentAuthor' => [
'type' => Types::list_of( Types::int() ),
'description' => __( 'Content object author ID to limit results by.', 'wp-graphql' ),
],
'contentStatus' => [
'type' => Types::list_of( Types::post_status_enum() ),
'description' => __( 'Array of content object statuses to retrieve affiliated comments for.
Pass \'any\' to match any value.', 'wp-graphql' ),
],
'contentType' => [
'type' => Types::list_of( Types::post_type_enum() ),
'description' => __( 'Content object type or array of types to retrieve affiliated comments for. Pass \'any\' to match any value.', 'wp-graphql' ),
],
'contentName' => [
'type' => Types::string(),
'description' => __( 'Content object name to retrieve affiliated comments for.', 'wp-graphql' ),
],
'contentParent' => [
'type' => Types::int(),
'description' => __( 'Content Object parent ID to retrieve affiliated comments for.', 'wp-graphql' ),
],
'search' => [
'type' => Types::string(),
'description' => __( 'Search term(s) to retrieve matching comments for.', 'wp-graphql' ),
],
'status' => [
'type' => Types::string(),
'description' => __( 'Comment status to limit results by.', 'wp-graphql' ),
],
'commentType' => [
'type' => Types::string(),
'description' => __( 'Include comments of a given type.', 'wp-graphql' ),
],
'commentTypeIn' => [
'type' => Types::list_of( Types::string() ),
'description' => __( 'Include comments from a given array of comment types.', 'wp-graphql' ),
],
'commentTypeNotIn' => [
'type' => Types::string(),
'description' => __( 'Exclude comments from a given array of comment types.', 'wp-graphql' ),
],
'userId' => [
'type' => Types::int(),
'description' => __( 'Include comments for a specific user ID.', 'wp-graphql' ),
],
];
self::$fields = self::prepare_fields( $fields, 'CommentArgs' );
endif;
return self::$fields;
}
private static function comments_orderby_enum() {
if ( null === self::$comments_orderby_enum ) :
self::$comments_orderby_enum = new WPEnumType([
'name' => 'CommentsOrderby',
'values' => [
'COMMENT_AGENT' => [
'value' => 'comment_agent',
],
'COMMENT_APPROVED' => [
'value' => 'comment_approved',
],
'COMMENT_AUTHOR' => [
'value' => 'comment_author',
],
'COMMENT_AUTHOR_EMAIL' => [
'value' => 'comment_author_email',
],
'COMMENT_AUTHOR_IP' => [
'value' => 'comment_author_IP',
],
'COMMENT_AUTHOR_URL' => [
'value' => 'comment_author_url',
],
'COMMENT_CONTENT' => [
'value' => 'comment_content',
],
'COMMENT_DATE' => [
'value' => 'comment_date',
],
'COMMENT_DATE_GMT' => [
'value' => 'comment_date_gmt',
],
'COMMENT_ID' => [
'value' => 'comment_ID',
],
'COMMENT_KARMA' => [
'value' => 'comment_karma',
],
'COMMENT_PARENT' => [
'value' => 'comment_parent',
],
'COMMENT_POST_ID' => [
'value' => 'comment_post_ID',
],
'COMMENT_TYPE' => [
'value' => 'comment_type',
],
'USER_ID' => [
'value' => 'user_id',
],
'COMMENT_IN' => [
'value' => 'comment__in',
],
],
]);
endif;
return self::$comments_orderby_enum;
}
}