obs_models.dart 1.53 KB
import 'package:json_annotation/json_annotation.dart';

part 'obs_models.g.dart';

@JsonSerializable()
class ObsTokenRequest {
  const ObsTokenRequest({
    this.source = 'doublefeel',
    required this.fileType,
    required this.count,
    required this.scene,
  });

  final String source;
  @JsonKey(name: 'file_type')
  final String fileType;
  final int count;
  final String scene;

  factory ObsTokenRequest.fromJson(Map<String, dynamic> json) =>
      _$ObsTokenRequestFromJson(json);
  Map<String, dynamic> toJson() => _$ObsTokenRequestToJson(this);
}

@JsonSerializable()
class ObsTokenResponse {
  const ObsTokenResponse({
    this.keys,
    this.token,
    this.host,
    this.endPoint,
    this.bucket,
  });

  final List<String>? keys;
  final ObsToken? token;
  final String? host;
  @JsonKey(name: 'endpoint')
  final String? endPoint;
  final String? bucket;

  factory ObsTokenResponse.fromJson(Map<String, dynamic> json) =>
      _$ObsTokenResponseFromJson(json);
  Map<String, dynamic> toJson() => _$ObsTokenResponseToJson(this);
}

@JsonSerializable()
class ObsToken {
  const ObsToken({
    this.accessKey,
    this.secretKey,
    this.securityToken,
    this.expiration,
  });

  @JsonKey(name: 'access_key')
  final String? accessKey;
  @JsonKey(name: 'secret_key')
  final String? secretKey;
  @JsonKey(name: 'security_token')
  final String? securityToken;
  final String? expiration;

  factory ObsToken.fromJson(Map<String, dynamic> json) =>
      _$ObsTokenFromJson(json);
  Map<String, dynamic> toJson() => _$ObsTokenToJson(this);
}