Skip to content

Commit

Permalink
chore:L rename some authed media stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
td-famedly committed Sep 11, 2024
1 parent acdd813 commit 326e1d2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
9 changes: 4 additions & 5 deletions lib/matrix_api_lite/generated/api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ class Api {
/// repository APIs, for example, proxies may enforce a lower upload size limit
/// than is advertised by the server on this endpoint.
/// {{% /boxes/note %}}
Future<GetConfigAuthedResponse> getConfigAuthed() async {
Future<MediaConfig> getConfigAuthed() async {
final requestUri = Uri(path: '_matrix/client/v1/media/config');
final request = Request('GET', baseUri!.resolveUri(requestUri));
request.headers['authorization'] = 'Bearer ${bearerToken!}';
Expand All @@ -174,7 +174,7 @@ class Api {
if (response.statusCode != 200) unexpectedResponse(response, responseBody);
final responseString = utf8.decode(responseBody);
final json = jsonDecode(responseString);
return GetConfigAuthedResponse.fromJson(json as Map<String, Object?>);
return MediaConfig.fromJson(json as Map<String, Object?>);
}

/// {{% boxes/note %}}
Expand Down Expand Up @@ -277,8 +277,7 @@ class Api {
/// [ts] The preferred point in time to return a preview for. The server may
/// return a newer version if it does not have the requested version
/// available.
Future<GetUrlPreviewAuthedResponse> getUrlPreviewAuthed(Uri url,
{int? ts}) async {
Future<MediaPreviewUrl> getUrlPreviewAuthed(Uri url, {int? ts}) async {
final requestUri =
Uri(path: '_matrix/client/v1/media/preview_url', queryParameters: {
'url': url.toString(),
Expand All @@ -291,7 +290,7 @@ class Api {
if (response.statusCode != 200) unexpectedResponse(response, responseBody);
final responseString = utf8.decode(responseBody);
final json = jsonDecode(responseString);
return GetUrlPreviewAuthedResponse.fromJson(json as Map<String, Object?>);
return MediaPreviewUrl.fromJson(json as Map<String, Object?>);
}

/// Download a thumbnail of content from the content repository.
Expand Down
16 changes: 8 additions & 8 deletions lib/matrix_api_lite/generated/model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -212,13 +212,13 @@ class GenerateLoginTokenResponse {
}

///
@_NameSource('generated')
class GetConfigAuthedResponse {
GetConfigAuthedResponse({
@_NameSource('rule override generated')
class MediaConfig {
MediaConfig({
this.mUploadSize,
});

GetConfigAuthedResponse.fromJson(Map<String, Object?> json)
MediaConfig.fromJson(Map<String, Object?> json)
: mUploadSize =
((v) => v != null ? v as int : null)(json['m.upload.size']);
Map<String, Object?> toJson() {
Expand All @@ -235,14 +235,14 @@ class GetConfigAuthedResponse {
}

///
@_NameSource('generated')
class GetUrlPreviewAuthedResponse {
GetUrlPreviewAuthedResponse({
@_NameSource('rule override generated')
class MediaPreviewUrl {
MediaPreviewUrl({
this.matrixImageSize,
this.ogImage,
});

GetUrlPreviewAuthedResponse.fromJson(Map<String, Object?> json)
MediaPreviewUrl.fromJson(Map<String, Object?> json)
: matrixImageSize =
((v) => v != null ? v as int : null)(json['matrix:image:size']),
ogImage = ((v) =>
Expand Down

0 comments on commit 326e1d2

Please sign in to comment.