public override int GetHashCode() { int hash = 1; if (updateMask_ != null) { hash ^= UpdateMask.GetHashCode(); } if (policyValidationParameter_ != null) { hash ^= PolicyValidationParameter.GetHashCode(); } if (operationCase_ == OperationOneofCase.Create) { hash ^= Create.GetHashCode(); } if (operationCase_ == OperationOneofCase.Update) { hash ^= Update.GetHashCode(); } if (operationCase_ == OperationOneofCase.Remove) { hash ^= Remove.GetHashCode(); } hash ^= (int)operationCase_; if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public void MergeFrom(AdGroupAdOperation other) { if (other == null) { return; } if (other.updateMask_ != null) { if (updateMask_ == null) { updateMask_ = new global::Google.Protobuf.WellKnownTypes.FieldMask(); } UpdateMask.MergeFrom(other.UpdateMask); } if (other.policyValidationParameter_ != null) { if (policyValidationParameter_ == null) { policyValidationParameter_ = new global::Google.Ads.GoogleAds.V0.Common.PolicyValidationParameter(); } PolicyValidationParameter.MergeFrom(other.PolicyValidationParameter); } switch (other.OperationCase) { case OperationOneofCase.Create: if (Create == null) { Create = new global::Google.Ads.GoogleAds.V0.Resources.AdGroupAd(); } Create.MergeFrom(other.Create); break; case OperationOneofCase.Update: if (Update == null) { Update = new global::Google.Ads.GoogleAds.V0.Resources.AdGroupAd(); } Update.MergeFrom(other.Update); break; case OperationOneofCase.Remove: Remove = other.Remove; break; } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); }
/// <summary> /// Sends exemption requests for creating an expanded text ad. /// </summary> /// <param name="customerId">The customer ID for which the call is made.</param> /// <param name="service">The ad group ad service.</param> /// <param name="operation">The ad group ad operation to request exemption for.</param> /// <param name="ignorablePolicyTopics">The ignorable policy topics.</param> private static void RequestExemption(long customerId, AdGroupAdServiceClient service, AdGroupAdOperation operation, string[] ignorablePolicyTopics) { Console.WriteLine("Try adding an expanded text ad again by requesting exemption for " + "its policy violations."); PolicyValidationParameter validationParameter = new PolicyValidationParameter(); validationParameter.IgnorablePolicyTopics.AddRange(ignorablePolicyTopics); operation.PolicyValidationParameter = validationParameter; MutateAdGroupAdsResponse response = service.MutateAdGroupAds( customerId.ToString(), new[] { operation }); Console.WriteLine($"Successfully added an expanded text ad with resource name " + $"'{response.Results[0].ResourceName}' by requesting for policy violation " + $"exemption."); }
/// <summary> /// Sends exemption requests for creating a keyword. /// </summary> /// <param name="customerId">The customer ID for which the call is made.</param> /// <param name="service">The ad group criterion service.</param> /// <param name="operation">The ad group criterion operation to request exemption for. /// </param> /// <param name="exemptPolicyViolationKeys">The exemptable policy violation keys.</param> private static void RequestExemption( long customerId, AdGroupCriterionServiceClient service, AdGroupCriterionOperation operation, PolicyViolationKey[] exemptPolicyViolationKeys) { Console.WriteLine("Try adding a keyword again by requesting exemption for its policy " + "violations."); PolicyValidationParameter validationParameter = new PolicyValidationParameter(); validationParameter.ExemptPolicyViolationKeys.AddRange(exemptPolicyViolationKeys); operation.ExemptPolicyViolationKeys.AddRange(exemptPolicyViolationKeys); MutateAdGroupCriteriaResponse response = service.MutateAdGroupCriteria( customerId.ToString(), new[] { operation }); Console.WriteLine($"Successfully added a keyword with resource name " + $"'{response.Results[0].ResourceName}' by requesting for policy violation " + $"exemption."); }