setAppStoreReleaseNotes method

  1. @override
Future<void> setAppStoreReleaseNotes({
  1. required String appStoreVersionId,
  2. required String locale,
  3. required String whatsNew,
})
override

Creates or updates localized App Store "What's New" text.

Implementation

@override
Future<void> setAppStoreReleaseNotes({
  required String appStoreVersionId,
  required String locale,
  required String whatsNew,
}) async {
  final localizations = (await _collection(
    '/v1/appStoreVersions/$appStoreVersionId/'
    'appStoreVersionLocalizations?limit=200',
  )).map(_genericResource);
  final localization = localizations
      .where(
        (item) => item.attributes['locale'] == locale,
      )
      .firstOrNull;
  if (localization == null) {
    throw SmfError(
      'App Store locale "$locale" does not exist. Add it to the app in App '
      'Store Connect before releasing.',
      SmfErrorCode.appStoreLocaleNotFound,
    );
  }
  await _request(
    'PATCH',
    '/v1/appStoreVersionLocalizations/${localization.id}',
    body: <String, Object?>{
      'data': <String, Object?>{
        'type': 'appStoreVersionLocalizations',
        'id': localization.id,
        'attributes': <String, Object?>{'whatsNew': whatsNew},
      },
    },
  );
}