1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
use crate;
use GraphQLQuery;
use Client;
use Uuid;
/// Fetches the user ID associated with the provided access token and outputs it.
/// This function sends a GraphQL query to retrieve the user's ID using the provided access token.
///
/// # Arguments
///
/// * `token` - A valid access token for authentication.
///
/// # Returns
///
/// The user's ID as a UUID (Universally Unique Identifier).
///
/// # Examples
///
/// ```
/// let access_token = "your_access_token";
/// let user_id = fetch_user_id(access_token);
/// println!("User ID: {}", user_id);
/// ```
///
/// # Panics
///
/// This function will panic and terminate the program if any errors occur during the process,
/// including if the `GRAPHQL_URL` environment variable is not set, if the authorization header is missing,
/// or if there are errors in the GraphQL response.
///