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

Add Open API version number to root client #259

Merged
merged 4 commits into from
Sep 6, 2024

Conversation

dfdgsdfg
Copy link
Contributor

@dfdgsdfg dfdgsdfg commented Sep 6, 2024

Add Open API version number to root client

Sometimes, developers specify the version used in the application. It’s also useful to add a request header like X-API-Version: 1.0.0.

API Spec

{
  "openapi": "3.0.0",
  "info": {
    "version": "1.0.0"
  }
}

Usage

final client = RestClient(dio);

// 1.0.0
print(RestClient.version);

client.someApi.getRequest(
  extras: { 
    'custom-header': { 
      'X-API-Version': '${RestClient.version}' 
    }
  }
);

@Carapacik Carapacik self-requested a review September 6, 2024 12:51
@Carapacik Carapacik merged commit 4661e59 into Carapacik:main Sep 6, 2024
1 check passed
@dfdgsdfg dfdgsdfg deleted the feature/version_info branch September 7, 2024 07:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants