Get a list of Feed Item Ids used by a campaign via a given Campaign Feed.

  Args:
    client: an AdWordsClient instance.
    feed: a Campaign Feed.
    placeholder_type: the Placeholder Type.

  Returns:
    A list of Feed Item Ids.

def GetCampaignFeeds(client, feed, placeholder_type):
  """Get a list of Feed Item Ids used by a campaign via a given Campaign Feed.

  Args:
    client: an AdWordsClient instance.
    feed: a Campaign Feed.
    placeholder_type: the Placeholder Type.

  Returns:
    A list of Feed Item Ids.
  """
  campaign_feed_service = client.GetService('CampaignFeedService', 'v201809')

  campaign_feeds = []
  more_pages = True

  selector = {
      'fields': ['CampaignId', 'MatchingFunction', 'PlaceholderTypes'],
      'predicates': [
          {
              'field': 'Status',
              'operator': 'EQUALS',
              'values': ['ENABLED']
          },
          {
              'field': 'FeedId',
              'operator': 'EQUALS',
              'values': [feed['id']]
          },
          {
              'field': 'PlaceholderTypes',
              'operator': 'CONTAINS_ANY',
              'values': [placeholder_type]
          }
      ],
      'paging': {
          'startIndex': 0,
          'numberResults': PAGE_SIZE
      }
  }

  while more_pages:
    page = campaign_feed_service.get(selector)

    if 'entries' in page:
      campaign_feeds.extend(page['entries'])

    selector['paging']['startIndex'] += PAGE_SIZE
    more_pages = selector['paging']['startIndex'] < int(page['totalNumEntries'])

  return campaign_feeds