View Source Apple.WeatherKitRestAPI (apple v0.3.0)

Utilities for WeatherKit REST API.

Summary

Types

The private key ID, like "2Y9R5HMY68".

The private key associated with the key_id.

The registered service ID, like "com.example.weatherkit-client".

The team ID, like "6MPDV0UYYX".

Functions

Builds a token to authorize HTTP requests.

Types

@type key_id() :: String.t()

The private key ID, like "2Y9R5HMY68".

@type private_key() :: String.t()

The private key associated with the key_id.

It's in PEM format, like:

-----BEGIN PRIVATE KEY-----
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
...
-----END PRIVATE KEY-----
@type service_id() :: String.t()

The registered service ID, like "com.example.weatherkit-client".

@type team_id() :: String.t()

The team ID, like "6MPDV0UYYX".

Functions

Link to this function

build_auth_token!(team_id, key_id, private_key, service_id)

View Source
@spec build_auth_token!(team_id(), key_id(), private_key(), service_id()) ::
  String.t()

Builds a token to authorize HTTP requests.

To get the value of arguments, such as team_id, key_id and so on, please read Request authentication for WeatherKit REST API.

After building it, use it in the Authorization header like this:

Authorization: Bearer <JWT>