Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Add info object #94

Closed
dblock opened this issue Dec 23, 2022 · 3 comments
Closed

[FEATURE] Add info object #94

dblock opened this issue Dec 23, 2022 · 3 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@dblock
Copy link
Member

dblock commented Dec 23, 2022

Is your feature request related to a problem?

Fetching server info at root doesn't return a structure.

What solution would you like?

let info: Info = client.info().send().await?.json().await?;

What alternatives have you considered?

Currently I'm doing one of these:

    let info: Value = client.info().send().await?.json().await?;
    println!("{}: {}", info["version"]["distribution"].as_str().unwrap(), info["version"]["number"].as_str().unwrap());
    #[derive(Serialize, Deserialize)]
    struct Version {
        distribution: String,
        number: String
    }

    #[derive(Serialize, Deserialize)]
    struct Info {
        version: Version
    }

    let info: Info = client.info().send().await?.json().await?;
    println!("{}: {}", info.version.distribution, info.version.number);

Is there an existing better way, otherwise I'll try to queue up a PR. Also not sure what the right way to add this is, pointers appreciated.

@dblock dblock added the enhancement New feature or request label Dec 23, 2022
@wbeckler wbeckler added the good first issue Good for newcomers label Jan 18, 2023
@Refffy
Copy link

Refffy commented Mar 15, 2023

Hey! I'll work on the issue.

@samuelorji
Copy link
Contributor

@Xtansia can i pick this next ?

@samuelorji
Copy link
Contributor

draft: #187 with some questions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

5 participants