# coding: utf-8

"""
    Cloudsmith API

    The API to the Cloudsmith Service

    OpenAPI spec version: v1
    Contact: <EMAIL>
    Generated by: https://github.com/swagger-api/swagger-codegen.git
"""


from __future__ import absolute_import

import sys
import os
import re

# python 2 and python 3 compatibility library
from six import iteritems

from ..configuration import Configuration
from ..api_client import ApiClient


class BadgesApi(object):
    """
    NOTE: This class is auto generated by the swagger code generator program.
    Do not edit the class manually.
    Ref: https://github.com/swagger-api/swagger-codegen
    """

    def __init__(self, api_client=None):
        config = Configuration()
        if api_client:
            self.api_client = api_client
        else:
            if not config.api_client:
                config.api_client = ApiClient()
            self.api_client = config.api_client

    def badges_version_list(self, owner, repo, package_format, package_name, package_version, package_identifiers, **kwargs):
        """
        Get latest package version for a package or package group.
        Get latest package version for a package or package group.
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.badges_version_list(owner, repo, package_format, package_name, package_version, package_identifiers, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str owner:  (required)
        :param str repo:  (required)
        :param str package_format:  (required)
        :param str package_name:  (required)
        :param str package_version:  (required)
        :param str package_identifiers:  (required)
        :param str badge_token: Badge token to authenticate for private packages
        :param str cache_seconds: Override the shields.io badge cacheSeconds value.
        :param str color: Override the shields.io badge color value.
        :param str label: Override the shields.io badge label value.
        :param str label_color: Override the shields.io badge labelColor value.
        :param str logo_color: Override the shields.io badge logoColor value.
        :param str logo_width: Override the shields.io badge logoWidth value.
        :param bool render: If true, badge will be rendered
        :param bool shields: If true, a shields response will be generated
        :param bool show_latest: If true, for latest version badges a '(latest)' suffix is added
        :param str style: Override the shields.io badge style value.
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.badges_version_list_with_http_info(owner, repo, package_format, package_name, package_version, package_identifiers, **kwargs)
        else:
            (data) = self.badges_version_list_with_http_info(owner, repo, package_format, package_name, package_version, package_identifiers, **kwargs)
            return data

    def badges_version_list_with_http_info(self, owner, repo, package_format, package_name, package_version, package_identifiers, **kwargs):
        """
        Get latest package version for a package or package group.
        Get latest package version for a package or package group.
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.badges_version_list_with_http_info(owner, repo, package_format, package_name, package_version, package_identifiers, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str owner:  (required)
        :param str repo:  (required)
        :param str package_format:  (required)
        :param str package_name:  (required)
        :param str package_version:  (required)
        :param str package_identifiers:  (required)
        :param str badge_token: Badge token to authenticate for private packages
        :param str cache_seconds: Override the shields.io badge cacheSeconds value.
        :param str color: Override the shields.io badge color value.
        :param str label: Override the shields.io badge label value.
        :param str label_color: Override the shields.io badge labelColor value.
        :param str logo_color: Override the shields.io badge logoColor value.
        :param str logo_width: Override the shields.io badge logoWidth value.
        :param bool render: If true, badge will be rendered
        :param bool shields: If true, a shields response will be generated
        :param bool show_latest: If true, for latest version badges a '(latest)' suffix is added
        :param str style: Override the shields.io badge style value.
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['owner', 'repo', 'package_format', 'package_name', 'package_version', 'package_identifiers', 'badge_token', 'cache_seconds', 'color', 'label', 'label_color', 'logo_color', 'logo_width', 'render', 'shields', 'show_latest', 'style']
        all_params.append('callback')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method badges_version_list" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'owner' is set
        if ('owner' not in params) or (params['owner'] is None):
            raise ValueError("Missing the required parameter `owner` when calling `badges_version_list`")
        # verify the required parameter 'repo' is set
        if ('repo' not in params) or (params['repo'] is None):
            raise ValueError("Missing the required parameter `repo` when calling `badges_version_list`")
        # verify the required parameter 'package_format' is set
        if ('package_format' not in params) or (params['package_format'] is None):
            raise ValueError("Missing the required parameter `package_format` when calling `badges_version_list`")
        # verify the required parameter 'package_name' is set
        if ('package_name' not in params) or (params['package_name'] is None):
            raise ValueError("Missing the required parameter `package_name` when calling `badges_version_list`")
        # verify the required parameter 'package_version' is set
        if ('package_version' not in params) or (params['package_version'] is None):
            raise ValueError("Missing the required parameter `package_version` when calling `badges_version_list`")
        # verify the required parameter 'package_identifiers' is set
        if ('package_identifiers' not in params) or (params['package_identifiers'] is None):
            raise ValueError("Missing the required parameter `package_identifiers` when calling `badges_version_list`")


        collection_formats = {}

        path_params = {}
        if 'owner' in params:
            path_params['owner'] = params['owner']
        if 'repo' in params:
            path_params['repo'] = params['repo']
        if 'package_format' in params:
            path_params['package_format'] = params['package_format']
        if 'package_name' in params:
            path_params['package_name'] = params['package_name']
        if 'package_version' in params:
            path_params['package_version'] = params['package_version']
        if 'package_identifiers' in params:
            path_params['package_identifiers'] = params['package_identifiers']

        query_params = []
        if 'badge_token' in params:
            query_params.append(('badge_token', params['badge_token']))
        if 'cache_seconds' in params:
            query_params.append(('cacheSeconds', params['cache_seconds']))
        if 'color' in params:
            query_params.append(('color', params['color']))
        if 'label' in params:
            query_params.append(('label', params['label']))
        if 'label_color' in params:
            query_params.append(('labelColor', params['label_color']))
        if 'logo_color' in params:
            query_params.append(('logoColor', params['logo_color']))
        if 'logo_width' in params:
            query_params.append(('logoWidth', params['logo_width']))
        if 'render' in params:
            query_params.append(('render', params['render']))
        if 'shields' in params:
            query_params.append(('shields', params['shields']))
        if 'show_latest' in params:
            query_params.append(('show_latest', params['show_latest']))
        if 'style' in params:
            query_params.append(('style', params['style']))

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # Authentication setting
        auth_settings = ['apikey']

        return self.api_client.call_api('/badges/version/{owner}/{repo}/{package_format}/{package_name}/{package_version}/{package_identifiers}/', 'GET',
                                        path_params,
                                        query_params,
                                        header_params,
                                        body=body_params,
                                        post_params=form_params,
                                        files=local_var_files,
                                        response_type=None,
                                        auth_settings=auth_settings,
                                        callback=params.get('callback'),
                                        _return_http_data_only=params.get('_return_http_data_only'),
                                        _preload_content=params.get('_preload_content', True),
                                        _request_timeout=params.get('_request_timeout'),
                                        collection_formats=collection_formats)

# coding: utf-8

"""
    Cloudsmith API

    The API to the Cloudsmith Service

    OpenAPI spec version: v1
    Contact: <EMAIL>
    Generated by: https://github.com/swagger-api/swagger-codegen.git
"""


from __future__ import absolute_import

import sys
import os
import re

# python 2 and python 3 compatibility library
from six import iteritems

from ..configuration import Configuration
from ..api_client import ApiClient


class BadgesApi(object):
    """
    NOTE: This class is auto generated by the swagger code generator program.
    Do not edit the class manually.
    Ref: https://github.com/swagger-api/swagger-codegen
    """

    def __init__(self, api_client=None):
        config = Configuration()
        if api_client:
            self.api_client = api_client
        else:
            if not config.api_client:
                config.api_client = ApiClient()
            self.api_client = config.api_client

    def badges_version_list(self, owner, repo, package_format, package_name, package_version, package_identifiers, **kwargs):
        """
        Get latest package version for a package or package group.
        Get latest package version for a package or package group.
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.badges_version_list(owner, repo, package_format, package_name, package_version, package_identifiers, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str owner:  (required)
        :param str repo:  (required)
        :param str package_format:  (required)
        :param str package_name:  (required)
        :param str package_version:  (required)
        :param str package_identifiers:  (required)
        :param str badge_token: Badge token to authenticate for private packages
        :param str cache_seconds: Override the shields.io badge cacheSeconds value.
        :param str color: Override the shields.io badge color value.
        :param str label: Override the shields.io badge label value.
        :param str label_color: Override the shields.io badge labelColor value.
        :param str logo_color: Override the shields.io badge logoColor value.
        :param str logo_width: Override the shields.io badge logoWidth value.
        :param bool render: If true, badge will be rendered
        :param bool shields: If true, a shields response will be generated
        :param bool show_latest: If true, for latest version badges a '(latest)' suffix is added
        :param str style: Override the shields.io badge style value.
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.badges_version_list_with_http_info(owner, repo, package_format, package_name, package_version, package_identifiers, **kwargs)
        else:
            (data) = self.badges_version_list_with_http_info(owner, repo, package_format, package_name, package_version, package_identifiers, **kwargs)
            return data

    def badges_version_list_with_http_info(self, owner, repo, package_format, package_name, package_version, package_identifiers, **kwargs):
        """
        Get latest package version for a package or package group.
        Get latest package version for a package or package group.
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.badges_version_list_with_http_info(owner, repo, package_format, package_name, package_version, package_identifiers, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str owner:  (required)
        :param str repo:  (required)
        :param str package_format:  (required)
        :param str package_name:  (required)
        :param str package_version:  (required)
        :param str package_identifiers:  (required)
        :param str badge_token: Badge token to authenticate for private packages
        :param str cache_seconds: Override the shields.io badge cacheSeconds value.
        :param str color: Override the shields.io badge color value.
        :param str label: Override the shields.io badge label value.
        :param str label_color: Override the shields.io badge labelColor value.
        :param str logo_color: Override the shields.io badge logoColor value.
        :param str logo_width: Override the shields.io badge logoWidth value.
        :param bool render: If true, badge will be rendered
        :param bool shields: If true, a shields response will be generated
        :param bool show_latest: If true, for latest version badges a '(latest)' suffix is added
        :param str style: Override the shields.io badge style value.
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['owner', 'repo', 'package_format', 'package_name', 'package_version', 'package_identifiers', 'badge_token', 'cache_seconds', 'color', 'label', 'label_color', 'logo_color', 'logo_width', 'render', 'shields', 'show_latest', 'style']
        all_params.append('callback')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method badges_version_list" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'owner' is set
        if ('owner' not in params) or (params['owner'] is None):
            raise ValueError("Missing the required parameter `owner` when calling `badges_version_list`")
        # verify the required parameter 'repo' is set
        if ('repo' not in params) or (params['repo'] is None):
            raise ValueError("Missing the required parameter `repo` when calling `badges_version_list`")
        # verify the required parameter 'package_format' is set
        if ('package_format' not in params) or (params['package_format'] is None):
            raise ValueError("Missing the required parameter `package_format` when calling `badges_version_list`")
        # verify the required parameter 'package_name' is set
        if ('package_name' not in params) or (params['package_name'] is None):
            raise ValueError("Missing the required parameter `package_name` when calling `badges_version_list`")
        # verify the required parameter 'package_version' is set
        if ('package_version' not in params) or (params['package_version'] is None):
            raise ValueError("Missing the required parameter `package_version` when calling `badges_version_list`")
        # verify the required parameter 'package_identifiers' is set
        if ('package_identifiers' not in params) or (params['package_identifiers'] is None):
            raise ValueError("Missing the required parameter `package_identifiers` when calling `badges_version_list`")


        collection_formats = {}

        path_params = {}
        if 'owner' in params:
            path_params['owner'] = params['owner']
        if 'repo' in params:
            path_params['repo'] = params['repo']
        if 'package_format' in params:
            path_params['package_format'] = params['package_format']
        if 'package_name' in params:
            path_params['package_name'] = params['package_name']
        if 'package_version' in params:
            path_params['package_version'] = params['package_version']
        if 'package_identifiers' in params:
            path_params['package_identifiers'] = params['package_identifiers']

        query_params = []
        if 'badge_token' in params:
            query_params.append(('badge_token', params['badge_token']))
        if 'cache_seconds' in params:
            query_params.append(('cacheSeconds', params['cache_seconds']))
        if 'color' in params:
            query_params.append(('color', params['color']))
        if 'label' in params:
            query_params.append(('label', params['label']))
        if 'label_color' in params:
            query_params.append(('labelColor', params['label_color']))
        if 'logo_color' in params:
            query_params.append(('logoColor', params['logo_color']))
        if 'logo_width' in params:
            query_params.append(('logoWidth', params['logo_width']))
        if 'render' in params:
            query_params.append(('render', params['render']))
        if 'shields' in params:
            query_params.append(('shields', params['shields']))
        if 'show_latest' in params:
            query_params.append(('show_latest', params['show_latest']))
        if 'style' in params:
            query_params.append(('style', params['style']))

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # Authentication setting
        auth_settings = ['apikey']

        return self.api_client.call_api('/badges/version/{owner}/{repo}/{package_format}/{package_name}/{package_version}/{package_identifiers}/', 'GET',
                                        path_params,
                                        query_params,
                                        header_params,
                                        body=body_params,
                                        post_params=form_params,
                                        files=local_var_files,
                                        response_type=None,
                                        auth_settings=auth_settings,
                                        callback=params.get('callback'),
                                        _return_http_data_only=params.get('_return_http_data_only'),
                                        _preload_content=params.get('_preload_content', True),
                                        _request_timeout=params.get('_request_timeout'),
                                        collection_formats=collection_formats)

# coding: utf-8 Cloudsmith API      The API to the Cloudsmith Service      OpenAPI spec version: v1     Contact: <EMAIL>     Generated by: https://github.com/swagger-api/swagger-codegen.git # python 2 and python 3 compatibility library NOTE: This class is auto generated by the swagger code generator program.     Do not edit the class manually.     Ref: https://github.com/swagger-api/swagger-codegen Get latest package version for a package or package group.         Get latest package version for a package or package group.         This method makes a synchronous HTTP request by default. To make an         asynchronous HTTP request, please define a `callback` function         to be invoked when receiving the response.         >>> def callback_function(response):         >>>     pprint(response)         >>>         >>> thread = api.badges_version_list(owner, repo, package_format, package_name, package_version, package_identifiers, callback=callback_function)          :param callback function: The callback function             for asynchronous request. (optional)         :param str owner:  (required)         :param str repo:  (required)         :param str package_format:  (required)         :param str package_name:  (required)         :param str package_version:  (required)         :param str package_identifiers:  (required)         :param str badge_token: Badge token to authenticate for private packages         :param str cache_seconds: Override the shields.io badge cacheSeconds value.         :param str color: Override the shields.io badge color value.         :param str label: Override the shields.io badge label value.         :param str label_color: Override the shields.io badge labelColor value.         :param str logo_color: Override the shields.io badge logoColor value.         :param str logo_width: Override the shields.io badge logoWidth value.         :param bool render: If true, badge will be rendered         :param bool shields: If true, a shields response will be generated         :param bool show_latest: If true, for latest version badges a '(latest)' suffix is added         :param str style: Override the shields.io badge style value.         :return: None                  If the method is called asynchronously,                  returns the request thread. Get latest package version for a package or package group.         Get latest package version for a package or package group.         This method makes a synchronous HTTP request by default. To make an         asynchronous HTTP request, please define a `callback` function         to be invoked when receiving the response.         >>> def callback_function(response):         >>>     pprint(response)         >>>         >>> thread = api.badges_version_list_with_http_info(owner, repo, package_format, package_name, package_version, package_identifiers, callback=callback_function)          :param callback function: The callback function             for asynchronous request. (optional)         :param str owner:  (required)         :param str repo:  (required)         :param str package_format:  (required)         :param str package_name:  (required)         :param str package_version:  (required)         :param str package_identifiers:  (required)         :param str badge_token: Badge token to authenticate for private packages         :param str cache_seconds: Override the shields.io badge cacheSeconds value.         :param str color: Override the shields.io badge color value.         :param str label: Override the shields.io badge label value.         :param str label_color: Override the shields.io badge labelColor value.         :param str logo_color: Override the shields.io badge logoColor value.         :param str logo_width: Override the shields.io badge logoWidth value.         :param bool render: If true, badge will be rendered         :param bool shields: If true, a shields response will be generated         :param bool show_latest: If true, for latest version badges a '(latest)' suffix is added         :param str style: Override the shields.io badge style value.         :return: None                  If the method is called asynchronously,                  returns the request thread. # verify the required parameter 'owner' is set # verify the required parameter 'repo' is set # verify the required parameter 'package_format' is set # verify the required parameter 'package_name' is set # verify the required parameter 'package_version' is set # verify the required parameter 'package_identifiers' is set # Authentication setting