コード例 #1
0
        /// <summary>
        /// Run the code example.
        /// </summary>
        /// <param name="user">The Dfa user object running the code example.
        /// </param>
        public override void Run(DfaUser user)
        {
            // Create CreativeGroupRemoteService instance.
            CreativeGroupRemoteService service = (CreativeGroupRemoteService)user.GetService(
                DfaService.v1_20.CreativeGroupRemoteService);

            long   advertiserId      = long.Parse(_T("INSERT_ADVERTISER_ID_HERE"));
            int    groupNumber       = int.Parse(_T("INSERT_GROUP_NUMBER_HERE"));
            string creativeGroupName = _T("INSERT_CREATIVE_GROUP_NAME_HERE");

            // Create creative group structure.
            CreativeGroup creativeGroup = new CreativeGroup();

            creativeGroup.id           = -1;
            creativeGroup.name         = creativeGroupName;
            creativeGroup.groupNumber  = groupNumber;
            creativeGroup.advertiserId = advertiserId;

            try {
                // Create creative group.
                CreativeGroupSaveResult creativeGroupSaveResult = service.saveCreativeGroup(creativeGroup);

                // Display new creative group id.
                Console.WriteLine("Creative group with id \"{0}\" was created.",
                                  creativeGroupSaveResult.id);
            } catch (Exception e) {
                Console.WriteLine("Failed to create creative group. Exception says \"{0}\"",
                                  e.Message);
            }
        }
    /// <summary>
    /// Run the code example.
    /// </summary>
    /// <param name="service">An initialized Dfa Reporting service object
    /// </param>
    public override void Run(DfareportingService service) {
      int groupNumber = int.Parse(_T("INSERT_GROUP_NUMBER_HERE"));
      long advertiserId = long.Parse(_T("INSERT_ADVERTISER_ID_HERE"));
      long profileId = long.Parse(_T("INSERT_USER_PROFILE_ID_HERE"));

      string creativeGroupName = _T("INSERT_CREATIVE_GROUP_NAME_HERE");

      // Create the creative group.
      CreativeGroup creativeGroup = new CreativeGroup();
      creativeGroup.Name = creativeGroupName;
      creativeGroup.GroupNumber = groupNumber;
      creativeGroup.AdvertiserId = advertiserId;

      // Insert the creative group.
      CreativeGroup result =
          service.CreativeGroups.Insert(creativeGroup, profileId).Execute();

      // Display the new creative group ID.
      Console.WriteLine("Creative group with ID {0} was created.", result.Id);
    }
コード例 #3
0
        /// <summary>
        /// Run the code example.
        /// </summary>
        /// <param name="service">An initialized Dfa Reporting service object
        /// </param>
        public override void Run(DfareportingService service)
        {
            int  groupNumber  = int.Parse(_T("INSERT_GROUP_NUMBER_HERE"));
            long advertiserId = long.Parse(_T("INSERT_ADVERTISER_ID_HERE"));
            long profileId    = long.Parse(_T("INSERT_USER_PROFILE_ID_HERE"));

            string creativeGroupName = _T("INSERT_CREATIVE_GROUP_NAME_HERE");

            // Create the creative group.
            CreativeGroup creativeGroup = new CreativeGroup();

            creativeGroup.Name         = creativeGroupName;
            creativeGroup.GroupNumber  = groupNumber;
            creativeGroup.AdvertiserId = advertiserId;

            // Insert the creative group.
            CreativeGroup result =
                service.CreativeGroups.Insert(creativeGroup, profileId).Execute();

            // Display the new creative group ID.
            Console.WriteLine("Creative group with ID {0} was created.", result.Id);
        }
コード例 #4
0
        /// <summary>
        /// Inserts a new creative group.
        /// Documentation https://developers.google.com/dfareporting/v2.7/reference/creativeGroups/insert
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated dfareporting service.</param>
        /// <param name="profileId">User profile ID associated with this request.</param>
        /// <param name="body">A valid dfareporting v2.7 body.</param>
        /// <returns>CreativeGroupResponse</returns>
        public static CreativeGroup Insert(dfareportingService service, string profileId, CreativeGroup body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (profileId == null)
                {
                    throw new ArgumentNullException(profileId);
                }

                // Make the request.
                return(service.CreativeGroups.Insert(body, profileId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request CreativeGroups.Insert failed.", ex);
            }
        }