public async Task <BaseResponse> CreateHubAsync(string netlifySiteName, string repositoryName, string repositoryId, string deployKeyId, string accesToken, string netlifyCMDCommand, string netlifyDirBuildName) { if (ServiceValidator.ObjectIsNull(netlifySiteName)) { return(new BaseResponse(false, new List <string>() { ServiceValidator.MessageCreator( nameof(NetlifyApiClientService), nameof(CreateHubAsync), nameof(netlifySiteName), "invalid_parameter_is_null") })); } if (ServiceValidator.ObjectIsNull(repositoryName)) { return(new BaseResponse(false, new List <string>() { ServiceValidator.MessageCreator( nameof(NetlifyApiClientService), nameof(CreateHubAsync), nameof(repositoryName), "invalid_parameter_is_null") })); } if (ServiceValidator.ObjectIsNull(repositoryId)) { return(new BaseResponse(false, new List <string>() { ServiceValidator.MessageCreator( nameof(NetlifyApiClientService), nameof(CreateHubAsync), nameof(repositoryId), "invalid_parameter_is_null") })); } if (ServiceValidator.ObjectIsNull(deployKeyId)) { return(new BaseResponse(false, new List <string>() { ServiceValidator.MessageCreator( nameof(NetlifyApiClientService), nameof(CreateHubAsync), nameof(deployKeyId), "invalid_parameter_is_null") })); } if (ServiceValidator.ObjectIsNull(accesToken)) { return(new BaseResponse(false, new List <string>() { ServiceValidator.MessageCreator( nameof(NetlifyApiClientService), nameof(CreateHubAsync), nameof(accesToken), "invalid_parameter_is_null") })); } if (ServiceValidator.ObjectIsNull(netlifyCMDCommand)) { return(new BaseResponse(false, new List <string>() { ServiceValidator.MessageCreator( nameof(NetlifyApiClientService), nameof(CreateHubAsync), nameof(netlifyCMDCommand), "invalid_parameter_is_null") })); } if (ServiceValidator.ObjectIsNull(netlifyDirBuildName)) { return(new BaseResponse(false, new List <string>() { ServiceValidator.MessageCreator( nameof(NetlifyApiClientService), nameof(CreateHubAsync), nameof(netlifyDirBuildName), "invalid_parameter_is_null") })); } try { var result = await client.PostCreateAsync(netlifySiteName, repositoryName, repositoryId, deployKeyId, accesToken, netlifyCMDCommand, netlifyDirBuildName); return(new BaseResponse(true, new List <string>() { result })); } catch (Exception ex) { return(new BaseResponse(false, new List <string>() { ex.Message })); } }
public async Task <BaseResponse> PushDataToHubAsync( string hubId, string accesTokken, IList <string> filePaths, IList <string> fileContents) { if (ServiceValidator.StringIsNullOrEmpty(hubId)) { return(new BaseResponse(false, new List <string>() { ServiceValidator.MessageCreator( nameof(GitLabAPIClientService), nameof(PushDataToHubAsync), nameof(hubId), "invalid_parameter_null_or_empty") })); } if (ServiceValidator.StringIsNullOrEmpty(accesTokken)) { return(new BaseResponse(false, new List <string>() { ServiceValidator.MessageCreator( nameof(GitLabAPIClientService), nameof(PushDataToHubAsync), nameof(accesTokken), "invalid_parameter_null_or_empty") })); } if (ServiceValidator.ObjectIsNull(filePaths)) { return(new BaseResponse(false, new List <string>() { ServiceValidator.MessageCreator( nameof(GitLabAPIClientService), nameof(PushDataToHubAsync), nameof(filePaths), "invalid_parameter_is_null") })); } if (ServiceValidator.ObjectIsNull(fileContents)) { return(new BaseResponse(false, new List <string>() { ServiceValidator.MessageCreator( nameof(GitLabAPIClientService), nameof(PushDataToHubAsync), nameof(fileContents), "invalid_parameter_is_null") })); } try { var result = await client.PushToHubAsync(hubId, accesTokken, filePaths, fileContents); return(new BaseResponse(true)); } catch (Exception ex) { return(new BaseResponse(false, new List <string>() { ex.Message })); } }