LLMS_REST_Webhooks_Controller::get_item_schema()

Get the Webhook’s schema, conforming to JSON Schema.


Return Return

(array)


Top ↑

Source Source

File: libraries/lifterlms-rest/includes/server/class-llms-rest-webhooks-controller.php

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
protected function get_item_schema_base() {
 
    return array(
        '$schema'    => 'http://json-schema.org/draft-04/schema#',
        'title'      => 'webhook',
        'type'       => 'object',
        'properties' => array(
            'id'           => array(
                'description' => __( 'Webhook ID.', 'lifterlms' ),
                'type'        => 'integer',
                'context'     => array( 'view', 'edit' ),
                'readonly'    => true,
            ),
            'name'         => array(
                'description' => __( 'Friendly, human-readable name or description.', 'lifterlms' ),
                'type'        => 'string',
                'context'     => array( 'view', 'edit' ),
                'arg_options' => array(
                    'sanitize_callback' => 'sanitize_text_field',
                ),
            ),
            'status'       => array(
                'description' => __( 'The status of the webhook.', 'lifterlms' ),
                'type'        => 'string',
                'context'     => array( 'view', 'edit' ),
                'enum'        => array_keys( LLMS_REST_API()->webhooks()->get_statuses() ),
                'default'     => 'disabled',
            ),
            'topic'        => array(
                'description' => __( 'The webhook topic', 'lifterlms' ),
                'type'        => 'string',
                'required'    => true,
                'context'     => array( 'view', 'edit' ),
                'arg_options' => array(
                    'validate_callback' => array( LLMS_REST_API()->webhooks(), 'is_topic_valid' ),
                ),
            ),
            'delivery_url' => array(
                'description' => __( 'The webhook payload delivery URL.', 'lifterlms' ),
                'type'        => 'string',
                'context'     => array( 'view', 'edit' ),
                'required'    => true,
            ),
            'secret'       => array(
                'description' => __( 'An optional secret key used to generate the delivery signature.', 'lifterlms' ),
                'type'        => 'string',
                'context'     => array( 'view', 'edit' ),
            ),
            'created'      => array(
                'description' => __( 'Creation date. Format: Y-m-d H:i:s', 'lifterlms' ),
                'type'        => 'string',
                'format'      => 'date-time',
                'context'     => array( 'view', 'edit' ),
                'readonly'    => true,
            ),
            'updated'      => array(
                'description' => __( 'Date last modified. Format: Y-m-d H:i:s', 'lifterlms' ),
                'type'        => 'string',
                'format'      => 'date-time',
                'context'     => array( 'view', 'edit' ),
                'readonly'    => true,
            ),
            'resource'     => array(
                'description' => __( 'The parsed resource from the `topic`.', 'lifterlms' ),
                'type'        => 'string',
                'context'     => array( 'view', 'edit' ),
                'readonly'    => true,
            ),
            'event'        => array(
                'description' => __( 'The parsed event from the `topic`.', 'lifterlms' ),
                'type'        => 'string',
                'context'     => array( 'view', 'edit' ),
                'readonly'    => true,
            ),
            'hooks'        => array(
                'description' => __( 'List of WordPress action hook associated with the webhook.', 'lifterlms' ),
                'type'        => 'array',
                'items'       => array(
                    'type' => 'string',
                ),
                'context'     => array( 'view', 'edit' ),
            ),
        ),
    );
 
}


Top ↑

Changelog Changelog

Changelog
Version Description
1.0.0-beta.3 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.