<commit_before>package com.datasift.client.managedsource.sources;

import com.datasift.client.DataSiftConfig;
import com.datasift.client.managedsource.ManagedDataSourceType;

/**
 * @author <NAME> <<EMAIL>>
 */
public class GooglePlus extends BaseSource<GooglePlus> {
    public GooglePlus(DataSiftConfig config) {
        super(config, ManagedDataSourceType.GOOGLE_PLUS);
    }

    public GooglePlus setParams(boolean enableComments, boolean enablePlusOnes) {
        return enableComments(enableComments).enablePlusOnes(enablePlusOnes);
    }

    /**
     * set to true, if you want to receive comment interactions.
     *
     * @return this
     */
    public GooglePlus enableComments(boolean enabled) {
        return setParametersField("comments", enabled);
    }

    /**
     * set to true, if you want to receive +1 interactions.
     *
     * @return this
     */
    public GooglePlus enablePlusOnes(boolean enabled) {
        return setParametersField("plus_ones", enabled);
    }

    public GooglePlus addResource(Type type, String userId) {
        ResourceParams parameterSet = newResourceParams();
        switch (type) {
            case PUBLIC_ACTIVITIES:
                parameterSet.set("type", "public_activities");
                break;
            case PEOPLE_UPDATES:
                if (userId == null || userId.isEmpty()) {
                    throw new IllegalArgumentException("If type is people_updates then userId is required");
                }
                parameterSet.set("type", "people_updates");
                parameterSet.set("user_id", userId);
                parameterSet.set("event_types", "activities"); //activities is currently the only support event type
                break;
            default:
                throw new IllegalArgumentException("Unsupported type");
        }
        return this;
    }

    /**
     * Adds an OAuth token to the managed source
     *<commit_msg>#68 send event_types as an array not a string<commit_after>package com.datasift.client.managedsource.sources;

import com.datasift.client.DataSiftConfig;
import com.datasift.client.managedsource.ManagedDataSourceType;

import java.util.ArrayList;

/**
 * @author <NAME> <<EMAIL> <EMAIL>>
 */
public class GooglePlus extends BaseSource<GooglePlus> {
    public GooglePlus(DataSiftConfig config) {
        super(config, ManagedDataSourceType.GOOGLE_PLUS);
    }

    public GooglePlus setParams(boolean enableComments, boolean enablePlusOnes) {
        return enableComments(enableComments).enablePlusOnes(enablePlusOnes);
    }

    /**
     * set to true, if you want to receive comment interactions.
     *
     * @return this
     */
    public GooglePlus enableComments(boolean enabled) {
        return setParametersField("comments", enabled);
    }

    /**
     * set to true, if you want to receive +1 interactions.
     *
     * @return this
     */
    public GooglePlus enablePlusOnes(boolean enabled) {
        return setParametersField("plus_ones", enabled);
    }

    public GooglePlus addResource(Type type, String userId) {
        ResourceParams parameterSet = newResourceParams();
        switch (type) {
            case PUBLIC_ACTIVITIES:
                parameterSet.set("type", "public_activities");
                break;
            case PEOPLE_UPDATES:
                if (userId == null || userId.isEmpty()) {
                    throw new IllegalArgumentException("If type is people_updates then userId is required");
                }
                parameterSet.set("type", "people_updates");
                parameterSet.set("user_id", userId);
                parameterSet.set("event_types", new ArrayList<String>() {
                    {
                        //activities is currently the only supported event type
                        add("activities");
                    }
                });
                break;
            default:
                throw new IllegalArgumentException("Unsupported type");
        }
        return this;
    }

    /**
     * Adds an OAuth token to the managed source
     *
{'fraction_non_alphanumeric': 0.0905982905982906, 'fraction_numerical': 0.0009768009768009768, 'mean_word_length': 2.268954509177973, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5528990', 'n_tokens_mistral': 1065, 'n_tokens_neox': 1016, 'n_words': 267}