Skip to content

Commit

Permalink
docs: updated withLanguage and withUnitSystem sections
Browse files Browse the repository at this point in the history
  • Loading branch information
andrepimpao committed May 9, 2024
1 parent 67d5598 commit 23906c4
Showing 1 changed file with 16 additions and 18 deletions.
34 changes: 16 additions & 18 deletions docs/03-supported-apis.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,41 +218,39 @@ $location = $api->geocoding()->getByZipCode('1000-001', 'pt');

## Common Methods

#### `withUnitSystem`
#### `withLanguage`

```php
withUnitSystem(string $unitSystem): self
withLanguage(string $language): self
```

Makes a request with a different unit system from the one globally defined in the [configuration](02-configuration.md#unitsystem).

Only available for [`OneCall`](#one-call) and [`Weather`](#weather) APIs.
Set the language per request.
Only available for [`OneCall`](#one-call) and [`Weather`](#weather) API requests.

```php
use ProgrammatorDev\OpenWeatherMap\UnitSystem\UnitSystem;
use ProgrammatorDev\OpenWeatherMap\Language\Language

// Uses 'imperial' unit system for this request alone
$openWeatherMap->weather()
->withUnitSystem(UnitSystem::IMPERIAL)
// uses the "pt" language for this request alone
$api->weather()
->withLanguage(Language::PORTUGUESE)
->getCurrent(50, 50);
```

#### `withLanguage`
#### `withUnitSystem`

```php
withLanguage(string $language): self
withUnitSystem(string $unitSystem): self
```

Makes a request with a different language from the one globally defined in the [configuration](02-configuration.md#language).

Only available for [`OneCall`](#one-call) and [`Weather`](#weather) APIs.
Set the unit system per request.
Only available for [`OneCall`](#one-call) and [`Weather`](#weather) API requests.

```php
use ProgrammatorDev\OpenWeatherMap\Language\Language
use ProgrammatorDev\OpenWeatherMap\UnitSystem\UnitSystem;

// Uses 'pt' language for this request alone
$openWeatherMap->weather()
->withLanguage(Language::PORTUGUESE)
// uses the "imperial" unit system for this request alone
$api->weather()
->withUnitSystem(UnitSystem::IMPERIAL)
->getCurrent(50, 50);
```

Expand Down

0 comments on commit 23906c4

Please sign in to comment.