# -*- coding: utf-8 -*-

"""
instagramapi

This file was automatically generated by APIMATIC v3.0 (
 https://www.apimatic.io ).
"""

from apimatic_core.authentication.query_auth import QueryAuth


class ApiKey(QueryAuth):

    @property
    def error_message(self):
        """Display error message on occurrence of authentication failure
        in ApiKey

        """
        return "ApiKey: access_token is undefined."

    def __init__(self, api_key_credentials):
        auth_params = {}
        if api_key_credentials is not None \
                and api_key_credentials.access_token is not None:
            auth_params["access_token"] = api_key_credentials.access_token
        super().__init__(auth_params=auth_params)


class ApiKeyCredentials:

    @property
    def access_token(self):
        return self._access_token

    def __init__(self, access_token):
        if access_token is None:
            raise ValueError('access_token cannot be None')
        self._access_token = access_token

    def clone_with(self, access_token=None):
        return ApiKeyCredentials(access_token or self.access_token)
