Example #1
0
    def deducer(self, email=None, username=None, casing=None):
        """
        Take a username or email address provided as a string and
        attempts to deduce a structured name.

        :var email: It allows you to pass an email address.
        :vartype email: str

        :var username: It allows you to pass a username.
        :vartype username: str

        :var casing: One of: uppercase, lowercase or titlecase.
        :vartype casing: str
        """
        if ((email is None and username is None) or
            (email is not None and username is not None)):
           raise TypeError('deducer() must be passed just one '
                           'of email or username.')

        params = base.get_params(None, locals())
        url = '{0}/{1}'.format(self.get_url(), 'deducer')

        request = http.Request('GET', url, params)

        return request, parsers.parse_json
Example #2
0
    def get(self, queue=None, style=None, prettyPrint=None, countryCode=None):
        """
        Fetch a single object.

        :var queue: Using this parameter notifies FullContact that the
                    query in question will be called later.
        :vartype queue: int

        :var style: The style parameter can be used to control the document
                    structure returned. Only available for email lookups.
        :vartype style: str

        :var prettyPrint: Used to disable prettyprint formatting response
        :vartype prettyPrint: str

        :var countryCode: For phone lookups, it must be passed when using
                          non US/Canada based numbers. Use the ISO-3166
                          two-digit country code. It defaults to US.
        :vartype countryCode: str
        """
        params = base.get_params(None, locals())
        params.update(self.lookup)

        request = http.Request('GET', self.get_url(), params)

        return request, parsers.parse_json
Example #3
0
    def get(self, customer=None, limit=None, ending_before=None,
            starting_after=None):
        """
        Fetch all of the objects.

        :var customer: In the case of upcoming invoices, the customer of the
            upcoming invoice is required. In other cases it is ignored.
        :vartype customer: str

        :var limit: A limit on the number of objects to be returned.
            Count can range between 1 and 100 objects.
        :vartype count: int

        :var ending_before: A cursor (object ID) for use in pagination. Fetched
            objetcs will be newer than the given object.
        :vartype ending_before: str

        :var starting_after: A cursor (object ID) for use in pagination.
            Fetched objetcs will be older than the given object.
        :vartype starting_after: str
        """
        params = base.get_params(None, locals())
        request = http.Request('GET', self.get_url(), params)

        return request, parsers.parse_json
Example #4
0
    def stats(self, name=None, givenName=None, familyName=None, casing=None):
        """
        Determine more about a name.

        :var name: It can be used when you only know a single name and
                   you are uncertain whether it is the given name
                   or family name.
        :vartype name: str

        :var givenName: It can be used when you know that the name
                        is a first name.
        :vartype givenName: str

        :var familyName: It can be used when you know that the name
                         is a last name.
        :vartype familyName: str

        :var casing: One of: uppercase, lowercase or titlecase.
        :vartype casing: str
        """
        if ((name is None and givenName is None and familyName is None) or
            (name is not None and (
                givenName is not None or familyName is not None))):
           raise TypeError('stats() must be passed just one '
                           'of email, givenName or familyName.')

        params = base.get_params(None, locals())
        url = '{0}/{1}'.format(self.get_url(), 'stats')

        request = http.Request('GET', url, params)

        return request, parsers.parse_json
Example #5
0
    def share_counts(self, unit=None, units=None, timezone=None,
                     rollup=None, limit=None, unit_reference_ts=None):
        """
        Returns the number of shares by the authenticated user
        in a given time period.

        :var unit: timspan: minute, hour, day, week or month.
            When unit is minute the maximum value for units is 60.
            if` not indicated, defaults to day.
        :vartype unit: str

        :var units: an integer representing the time units to query data for.
            If -1 is passed, it will return all units of time.
        :vartype units: int

        :var timezone: an integer hour offset from UTC (-14..14) or a timezone
            string. If not indicated, defaults to America/New_York.
        :vartype timezone: str

        :var rollup: returns data for multiple units rolled up to a single
            result instead of a separate value for each period of time.
        :vartype rollup: bool

        :var limit: the number of rows it will return. Default is 100.
        :vartype limit: int

        :var unit_reference_ts: an epoch timestamp, indicating the most recent
            time for which to pull metrics.
            If not indicated, it defaults to now.
        :vartype unit_reference_ts: int
        """
        params = base.get_params(None, locals())
        return self._get('share_counts', params)
Example #6
0
    def get(self, customer=None, count=None, offset=None, ending_before=None,
            starting_after=None):
        """
        Fetch all of the objects.

        :var customer: The identifier of the customer whose invoices to return.
            If none is provided, all invoices will be returned.
        :vartype customer: str
        :var count: A limit on the number of objects to be returned.
            Count can range between 1 and 100 objects.
        :vartype count: int

        :var offset: An offset into your object array. The API will return
            the requested number of objects starting at that offset.
        :vartype offset: int

        :var ending_before: A cursor (object ID) for use in pagination. Fetched
            objetcs will be newer than the given object.
        :vartype ending_before: str

        :var starting_after: A cursor (object ID) for use in pagination.
            Fetched objetcs will be older than the given object.
        :vartype starting_after: str
        """
        params = base.get_params(None, locals())
        request = http.Request('GET', self.get_url(), params)

        return request, parsers.parse_json
Example #7
0
    def create(self, event_name, created_at, user_id=None, email=None,
               metadata=None):
        """
        Create a new Event object.

        :var event_name: The name of the event that occurred.
        :vartype event_name: str

        :var created_at: The time the event occurred as a UTC Unix timestamp.
        :vartype created_at: int

        :var user_id: The user_id of the user which messages should be
            returned. Required if no email.
        :vartype user_id: int

        :var email: The email of the user which messages that should be
            returned. Required if no user_id.
        :vartype email: str

        :var metadata: Optional metadata about the event.
        :vartype metadata: dict
        """
        if not user_id and not email:
            raise TypeError(
                'create() must be passed at least one of user_id, email')

        params = base.get_params(None, locals())
        request = http.Request('POST', self.get_url(), params)

        return request, parsers.parse_empty
Example #8
0
    def get(
        self,
        milestone=None,
        state="open",
        assignee=None,
        mentioned=None,
        labels=None,
        sort="created",
        direction="desc",
        since=None,
    ):
        """
        Fetch issues for this repository based on the filter parameters and
        using the specified format.

        For details on the meanings and allowed values for each parameter, see
        http://developer.github.com/v3/issues/#list-issues-for-a-repository
        """
        url = self.get_url()
        params = base.get_params(
            ("milestone", "state", "assignee", "mentioned", "labels", "sort", "direction", "since", "page", "per_page"),
            locals(),
        )

        headers = resource.mimetype_accept(format)

        return http.Request("GET", url, params, headers), parsers.parse_json
Example #9
0
    def get_auth_url(self, response_type, redirect_uri, scope, state=None,
                     access_type=None, approval_prompt=None, login_hint=None):
        """
        This endpoint is the target of the initial request for an access token.
        It handles active session lookup, authenticating the user, and user
        consent. The result of requests of this endpoint include access tokens,
        refresh tokens, and authorization codes.

        :var response_type: Determines if the Google OAuth 2.0 endpoint returns
            an authorization code. For installed applications, a value of code
            should be used.
        :vartype response_type: str

        :var redirect_uri: One of the redirect_uri values registered at the
            APIs Console. Determines where the response is sent.
            You may choose between urn:ietf:wg:oauth:2.0:oob or an
            http://localhost port.
        :vartype redirect_uri: str

        :var scope: Space delimited set of permissions the application
            requests. Indicates the Google API access your application is
            requesting. The values passed in this parameter inform the consent
            page shown to the user. There is an inverse relationship between
            the number of permissions requested and the likelihood of obtaining
            user consent.
        :vartype scope: str

        :var state: Indicates any state which may be useful to your application
            upon receipt of the response. The Google Authorization Server
            roundtrips this parameter, so your application receives the same
            value it sent.
        :vartype state: str

        :var access_type: online or offline. Indicates if your application
            needs to access a Google API when the user is not present at the
            browser. This parameter defaults to online. If your application
            needs to refresh access tokens when the user is not present at the
            browser, then use offline. This will result in your application
            obtaining a refresh token the first time your application exchanges
            an authorization code for a user.
        :vartype access_type: str

        :var approval_prompt: force or auto. Indicates if the user should be
            re-prompted for consent. The default is auto, so a given user
            should only see the consent page for a given set of scopes the
            first time through the sequence. If the value is force, then the
            user sees a consent page even if they have previously given consent
            to your application for a given set of scopes.
        :vartype approval_prompt: str

        :var login_hint: When your application knows which user it is trying to
            authenticate, it may provide this parameter as a hint to the
            Authentication Server. Passing this hint will either pre-fill the
            email box on the sign-in form or select the proper multi-login
            session, thereby simplifying the login flow.
        :vartype login_hint: str
        """
        params = {'client_id': self.client_id}
        params.update(base.get_params(None, locals()))
        return '{0}?{1}'.format(self.get_url('auth'), urllib.urlencode(params))
Example #10
0
    def get(
        self,
        filter="assigned",
        state="open",
        labels=None,
        sort="created",
        direction="desc",
        since=None,
        format=None,
        page=None,
        per_page=None,
    ):
        """
        Fetch the authenticated user's issues based on the filter parameters,
        and using the specified format.

        For details on the meanings and allowed values for each parameter, see
        http://developer.github.com/v3/issues/#list-issues.
        """
        url = self.get_url()
        params = base.get_params(
            ("filter", "state", "labels", "sort", "direction", "since", "page", "per_page"), locals()
        )

        headers = resource.mimetype_accept(format)

        return http.Request("GET", url, params, headers), parsers.parse_json
Example #11
0
    def public(self, page=None, per_page=None, sort=None):
        """
        Fetch public custom fields.

        :var page: Where should paging start. If left as `None`, the first page
            is returned.
        :vartype page: int

        :var per_page: How many objects sould be returned. If left as `None`,
            10 objects are returned.
        :vartype per_page: int

        :var filter: The kind of fields to return, see upstream
            documentation for possible values.
        :vartype filter: str

        :var sort: How should the returned collection be sorted. Refer to
            upstream documentation for possible values.
        :vartype sort: str
        """
        params = base.get_params(None, locals())
        url = "{0}/public".format(self.get_url())
        request = http.Request("GET", url, params)

        return request, parsers.parse_json
Example #12
0
    def patch(self, obj, alwaysIncludeEmail=None, sendNotifications=None):
        """
        Patch this resource.

        :var obj: a Python object representing the updated resource, usually in
            the same format as returned from `get`. Refer to the upstream
            documentation for details.
        :var alwaysIncludeEmail: Whether to always include a value in the
            "email" field for the organizer, creator and attendees, even
            if no real email is available. The default is False.
        :vartype alwaysIncludeEmail: str
        :var sendNotifications: Whether to send notifications.
            The default is False.
        :vartype sendNotifications: str
        """
        self.require_item()

        params = base.get_params(("alwaysIncludeEmail", "sendNotifications"), locals())
        url = self.get_url()
        if params:
            url += "?" + http.urlencode_any(params)

        request = http.Request("PATCH", url, self.wrap_object(obj))

        return request, parsers.parse_json
Example #13
0
    def get(self, limit=None, offset=None, query=None, lang=None,
            cities=None, domain=None, fields=None):
        """
        Search links receiving clicks across bitly by content, language, location, and more

        :var limit: the maximum number of links to return.
        :vartype limit: int

        :var offset: which result to start with (defaults to 0).
        :vartype offset: int

        :var query: the string to query for.
        :vartype query: str

        :var lang: favor results in this language (two letter ISO code).
        :vartype lang: str

        :var cities: show links active in this city.
        :vartype cities: str

        :var domain: restrict results to this web domain.
        :vartype domain: str

        :var fields: which fields to return in the response (comma-separated).
            May be any of: domain, initial_epoch, h2, h3, site, lastindexed,
            keywords, last_indexed_epoch, title, initial, summaryText, content,
            score, summaryTitle, type, description, cities, lang, url,
            referrer, aggregate_link, lastseen, page, ogtitle aggregate_link.
            By default, all will be returned.
        :vartype fields: str
        """
        params = base.get_params(None, locals())

        request = http.Request('GET', self.get_url(), params)
        return request, parsers.parse_json
Example #14
0
    def get(self, max_results=None, start_index=None, userIp=None,
            quotaUser=None):
        """
        List resource

        :var max-results: The maximum number of rows to include in the response
        :vartype max-results: int

        :var start-index: The first row of data to retrieve, starting at 1.
            Use this parameter as a pagination mechanism along with the
            max-results parameter.
        :vartype start-index: int

        :var userIp: Specifies IP address of the end user for whom the API call
            is being made. Used to cap usage per IP.
        :vartype userIp: str

        :var quotaUser: Alternative to userIp in cases when the user's IP
            address is unknown.
        :vartype quotaUser: str
        """
        params = base.get_params(None, locals(),
                                 translate_param=translate_param)
        request = http.Request('GET', self.get_url(), params)

        return request, parsers.parse_json
Example #15
0
    def get(self, type=None, limit=None, ending_before=None,
            starting_after=None):
        """
        Fetch all of the objects.

        :var type: A string containing a specific event name, or group of
            events using * as a wildcard. The list will be filtered to
            include only events with a matching event property.
        :vartype type: str

        :var limit: A limit on the number of objects to be returned.
            Count can range between 1 and 100 objects.
        :vartype count: int

        :var ending_before: A cursor (object ID) for use in pagination. Fetched
            objetcs will be newer than the given object.
        :vartype ending_before: str

        :var starting_after: A cursor (object ID) for use in pagination.
            Fetched objetcs will be older than the given object.
        :vartype starting_after: str
        """
        params = base.get_params(None, locals())
        request = http.Request('GET', self.get_url(), params)

        return request, parsers.parse_json
Example #16
0
    def export(self, from_date, to_date, event=None, where=None, bucket=None):
        """
        Export raw data from your account.

        Upstream documentation: {0}

        :var from_date: Query start date, in yyyy-mm-dd format.
        :vartype from_date: str

        :var to_date: Query finish date, in yyyy-mm-dd format.
        :vartype to_date: str

        :var event: Optional list of events to export.
        :vartype event: list of str

        :var where: A filter expression.
        :vartype where: str

        :var bucket: Data bucket to query.
        :vartype bucket: str
        """
        params = base.get_params(('from_date', 'to_date',
                                  'event', 'where', 'bucket'),
                                 locals(), resources.serialize_param)

        uri = 'http://data.mixpanel.com/api/2.0/export/'
        request = http.Request('GET', uri, params)

        return request, resources.parse_export
Example #17
0
    def get(self, count=None, max_timestamp=None, min_timestamp=None,
            min_id=None, max_id=None):
        """
        Fetch all of the objects.

        :var count: Count of media to return.
        :vartype count: int

        :var max_timestamp: Return media before this UNIX timestamp.
        :vartype max_timestamp: int

        :var min_timestamp: Return media after this UNIX timestamp.
        :vartype min_timestamp: int

        :var min_id: Return media later than this min_id.
        :vartype min_id: int

        :var max_id: Return media earlier than this max_id.
        :vartype max_id: int
        """
        params = base.get_params(
            ('count', 'max_timestamp', 'min_timestamp', 'min_id', 'max_id'),
            locals())
        request = http.Request('GET', self.get_url(), params)

        return request, parsers.parse_json
Example #18
0
    def get(self, total_count=False, limit=None,
            ending_before=None, starting_after=None):
        """
        Fetch all of the objects.

        :var total_count: Include the total count of all customers.
        :vartype total_count: bool

        :var limit: A limit on the number of objects to be returned.
            Count can range between 1 and 100 objects.
        :vartype count: int

        :var ending_before: A cursor (object ID) for use in pagination. Fetched
            objetcs will be newer than the given object.
        :vartype ending_before: str

        :var starting_after: A cursor (object ID) for use in pagination.
            Fetched objetcs will be older than the given object.
        :vartype starting_after: str
        """
        params = base.get_params(None, locals())
        params.pop('total_count', None)
        if total_count:
            params.update({'include[]': 'total_count'})
        request = http.Request('GET', self.get_url(), params)

        return request, parsers.parse_json
Example #19
0
    def metric_data(self, names, values=None, from_datetime=None,
                    to_datetime=None, summarize=None):
        """
        List of values for each requested metrics.

        :var names: Retrieve specific metrics by name.
        :vartype names: str

        :var values: Retrieve specific metrics values.
        :vartype values: str

        :var from_datetime: Retrieve metrics after this time.
        :vartype from_datetime: str

        :var to_datetime: Retrieve metrics before this time.
        :vartype to_datetime: str

        :var summarize: Sumarize the data.
        :vartype summarize: bool
        """
        params = base.get_params(None, locals())
        if params.get('from_datetime') and params.get('to_datetime'):
            params['from'] = params.pop('from_datetime')
            params['to'] = params.pop('to_datetime')
        url = '{0}/metrics/data.json'.format(self.get_url())
        request = http.Request('GET', url, params)

        return request, parsers.parse_json
Example #20
0
    def get(self, lat=None, max_timestamp=None, min_timestamp=None,
            lng=None, distance=None):
        """
        Fetch all of the objects.

        :var lat: Latitude of the center search coordinate.
            If used, lng is required.
        :vartype lat: float

        :var max_timestamp: A unix timestamp. All media returned will be
            taken later than this timestamp.
        :vartype max_timestamp: int

        :var min_timestamp: A unix timestamp. All media returned will be
            taken earlier than this timestamp.
        :vartype min_timestamp: int

        :var lng: Longitude of the center search coordinate.
            If used, lat is required.
        :vartype lng: float

        :var distance: Default is 1km (distance=1000), max distance is 5km.
        :vartype distance: int
        """
        params = base.get_params(
            ('lat', 'max_timestamp', 'min_timestamp', 'lng', 'distance'),
            locals())
        request = http.Request('GET', self.get_url(), params)

        return request, parsers.parse_json
Example #21
0
    def get(self, lat=None, distance=None, lng=None,
            foursquare_v2_id=None, foursquare_id=None):
        """
        fetch all locations by geographic coordinate.

        :var lat: Latitude of the center search coordinate.
            If used, lng is required.
        :vartype lat: float

        :var distance: Default is 1km (distance=1000), max distance is 5km.
        :vartype distance: int

        :var lng: Longitude of the center search coordinate.
            If used, lat is required.
        :vartype lng: float

        :var foursquare_v2_id: A foursquare v2 api location id.
            If used, you are not required to use lat and ln
        :vartype foursquare_v2_id: str

        :var foursquare_id: A foursquare v1 api location id.
            If used, you are not required to use lat and lng.
            Note that this method is deprecated; you should use the
            new foursquare IDs with V2 of their API.
        :vartype foursquare_id: str
        """
        params = base.get_params(
            ('lat', 'distance', 'lng', 'foursquare_v2_id', 'foursquare_id'),
            locals())
        request = http.Request('GET', self.get_url(), params)

        return request, parsers.parse_json
Example #22
0
    def get(self, total_count=False, count=None, offset=None,
            ending_before=None, starting_after=None):
        """
        Fetch all of the objects.

        :var total_count: Include the total count of all customers.
        :vartype total_count: bool

        :var count: A limit on the number of objects to be returned.
            Count can range between 1 and 100 objects.
        :vartype count: int

        :var offset: An offset into your object array. The API will return
            the requested number of objects starting at that offset.
        :vartype offset: int

        :var ending_before: A cursor (object ID) for use in pagination. Fetched
            objetcs will be newer than the given object.
        :vartype ending_before: str

        :var starting_after: A cursor (object ID) for use in pagination.
            Fetched objetcs will be older than the given object.
        :vartype starting_after: str
        """
        params = {'count': count, 'offset': offset}
        if total_count:
            params.update({'include[]': 'total_count'})
        params = base.get_params(None, params)
        request = http.Request('GET', self.get_url(), params)

        return request, parsers.parse_json
Example #23
0
    def get(self, customer=None, limit=None, ending_before=None,
            starting_after=None):
        """
        Fetch all of the objects.

        :var customer: Only return charges for the customer specified by
            this customer ID.
        :vartype customer: str

        :var limit: A limit on the number of objects to be returned.
            Count can range between 1 and 100 objects.
        :vartype count: int

        :var ending_before: A cursor (object ID) for use in pagination. Fetched
            objetcs will be newer than the given object.
        :vartype ending_before: str

        :var starting_after: A cursor (object ID) for use in pagination.
            Fetched objetcs will be older than the given object.
        :vartype starting_after: str
        """
        params = base.get_params(None, locals())
        request = http.Request('GET', self.get_url(), params)

        return request, parsers.parse_json
Example #24
0
    def referring_domains(self, unit=None, units=None, timezone=None,
                          limit=None, unit_reference_ts=None):
        """
        Returns metrics about the domains referring click traffic
        to a single bitly link.

        :var unit: timspan: minute, hour, day, week or month.
            When unit is minute the maximum value for units is 60.
            if` not indicated, defaults to day.
        :vartype unit: str

        :var units: an integer representing the time units to query data for.
            If -1 is passed, it will return all units of time.
        :vartype units: int

        :var timezone: an integer hour offset from UTC (-14..14) or a timezone
            string. If not indicated, defaults to America/New_York.
        :vartype timezone: str

        :var limit: the number of rows it will return. Default is 100.
        :vartype limit: int

        :var unit_reference_ts: an epoch timestamp, indicating the most recent
            time for which to pull metrics.
            If not indicated, it defaults to now.
        :vartype unit_reference_ts: int
        """
        params = base.get_params(None, locals())
        return self._get('referring_domains', params)
Example #25
0
File: v3.py Project: 80vs90/libsaas
    def get(self, part, id=None, regionCode=None, hl=None):
        """
        Returns a list of categories that can be associated with
        YouTube videos.

        :var part: The part parameter specifies the videoCategory
            resource parts that the API response will include.
            Supported values are id and snippet.
        :vartype part: str

        :var id: The id parameter specifies a comma-separated list
            of video category IDs for the resources that you are retrieving.
        :vartype id: str

        :var regionCode: The regionCode parameter instructs the API to return
            the list of video categories available in the specified country.
            The parameter value is an ISO 3166-1 alpha-2 country code.
        :vartype regionCode: str

        :var hl: The hl parameter specifies the language that should be used
            for text values in the API response. The default value is en_US.
        :vartype hl: str
        """
        params = base.get_params(None, locals())

        request = http.Request('GET', self.get_url(), params)
        return request, parsers.parse_json
Example #26
0
    def popular_links(self, unit=None, units=None, timezone=None,
                  limit=None, unit_reference_ts=None):
        """
        Returns the authenticated user's most-clicked bitly links
        (ordered by number of clicks) in a given time period.

        :var unit: timspan: minute, hour, day, week or month.
            When unit is minute the maximum value for units is 60.
            if` not indicated, defaults to day.
        :vartype unit: str

        :var units: an integer representing the time units to query data for.
            If -1 is passed, it will return all units of time.
        :vartype units: int

        :var timezone: an integer hour offset from UTC (-14..14) or a timezone
            string. If not indicated, defaults to America/New_York.
        :vartype timezone: str

        :var limit: the number of rows it will return. Default is 100.
        :vartype limit: int

        :var unit_reference_ts: an epoch timestamp, indicating the most recent
            time for which to pull metrics.
            If not indicated, it defaults to now.
        :vartype unit_reference_ts: int
        """
        params = base.get_params(None, locals())
        return self._get('popular_links', params)
Example #27
0
    def alias(self, from_user_id, to_user_id, context=None, timestamp=None):
        """
        Identify an user.

        :var from_user_id: The anonymous user's id before they are logged in.
        :vartype from_user_id: str

        :var to_user_id: The identified user's id after they're logged in.
        :vartype to_user_id: str

        :var context: A dictionary of provider specific options.
        :vartype context: dict

        :var timestamp: An ISO 8601 date string representing
        when the identify took place.
        :vartype timestamp: str
        """
        params = {
            'from': from_user_id,
            'to': to_user_id,
        }
        params.update(base.get_params(('context', 'timestamp'), locals()))
        url = '{0}/{1}'.format(self.get_url(), 'alias')

        request = http.Request('POST', url, params)
        return request, parsers.parse_json
Example #28
0
    def get(self, page=None, per_page=None, category=None,
            filter=None, sort=None):
        """
        Fetch suggestions from this user on this forum.

        :var page: Where should paging start. If left as `None`, the first page
            is returned.
        :vartype page: int

        :var per_page: How many objects sould be returned. If left as `None`,
            10 objects are returned.
        :vartype per_page: int

        :var category: Either a category ID, `all` or `uncategorized`. See
            upstream documentation for details.
        :vartype category: str

        :var filter: The kind of suggestions to return, see upstream
            documentation for possible values.
        :vartype filter: str

        :var sort: How should the returned collection be sorted. Refer to
            upstream documentation for possible values.
        :vartype sort: str
        """
        params = base.get_params(None, locals())
        request = http.Request('GET', self.get_url(), params)

        return request, parsers.parse_json
Example #29
0
    def names(self, type, limit=None):
        """
        Fetch the most common events over the last 31 days.
        """
        params = base.get_params(('type', 'limit'), locals(), serialize_param)
        request = http.Request('GET', 'events/names/', params)

        return request, parsers.parse_json
Example #30
0
    def top(self, type, limit=None):
        """
        Fetch the top events for today.
        """
        params = base.get_params(('type', 'limit'), locals(), serialize_param)
        request = http.Request('GET', 'events/top/', params)

        return request, parsers.parse_json
Example #31
0
    def get(self, embed=None, fields=None, per_page=None, page=None):
        """
        Retrieve a paginated list of all companies

        Upstream documentation: http://dev.desk.com/API/companies/#list
        """
        params = base.get_params(None, locals())

        return http.Request('GET', self.get_url(), params), parsers.parse_json
Example #32
0
    def clickrate(self, phrase):
        """
        Returns the click rate for content containing a specified phrase.

        :var phrase: the phrase for which you'd like to get the click rate.
        :vartype phrase: str
        """
        params = base.get_params(None, locals())
        return self._get('clickrate', params)
Example #33
0
    def preferences(self, per_page=None, page=None):
        """
        List all of the user's preferences.

        Upstream documentation: http://dev.desk.com/API/users/#preferences-list
        """
        params = base.get_params(None, locals())
        url = '{0}/{1}'.format(self.get_url(), 'preferences')
        return http.Request('GET', url, params), parsers.parse_json
Example #34
0
    def users(self, per_page=None, page=None):
        """
        Retrieve a paginated list of all users for the given group.

        Upstream documentation: http://dev.desk.com/API/groups#list-users
        """
        params = base.get_params(None, locals())
        url = '{0}/{1}'.format(self.get_url(), 'users')
        return http.Request('GET', url, params), parsers.parse_json
Example #35
0
    def recent(self, page=None, per_page=None):
        """
        Fetch all recent tickets. The parameters are the same as for the `get`
        method.
        """
        url = '{0}/{1}'.format(self.get_url(), 'recent')
        params = base.get_params(('page', 'per_page'), locals())

        return http.Request('GET', url, params), parsers.parse_json
Example #36
0
    def search(self, text=None, topic_ids=None, per_page=None, page=None):
        """
        Perform a search across all public articles.

        Upstream documentation: http://dev.desk.com/API/articles#search
        """
        params = base.get_params(None, locals())
        url = '{0}/{1}'.format(self.get_url(), 'search')
        return http.Request('GET', url, params), parsers.parse_json
Example #37
0
    def users(self):
        """
        Fetch the company's users.
        """
        params = base.get_params(None, locals())
        url = '{0}/{1}/{2}'.format(self.get_url(), self.object_id, 'users')
        request = http.Request('GET', url, params)

        return request, parsers.parse_json
Example #38
0
File: v3.py Project: uberVU/libsaas
    def get(self,
            part,
            id=None,
            mine=None,
            categoryId=None,
            mySubscribers=None,
            maxResults=None,
            pageToken=None):
        """
        Returns a collection of zero or more channel resources that
        match the request criteria.

        :var part: The part parameter specifies a comma-separated list
            of one or more channel resource properties that the API
            response will include. The part names that you can include
            in the parameter value are id, snippet, contentDetails,
            statistics, and topicDetails.
        :vartype part: str

        :var id: The id parameter specifies a comma-separated list of
            the YouTube channel ID(s) for the resource(s) that are
            being retrieved. In a channel resource, the id property
            specifies the channel's YouTube channel ID.
        :vartype id: str

        :var mine: Set this parameter's value to true to instruct the
            API to only return channels owned by the authenticated user.
        :vartype mine: bool

        :var categoryId: The categoryId parameter specifies a
            Freebase topic ID thereby requesting YouTube channels associated
            with that topic. In a channel resource, the
            (key).topicDetails.topicIds[] property identifies the topic IDs
            associated with that channel.
        :vartype categoryId: str

        :var mySubscribers: Set this parameter's value to true to retrieve
            a list of channels that subscribed to the authenticated
            user's channel.
        :vartype mySubscribers: str

        :var maxResults: The maxResults parameter specifies the maximum number
            of items that should be returned in the result set. Acceptable
            values are 0 to 50, inclusive. The default value is 5.
        :vartype maxResults: int

        :var pageToken: The pageToken parameter identifies a specific page in
            the result set that should be returned. In an API response, the
            nextPageToken and prevPageToken properties identify other pages
            that could be retrieved.
        :vartype pageToken: str
        """
        params = base.get_params(None, locals())

        request = http.Request('GET', self.get_url(), params)
        return request, parsers.parse_json
Example #39
0
    def search(self, term, item_type=None, start=None, limit=None):
        """
        Performs a search across the account and returns SearchResults.

        Upstream documentation:
        https://developers.pipedrive.com/v1#methods-SearchResults
        """
        params = base.get_params(None, locals())
        url = '{0}/searchResults'.format(self.get_url())
        return http.Request('GET', url, params), parsers.parse_json
Example #40
0
    def deals(self, start=None, limit=None):
        """
        Returns data about a deals that have a product attached to.

        Upstream documentation:
        https://developers.pipedrive.com/v1#methods-Products
        """
        params = base.get_params(None, locals())
        url = '{0}/deals'.format(self.get_url())
        return http.Request('GET', url, params), parsers.parse_json
Example #41
0
    def get(self, since=None, page=None, per_page=None):
        """
        Fetch the list of activities

        :var since: Timestamp offset in UTC on ISO8601 form %Y-%m-%dT%H:%M:%SZ
        :vartype since: str
        """
        params = base.get_params(('since', 'page', 'per_page'), locals())

        return http.Request('GET', self.get_url(), params), parsers.parse_json
Example #42
0
    def activities(self, start=None, limit=None, done=None, exclude=None):
        """
        Lists activities associated with an organization.

        Upstream documentation:
        https://developers.pipedrive.com/v1#methods-Organizations
        """
        params = base.get_params(None, locals())
        url = '{0}/activities'.format(self.get_url())
        return http.Request('GET', url, params), parsers.parse_json
Example #43
0
    def persons(self, start=None, limit=None):
        """
        Lists the persons of an organization.

        Upstream documentation:
        https://developers.pipedrive.com/v1#methods-Organizations
        """
        params = base.get_params(None, locals())
        url = '{0}/persons'.format(self.get_url())
        return http.Request('GET', url, params), parsers.parse_json
Example #44
0
    def get(self, embed=None, fields=None):
        """
        For single-object resources, fetch the object's data. For collections,
        fetch all of the objects.

        Upstream documentation: http://dev.desk.com/API/using-the-api/
        """
        params = base.get_params(None, locals())

        return http.Request('GET', self.get_url(), params), parsers.parse_json
Example #45
0
    def get(self, event, name, type, unit, interval, values=None, limit=None):
        """
        Fetch data of a single event.
        """
        params = base.get_params(
            ('event', 'name', 'type', 'unit', 'interval', 'values', 'limit'),
            locals(), serialize_param)
        request = http.Request('GET', 'events/properties/', params)

        return request, parsers.parse_json
Example #46
0
    def get(self, start=None, limit=None):
        """
        Returns all products

        Upstream documentation:
        https://developers.pipedrive.com/v1#methods-Products
        """
        params = base.get_params(None, locals())

        return http.Request('GET', self.get_url(), params), parsers.parse_json
Example #47
0
    def updates(self, start=None, limit=None):
        """
        Lists updates about a deal.

        Upstream documentation:
        https://developers.pipedrive.com/v1#methods-Deals
        """
        params = base.get_params(None, locals())
        url = '{0}/updates'.format(self.get_url())
        return http.Request('GET', url, params), parsers.parse_json
Example #48
0
    def files(self, start=None, limit=None):
        """
        Lists files associated with a person.

        Upstream documentation:
        https://developers.pipedrive.com/v1#methods-Persons
        """
        params = base.get_params(None, locals())
        url = '{0}/files'.format(self.get_url())
        return http.Request('GET', url, params), parsers.parse_json
Example #49
0
    def delete(self, ids):
        """
        Marks multiple persons as deleted.

        Upstream documentation:
        https://developers.pipedrive.com/v1#methods-Persons
        """
        params = base.get_params(None, locals())
        request = http.Request('DELETE', self.get_url(), params)
        return request, parsers.parse_json
Example #50
0
    def get(self, type=None):
        """
        Returns all filters.

        Upstream documentation:
        https://developers.pipedrive.com/v1#methods-Filters
        """
        params = base.get_params(None, locals())
        request = http.Request('GET', self.get_url(), params)
        return request, parsers.parse_json
Example #51
0
    def values(self, event, name, limit=None, bucket=None):
        """
        Fetch top values for a property.
        """
        params = base.get_params(('event', 'name', 'limit', 'bucket'),
                                 locals(), serialize_param)

        request = http.Request('GET', 'events/properties/values/', params)

        return request, parsers.parse_json
Example #52
0
    def multiseg(self, event, type, from_date, to_date, inner, outer, limit=None, unit=None):
        """
        Fetch the average of an expression for an event per time unit.
        """
        params = base.get_params(('event', 'type', 'from_date', 'to_date', 'inner', 'outer',
                                  'limit', 'unit'), locals(), serialize_param)

        request = http.Request('GET', 'segmentation/multiseg/', params)

        return request, parsers.parse_json
Example #53
0
    def average(self, event, from_date, to_date, on, unit=None, where=None):
        """
        Fetch the average of an expression for an event per time unit.
        """
        params = base.get_params(('event', 'from_date', 'to_date', 'on',
                                  'unit', 'where'), locals(), serialize_param)

        request = http.Request('GET', 'segmentation/average/', params)

        return request, parsers.parse_json
Example #54
0
    def get(self,
            limit=None,
            offset=None,
            onlyactive=None,
            includedeleted=None):
        params = base.get_params(None,
                                 locals(),
                                 translate_param=resource.translate_param)

        return http.Request('GET', self.get_url(), params), parsers.parse_json
Example #55
0
    def find(self, term):
        """
        Searches all deals by their title.

        Upstream documentation:
        https://developers.pipedrive.com/v1#methods-Deals
        """
        params = base.get_params(None, locals())
        url = '{0}/find'.format(self.get_url())
        return http.Request('GET', url, params), parsers.parse_json
Example #56
0
    def search(self, search=None):
        """
        Search through issues.

        :var search: the query string parameter.
        """
        url = self.get_url()
        params = base.get_params(('search', ), locals())

        return http.Request('GET', url, params), parsers.parse_json
Example #57
0
    def get(self, limit=None, offset=None):
        """
        Returns a list of all contacts.

        Upstream documentation: {0}
        """

        params = base.get_params(None, locals())

        return http.Request('GET', self.get_url(), params), parsers.parse_json
Example #58
0
    def find(self, term, start=None, limit=None):
        """
        Searches all organizations by their name.

        Upstream documentation:
        https://developers.pipedrive.com/v1#methods-Organizations
        """
        params = base.get_params(None, locals())
        url = '{0}/find'.format(self.get_url())
        return http.Request('GET', url, params), parsers.parse_json
Example #59
0
    def merge(self, merge_with_id):
        """
        Merges an organization with another organization.

        Upstream documentation:
        https://developers.pipedrive.com/v1#methods-Organizations
        """
        params = base.get_params(None, locals())
        url = '{0}/merge'.format(self.get_url())
        return http.Request('POST', url, params), parsers.parse_json
Example #60
0
    def results(self, period_start=None, period_end=None):
        """
        Lists results of a specific goal.

        Upstream documentation:
        https://developers.pipedrive.com/v1#methods-Goals
        """
        params = base.get_params(None, locals())
        url = '{0}/results'.format(self.get_url())
        return http.Request('GET', url, params), parsers.parse_json