Last updated:
0 purchases
openapi client delegates
openapi_client_delegates #
Openapi Client Delegates for printing and mocking openapi generated responses
Getting Started #
Use this library for printing api responses generated by openapi
Usage #
PrintingClientDelegate #
ApiClient apiClient = ApiClient(
basePath: 'Config.url',
apiClientDelegate: PrintingClientDelegate(
onResponse: (String requestLog) => print(requestLog),
logLevels: {
'a/call/you/dont/want/to/log/like/file/upload': LogLevel.none,
'a/frequent/call': LogLevel.url,
},
),
);
copied to clipboard
MockClientDelegate #
const Map<String, String> responseMap = {
'/auth/login': """{
"success": true,
"message": "SUCCESS",
"data": {
"accessToken": "908d1be3-a2ce-46b2-9548-edc435b736e9"
}
}""",
'/some-other-endpoint': """some-other-response""",
};
ApiClient apiClient = ApiClient(
basePath: Config.url,
apiClientDelegate: MockClientDelegate(
responseMap: responseMap,
onResponse: (String requestLog) => log(requestLog),
),
);
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.