From a6abc8bf51ac1fc5ebf604fbd2685e77c2e46f54 Mon Sep 17 00:00:00 2001 From: Ricardo Boss Date: Fri, 9 Feb 2024 21:03:59 +0100 Subject: [PATCH] Rename Method to HttpMethod (closes #3) --- lib/kiota_abstractions.dart | 2 +- lib/src/{method.dart => http_method.dart} | 2 +- lib/src/request_information.dart | 4 ++-- test/request_information_test.dart | 18 +++++++++--------- 4 files changed, 13 insertions(+), 13 deletions(-) rename lib/src/{method.dart => http_method.dart} (98%) diff --git a/lib/kiota_abstractions.dart b/lib/kiota_abstractions.dart index 1c5a4d8..7bde481 100644 --- a/lib/kiota_abstractions.dart +++ b/lib/kiota_abstractions.dart @@ -17,7 +17,7 @@ part 'src/api_client_builder.dart'; part 'src/base_request_builder.dart'; part 'src/extensions/map_extensions.dart'; part 'src/extensions/request_information_extensions.dart'; -part 'src/method.dart'; +part 'src/http_method.dart'; part 'src/multipart_body.dart'; part 'src/request_adapter.dart'; part 'src/request_headers.dart'; diff --git a/lib/src/method.dart b/lib/src/http_method.dart similarity index 98% rename from lib/src/method.dart rename to lib/src/http_method.dart index 4ff576d..a252226 100644 --- a/lib/src/method.dart +++ b/lib/src/http_method.dart @@ -1,7 +1,7 @@ part of '../kiota_abstractions.dart'; /// Represents the HTTP method used by a request. -enum Method { +enum HttpMethod { /// The GET method requests a representation of the specified resource. Requests using GET should only retrieve data. get, diff --git a/lib/src/request_information.dart b/lib/src/request_information.dart index bcef7b9..5b75192 100644 --- a/lib/src/request_information.dart +++ b/lib/src/request_information.dart @@ -28,8 +28,8 @@ class RequestInformation { /// The path parameters to use for the URL template when generating the URI. Map pathParameters; - /// The HTTP [Method] of the request. - Method? httpMethod; + /// The HTTP [HttpMethod] of the request. + HttpMethod? httpMethod; /// The query parameters to use for the URL when generating the URI. Map queryParameters; diff --git a/test/request_information_test.dart b/test/request_information_test.dart index 3180b3d..fd46074 100644 --- a/test/request_information_test.dart +++ b/test/request_information_test.dart @@ -30,7 +30,7 @@ void main() { test('SetUriExtractsQueryParameters', () { final example = RequestInformation( - httpMethod: Method.get, + httpMethod: HttpMethod.get, urlTemplate: 'http://localhost/{path}/me?foo={foo}', ); @@ -46,7 +46,7 @@ void main() { test('Adds and removes request options', () { // Arrange final testRequest = RequestInformation( - httpMethod: Method.get, + httpMethod: HttpMethod.get, )..uri = Uri.parse('http://localhost'); final testRequestOption = MockRequestOption(); @@ -67,7 +67,7 @@ void main() { test('Sets path parameters of DateTime type', () { // Arrange as the request builders would final requestInfo = RequestInformation( - httpMethod: Method.get, + httpMethod: HttpMethod.get, urlTemplate: "http://localhost/getDirectRoutingCalls(fromDateTime='{fromDateTime}',toDateTime='{toDateTime}')", ); @@ -93,7 +93,7 @@ void main() { test('Sets path parameters of boolean type', () { // Arrange as the request builders would final requestInfo = RequestInformation( - httpMethod: Method.get, + httpMethod: HttpMethod.get, urlTemplate: 'http://localhost/users{?%24count}', ); @@ -107,7 +107,7 @@ void main() { test('Builds URL on provided base URL', () { // Arrange as the request builders would final requestInfo = RequestInformation( - httpMethod: Method.get, + httpMethod: HttpMethod.get, urlTemplate: '{+baseurl}/users{?%24count}', ); @@ -124,7 +124,7 @@ void main() { // Arrange as the request builders would final requestInfo = RequestInformation( - httpMethod: Method.get, + httpMethod: HttpMethod.get, urlTemplate: '{+baseurl}/users{?%24count}', )..pathParameters = { 'baseurl': proxyUrl, @@ -141,7 +141,7 @@ void main() { test('Get URI resolves parameters case-sensitive', () { // Arrange final testRequest = RequestInformation( - httpMethod: Method.get, + httpMethod: HttpMethod.get, urlTemplate: 'http://localhost/{URITemplate}/ParameterMapping?IsCaseSensitive={IsCaseSensitive}', ); @@ -160,7 +160,7 @@ void main() { test('Sets enum value in path parameters', () { // Arrange final testRequest = RequestInformation( - httpMethod: Method.get, + httpMethod: HttpMethod.get, urlTemplate: 'http://localhost/{dataset}', ); @@ -174,7 +174,7 @@ void main() { test('Sets multiple enum values in path parameters', () { // Arrange final testRequest = RequestInformation( - httpMethod: Method.get, + httpMethod: HttpMethod.get, urlTemplate: 'http://localhost/{dataset}', );