{
    "content": [
        {
            "type": "text",
            "text": "# Net::Twitter::Role::RateLimit (perldoc)\n\n## NAME\n\nNet::Twitter::Role::RateLimit - Rate limit features for Net::Twitter\n\n## SYNOPSIS\n\nuse Net::Twitter;\nmy $nt = Net::Twitter->new(\ntraits => [qw/API::REST RateLimit/],\n%otheroptions,\n);\n#...later\nsleep $nt->untilrate(1.0) || $minimumwait;\nNOTE!\nRateLimit only works with Twitter API v1. The rate limiting strategy of Twitter API v1.1 is very\ndifferent. A v1.1 compatible RateLimit role may be coming, but isn't available, yet. It's\ninterface will necessarily be different.\n\n## DESCRIPTION\n\nThis provides utility methods that return information about the current rate limit status.\n\n## Sections\n\n- **NAME**\n- **VERSION**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **METHODS** (1 subsections)\n- **AUTHOR**\n- **LICENSE**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "Net::Twitter::Role::RateLimit",
        "section": "",
        "mode": "perldoc",
        "summary": "Net::Twitter::Role::RateLimit - Rate limit features for Net::Twitter",
        "synopsis": "use Net::Twitter;\nmy $nt = Net::Twitter->new(\ntraits => [qw/API::REST RateLimit/],\n%otheroptions,\n);\n#...later\nsleep $nt->untilrate(1.0) || $minimumwait;\nNOTE!\nRateLimit only works with Twitter API v1. The rate limiting strategy of Twitter API v1.1 is very\ndifferent. A v1.1 compatible RateLimit role may be coming, but isn't available, yet. It's\ninterface will necessarily be different.",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "VERSION",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 15,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "METHODS",
                "lines": 29,
                "subsections": [
                    {
                        "name": "until_rate",
                        "lines": 16
                    }
                ]
            },
            {
                "name": "AUTHOR",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "LICENSE",
                "lines": 5,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "Net::Twitter::Role::RateLimit - Rate limit features for Net::Twitter\n",
                "subsections": []
            },
            "VERSION": {
                "content": "version 4.01043\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "use Net::Twitter;\nmy $nt = Net::Twitter->new(\ntraits => [qw/API::REST RateLimit/],\n%otheroptions,\n);\n\n#...later\n\nsleep $nt->untilrate(1.0) || $minimumwait;\n\nNOTE!\nRateLimit only works with Twitter API v1. The rate limiting strategy of Twitter API v1.1 is very\ndifferent. A v1.1 compatible RateLimit role may be coming, but isn't available, yet. It's\ninterface will necessarily be different.\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "This provides utility methods that return information about the current rate limit status.\n",
                "subsections": []
            },
            "METHODS": {
                "content": "If current rate limit data is not resident, these methods will force a call to\n\"ratelimitstatus\". Therefore, any of these methods can throw an error.\n\nrateremaining\nReturns the number of API calls available before the next reset.\n\nratereset\nReturns the Unix epoch time of the next reset.\n\nratelimit\nReturns the current hourly rate limit.\n\nrateratio\nReturns remaining API call limit, divided by the time remaining before the next reset, as a\nratio of the total rate limit per hour.\n\nFor example, if \"ratelimit\" is 150, the total rate is 150 API calls per hour. If\n\"rateremaining\" is 75, and there 1800 seconds (1/2 hour) remaining before the next reset,\n\"rateratio\" returns 1.0, because there are exactly enough API calls remaining to maintain\nhe full rate of 150 calls per hour.\n\nIf \"rateremaining\" is 30 and there are 360 seconds remaining before reset, \"rateratio\"\nreturns 2.0, because there are enough API calls remaining to maintain twice the full rate of\n150 calls per hour.\n\nAs a final example, if \"rateremaining\" is 15, and there are 7200 seconds remaining before\nreset, \"rateratio\" returns 0.5, because there are only enough API calls remaining to\nmaintain half the full rate of 150 calls per hour.\n",
                "subsections": [
                    {
                        "name": "until_rate",
                        "content": "Returns the number of seconds to wait before making another rate limited API call such that\n$targetratio of the full rate would be available. It always returns a number greater than,\nor equal to zero.\n\nUse a target rate of 1.0 in a timeline polling loop to get a steady polling rate, using all\nthe allocated calls, and adjusted for other API calls as they occur.\n\nUse a target rate < 1.0 to allow a process to make calls as fast as possible but not consume\nall of the calls available, too soon. For example, if you have a process building a large\nsocial graph, you may want to allow it make as many calls as possible, with no wait, until\n20% of the available rate remains. Use a value of 0.2 for that purpose.\n\nA target rate > than 1.0 can be used for a process that should only use \"extra\" available\nAPI calls. This is useful for an application that requires most of it's rate limit for\nnormal operation.\n"
                    }
                ]
            },
            "AUTHOR": {
                "content": "Marc Mims <marc@questright.com>\n",
                "subsections": []
            },
            "LICENSE": {
                "content": "Copyright (c) 2016 Marc Mims\n\nThis library is free software; you can redistribute it and/or modify it under the same terms as\nPerl itself.\n",
                "subsections": []
            }
        }
    }
}