# Changelogs

## v1.6.0

* Redesigned the objects
  * Removed `BaseObject` class
  * `Flags` object has been renamed to `JokeFlags`
  * Added `language` alias for `Joke.lang`&#x20;
  * All objects are now frozen dataclasses which means they are now immutable and are read-only.
  * All objects now have proper `__repr__` attributes
* &#x20;Entire library is now properly typehinted. Thanks to [@MarzaElise](https://github.com/MarzaElise) for their contributions in typehinting the library.
* Moved `get_safe_joke` from utils module to `Client` and `AsyncClient` classes. Thanks to [@MarzaElise](https://github.com/MarzaElise)
* Client now works with async context manager. Thanks to [@MarzaElise](https://github.com/MarzaElise)
* `AsyncClient` now raises a new error `UnsupportedUsage` on exiting context manager. Thanks to [@MarzaElise](https://github.com/MarzaElise)
* Added support for `/weather` endpoint. You can now fetch weathers easily using `get_weather` methods.
  * Added `get_weather` in both client classes
  * Added four new classes `Weather`, `CurrentWeather`, `WeatherLocation`, `WeatherForecast`
  * Added new error, `InvalidCityError` raised upon invalid city provided in `get_weather` method.

{% hint style="info" %}
Version 1.5 were minor versions
{% endhint %}

## v1.4.2

* Restructured the library's data classes
  * All the data classes now inherit from a super class called [`BaseObject`](broken-reference)
  * AI response now is wrapped into a class called [`AIResponse`](../data-classes/airesponse) to stay even with new responses from version 4 AI response endpoint.
* Restructured the Exceptions hierarchy
  * New Exception sub class: [`HTTPError`](../errors/httperror) for 500s errors. Credits to [@Creepy-Creeper3625](https://github.com/Creepy-Creeper3625)
  * Added new Exception sub class: [`ArgumentError`](../errors/argumenterror).
  * `VersionError`,`PlanError` and `ServerError` are changed to [`InvalidVersionError`](../errors/argumenterror/invalidversionerror) ,[`InvalidPlanError`](../errors/argumenterror/invalidplanerror) and [`InvalidServerError`](../errors/argumenterror/invalidservererror) that are now inherited from [`ArgumentError`](../errors/argumenterror).
  * Added `Exception` class: [`Forbidden`](../errors/autherror)
  * Added two sub-classes of [`Forbidden`](../errors/autherror): [`PlanNotAllowed`](../errors/autherror/plannotallowed) and [`BadAPIKey`](../errors/autherror/badapikey)
* Restructured library files
  * All data classes are now in a single module `object`&#x20;
* [`AsyncClient`](../clients/asyncclient) now has proper default version. ([GH-7](https://github.com/nerdguyahmad/randomstuff.py/issues/7))
* `utils.generate_unique_id` now is called [`generate_uid`](../../sub-modules/utils#generate_uid) (As per version 4.)  ([GH-8](https://github.com/nerdguyahmad/randomstuff.py/issues/8))
* Added `errors.HTTPError` class for 500s statuses. ([GH-6](https://github.com/nerdguyahmad/randomstuff.py/issues/6))
* [`AsyncClient`](../clients/asyncclient) now properly inherits from [`Client`](../clients/client) ([GH-9](https://github.com/nerdguyahmad/randomstuff.py/issues/9))
* Added [`utils.format_joke`](../../sub-modules/utils#format_joke) method to format a "two-part" joke into custom (human readable) format.
* Added [`utils.get_safe_joke`](../../sub-modules/utils#get_safe_joke) method to filter or ignore any unsafe joke.
* Warnings now have certain colours using Unicode. Credits to [@Creepy-Creeper3625](https://github.com/Creepy-Creeper3625)

## v1.4.0

* Deprecated version 2 of API
* Added support for version 4
* Version 3 usage now triggers console warnings
* AI method now uses kwargs due to change in parameters for version 4 and 3.

## v1.3.2

* Added initial support for v4 beta
* `get_ai_response_beta()` argument added with different parameters names as default method. This is use able only with v4 beta. See [this](https://github.com/nerdguyahmad/randomstuff.py/wiki/get_ai_response_beta)
* get\_joke methods in both Client and AsyncClient classes now return correct link.
* Warning added for v4 beta.

## v1.3.1

* Added support for `unique_key` query on `/ai/response`.
* `get_ai_response()` take optional argument `unique_id` which is used to chat with a certain key. See [Unique Key](https://github.com/nerdguyahmad/randomstuff.py/wiki/Changelogs) page for more info.
* New module `randomstuff.utils`
* `utils.generate_unique_id` is a new method used to generate secure unique IDs.

## v1.3.0

* Added support for `bot_name` and `dev_name` queries on `/ai/response`.
* `get_ai_response()` take optional arguments `dev_name` and `bot_name` which determines developer name and bot name respectively.
* Added warnings.
* You are now warned when initialising client with `version='2'`.
* Add `suppress_warnings` optional argument in clients that determines whether you get console warnings or not.

## v1.2.2

* All methods and classes now raise `errors.AuthError` when invalid API key is passed.
* Same for unauthorised plan in `get_ai_response()`

## v1.2.1

* `get_joke()` works properly now.

## v1.2.0

* Add support for v2
* `Client` and `AsyncClient` now take `version` argument that determines the API version
* Added support for plans
* `get_ai_response()` now takes `plan` argument which determines the plan to use.

## v1.0.2

* Fixed minor bugs

## v1.0.1

* Initial Release
