LLMS_REST_API_Keys_Controller::get_item_schema()

Get the API Key’s schema, conforming to JSON Schema.


Return Return

(array)


Top ↑

Source Source

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

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
protected function get_item_schema_base() {
 
    return array(
        '$schema'    => 'http://json-schema.org/draft-04/schema#',
        'title'      => 'api_key',
        'type'       => 'object',
        'properties' => array(
            'description'   => array(
                'description' => __( 'Friendly, human-readable name or description.', 'lifterlms' ),
                'type'        => 'string',
                'required'    => true,
                'context'     => array( 'view', 'edit' ),
                'arg_options' => array(
                    'sanitize_callback' => 'sanitize_text_field',
                ),
            ),
            'permissions'   => array(
                'description' => __( 'Determines the capabilities and permissions of the key.', 'lifterlms' ),
                'type'        => 'string',
                'required'    => true,
                'context'     => array( 'view', 'edit' ),
                'enum'        => array_keys( LLMS_REST_API()->keys()->get_permissions() ),
            ),
            'user_id'       => array(
                'description' => __( 'The WordPress User ID of the key owner.', 'lifterlms' ),
                'type'        => 'integer',
                'required'    => true,
                'context'     => array( 'view', 'edit' ),
                'arg_options' => array(
                    'sanitize_callback' => 'absint',
                    'validate_callback' => array( $this, 'validate_user_exists' ),
                ),
            ),
            'truncated_key' => array(
                'description' => __( 'The last 7 characters of the Consumer Key.', 'lifterlms' ),
                'type'        => 'string',
                'context'     => array( 'view', 'edit' ),
                'readonly'    => true,
            ),
            'last_access'   => array(
                'description' => __( 'The date the key was last used. Format: Y-m-d H:i:s.', 'lifterlms' ),
                'type'        => 'string',
                'context'     => array( 'view', 'edit' ),
                'readonly'    => true,
            ),
        ),
    );
 
}


Top ↑

Changelog Changelog

Changelog
Version Description
1.0.0-beta.1 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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