public static void AddMainHeaders(IRequestContext context, YandexTtsConfig config) { if (!string.IsNullOrWhiteSpace(config.TokenIAM) && !string.IsNullOrWhiteSpace(config.FolderID)) { context.AddHeader(HEAD_AUTH, HEAD_AUTH_BEARER + " " + config.TokenIAM); } else if (!string.IsNullOrWhiteSpace(config.ApiKey)) { context.AddHeader(HEAD_AUTH, HEAD_AUTH_APIKEY + " " + config.ApiKey); } else { throw new YandexTtsServiceException("Параметры авторизации не заданы"); } }
public static void AddFolderParam(IRequestContext context, YandexTtsConfig config) { if (config == null) { throw new ArgumentNullException(nameof(config)); } if (!string.IsNullOrWhiteSpace(config.TokenIAM)) { if (string.IsNullOrWhiteSpace(config.FolderID)) { throw new ArgumentNullException(nameof(config.FolderID)); } context.AddParametr("folderId", config.FolderID); } }