This files describes API changes in the webapi plugin,
information provided here is intended especially for developers.

=== 19.1.3
* The trait totara_webapi\phpunit\webapi_phpunit_helper no longer has the $execution_context property. To access it, declare the property in your test and it'll be automatically populated.

=== 19.1.1 ===

* totara_webapi\server now accepts two extra constructor parameters, `$graphql_error_handler` and `$graphql_error_formatter`. These will override which error handler/formatter is used by that type of endpoint. Set to null to use the default handlers.
* totara_webapi\controllers\api_controller has two new functions to optionally override `get_default_error_handler` and `get_default_error_formatter`. These will be provided to the server instance created by the controller and can control which error handler/formatter is used.

=== 19.1.0 ===

* Added incrementation for query complexity for unresolved GraphQL types.
  Previously, unresolved types in a GraphQL query or mutation did not count towards query complexity,
  which may lead to a situation where very large results with unresolved types misrepresent their complexity
  and cause large server load without reaching the API limit.
  This change implements an increment of the query complexity for a query or mutation for unresolved types. It is
  possible to revert this behaviour by setting the config value, revert_TL_45204_until_T20.
* Added a new optional param `execution_context` to \totara_webapi\phpunit\webapi_phpunit_helper::resolve_graphql_type(). If this parameter is given, the method will use this given execution context instead of creating one.
* Added a validation exception `totara_webapi\exception\validation` to be used for validation errors. This contains a ::make method for retrieving a client_aware_exception.
* Added a record_not_found exception `totara_webapi\exception\record_not_found` to be used for when a record could not be found. This contains a ::make method for retrieving a client_aware_exception.

=== 19.0 ===

* client_aware_exception::getCategory method is deprecated and replaced with client_aware_exception::get_category
* The debugMessage field from formatted error messages now exists beneath the extensions key, any references to $error['debugMessage'] must update to $error['extensions']['debugMessage']

=== 18.0 ===

* Added a mandatory server parameter to handle_request_pre_hook and handle_request_post_hook.
* Closed writing session for the webapi endpoint(Ajax endpoint) which supports 'require_session' to improve performance for
  queries only. If the session needs to be modified by a query, please add middleware core\webapi\middleware\reopen_session_for_writing
  to them in order to reopen the session so that you can write the session and get the value from session.

=== 17.0 ===

* Parameter for \totara_webapi\request::__construct changed from string to totara_webapi\endpoint_type\base. A debugging notice
  will be emitted for type string and the creation of a type instance will be attempted.
* Parameter for \totara_webapi\graphql::get_schema changed from string to totara_webapi\endpoint_type\base. A debugging notice
  will be emitted for type string and the creation of a type instance will be attempted.
* Return type for \core\webapi\execution_context::get_type has changed from string to totara_webapi\endpoint_type\base.
* Added a middleware hook totara_webapi\hook\api_hook that allows defining middleware based on endpoint_type, component or resolver
* Removed server/totara/webapi/index.php and webapi node from admin setting under development menu
* Added second parameter 'execution_context' to method 'totara_webapi\server::add_performance_data_to_result'

=== 15.0 ===

* Introduced processor class, which is the base implementation of GraphQL StandardServer.
* graphql::get_schema has a new optional parameter 'type'
* server::prepare_schema has been deprecated.
* server::prepare_operations has been deprecated.
* server::create_operation has been deprecated.

=== 13 ===

* Introduced a new config flag $CFG->cache_graphql_schema to control caching of the schema. By default caching is on and can be turned off using the flag