<commit_before>import * as twitter from '../apis/twitter';

import {
    graphql,
    GraphQLSchema,
    GraphQLObjectType,
    GraphQLString,
    GraphQLNonNull,
    GraphQLEnumType,
    GraphQLInt,
    GraphQLList,
    GraphQLUnionType,
} from 'graphql';

let UserType = new GraphQLObjectType({

    name: 'TwitterUser',
    description: 'Twitter user, or as we like to say in France: a \'tweetos\'',
    fields: () => ({
        created_at: { type: GraphQLString },
        description: { type: GraphQLString },
        id: { type: GraphQLInt },
        screen_name: { type: GraphQLString },
        name: { type: GraphQLString },
        profile_image_url: { type: GraphQLString },
        url: { type: GraphQLString },
        tweets_count: { 
            type: GraphQLInt,
            resolve: ({ statuses_count: tweets_count }) => tweets_count
        },
        followers_count: { type: GraphQLInt },
        tweets: {
            type: new GraphQLList(TweetType),
            description: 'Get a list of tweets for current user',
            args: {
                limit: { type: GraphQLInt }
            },

            //             user            args
            resolve: ({ id: userId }, { limit = 10 }) => twitter.getTweets(userId, limit)
        }
    })

});

let TweetType = new GraphQLObjectType({

    name: 'Tweet',
    description: 'A tweet object',
    fields: () => ({
        id: { type: GraphQLString },
        created_at: { type: GraphQLString },
        user_screen_name: {
            type: GraphQLString,
            resolve: ({ user: { screen_name: user_screen_name } }) => user_screen_name
        },
        user_id: {
            type: GraphQLInt,
            resolve: ({ user: { id: user_id } }) => user_id
        },
        text: { type: GraphQLString },
        retweet_count: { type: GraphQLInt },
        retweets: {
            type: new GraphQLList(RetweetType),
            description: 'Get a list of retweets',
            args: {
                limit: { type: GraphQLInt }
            },
            resolve: ({ id: tweetId }, { limit = 5 }) => twitter.getRetweets(tweetId, limit)
        }
    })
});

let RetweetType = new GraphQLObjectType({

    name: 'Retweet',
    description: 'Retweet of a tweet',
    fields: () => ({
        id: { type: GraphQLString },
        created_at: { type: GraphQLString },
        in_reply_to_tweet_id: {
            type: GraphQLString,
            resolve: ({ in_reply_to_status_id: in_reply_to_tweet_id }) => in_reply_to_tweet_id
        },
        in_reply_to_user_id: { type: GraphQLInt },<commit_msg>use string id_str to get retweets<commit_after>import * as twitter from '../apis/twitter';

import {
    graphql,
    GraphQLSchema,
    GraphQLObjectType,
    GraphQLString,
    GraphQLNonNull,
    GraphQLEnumType,
    GraphQLInt,
    GraphQLList,
    GraphQLUnionType,
} from 'graphql';

let UserType = new GraphQLObjectType({

    name: 'TwitterUser',
    description: 'Twitter user, or as we like to say in France: a \'tweetos\'',
    fields: () => ({
        created_at: { type: GraphQLString },
        description: { type: GraphQLString },
        id: { type: GraphQLInt },
        screen_name: { type: GraphQLString },
        name: { type: GraphQLString },
        profile_image_url: { type: GraphQLString },
        url: { type: GraphQLString },
        tweets_count: { 
            type: GraphQLInt,
            resolve: ({ statuses_count: tweets_count }) => tweets_count
        },
        followers_count: { type: GraphQLInt },
        tweets: {
            type: new GraphQLList(TweetType),
            description: 'Get a list of tweets for current user',
            args: {
                limit: { type: GraphQLInt }
            },

            //             user            args
            resolve: ({ id: userId }, { limit = 10 }) => twitter.getTweets(userId, limit)
        }
    })

});

let TweetType = new GraphQLObjectType({

    name: 'Tweet',
    description: 'A tweet object',
    fields: () => ({
        id: { type: GraphQLString },
        id_str: { type: GraphQLString },
        created_at: { type: GraphQLString },
        user_screen_name: {
            type: GraphQLString,
            resolve: ({ user: { screen_name: user_screen_name } }) => user_screen_name
        },
        user_id: {
            type: GraphQLInt,
            resolve: ({ user: { id: user_id } }) => user_id
        },
        text: { type: GraphQLString },
        retweet_count: { type: GraphQLInt },
        retweets: {
            type: new GraphQLList(RetweetType),
            description: 'Get a list of retweets',
            args: {
                limit: { type: GraphQLInt }
            },
            resolve: ({ id_str: tweetId }, { limit = 5 }) => twitter.getRetweets(tweetId, limit)
        }
    })
});

let RetweetType = new GraphQLObjectType({

    name: 'Retweet',
    description: 'Retweet of a tweet',
    fields: () => ({
        id: { type: GraphQLString },
        created_at: { type: GraphQLString },
        in_reply_to_tweet_id: {
            type: GraphQLString,
            resolve: ({ in_reply_to_status_id: in_reply_to_tweet_id }) => in_reply_to_tweet_id
        },
        in_reply_to_user_id: { type: GraphQLInt },
{'fraction_non_alphanumeric': 0.1167396686345458, 'fraction_numerical': 0.0011426394972386211, 'mean_word_length': 1.9588732394366197, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4898637', 'n_tokens_mistral': 1603, 'n_tokens_neox': 1576, 'n_words': 372}