-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c2b8e49
commit 82432b2
Showing
6 changed files
with
113 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Copyright 2023 Kato Shinya. All rights reserved. | ||
// Redistribution and use in source and binary forms, with or without | ||
// modification, are permitted provided the conditions. | ||
|
||
enum HttpMethod { | ||
/// `GET` | ||
get('GET'), | ||
|
||
/// `POST` | ||
post('POST'), | ||
|
||
/// `DELETE` | ||
delete('DELETE'), | ||
|
||
/// `PUT` | ||
put('PUT'), | ||
|
||
/// `PATCH` | ||
patch('PATCH'); | ||
|
||
/// The value. | ||
final String value; | ||
|
||
/// Returns the http method associated with [value]. | ||
static HttpMethod valueOf(final String value) { | ||
for (final method in values) { | ||
if (method.value == value) { | ||
return method; | ||
} | ||
} | ||
|
||
throw UnsupportedError('Unsupported value [$value].'); | ||
} | ||
|
||
const HttpMethod(this.value); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright 2023 Kato Shinya. All rights reserved. | ||
// Redistribution and use in source and binary forms, with or without | ||
// modification, are permitted provided the conditions. | ||
|
||
// 馃寧 Project imports: | ||
import '../../core/http_method.dart'; | ||
|
||
class MastodonRequest { | ||
/// Returns the new instance of [MastodonRequest]. | ||
const MastodonRequest({ | ||
required this.method, | ||
required this.url, | ||
}); | ||
|
||
/// The http method when request has sent. | ||
final HttpMethod method; | ||
|
||
/// The request url. | ||
final Uri url; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters