├── .coveragerc ├── .gitignore ├── LICENSE ├── MANIFEST.in ├── README.md ├── digikey ├── __init__.py ├── constants.py ├── decorators.py ├── exceptions.py ├── oauth │ ├── __init__.py │ └── oauth2.py ├── utils.py └── v3 │ ├── __init__.py │ ├── api.py │ ├── batchproductdetails │ ├── __init__.py │ ├── api │ │ ├── __init__.py │ │ └── batch_search_api.py │ ├── api_client.py │ ├── configuration.py │ ├── models │ │ ├── __init__.py │ │ ├── api_error_response.py │ │ ├── api_validation_error.py │ │ ├── associated_product.py │ │ ├── basic_product.py │ │ ├── batch_product_details_request.py │ │ ├── batch_product_details_response.py │ │ ├── iso_search_locale.py │ │ ├── kit_part.py │ │ ├── limited_taxonomy.py │ │ ├── media_links.py │ │ ├── pid_vid.py │ │ ├── price_break.py │ │ └── product_details.py │ └── rest.py │ ├── ordersupport │ ├── __init__.py │ ├── api │ │ ├── __init__.py │ │ └── order_details_api.py │ ├── api_client.py │ ├── configuration.py │ ├── models │ │ ├── __init__.py │ │ ├── address.py │ │ ├── api_error_response.py │ │ ├── api_validation_error.py │ │ ├── back_order_details.py │ │ ├── default_shipping.py │ │ ├── line_item.py │ │ ├── order_status_response.py │ │ ├── sales_order_history_item.py │ │ ├── salesorder_history_item.py │ │ ├── schedule.py │ │ └── shipping_detail.py │ └── rest.py │ └── productinformation │ ├── __init__.py │ ├── api │ ├── __init__.py │ └── part_search_api.py │ ├── api_client.py │ ├── configuration.py │ ├── models │ ├── __init__.py │ ├── api_error_response.py │ ├── api_validation_error.py │ ├── associated_product.py │ ├── basic_product.py │ ├── digi_reel_pricing.py │ ├── filters.py │ ├── iso_search_locale.py │ ├── keyword_search_request.py │ ├── keyword_search_response.py │ ├── kit_part.py │ ├── limited_parameter.py │ ├── limited_taxonomy.py │ ├── manufacturer_product_details_request.py │ ├── media_links.py │ ├── parametric_filter.py │ ├── pid_vid.py │ ├── price_break.py │ ├── product.py │ ├── product_details.py │ ├── product_details_response.py │ ├── result_code.py │ ├── search_option.py │ ├── sort_direction.py │ ├── sort_option.py │ ├── sort_parameters.py │ └── value_pair.py │ └── rest.py ├── docs └── .keep ├── generate-v3-api └── generage_client_swagger.py ├── requirements-dev.txt ├── requirements-test.txt ├── requirements.txt ├── setup.cfg ├── setup.py └── tests ├── __init__.py ├── fixtures.py ├── local └── .keep ├── responses ├── keywordsearch_response.json └── oauth2_response.json ├── test_oauth2.py ├── utils.py └── v3 ├── ordersupport ├── __init__.py ├── test_address.py ├── test_api_error_response.py ├── test_api_validation_error.py ├── test_line_item.py ├── test_order_details_api.py ├── test_order_status_response.py ├── test_salesorder_history_item.py ├── test_schedule.py └── test_shipping_detail.py └── productinformation ├── __init__.py ├── test_api_error_response.py ├── test_api_validation_error.py ├── test_basic_product.py ├── test_digi_reel_pricing.py ├── test_filters.py ├── test_iso_search_locale.py ├── test_keyword_search_request.py ├── test_keyword_search_response.py ├── test_limited_parameter.py ├── test_limited_taxonomy.py ├── test_manufacturer_product_details_request.py ├── test_parametric_filter.py ├── test_part_search_api.py ├── test_pid_vid.py ├── test_price_break.py ├── test_product.py ├── test_product_details.py ├── test_search_option.py ├── test_sort_direction.py ├── test_sort_option.py ├── test_sort_parameters.py └── test_value_pair.py /.coveragerc: -------------------------------------------------------------------------------- 1 | [run] 2 | source = 3 | digikey/* 4 | omit = 5 | */site-packages/* 6 | venv/* 7 | tests/* 8 | 9 | [report] 10 | show_missing = True 11 | exclude_lines = 12 | pragma: no cover 13 | def __repr__ 14 | if self.debug: -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | .mypy_cache/ 4 | *.py[cod] 5 | *$py.class 6 | 7 | # C extensions 8 | *.so 9 | 10 | # Distribution / packaging 11 | .Python 12 | env/ 13 | venv/ 14 | build/ 15 | develop-eggs/ 16 | dist/ 17 | downloads/ 18 | eggs/ 19 | .eggs/ 20 | lib/ 21 | lib64/ 22 | parts/ 23 | sdist/ 24 | var/ 25 | *.egg-info/ 26 | .installed.cfg 27 | *.egg 28 | 29 | # PyInstaller 30 | # Usually these files are written by a python script from a template 31 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 32 | *.manifest 33 | *.spec 34 | 35 | # Installer logs 36 | pip-log.txt 37 | pip-delete-this-directory.txt 38 | 39 | # Unit test / coverage reports 40 | htmlcov/ 41 | .tox/ 42 | .coverage 43 | .coverage.* 44 | .cache 45 | nosetests.xml 46 | coverage.xml 47 | *,cover 48 | .hypothesis/ 49 | .python-version 50 | 51 | # Translations 52 | *.mo 53 | *.pot 54 | 55 | # Django stuff: 56 | *.log 57 | 58 | # Sphinx documentation 59 | docs/_build/ 60 | 61 | # PyBuilder 62 | target/ 63 | 64 | #Ipython Notebook 65 | .ipynb_checkpoints 66 | 67 | # IDE 68 | .idea/ 69 | 70 | # Swagger generated 71 | generate-v3-api/ 72 | 73 | # Other repository dependent 74 | tests/local/ 75 | .env/config.ini 76 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/peeter123/digikey-api/0c7707ce2359703526e3ecdeef15646d299801f5/MANIFEST.in -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Python Client for Digikey API 2 | ================================= 3 | Search for parts in the Digi-Key catalog by keyword using KeywordSearch. Then make a PartDetails call to retrieve all 4 | real time information about the part including pricing. PartDetails works best with Digi-Key part numbers as some 5 | manufacturers overlap other manufacturer part numbers. 6 | 7 | [![Pypi](https://img.shields.io/pypi/v/digikey-api.svg?color=brightgreen)](https://pypi.org/project/digikey-api/) 8 | [![Donate](https://img.shields.io/badge/Donate-PayPal-gold.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=53HWHHVCJ3D4J¤cy_code=EUR&source=url) 9 | 10 | # What does it do 11 | `digikey-api` is an [Digkey Part Search API](https://api-portal.digikey.com/node/8517) client for Python 3.6+. API response data is returned as Python objects that attempt to make it easy to get the data you want. Not all endpoints have been implemented. 12 | 13 | # Quickstart 14 | 15 | ## Install 16 | ```sh 17 | pip install digikey-api 18 | 19 | cache_dir="path/to/cache/dir" 20 | mkdir -p $cache_dir 21 | 22 | export DIGIKEY_CLIENT_ID="client_id" 23 | export DIGIKEY_CLIENT_SECRET="client_secret" 24 | export DIGIKEY_STORAGE_PATH="${cache_dir}" 25 | ``` 26 | 27 | The cache dir is used to store the OAUTH access and refresh token, if you delete it you will need to login again. 28 | 29 | # API V3 30 | ## Register 31 | Register an app on the Digikey API portal: [Digi-Key API V3](https://developer.digikey.com/get_started). You will need 32 | the client ID and the client secret to use the API. You will also need a Digi-Key account to authenticate, using the 33 | Oauth2 process. 34 | 35 | When registering an app the OAuth Callback needs to be set to `https://localhost:8139/digikey_callback`. 36 | 37 | ## Use [API V3] 38 | Python will automatically spawn a browser to allow you to authenticate using the Oauth2 process. After obtaining a token 39 | the library will cache the access token and use the refresh token to automatically refresh your credentials. 40 | 41 | You can test your application using the sandbox API, the data returned from a Sandbox API may not be complete, but the 42 | structure of the Sandbox API response will be a representation of what to expect in Production. 43 | 44 | For valid responses make sure you ue the client ID and secret for a [Production App](https://developer.digikey.com/documentation/organization). 45 | Otherwise, it is possible that dummy data is returned and you will pull your hair as to why it doesn't work. 46 | 47 | ```python 48 | import os 49 | from pathlib import Path 50 | 51 | import digikey 52 | from digikey.v3.productinformation import KeywordSearchRequest 53 | from digikey.v3.batchproductdetails import BatchProductDetailsRequest 54 | 55 | CACHE_DIR = Path('path/to/cache/dir') 56 | 57 | os.environ['DIGIKEY_CLIENT_ID'] = 'client_id' 58 | os.environ['DIGIKEY_CLIENT_SECRET'] = 'client_secret' 59 | os.environ['DIGIKEY_CLIENT_SANDBOX'] = 'False' 60 | os.environ['DIGIKEY_STORAGE_PATH'] = CACHE_DIR 61 | 62 | # Query product number 63 | dkpn = '296-6501-1-ND' 64 | part = digikey.product_details(dkpn) 65 | 66 | # Search for parts 67 | search_request = KeywordSearchRequest(keywords='CRCW080510K0FKEA', record_count=10) 68 | result = digikey.keyword_search(body=search_request) 69 | 70 | # Only if BatchProductDetails endpoint is explicitly enabled 71 | # Search for Batch of Parts/Product 72 | mpn_list = ["0ZCK0050FF2E", "LR1F1K0"] #Length upto 50 73 | batch_request = BatchProductDetailsRequest(products=mpn_list) 74 | part_results = digikey.batch_product_details(body=batch_request) 75 | ``` 76 | 77 | ## Logging [API V3] 78 | Logging is not forced upon the user but can be enabled according to convention: 79 | ```python 80 | import logging 81 | 82 | logger = logging.getLogger(__name__) 83 | logger.setLevel(logging.DEBUG) 84 | 85 | digikey_logger = logging.getLogger('digikey') 86 | digikey_logger.setLevel(logging.DEBUG) 87 | 88 | handler = logging.StreamHandler() 89 | handler.setLevel(logging.DEBUG) 90 | logger.addHandler(handler) 91 | digikey_logger.addHandler(handler) 92 | ``` 93 | 94 | ## Top-level APIs 95 | 96 | #### Product Information 97 | All functions from the [PartSearch](https://developer.digikey.com/products/product-information/partsearch/) API have been implemented. 98 | * `digikey.keyword_search()` 99 | * `digikey.product_details()` 100 | * `digikey.digi_reel_pricing()` 101 | * `digikey.suggested_parts()` 102 | * `digikey.manufacturer_product_details()` 103 | 104 | #### Batch Product Details 105 | The one function from the [BatchProductDetailsAPI](https://developer.digikey.com/products/batch-productdetails/batchproductdetailsapi) API has been implemented. 106 | * `digikey.batch_product_details()` 107 | 108 | #### Order Support 109 | All functions from the [OrderDetails](https://developer.digikey.com/products/order-support/orderdetails/) API have been implemented. 110 | * `digikey.salesorder_history()` 111 | * `digikey.status_salesorder_id()` 112 | 113 | #### Barcode 114 | TODO 115 | 116 | ## API Limits 117 | The API has a limited amount of requests you can make per time interval [Digikey Rate Limits](https://developer.digikey.com/documentation/shared-concepts#rate-limits). 118 | 119 | It is possible to retrieve the number of max requests and current requests by passing an optional api_limits kwarg to an API function: 120 | ```python 121 | api_limit = {} 122 | search_request = KeywordSearchRequest(keywords='CRCW080510K0FKEA', record_count=10) 123 | result = digikey.keyword_search(body=search_request, api_limits=api_limit) 124 | ``` 125 | 126 | The dict will be filled with the information returned from the API: 127 | ```python 128 | { 129 | 'api_requests_limit': 1000, 130 | 'api_requests_remaining': 139 131 | } 132 | ``` 133 | Sometimes the API does not return any rate limit data, the values will then be set to None. 134 | -------------------------------------------------------------------------------- /digikey/__init__.py: -------------------------------------------------------------------------------- 1 | from digikey.v3.api import (keyword_search, product_details, digi_reel_pricing, suggested_parts, 2 | manufacturer_product_details) 3 | from digikey.v3.api import (status_salesorder_id, salesorder_history) 4 | from digikey.v3.api import (batch_product_details) 5 | 6 | name = 'digikey' 7 | -------------------------------------------------------------------------------- /digikey/constants.py: -------------------------------------------------------------------------------- 1 | USER_AGENT = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:93.0) Gecko/20100101 Firefox/93.0' 2 | -------------------------------------------------------------------------------- /digikey/decorators.py: -------------------------------------------------------------------------------- 1 | import functools 2 | import logging 3 | 4 | import retrying 5 | from requests.exceptions import RequestException 6 | 7 | from digikey.exceptions import DigikeyError 8 | 9 | logger = logging.getLogger(__name__) 10 | 11 | 12 | def wrap_exception_in(exc_type, catch=Exception): 13 | """ 14 | Wraps raised exception in another exception type, and only includes 15 | the original exception type name in the new exception message. 16 | Args: 17 | exc_type: Exception type 18 | catch: optional, Exception type to catch 19 | """ 20 | 21 | def wrapper(func): 22 | @functools.wraps(func) 23 | def inner(*args, **kwargs): 24 | try: 25 | return func(*args, **kwargs) 26 | except catch as exc: 27 | logger.error('Wrapped error: %s', str(exc)) 28 | message = type(exc).__name__ 29 | # Add HTTP status code, if one is attached to 'exc'. 30 | try: 31 | message += f' {exc.response.status_code}' 32 | except AttributeError: 33 | pass 34 | raise exc_type(message) from exc 35 | 36 | return inner 37 | 38 | return wrapper 39 | 40 | 41 | # Retry when RequestException is raised. 42 | # wait 2^x * 100 milliseconds between each retry, 43 | # wait up to 10 seconds between each retry, 44 | # and stop retrying after 20 total seconds. 45 | exponential_backoff = retrying.retry( 46 | retry_on_exception=lambda exc: isinstance(exc, RequestException), 47 | wait_exponential_multiplier=100, 48 | wait_exponential_max=10000, 49 | stop_max_delay=20000) 50 | 51 | 52 | def retry(func): 53 | """ 54 | Applies exponential backoff and exception wrapper decorators to expose 55 | a single decorator, to wrap functions that make HTTP requests. 56 | """ 57 | 58 | @functools.wraps(func) 59 | @wrap_exception_in(DigikeyError) 60 | @exponential_backoff 61 | def inner(*args, **kwargs): 62 | return func(*args, **kwargs) 63 | 64 | return inner -------------------------------------------------------------------------------- /digikey/exceptions.py: -------------------------------------------------------------------------------- 1 | class DigikeyError(Exception): 2 | pass 3 | 4 | 5 | class DigikeyTypeError(Exception): 6 | pass 7 | 8 | 9 | class DigikeyOauthException(Exception): 10 | pass 11 | -------------------------------------------------------------------------------- /digikey/oauth/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/peeter123/digikey-api/0c7707ce2359703526e3ecdeef15646d299801f5/digikey/oauth/__init__.py -------------------------------------------------------------------------------- /digikey/utils.py: -------------------------------------------------------------------------------- 1 | import collections 2 | import itertools 3 | import json 4 | import logging 5 | from typing import List, Tuple 6 | from urllib.parse import urlencode 7 | 8 | from .exceptions import DigikeyTypeError 9 | 10 | logger = logging.getLogger(__name__) 11 | 12 | 13 | URL_MAX_LENGTH = 8000 14 | 15 | 16 | def chunked(list_: List, chunksize: int=20) -> List[List]: 17 | """ 18 | Partitions list into chunks of a given size. 19 | NOTE: Octopart enforces that its 'parts/match' endpoint take no more 20 | than 20 queries in a single request. 21 | Args: 22 | list_: list to be partitioned 23 | chunksize: size of resulting chunks 24 | Returns: 25 | list of lists. 26 | """ 27 | chunks: List[List] = [] 28 | for i in range(0, len(list_), chunksize): 29 | chunks.append(list_[i:i + chunksize]) 30 | return chunks 31 | 32 | 33 | def chunk_queries(queries: List) -> List[List]: 34 | """ 35 | Partitions list into chunks, and ensures that each chunk is small enough 36 | to not trigger an HTTP 414 error (Request URI Too Large). 37 | Args: 38 | queries (list) 39 | Returns: 40 | list 41 | """ 42 | chunks: List[List] = [] 43 | # Octopart can only handle 20 queries per request, so split into chunks. 44 | for chunk in chunked(queries): 45 | chunks.extend(split_chunk(chunk)) 46 | return chunks 47 | 48 | 49 | def split_chunk(chunk: List) -> List[List]: 50 | """ 51 | Split chunk into smaller pieces if encoding the chunk into a URL would 52 | result in an HTTP 414 error. 53 | Args: 54 | chunk (list) 55 | Returns: 56 | list of chunks 57 | """ 58 | encoded = urlencode({'queries': json.dumps(chunk)}) 59 | if len(encoded) > URL_MAX_LENGTH: 60 | # Split chunk in half to avoid HTTP 414 error. 61 | mid = len(chunk) // 2 62 | left, right = chunk[:mid], chunk[mid:] 63 | # Recurse in case either half is still too long. 64 | return flatten([split_chunk(left), split_chunk(right)]) 65 | else: 66 | return [chunk] 67 | 68 | 69 | def flatten(list_of_lists: List[List]) -> List: 70 | """Chain together a list of lists 71 | >>> flatten([[1, 2], [3, 4, 5], ['a']]) 72 | [1, 2, 3, 4, 5, 'a'] 73 | """ 74 | return list(itertools.chain(*list_of_lists)) 75 | 76 | 77 | def unique(list_: List) -> List: 78 | """Remove duplicate entries from list, keeping it in its original order 79 | >>> unique([1, 2, 2, 3, 4, 6, 2, 5]) 80 | [1, 2, 3, 4, 6, 5] 81 | >>> unique(['bb', 'aa', 'aa', 'aa', 'aa', 'aa', 'bb']) 82 | ['bb', 'aa'] 83 | """ 84 | return list(collections.OrderedDict.fromkeys(list_)) 85 | 86 | 87 | def sortby_param_str_from_list(sortby: List[Tuple[str, str]]=None) -> str: 88 | """Turns a list of tuples into a string for sending as GET parameter 89 | >>> sortby_param_str_from_list([('avg_price', 'asc'), ('score', 'desc')]) 90 | 'avg_price asc,score desc' 91 | """ 92 | if sortby and not isinstance(sortby, list): 93 | raise DigikeyTypeError( 94 | '"sortyby" must be a list of tuples of fieldname and one of "asc" ' 95 | 'or "desc"') 96 | 97 | def exc_from_entry(entry): 98 | return DigikeyTypeError( 99 | 'All "sortby" entries must be a tuple of a fieldname and one of ' 100 | '"asc" or "desc", not %s' % entry) 101 | 102 | out = [] 103 | 104 | for entry in sortby or []: 105 | try: 106 | sort_value, sort_order = entry 107 | except ValueError: 108 | raise exc_from_entry(entry) from ValueError 109 | 110 | if sort_order not in ('asc', 'desc'): 111 | raise exc_from_entry(entry) 112 | 113 | out.append(f"{sort_value} {sort_order}") 114 | 115 | return ','.join(out) 116 | 117 | 118 | def strtobool(val): 119 | """Convert a string representation of truth to true (1) or false (0). 120 | True values are 'y', 'yes', 't', 'true', 'on', and '1'; false values 121 | are 'n', 'no', 'f', 'false', 'off', and '0'. Raises ValueError if 122 | 'val' is anything else. 123 | 124 | Copy from distutils.utils, which was removed in Python 3.12 125 | """ 126 | val = val.lower() 127 | if val in ('y', 'yes', 't', 'true', 'on', '1'): 128 | return 1 129 | elif val in ('n', 'no', 'f', 'false', 'off', '0'): 130 | return 0 131 | else: 132 | raise ValueError("invalid truth value %r" % (val,)) 133 | -------------------------------------------------------------------------------- /digikey/v3/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/peeter123/digikey-api/0c7707ce2359703526e3ecdeef15646d299801f5/digikey/v3/__init__.py -------------------------------------------------------------------------------- /digikey/v3/batchproductdetails/__init__.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | # flake8: noqa 4 | 5 | """ 6 | Batch Product Details Api 7 | 8 | Retrieve list of product details from list of part numbers # noqa: E501 9 | 10 | OpenAPI spec version: v3 11 | 12 | Generated by: https://github.com/swagger-api/swagger-codegen.git 13 | """ 14 | 15 | 16 | from __future__ import absolute_import 17 | 18 | # import apis into sdk package 19 | from digikey.v3.batchproductdetails.api.batch_search_api import BatchSearchApi 20 | 21 | # import ApiClient 22 | from digikey.v3.batchproductdetails.api_client import ApiClient 23 | from digikey.v3.batchproductdetails.configuration import Configuration 24 | # import models into sdk package 25 | from digikey.v3.batchproductdetails.models.api_error_response import ApiErrorResponse 26 | from digikey.v3.batchproductdetails.models.api_validation_error import ApiValidationError 27 | from digikey.v3.batchproductdetails.models.associated_product import AssociatedProduct 28 | from digikey.v3.batchproductdetails.models.basic_product import BasicProduct 29 | from digikey.v3.batchproductdetails.models.batch_product_details_request import BatchProductDetailsRequest 30 | from digikey.v3.batchproductdetails.models.batch_product_details_response import BatchProductDetailsResponse 31 | from digikey.v3.batchproductdetails.models.iso_search_locale import IsoSearchLocale 32 | from digikey.v3.batchproductdetails.models.kit_part import KitPart 33 | from digikey.v3.batchproductdetails.models.limited_taxonomy import LimitedTaxonomy 34 | from digikey.v3.batchproductdetails.models.media_links import MediaLinks 35 | from digikey.v3.batchproductdetails.models.pid_vid import PidVid 36 | from digikey.v3.batchproductdetails.models.price_break import PriceBreak 37 | from digikey.v3.batchproductdetails.models.product_details import ProductDetails 38 | -------------------------------------------------------------------------------- /digikey/v3/batchproductdetails/api/__init__.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import 2 | 3 | # flake8: noqa 4 | 5 | # import apis into api package 6 | from digikey.v3.batchproductdetails.api.batch_search_api import BatchSearchApi 7 | -------------------------------------------------------------------------------- /digikey/v3/batchproductdetails/models/__init__.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | # flake8: noqa 4 | """ 5 | Batch Product Details Api 6 | 7 | Retrieve list of product details from list of part numbers # noqa: E501 8 | 9 | OpenAPI spec version: v3 10 | 11 | Generated by: https://github.com/swagger-api/swagger-codegen.git 12 | """ 13 | 14 | 15 | from __future__ import absolute_import 16 | 17 | # import models into model package 18 | from digikey.v3.batchproductdetails.models.api_error_response import ApiErrorResponse 19 | from digikey.v3.batchproductdetails.models.api_validation_error import ApiValidationError 20 | from digikey.v3.batchproductdetails.models.associated_product import AssociatedProduct 21 | from digikey.v3.batchproductdetails.models.basic_product import BasicProduct 22 | from digikey.v3.batchproductdetails.models.batch_product_details_request import BatchProductDetailsRequest 23 | from digikey.v3.batchproductdetails.models.batch_product_details_response import BatchProductDetailsResponse 24 | from digikey.v3.batchproductdetails.models.iso_search_locale import IsoSearchLocale 25 | from digikey.v3.batchproductdetails.models.kit_part import KitPart 26 | from digikey.v3.batchproductdetails.models.limited_taxonomy import LimitedTaxonomy 27 | from digikey.v3.batchproductdetails.models.media_links import MediaLinks 28 | from digikey.v3.batchproductdetails.models.pid_vid import PidVid 29 | from digikey.v3.batchproductdetails.models.price_break import PriceBreak 30 | from digikey.v3.batchproductdetails.models.product_details import ProductDetails 31 | -------------------------------------------------------------------------------- /digikey/v3/batchproductdetails/models/api_validation_error.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | """ 4 | Batch Product Details Api 5 | 6 | Retrieve list of product details from list of part numbers # noqa: E501 7 | 8 | OpenAPI spec version: v3 9 | 10 | Generated by: https://github.com/swagger-api/swagger-codegen.git 11 | """ 12 | 13 | 14 | import pprint 15 | import re # noqa: F401 16 | 17 | import six 18 | 19 | 20 | class ApiValidationError(object): 21 | """NOTE: This class is auto generated by the swagger code generator program. 22 | 23 | Do not edit the class manually. 24 | """ 25 | 26 | """ 27 | Attributes: 28 | swagger_types (dict): The key is attribute name 29 | and the value is attribute type. 30 | attribute_map (dict): The key is attribute name 31 | and the value is json key in definition. 32 | """ 33 | swagger_types = { 34 | 'field': 'str', 35 | 'message': 'str' 36 | } 37 | 38 | attribute_map = { 39 | 'field': 'Field', 40 | 'message': 'Message' 41 | } 42 | 43 | def __init__(self, field=None, message=None): # noqa: E501 44 | """ApiValidationError - a model defined in Swagger""" # noqa: E501 45 | 46 | self._field = None 47 | self._message = None 48 | self.discriminator = None 49 | 50 | if field is not None: 51 | self.field = field 52 | if message is not None: 53 | self.message = message 54 | 55 | @property 56 | def field(self): 57 | """Gets the field of this ApiValidationError. # noqa: E501 58 | 59 | 60 | :return: The field of this ApiValidationError. # noqa: E501 61 | :rtype: str 62 | """ 63 | return self._field 64 | 65 | @field.setter 66 | def field(self, field): 67 | """Sets the field of this ApiValidationError. 68 | 69 | 70 | :param field: The field of this ApiValidationError. # noqa: E501 71 | :type: str 72 | """ 73 | 74 | self._field = field 75 | 76 | @property 77 | def message(self): 78 | """Gets the message of this ApiValidationError. # noqa: E501 79 | 80 | 81 | :return: The message of this ApiValidationError. # noqa: E501 82 | :rtype: str 83 | """ 84 | return self._message 85 | 86 | @message.setter 87 | def message(self, message): 88 | """Sets the message of this ApiValidationError. 89 | 90 | 91 | :param message: The message of this ApiValidationError. # noqa: E501 92 | :type: str 93 | """ 94 | 95 | self._message = message 96 | 97 | def to_dict(self): 98 | """Returns the model properties as a dict""" 99 | result = {} 100 | 101 | for attr, _ in six.iteritems(self.swagger_types): 102 | value = getattr(self, attr) 103 | if isinstance(value, list): 104 | result[attr] = list(map( 105 | lambda x: x.to_dict() if hasattr(x, "to_dict") else x, 106 | value 107 | )) 108 | elif hasattr(value, "to_dict"): 109 | result[attr] = value.to_dict() 110 | elif isinstance(value, dict): 111 | result[attr] = dict(map( 112 | lambda item: (item[0], item[1].to_dict()) 113 | if hasattr(item[1], "to_dict") else item, 114 | value.items() 115 | )) 116 | else: 117 | result[attr] = value 118 | if issubclass(ApiValidationError, dict): 119 | for key, value in self.items(): 120 | result[key] = value 121 | 122 | return result 123 | 124 | def to_str(self): 125 | """Returns the string representation of the model""" 126 | return pprint.pformat(self.to_dict()) 127 | 128 | def __repr__(self): 129 | """For `print` and `pprint`""" 130 | return self.to_str() 131 | 132 | def __eq__(self, other): 133 | """Returns true if both objects are equal""" 134 | if not isinstance(other, ApiValidationError): 135 | return False 136 | 137 | return self.__dict__ == other.__dict__ 138 | 139 | def __ne__(self, other): 140 | """Returns true if both objects are not equal""" 141 | return not self == other 142 | -------------------------------------------------------------------------------- /digikey/v3/batchproductdetails/models/batch_product_details_request.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | """ 4 | Batch Product Details Api 5 | 6 | Retrieve list of product details from list of part numbers # noqa: E501 7 | 8 | OpenAPI spec version: v3 9 | 10 | Generated by: https://github.com/swagger-api/swagger-codegen.git 11 | """ 12 | 13 | 14 | import pprint 15 | import re # noqa: F401 16 | 17 | import six 18 | 19 | 20 | class BatchProductDetailsRequest(object): 21 | """NOTE: This class is auto generated by the swagger code generator program. 22 | 23 | Do not edit the class manually. 24 | """ 25 | 26 | """ 27 | Attributes: 28 | swagger_types (dict): The key is attribute name 29 | and the value is attribute type. 30 | attribute_map (dict): The key is attribute name 31 | and the value is json key in definition. 32 | """ 33 | swagger_types = { 34 | 'products': 'list[str]' 35 | } 36 | 37 | attribute_map = { 38 | 'products': 'Products' 39 | } 40 | 41 | def __init__(self, products=None): # noqa: E501 42 | """BatchProductDetailsRequest - a model defined in Swagger""" # noqa: E501 43 | 44 | self._products = None 45 | self.discriminator = None 46 | 47 | self.products = products 48 | 49 | @property 50 | def products(self): 51 | """Gets the products of this BatchProductDetailsRequest. # noqa: E501 52 | 53 | # noqa: E501 54 | 55 | :return: The products of this BatchProductDetailsRequest. # noqa: E501 56 | :rtype: list[str] 57 | """ 58 | return self._products 59 | 60 | @products.setter 61 | def products(self, products): 62 | """Sets the products of this BatchProductDetailsRequest. 63 | 64 | # noqa: E501 65 | 66 | :param products: The products of this BatchProductDetailsRequest. # noqa: E501 67 | :type: list[str] 68 | """ 69 | if products is None: 70 | raise ValueError("Invalid value for `products`, must not be `None`") # noqa: E501 71 | 72 | self._products = products 73 | 74 | def to_dict(self): 75 | """Returns the model properties as a dict""" 76 | result = {} 77 | 78 | for attr, _ in six.iteritems(self.swagger_types): 79 | value = getattr(self, attr) 80 | if isinstance(value, list): 81 | result[attr] = list(map( 82 | lambda x: x.to_dict() if hasattr(x, "to_dict") else x, 83 | value 84 | )) 85 | elif hasattr(value, "to_dict"): 86 | result[attr] = value.to_dict() 87 | elif isinstance(value, dict): 88 | result[attr] = dict(map( 89 | lambda item: (item[0], item[1].to_dict()) 90 | if hasattr(item[1], "to_dict") else item, 91 | value.items() 92 | )) 93 | else: 94 | result[attr] = value 95 | if issubclass(BatchProductDetailsRequest, dict): 96 | for key, value in self.items(): 97 | result[key] = value 98 | 99 | return result 100 | 101 | def to_str(self): 102 | """Returns the string representation of the model""" 103 | return pprint.pformat(self.to_dict()) 104 | 105 | def __repr__(self): 106 | """For `print` and `pprint`""" 107 | return self.to_str() 108 | 109 | def __eq__(self, other): 110 | """Returns true if both objects are equal""" 111 | if not isinstance(other, BatchProductDetailsRequest): 112 | return False 113 | 114 | return self.__dict__ == other.__dict__ 115 | 116 | def __ne__(self, other): 117 | """Returns true if both objects are not equal""" 118 | return not self == other 119 | -------------------------------------------------------------------------------- /digikey/v3/batchproductdetails/models/batch_product_details_response.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | """ 4 | Batch Product Details Api 5 | 6 | Retrieve list of product details from list of part numbers # noqa: E501 7 | 8 | OpenAPI spec version: v3 9 | 10 | Generated by: https://github.com/swagger-api/swagger-codegen.git 11 | """ 12 | 13 | 14 | import pprint 15 | import re # noqa: F401 16 | 17 | import six 18 | 19 | 20 | class BatchProductDetailsResponse(object): 21 | """NOTE: This class is auto generated by the swagger code generator program. 22 | 23 | Do not edit the class manually. 24 | """ 25 | 26 | """ 27 | Attributes: 28 | swagger_types (dict): The key is attribute name 29 | and the value is attribute type. 30 | attribute_map (dict): The key is attribute name 31 | and the value is json key in definition. 32 | """ 33 | swagger_types = { 34 | 'product_details': 'list[ProductDetails]', 35 | 'errors': 'list[str]' 36 | } 37 | 38 | attribute_map = { 39 | 'product_details': 'ProductDetails', 40 | 'errors': 'Errors' 41 | } 42 | 43 | def __init__(self, product_details=None, errors=None): # noqa: E501 44 | """BatchProductDetailsResponse - a model defined in Swagger""" # noqa: E501 45 | 46 | self._product_details = None 47 | self._errors = None 48 | self.discriminator = None 49 | 50 | if product_details is not None: 51 | self.product_details = product_details 52 | if errors is not None: 53 | self.errors = errors 54 | 55 | @property 56 | def product_details(self): 57 | """Gets the product_details of this BatchProductDetailsResponse. # noqa: E501 58 | 59 | List of ProductDetails # noqa: E501 60 | 61 | :return: The product_details of this BatchProductDetailsResponse. # noqa: E501 62 | :rtype: list[ProductDetails] 63 | """ 64 | return self._product_details 65 | 66 | @product_details.setter 67 | def product_details(self, product_details): 68 | """Sets the product_details of this BatchProductDetailsResponse. 69 | 70 | List of ProductDetails # noqa: E501 71 | 72 | :param product_details: The product_details of this BatchProductDetailsResponse. # noqa: E501 73 | :type: list[ProductDetails] 74 | """ 75 | 76 | self._product_details = product_details 77 | 78 | @property 79 | def errors(self): 80 | """Gets the errors of this BatchProductDetailsResponse. # noqa: E501 81 | 82 | List of Errors # noqa: E501 83 | 84 | :return: The errors of this BatchProductDetailsResponse. # noqa: E501 85 | :rtype: list[str] 86 | """ 87 | return self._errors 88 | 89 | @errors.setter 90 | def errors(self, errors): 91 | """Sets the errors of this BatchProductDetailsResponse. 92 | 93 | List of Errors # noqa: E501 94 | 95 | :param errors: The errors of this BatchProductDetailsResponse. # noqa: E501 96 | :type: list[str] 97 | """ 98 | 99 | self._errors = errors 100 | 101 | def to_dict(self): 102 | """Returns the model properties as a dict""" 103 | result = {} 104 | 105 | for attr, _ in six.iteritems(self.swagger_types): 106 | value = getattr(self, attr) 107 | if isinstance(value, list): 108 | result[attr] = list(map( 109 | lambda x: x.to_dict() if hasattr(x, "to_dict") else x, 110 | value 111 | )) 112 | elif hasattr(value, "to_dict"): 113 | result[attr] = value.to_dict() 114 | elif isinstance(value, dict): 115 | result[attr] = dict(map( 116 | lambda item: (item[0], item[1].to_dict()) 117 | if hasattr(item[1], "to_dict") else item, 118 | value.items() 119 | )) 120 | else: 121 | result[attr] = value 122 | if issubclass(BatchProductDetailsResponse, dict): 123 | for key, value in self.items(): 124 | result[key] = value 125 | 126 | return result 127 | 128 | def to_str(self): 129 | """Returns the string representation of the model""" 130 | return pprint.pformat(self.to_dict()) 131 | 132 | def __repr__(self): 133 | """For `print` and `pprint`""" 134 | return self.to_str() 135 | 136 | def __eq__(self, other): 137 | """Returns true if both objects are equal""" 138 | if not isinstance(other, BatchProductDetailsResponse): 139 | return False 140 | 141 | return self.__dict__ == other.__dict__ 142 | 143 | def __ne__(self, other): 144 | """Returns true if both objects are not equal""" 145 | return not self == other 146 | -------------------------------------------------------------------------------- /digikey/v3/batchproductdetails/models/iso_search_locale.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | """ 4 | Batch Product Details Api 5 | 6 | Retrieve list of product details from list of part numbers # noqa: E501 7 | 8 | OpenAPI spec version: v3 9 | 10 | Generated by: https://github.com/swagger-api/swagger-codegen.git 11 | """ 12 | 13 | 14 | import pprint 15 | import re # noqa: F401 16 | 17 | import six 18 | 19 | 20 | class IsoSearchLocale(object): 21 | """NOTE: This class is auto generated by the swagger code generator program. 22 | 23 | Do not edit the class manually. 24 | """ 25 | 26 | """ 27 | Attributes: 28 | swagger_types (dict): The key is attribute name 29 | and the value is attribute type. 30 | attribute_map (dict): The key is attribute name 31 | and the value is json key in definition. 32 | """ 33 | swagger_types = { 34 | 'site': 'str', 35 | 'language': 'str', 36 | 'currency': 'str', 37 | 'ship_to_country': 'str' 38 | } 39 | 40 | attribute_map = { 41 | 'site': 'Site', 42 | 'language': 'Language', 43 | 'currency': 'Currency', 44 | 'ship_to_country': 'ShipToCountry' 45 | } 46 | 47 | def __init__(self, site=None, language=None, currency=None, ship_to_country=None): # noqa: E501 48 | """IsoSearchLocale - a model defined in Swagger""" # noqa: E501 49 | 50 | self._site = None 51 | self._language = None 52 | self._currency = None 53 | self._ship_to_country = None 54 | self.discriminator = None 55 | 56 | if site is not None: 57 | self.site = site 58 | if language is not None: 59 | self.language = language 60 | if currency is not None: 61 | self.currency = currency 62 | if ship_to_country is not None: 63 | self.ship_to_country = ship_to_country 64 | 65 | @property 66 | def site(self): 67 | """Gets the site of this IsoSearchLocale. # noqa: E501 68 | 69 | The site used for the API call. # noqa: E501 70 | 71 | :return: The site of this IsoSearchLocale. # noqa: E501 72 | :rtype: str 73 | """ 74 | return self._site 75 | 76 | @site.setter 77 | def site(self, site): 78 | """Sets the site of this IsoSearchLocale. 79 | 80 | The site used for the API call. # noqa: E501 81 | 82 | :param site: The site of this IsoSearchLocale. # noqa: E501 83 | :type: str 84 | """ 85 | 86 | self._site = site 87 | 88 | @property 89 | def language(self): 90 | """Gets the language of this IsoSearchLocale. # noqa: E501 91 | 92 | The language used for the API call. If the provided language is not valid for the site, it will be set to the site default. # noqa: E501 93 | 94 | :return: The language of this IsoSearchLocale. # noqa: E501 95 | :rtype: str 96 | """ 97 | return self._language 98 | 99 | @language.setter 100 | def language(self, language): 101 | """Sets the language of this IsoSearchLocale. 102 | 103 | The language used for the API call. If the provided language is not valid for the site, it will be set to the site default. # noqa: E501 104 | 105 | :param language: The language of this IsoSearchLocale. # noqa: E501 106 | :type: str 107 | """ 108 | 109 | self._language = language 110 | 111 | @property 112 | def currency(self): 113 | """Gets the currency of this IsoSearchLocale. # noqa: E501 114 | 115 | The currency used for the API call. If the provided currency is not valid for the site, it will be set to the site default. # noqa: E501 116 | 117 | :return: The currency of this IsoSearchLocale. # noqa: E501 118 | :rtype: str 119 | """ 120 | return self._currency 121 | 122 | @currency.setter 123 | def currency(self, currency): 124 | """Sets the currency of this IsoSearchLocale. 125 | 126 | The currency used for the API call. If the provided currency is not valid for the site, it will be set to the site default. # noqa: E501 127 | 128 | :param currency: The currency of this IsoSearchLocale. # noqa: E501 129 | :type: str 130 | """ 131 | 132 | self._currency = currency 133 | 134 | @property 135 | def ship_to_country(self): 136 | """Gets the ship_to_country of this IsoSearchLocale. # noqa: E501 137 | 138 | The destination for shipping the product. This is used for tariffs and regional pricing. # noqa: E501 139 | 140 | :return: The ship_to_country of this IsoSearchLocale. # noqa: E501 141 | :rtype: str 142 | """ 143 | return self._ship_to_country 144 | 145 | @ship_to_country.setter 146 | def ship_to_country(self, ship_to_country): 147 | """Sets the ship_to_country of this IsoSearchLocale. 148 | 149 | The destination for shipping the product. This is used for tariffs and regional pricing. # noqa: E501 150 | 151 | :param ship_to_country: The ship_to_country of this IsoSearchLocale. # noqa: E501 152 | :type: str 153 | """ 154 | 155 | self._ship_to_country = ship_to_country 156 | 157 | def to_dict(self): 158 | """Returns the model properties as a dict""" 159 | result = {} 160 | 161 | for attr, _ in six.iteritems(self.swagger_types): 162 | value = getattr(self, attr) 163 | if isinstance(value, list): 164 | result[attr] = list(map( 165 | lambda x: x.to_dict() if hasattr(x, "to_dict") else x, 166 | value 167 | )) 168 | elif hasattr(value, "to_dict"): 169 | result[attr] = value.to_dict() 170 | elif isinstance(value, dict): 171 | result[attr] = dict(map( 172 | lambda item: (item[0], item[1].to_dict()) 173 | if hasattr(item[1], "to_dict") else item, 174 | value.items() 175 | )) 176 | else: 177 | result[attr] = value 178 | if issubclass(IsoSearchLocale, dict): 179 | for key, value in self.items(): 180 | result[key] = value 181 | 182 | return result 183 | 184 | def to_str(self): 185 | """Returns the string representation of the model""" 186 | return pprint.pformat(self.to_dict()) 187 | 188 | def __repr__(self): 189 | """For `print` and `pprint`""" 190 | return self.to_str() 191 | 192 | def __eq__(self, other): 193 | """Returns true if both objects are equal""" 194 | if not isinstance(other, IsoSearchLocale): 195 | return False 196 | 197 | return self.__dict__ == other.__dict__ 198 | 199 | def __ne__(self, other): 200 | """Returns true if both objects are not equal""" 201 | return not self == other 202 | -------------------------------------------------------------------------------- /digikey/v3/batchproductdetails/models/kit_part.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | """ 4 | Batch Product Details Api 5 | 6 | Retrieve list of product details from list of part numbers # noqa: E501 7 | 8 | OpenAPI spec version: v3 9 | 10 | Generated by: https://github.com/swagger-api/swagger-codegen.git 11 | """ 12 | 13 | 14 | import pprint 15 | import re # noqa: F401 16 | 17 | import six 18 | 19 | 20 | class KitPart(object): 21 | """NOTE: This class is auto generated by the swagger code generator program. 22 | 23 | Do not edit the class manually. 24 | """ 25 | 26 | """ 27 | Attributes: 28 | swagger_types (dict): The key is attribute name 29 | and the value is attribute type. 30 | attribute_map (dict): The key is attribute name 31 | and the value is json key in definition. 32 | """ 33 | swagger_types = { 34 | 'associated_product': 'AssociatedProduct', 35 | 'kit_part_quantity': 'int' 36 | } 37 | 38 | attribute_map = { 39 | 'associated_product': 'AssociatedProduct', 40 | 'kit_part_quantity': 'KitPartQuantity' 41 | } 42 | 43 | def __init__(self, associated_product=None, kit_part_quantity=None): # noqa: E501 44 | """KitPart - a model defined in Swagger""" # noqa: E501 45 | 46 | self._associated_product = None 47 | self._kit_part_quantity = None 48 | self.discriminator = None 49 | 50 | if associated_product is not None: 51 | self.associated_product = associated_product 52 | if kit_part_quantity is not None: 53 | self.kit_part_quantity = kit_part_quantity 54 | 55 | @property 56 | def associated_product(self): 57 | """Gets the associated_product of this KitPart. # noqa: E501 58 | 59 | 60 | :return: The associated_product of this KitPart. # noqa: E501 61 | :rtype: AssociatedProduct 62 | """ 63 | return self._associated_product 64 | 65 | @associated_product.setter 66 | def associated_product(self, associated_product): 67 | """Sets the associated_product of this KitPart. 68 | 69 | 70 | :param associated_product: The associated_product of this KitPart. # noqa: E501 71 | :type: AssociatedProduct 72 | """ 73 | 74 | self._associated_product = associated_product 75 | 76 | @property 77 | def kit_part_quantity(self): 78 | """Gets the kit_part_quantity of this KitPart. # noqa: E501 79 | 80 | Number of the product in the Kit. # noqa: E501 81 | 82 | :return: The kit_part_quantity of this KitPart. # noqa: E501 83 | :rtype: int 84 | """ 85 | return self._kit_part_quantity 86 | 87 | @kit_part_quantity.setter 88 | def kit_part_quantity(self, kit_part_quantity): 89 | """Sets the kit_part_quantity of this KitPart. 90 | 91 | Number of the product in the Kit. # noqa: E501 92 | 93 | :param kit_part_quantity: The kit_part_quantity of this KitPart. # noqa: E501 94 | :type: int 95 | """ 96 | 97 | self._kit_part_quantity = kit_part_quantity 98 | 99 | def to_dict(self): 100 | """Returns the model properties as a dict""" 101 | result = {} 102 | 103 | for attr, _ in six.iteritems(self.swagger_types): 104 | value = getattr(self, attr) 105 | if isinstance(value, list): 106 | result[attr] = list(map( 107 | lambda x: x.to_dict() if hasattr(x, "to_dict") else x, 108 | value 109 | )) 110 | elif hasattr(value, "to_dict"): 111 | result[attr] = value.to_dict() 112 | elif isinstance(value, dict): 113 | result[attr] = dict(map( 114 | lambda item: (item[0], item[1].to_dict()) 115 | if hasattr(item[1], "to_dict") else item, 116 | value.items() 117 | )) 118 | else: 119 | result[attr] = value 120 | if issubclass(KitPart, dict): 121 | for key, value in self.items(): 122 | result[key] = value 123 | 124 | return result 125 | 126 | def to_str(self): 127 | """Returns the string representation of the model""" 128 | return pprint.pformat(self.to_dict()) 129 | 130 | def __repr__(self): 131 | """For `print` and `pprint`""" 132 | return self.to_str() 133 | 134 | def __eq__(self, other): 135 | """Returns true if both objects are equal""" 136 | if not isinstance(other, KitPart): 137 | return False 138 | 139 | return self.__dict__ == other.__dict__ 140 | 141 | def __ne__(self, other): 142 | """Returns true if both objects are not equal""" 143 | return not self == other 144 | -------------------------------------------------------------------------------- /digikey/v3/batchproductdetails/models/pid_vid.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | """ 4 | Batch Product Details Api 5 | 6 | Retrieve list of product details from list of part numbers # noqa: E501 7 | 8 | OpenAPI spec version: v3 9 | 10 | Generated by: https://github.com/swagger-api/swagger-codegen.git 11 | """ 12 | 13 | 14 | import pprint 15 | import re # noqa: F401 16 | 17 | import six 18 | 19 | 20 | class PidVid(object): 21 | """NOTE: This class is auto generated by the swagger code generator program. 22 | 23 | Do not edit the class manually. 24 | """ 25 | 26 | """ 27 | Attributes: 28 | swagger_types (dict): The key is attribute name 29 | and the value is attribute type. 30 | attribute_map (dict): The key is attribute name 31 | and the value is json key in definition. 32 | """ 33 | swagger_types = { 34 | 'parameter_id': 'int', 35 | 'value_id': 'str', 36 | 'parameter': 'str', 37 | 'value': 'str' 38 | } 39 | 40 | attribute_map = { 41 | 'parameter_id': 'ParameterId', 42 | 'value_id': 'ValueId', 43 | 'parameter': 'Parameter', 44 | 'value': 'Value' 45 | } 46 | 47 | def __init__(self, parameter_id=None, value_id=None, parameter=None, value=None): # noqa: E501 48 | """PidVid - a model defined in Swagger""" # noqa: E501 49 | 50 | self._parameter_id = None 51 | self._value_id = None 52 | self._parameter = None 53 | self._value = None 54 | self.discriminator = None 55 | 56 | if parameter_id is not None: 57 | self.parameter_id = parameter_id 58 | if value_id is not None: 59 | self.value_id = value_id 60 | if parameter is not None: 61 | self.parameter = parameter 62 | if value is not None: 63 | self.value = value 64 | 65 | @property 66 | def parameter_id(self): 67 | """Gets the parameter_id of this PidVid. # noqa: E501 68 | 69 | The Id of the parameter. # noqa: E501 70 | 71 | :return: The parameter_id of this PidVid. # noqa: E501 72 | :rtype: int 73 | """ 74 | return self._parameter_id 75 | 76 | @parameter_id.setter 77 | def parameter_id(self, parameter_id): 78 | """Sets the parameter_id of this PidVid. 79 | 80 | The Id of the parameter. # noqa: E501 81 | 82 | :param parameter_id: The parameter_id of this PidVid. # noqa: E501 83 | :type: int 84 | """ 85 | 86 | self._parameter_id = parameter_id 87 | 88 | @property 89 | def value_id(self): 90 | """Gets the value_id of this PidVid. # noqa: E501 91 | 92 | The Id of the value. # noqa: E501 93 | 94 | :return: The value_id of this PidVid. # noqa: E501 95 | :rtype: str 96 | """ 97 | return self._value_id 98 | 99 | @value_id.setter 100 | def value_id(self, value_id): 101 | """Sets the value_id of this PidVid. 102 | 103 | The Id of the value. # noqa: E501 104 | 105 | :param value_id: The value_id of this PidVid. # noqa: E501 106 | :type: str 107 | """ 108 | 109 | self._value_id = value_id 110 | 111 | @property 112 | def parameter(self): 113 | """Gets the parameter of this PidVid. # noqa: E501 114 | 115 | The name of the parameter. # noqa: E501 116 | 117 | :return: The parameter of this PidVid. # noqa: E501 118 | :rtype: str 119 | """ 120 | return self._parameter 121 | 122 | @parameter.setter 123 | def parameter(self, parameter): 124 | """Sets the parameter of this PidVid. 125 | 126 | The name of the parameter. # noqa: E501 127 | 128 | :param parameter: The parameter of this PidVid. # noqa: E501 129 | :type: str 130 | """ 131 | 132 | self._parameter = parameter 133 | 134 | @property 135 | def value(self): 136 | """Gets the value of this PidVid. # noqa: E501 137 | 138 | The name of the value. # noqa: E501 139 | 140 | :return: The value of this PidVid. # noqa: E501 141 | :rtype: str 142 | """ 143 | return self._value 144 | 145 | @value.setter 146 | def value(self, value): 147 | """Sets the value of this PidVid. 148 | 149 | The name of the value. # noqa: E501 150 | 151 | :param value: The value of this PidVid. # noqa: E501 152 | :type: str 153 | """ 154 | 155 | self._value = value 156 | 157 | def to_dict(self): 158 | """Returns the model properties as a dict""" 159 | result = {} 160 | 161 | for attr, _ in six.iteritems(self.swagger_types): 162 | value = getattr(self, attr) 163 | if isinstance(value, list): 164 | result[attr] = list(map( 165 | lambda x: x.to_dict() if hasattr(x, "to_dict") else x, 166 | value 167 | )) 168 | elif hasattr(value, "to_dict"): 169 | result[attr] = value.to_dict() 170 | elif isinstance(value, dict): 171 | result[attr] = dict(map( 172 | lambda item: (item[0], item[1].to_dict()) 173 | if hasattr(item[1], "to_dict") else item, 174 | value.items() 175 | )) 176 | else: 177 | result[attr] = value 178 | if issubclass(PidVid, dict): 179 | for key, value in self.items(): 180 | result[key] = value 181 | 182 | return result 183 | 184 | def to_str(self): 185 | """Returns the string representation of the model""" 186 | return pprint.pformat(self.to_dict()) 187 | 188 | def __repr__(self): 189 | """For `print` and `pprint`""" 190 | return self.to_str() 191 | 192 | def __eq__(self, other): 193 | """Returns true if both objects are equal""" 194 | if not isinstance(other, PidVid): 195 | return False 196 | 197 | return self.__dict__ == other.__dict__ 198 | 199 | def __ne__(self, other): 200 | """Returns true if both objects are not equal""" 201 | return not self == other 202 | -------------------------------------------------------------------------------- /digikey/v3/batchproductdetails/models/price_break.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | """ 4 | Batch Product Details Api 5 | 6 | Retrieve list of product details from list of part numbers # noqa: E501 7 | 8 | OpenAPI spec version: v3 9 | 10 | Generated by: https://github.com/swagger-api/swagger-codegen.git 11 | """ 12 | 13 | 14 | import pprint 15 | import re # noqa: F401 16 | 17 | import six 18 | 19 | 20 | class PriceBreak(object): 21 | """NOTE: This class is auto generated by the swagger code generator program. 22 | 23 | Do not edit the class manually. 24 | """ 25 | 26 | """ 27 | Attributes: 28 | swagger_types (dict): The key is attribute name 29 | and the value is attribute type. 30 | attribute_map (dict): The key is attribute name 31 | and the value is json key in definition. 32 | """ 33 | swagger_types = { 34 | 'break_quantity': 'int', 35 | 'unit_price': 'float', 36 | 'total_price': 'float' 37 | } 38 | 39 | attribute_map = { 40 | 'break_quantity': 'BreakQuantity', 41 | 'unit_price': 'UnitPrice', 42 | 'total_price': 'TotalPrice' 43 | } 44 | 45 | def __init__(self, break_quantity=None, unit_price=None, total_price=None): # noqa: E501 46 | """PriceBreak - a model defined in Swagger""" # noqa: E501 47 | 48 | self._break_quantity = None 49 | self._unit_price = None 50 | self._total_price = None 51 | self.discriminator = None 52 | 53 | if break_quantity is not None: 54 | self.break_quantity = break_quantity 55 | if unit_price is not None: 56 | self.unit_price = unit_price 57 | if total_price is not None: 58 | self.total_price = total_price 59 | 60 | @property 61 | def break_quantity(self): 62 | """Gets the break_quantity of this PriceBreak. # noqa: E501 63 | 64 | Price tiers based on the available quantities of the product. # noqa: E501 65 | 66 | :return: The break_quantity of this PriceBreak. # noqa: E501 67 | :rtype: int 68 | """ 69 | return self._break_quantity 70 | 71 | @break_quantity.setter 72 | def break_quantity(self, break_quantity): 73 | """Sets the break_quantity of this PriceBreak. 74 | 75 | Price tiers based on the available quantities of the product. # noqa: E501 76 | 77 | :param break_quantity: The break_quantity of this PriceBreak. # noqa: E501 78 | :type: int 79 | """ 80 | 81 | self._break_quantity = break_quantity 82 | 83 | @property 84 | def unit_price(self): 85 | """Gets the unit_price of this PriceBreak. # noqa: E501 86 | 87 | Price of a single unit of the product at this break. # noqa: E501 88 | 89 | :return: The unit_price of this PriceBreak. # noqa: E501 90 | :rtype: float 91 | """ 92 | return self._unit_price 93 | 94 | @unit_price.setter 95 | def unit_price(self, unit_price): 96 | """Sets the unit_price of this PriceBreak. 97 | 98 | Price of a single unit of the product at this break. # noqa: E501 99 | 100 | :param unit_price: The unit_price of this PriceBreak. # noqa: E501 101 | :type: float 102 | """ 103 | 104 | self._unit_price = unit_price 105 | 106 | @property 107 | def total_price(self): 108 | """Gets the total_price of this PriceBreak. # noqa: E501 109 | 110 | Price of BreakQuantity units of the product. # noqa: E501 111 | 112 | :return: The total_price of this PriceBreak. # noqa: E501 113 | :rtype: float 114 | """ 115 | return self._total_price 116 | 117 | @total_price.setter 118 | def total_price(self, total_price): 119 | """Sets the total_price of this PriceBreak. 120 | 121 | Price of BreakQuantity units of the product. # noqa: E501 122 | 123 | :param total_price: The total_price of this PriceBreak. # noqa: E501 124 | :type: float 125 | """ 126 | 127 | self._total_price = total_price 128 | 129 | def to_dict(self): 130 | """Returns the model properties as a dict""" 131 | result = {} 132 | 133 | for attr, _ in six.iteritems(self.swagger_types): 134 | value = getattr(self, attr) 135 | if isinstance(value, list): 136 | result[attr] = list(map( 137 | lambda x: x.to_dict() if hasattr(x, "to_dict") else x, 138 | value 139 | )) 140 | elif hasattr(value, "to_dict"): 141 | result[attr] = value.to_dict() 142 | elif isinstance(value, dict): 143 | result[attr] = dict(map( 144 | lambda item: (item[0], item[1].to_dict()) 145 | if hasattr(item[1], "to_dict") else item, 146 | value.items() 147 | )) 148 | else: 149 | result[attr] = value 150 | if issubclass(PriceBreak, dict): 151 | for key, value in self.items(): 152 | result[key] = value 153 | 154 | return result 155 | 156 | def to_str(self): 157 | """Returns the string representation of the model""" 158 | return pprint.pformat(self.to_dict()) 159 | 160 | def __repr__(self): 161 | """For `print` and `pprint`""" 162 | return self.to_str() 163 | 164 | def __eq__(self, other): 165 | """Returns true if both objects are equal""" 166 | if not isinstance(other, PriceBreak): 167 | return False 168 | 169 | return self.__dict__ == other.__dict__ 170 | 171 | def __ne__(self, other): 172 | """Returns true if both objects are not equal""" 173 | return not self == other 174 | -------------------------------------------------------------------------------- /digikey/v3/ordersupport/__init__.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | # flake8: noqa 4 | 5 | """ 6 | Order Details 7 | 8 | Retrieve information about current and past orders. # noqa: E501 9 | 10 | OpenAPI spec version: v3 11 | 12 | Generated by: https://github.com/swagger-api/swagger-codegen.git 13 | """ 14 | 15 | 16 | from __future__ import absolute_import 17 | 18 | # import apis into sdk package 19 | from digikey.v3.ordersupport.api.order_details_api import OrderDetailsApi 20 | 21 | # import ApiClient 22 | from digikey.v3.ordersupport.api_client import ApiClient 23 | from digikey.v3.ordersupport.configuration import Configuration 24 | # import models into sdk package 25 | from digikey.v3.ordersupport.models.address import Address 26 | from digikey.v3.ordersupport.models.api_error_response import ApiErrorResponse 27 | from digikey.v3.ordersupport.models.api_validation_error import ApiValidationError 28 | from digikey.v3.ordersupport.models.back_order_details import BackOrderDetails 29 | from digikey.v3.ordersupport.models.default_shipping import DefaultShipping 30 | from digikey.v3.ordersupport.models.line_item import LineItem 31 | from digikey.v3.ordersupport.models.order_status_response import OrderStatusResponse 32 | from digikey.v3.ordersupport.models.sales_order_history_item import SalesOrderHistoryItem 33 | from digikey.v3.ordersupport.models.schedule import Schedule 34 | from digikey.v3.ordersupport.models.shipping_detail import ShippingDetail 35 | -------------------------------------------------------------------------------- /digikey/v3/ordersupport/api/__init__.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import 2 | 3 | # flake8: noqa 4 | 5 | # import apis into api package 6 | from digikey.v3.ordersupport.api.order_details_api import OrderDetailsApi 7 | -------------------------------------------------------------------------------- /digikey/v3/ordersupport/models/__init__.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | # flake8: noqa 4 | """ 5 | Order Details 6 | 7 | Retrieve information about current and past orders. # noqa: E501 8 | 9 | OpenAPI spec version: v3 10 | 11 | Generated by: https://github.com/swagger-api/swagger-codegen.git 12 | """ 13 | 14 | 15 | from __future__ import absolute_import 16 | 17 | # import models into model package 18 | from digikey.v3.ordersupport.models.address import Address 19 | from digikey.v3.ordersupport.models.api_error_response import ApiErrorResponse 20 | from digikey.v3.ordersupport.models.api_validation_error import ApiValidationError 21 | from digikey.v3.ordersupport.models.back_order_details import BackOrderDetails 22 | from digikey.v3.ordersupport.models.default_shipping import DefaultShipping 23 | from digikey.v3.ordersupport.models.line_item import LineItem 24 | from digikey.v3.ordersupport.models.order_status_response import OrderStatusResponse 25 | from digikey.v3.ordersupport.models.sales_order_history_item import SalesOrderHistoryItem 26 | from digikey.v3.ordersupport.models.schedule import Schedule 27 | from digikey.v3.ordersupport.models.shipping_detail import ShippingDetail 28 | -------------------------------------------------------------------------------- /digikey/v3/ordersupport/models/api_validation_error.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | """ 4 | Order Details 5 | 6 | Retrieve information about current and past orders. # noqa: E501 7 | 8 | OpenAPI spec version: v3 9 | 10 | Generated by: https://github.com/swagger-api/swagger-codegen.git 11 | """ 12 | 13 | 14 | import pprint 15 | import re # noqa: F401 16 | 17 | import six 18 | 19 | 20 | class ApiValidationError(object): 21 | """NOTE: This class is auto generated by the swagger code generator program. 22 | 23 | Do not edit the class manually. 24 | """ 25 | 26 | """ 27 | Attributes: 28 | swagger_types (dict): The key is attribute name 29 | and the value is attribute type. 30 | attribute_map (dict): The key is attribute name 31 | and the value is json key in definition. 32 | """ 33 | swagger_types = { 34 | 'field': 'str', 35 | 'message': 'str' 36 | } 37 | 38 | attribute_map = { 39 | 'field': 'Field', 40 | 'message': 'Message' 41 | } 42 | 43 | def __init__(self, field=None, message=None): # noqa: E501 44 | """ApiValidationError - a model defined in Swagger""" # noqa: E501 45 | 46 | self._field = None 47 | self._message = None 48 | self.discriminator = None 49 | 50 | if field is not None: 51 | self.field = field 52 | if message is not None: 53 | self.message = message 54 | 55 | @property 56 | def field(self): 57 | """Gets the field of this ApiValidationError. # noqa: E501 58 | 59 | 60 | :return: The field of this ApiValidationError. # noqa: E501 61 | :rtype: str 62 | """ 63 | return self._field 64 | 65 | @field.setter 66 | def field(self, field): 67 | """Sets the field of this ApiValidationError. 68 | 69 | 70 | :param field: The field of this ApiValidationError. # noqa: E501 71 | :type: str 72 | """ 73 | 74 | self._field = field 75 | 76 | @property 77 | def message(self): 78 | """Gets the message of this ApiValidationError. # noqa: E501 79 | 80 | 81 | :return: The message of this ApiValidationError. # noqa: E501 82 | :rtype: str 83 | """ 84 | return self._message 85 | 86 | @message.setter 87 | def message(self, message): 88 | """Sets the message of this ApiValidationError. 89 | 90 | 91 | :param message: The message of this ApiValidationError. # noqa: E501 92 | :type: str 93 | """ 94 | 95 | self._message = message 96 | 97 | def to_dict(self): 98 | """Returns the model properties as a dict""" 99 | result = {} 100 | 101 | for attr, _ in six.iteritems(self.swagger_types): 102 | value = getattr(self, attr) 103 | if isinstance(value, list): 104 | result[attr] = list(map( 105 | lambda x: x.to_dict() if hasattr(x, "to_dict") else x, 106 | value 107 | )) 108 | elif hasattr(value, "to_dict"): 109 | result[attr] = value.to_dict() 110 | elif isinstance(value, dict): 111 | result[attr] = dict(map( 112 | lambda item: (item[0], item[1].to_dict()) 113 | if hasattr(item[1], "to_dict") else item, 114 | value.items() 115 | )) 116 | else: 117 | result[attr] = value 118 | if issubclass(ApiValidationError, dict): 119 | for key, value in self.items(): 120 | result[key] = value 121 | 122 | return result 123 | 124 | def to_str(self): 125 | """Returns the string representation of the model""" 126 | return pprint.pformat(self.to_dict()) 127 | 128 | def __repr__(self): 129 | """For `print` and `pprint`""" 130 | return self.to_str() 131 | 132 | def __eq__(self, other): 133 | """Returns true if both objects are equal""" 134 | if not isinstance(other, ApiValidationError): 135 | return False 136 | 137 | return self.__dict__ == other.__dict__ 138 | 139 | def __ne__(self, other): 140 | """Returns true if both objects are not equal""" 141 | return not self == other 142 | -------------------------------------------------------------------------------- /digikey/v3/ordersupport/models/back_order_details.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | """ 4 | Order Details 5 | 6 | Retrieve information about current and past orders. # noqa: E501 7 | 8 | OpenAPI spec version: v3 9 | 10 | Generated by: https://github.com/swagger-api/swagger-codegen.git 11 | """ 12 | 13 | 14 | import pprint 15 | import re # noqa: F401 16 | 17 | import six 18 | 19 | 20 | class BackOrderDetails(object): 21 | """NOTE: This class is auto generated by the swagger code generator program. 22 | 23 | Do not edit the class manually. 24 | """ 25 | 26 | """ 27 | Attributes: 28 | swagger_types (dict): The key is attribute name 29 | and the value is attribute type. 30 | attribute_map (dict): The key is attribute name 31 | and the value is json key in definition. 32 | """ 33 | swagger_types = { 34 | 'quantity': 'int', 35 | 'back_order_estimates': 'list[Schedule]' 36 | } 37 | 38 | attribute_map = { 39 | 'quantity': 'Quantity', 40 | 'back_order_estimates': 'BackOrderEstimates' 41 | } 42 | 43 | def __init__(self, quantity=None, back_order_estimates=None): # noqa: E501 44 | """BackOrderDetails - a model defined in Swagger""" # noqa: E501 45 | 46 | self._quantity = None 47 | self._back_order_estimates = None 48 | self.discriminator = None 49 | 50 | if quantity is not None: 51 | self.quantity = quantity 52 | if back_order_estimates is not None: 53 | self.back_order_estimates = back_order_estimates 54 | 55 | @property 56 | def quantity(self): 57 | """Gets the quantity of this BackOrderDetails. # noqa: E501 58 | 59 | The total quantity that is backorder. This quantity is the same as LinteItem.QuantityBackorder # noqa: E501 60 | 61 | :return: The quantity of this BackOrderDetails. # noqa: E501 62 | :rtype: int 63 | """ 64 | return self._quantity 65 | 66 | @quantity.setter 67 | def quantity(self, quantity): 68 | """Sets the quantity of this BackOrderDetails. 69 | 70 | The total quantity that is backorder. This quantity is the same as LinteItem.QuantityBackorder # noqa: E501 71 | 72 | :param quantity: The quantity of this BackOrderDetails. # noqa: E501 73 | :type: int 74 | """ 75 | 76 | self._quantity = quantity 77 | 78 | @property 79 | def back_order_estimates(self): 80 | """Gets the back_order_estimates of this BackOrderDetails. # noqa: E501 81 | 82 | The Manufacturer's estimated date and quantity that Digi-Key will receive the product. # noqa: E501 83 | 84 | :return: The back_order_estimates of this BackOrderDetails. # noqa: E501 85 | :rtype: list[Schedule] 86 | """ 87 | return self._back_order_estimates 88 | 89 | @back_order_estimates.setter 90 | def back_order_estimates(self, back_order_estimates): 91 | """Sets the back_order_estimates of this BackOrderDetails. 92 | 93 | The Manufacturer's estimated date and quantity that Digi-Key will receive the product. # noqa: E501 94 | 95 | :param back_order_estimates: The back_order_estimates of this BackOrderDetails. # noqa: E501 96 | :type: list[Schedule] 97 | """ 98 | 99 | self._back_order_estimates = back_order_estimates 100 | 101 | def to_dict(self): 102 | """Returns the model properties as a dict""" 103 | result = {} 104 | 105 | for attr, _ in six.iteritems(self.swagger_types): 106 | value = getattr(self, attr) 107 | if isinstance(value, list): 108 | result[attr] = list(map( 109 | lambda x: x.to_dict() if hasattr(x, "to_dict") else x, 110 | value 111 | )) 112 | elif hasattr(value, "to_dict"): 113 | result[attr] = value.to_dict() 114 | elif isinstance(value, dict): 115 | result[attr] = dict(map( 116 | lambda item: (item[0], item[1].to_dict()) 117 | if hasattr(item[1], "to_dict") else item, 118 | value.items() 119 | )) 120 | else: 121 | result[attr] = value 122 | if issubclass(BackOrderDetails, dict): 123 | for key, value in self.items(): 124 | result[key] = value 125 | 126 | return result 127 | 128 | def to_str(self): 129 | """Returns the string representation of the model""" 130 | return pprint.pformat(self.to_dict()) 131 | 132 | def __repr__(self): 133 | """For `print` and `pprint`""" 134 | return self.to_str() 135 | 136 | def __eq__(self, other): 137 | """Returns true if both objects are equal""" 138 | if not isinstance(other, BackOrderDetails): 139 | return False 140 | 141 | return self.__dict__ == other.__dict__ 142 | 143 | def __ne__(self, other): 144 | """Returns true if both objects are not equal""" 145 | return not self == other 146 | -------------------------------------------------------------------------------- /digikey/v3/ordersupport/models/default_shipping.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | """ 4 | Order Details 5 | 6 | Retrieve information about current and past orders. # noqa: E501 7 | 8 | OpenAPI spec version: v3 9 | 10 | Generated by: https://github.com/swagger-api/swagger-codegen.git 11 | """ 12 | 13 | 14 | import pprint 15 | import re # noqa: F401 16 | 17 | import six 18 | 19 | 20 | class DefaultShipping(object): 21 | """NOTE: This class is auto generated by the swagger code generator program. 22 | 23 | Do not edit the class manually. 24 | """ 25 | 26 | """ 27 | Attributes: 28 | swagger_types (dict): The key is attribute name 29 | and the value is attribute type. 30 | attribute_map (dict): The key is attribute name 31 | and the value is json key in definition. 32 | """ 33 | swagger_types = { 34 | 'digi_key_release_date': 'str', 35 | 'estimated_in_house_date': 'str' 36 | } 37 | 38 | attribute_map = { 39 | 'digi_key_release_date': 'DigiKeyReleaseDate', 40 | 'estimated_in_house_date': 'EstimatedInHouseDate' 41 | } 42 | 43 | def __init__(self, digi_key_release_date=None, estimated_in_house_date=None): # noqa: E501 44 | """DefaultShipping - a model defined in Swagger""" # noqa: E501 45 | 46 | self._digi_key_release_date = None 47 | self._estimated_in_house_date = None 48 | self.discriminator = None 49 | 50 | if digi_key_release_date is not None: 51 | self.digi_key_release_date = digi_key_release_date 52 | if estimated_in_house_date is not None: 53 | self.estimated_in_house_date = estimated_in_house_date 54 | 55 | @property 56 | def digi_key_release_date(self): 57 | """Gets the digi_key_release_date of this DefaultShipping. # noqa: E501 58 | 59 | Default shipping date # noqa: E501 60 | 61 | :return: The digi_key_release_date of this DefaultShipping. # noqa: E501 62 | :rtype: str 63 | """ 64 | return self._digi_key_release_date 65 | 66 | @digi_key_release_date.setter 67 | def digi_key_release_date(self, digi_key_release_date): 68 | """Sets the digi_key_release_date of this DefaultShipping. 69 | 70 | Default shipping date # noqa: E501 71 | 72 | :param digi_key_release_date: The digi_key_release_date of this DefaultShipping. # noqa: E501 73 | :type: str 74 | """ 75 | 76 | self._digi_key_release_date = digi_key_release_date 77 | 78 | @property 79 | def estimated_in_house_date(self): 80 | """Gets the estimated_in_house_date of this DefaultShipping. # noqa: E501 81 | 82 | The estimated date the product will # noqa: E501 83 | 84 | :return: The estimated_in_house_date of this DefaultShipping. # noqa: E501 85 | :rtype: str 86 | """ 87 | return self._estimated_in_house_date 88 | 89 | @estimated_in_house_date.setter 90 | def estimated_in_house_date(self, estimated_in_house_date): 91 | """Sets the estimated_in_house_date of this DefaultShipping. 92 | 93 | The estimated date the product will # noqa: E501 94 | 95 | :param estimated_in_house_date: The estimated_in_house_date of this DefaultShipping. # noqa: E501 96 | :type: str 97 | """ 98 | 99 | self._estimated_in_house_date = estimated_in_house_date 100 | 101 | def to_dict(self): 102 | """Returns the model properties as a dict""" 103 | result = {} 104 | 105 | for attr, _ in six.iteritems(self.swagger_types): 106 | value = getattr(self, attr) 107 | if isinstance(value, list): 108 | result[attr] = list(map( 109 | lambda x: x.to_dict() if hasattr(x, "to_dict") else x, 110 | value 111 | )) 112 | elif hasattr(value, "to_dict"): 113 | result[attr] = value.to_dict() 114 | elif isinstance(value, dict): 115 | result[attr] = dict(map( 116 | lambda item: (item[0], item[1].to_dict()) 117 | if hasattr(item[1], "to_dict") else item, 118 | value.items() 119 | )) 120 | else: 121 | result[attr] = value 122 | if issubclass(DefaultShipping, dict): 123 | for key, value in self.items(): 124 | result[key] = value 125 | 126 | return result 127 | 128 | def to_str(self): 129 | """Returns the string representation of the model""" 130 | return pprint.pformat(self.to_dict()) 131 | 132 | def __repr__(self): 133 | """For `print` and `pprint`""" 134 | return self.to_str() 135 | 136 | def __eq__(self, other): 137 | """Returns true if both objects are equal""" 138 | if not isinstance(other, DefaultShipping): 139 | return False 140 | 141 | return self.__dict__ == other.__dict__ 142 | 143 | def __ne__(self, other): 144 | """Returns true if both objects are not equal""" 145 | return not self == other 146 | -------------------------------------------------------------------------------- /digikey/v3/ordersupport/models/sales_order_history_item.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | """ 4 | Order Details 5 | 6 | Retrieve information about current and past orders. # noqa: E501 7 | 8 | OpenAPI spec version: v3 9 | 10 | Generated by: https://github.com/swagger-api/swagger-codegen.git 11 | """ 12 | 13 | 14 | import pprint 15 | import re # noqa: F401 16 | 17 | import six 18 | 19 | 20 | class SalesOrderHistoryItem(object): 21 | """NOTE: This class is auto generated by the swagger code generator program. 22 | 23 | Do not edit the class manually. 24 | """ 25 | 26 | """ 27 | Attributes: 28 | swagger_types (dict): The key is attribute name 29 | and the value is attribute type. 30 | attribute_map (dict): The key is attribute name 31 | and the value is json key in definition. 32 | """ 33 | swagger_types = { 34 | 'salesorder_id': 'int', 35 | 'customer_id': 'int', 36 | 'date_entered': 'str', 37 | 'purchase_order': 'str' 38 | } 39 | 40 | attribute_map = { 41 | 'salesorder_id': 'SalesorderId', 42 | 'customer_id': 'CustomerId', 43 | 'date_entered': 'DateEntered', 44 | 'purchase_order': 'PurchaseOrder' 45 | } 46 | 47 | def __init__(self, salesorder_id=None, customer_id=None, date_entered=None, purchase_order=None): # noqa: E501 48 | """SalesOrderHistoryItem - a model defined in Swagger""" # noqa: E501 49 | 50 | self._salesorder_id = None 51 | self._customer_id = None 52 | self._date_entered = None 53 | self._purchase_order = None 54 | self.discriminator = None 55 | 56 | if salesorder_id is not None: 57 | self.salesorder_id = salesorder_id 58 | if customer_id is not None: 59 | self.customer_id = customer_id 60 | if date_entered is not None: 61 | self.date_entered = date_entered 62 | if purchase_order is not None: 63 | self.purchase_order = purchase_order 64 | 65 | @property 66 | def salesorder_id(self): 67 | """Gets the salesorder_id of this SalesOrderHistoryItem. # noqa: E501 68 | 69 | The SalesOrder Id. You can use this Id to look up details on the order. # noqa: E501 70 | 71 | :return: The salesorder_id of this SalesOrderHistoryItem. # noqa: E501 72 | :rtype: int 73 | """ 74 | return self._salesorder_id 75 | 76 | @salesorder_id.setter 77 | def salesorder_id(self, salesorder_id): 78 | """Sets the salesorder_id of this SalesOrderHistoryItem. 79 | 80 | The SalesOrder Id. You can use this Id to look up details on the order. # noqa: E501 81 | 82 | :param salesorder_id: The salesorder_id of this SalesOrderHistoryItem. # noqa: E501 83 | :type: int 84 | """ 85 | 86 | self._salesorder_id = salesorder_id 87 | 88 | @property 89 | def customer_id(self): 90 | """Gets the customer_id of this SalesOrderHistoryItem. # noqa: E501 91 | 92 | The CustomerId associated with the SalesOrder # noqa: E501 93 | 94 | :return: The customer_id of this SalesOrderHistoryItem. # noqa: E501 95 | :rtype: int 96 | """ 97 | return self._customer_id 98 | 99 | @customer_id.setter 100 | def customer_id(self, customer_id): 101 | """Sets the customer_id of this SalesOrderHistoryItem. 102 | 103 | The CustomerId associated with the SalesOrder # noqa: E501 104 | 105 | :param customer_id: The customer_id of this SalesOrderHistoryItem. # noqa: E501 106 | :type: int 107 | """ 108 | 109 | self._customer_id = customer_id 110 | 111 | @property 112 | def date_entered(self): 113 | """Gets the date_entered of this SalesOrderHistoryItem. # noqa: E501 114 | 115 | Date in which the order was entered in ISO 8601 format. # noqa: E501 116 | 117 | :return: The date_entered of this SalesOrderHistoryItem. # noqa: E501 118 | :rtype: str 119 | """ 120 | return self._date_entered 121 | 122 | @date_entered.setter 123 | def date_entered(self, date_entered): 124 | """Sets the date_entered of this SalesOrderHistoryItem. 125 | 126 | Date in which the order was entered in ISO 8601 format. # noqa: E501 127 | 128 | :param date_entered: The date_entered of this SalesOrderHistoryItem. # noqa: E501 129 | :type: str 130 | """ 131 | 132 | self._date_entered = date_entered 133 | 134 | @property 135 | def purchase_order(self): 136 | """Gets the purchase_order of this SalesOrderHistoryItem. # noqa: E501 137 | 138 | Purchase order if available # noqa: E501 139 | 140 | :return: The purchase_order of this SalesOrderHistoryItem. # noqa: E501 141 | :rtype: str 142 | """ 143 | return self._purchase_order 144 | 145 | @purchase_order.setter 146 | def purchase_order(self, purchase_order): 147 | """Sets the purchase_order of this SalesOrderHistoryItem. 148 | 149 | Purchase order if available # noqa: E501 150 | 151 | :param purchase_order: The purchase_order of this SalesOrderHistoryItem. # noqa: E501 152 | :type: str 153 | """ 154 | 155 | self._purchase_order = purchase_order 156 | 157 | def to_dict(self): 158 | """Returns the model properties as a dict""" 159 | result = {} 160 | 161 | for attr, _ in six.iteritems(self.swagger_types): 162 | value = getattr(self, attr) 163 | if isinstance(value, list): 164 | result[attr] = list(map( 165 | lambda x: x.to_dict() if hasattr(x, "to_dict") else x, 166 | value 167 | )) 168 | elif hasattr(value, "to_dict"): 169 | result[attr] = value.to_dict() 170 | elif isinstance(value, dict): 171 | result[attr] = dict(map( 172 | lambda item: (item[0], item[1].to_dict()) 173 | if hasattr(item[1], "to_dict") else item, 174 | value.items() 175 | )) 176 | else: 177 | result[attr] = value 178 | if issubclass(SalesOrderHistoryItem, dict): 179 | for key, value in self.items(): 180 | result[key] = value 181 | 182 | return result 183 | 184 | def to_str(self): 185 | """Returns the string representation of the model""" 186 | return pprint.pformat(self.to_dict()) 187 | 188 | def __repr__(self): 189 | """For `print` and `pprint`""" 190 | return self.to_str() 191 | 192 | def __eq__(self, other): 193 | """Returns true if both objects are equal""" 194 | if not isinstance(other, SalesOrderHistoryItem): 195 | return False 196 | 197 | return self.__dict__ == other.__dict__ 198 | 199 | def __ne__(self, other): 200 | """Returns true if both objects are not equal""" 201 | return not self == other 202 | -------------------------------------------------------------------------------- /digikey/v3/ordersupport/models/salesorder_history_item.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | """ 4 | Order Details 5 | 6 | Retrieve information about current and past orders. # noqa: E501 7 | 8 | OpenAPI spec version: v3 9 | Contact: api.contact@digikey.com 10 | Generated by: https://github.com/swagger-api/swagger-codegen.git 11 | """ 12 | 13 | 14 | import pprint 15 | import re # noqa: F401 16 | 17 | import six 18 | 19 | 20 | class SalesorderHistoryItem(object): 21 | """NOTE: This class is auto generated by the swagger code generator program. 22 | 23 | Do not edit the class manually. 24 | """ 25 | 26 | """ 27 | Attributes: 28 | swagger_types (dict): The key is attribute name 29 | and the value is attribute type. 30 | attribute_map (dict): The key is attribute name 31 | and the value is json key in definition. 32 | """ 33 | swagger_types = { 34 | 'salesorder_id': 'int', 35 | 'customer_id': 'int', 36 | 'date_entered': 'str', 37 | 'purchase_order': 'str' 38 | } 39 | 40 | attribute_map = { 41 | 'salesorder_id': 'SalesorderId', 42 | 'customer_id': 'CustomerId', 43 | 'date_entered': 'DateEntered', 44 | 'purchase_order': 'PurchaseOrder' 45 | } 46 | 47 | def __init__(self, salesorder_id=None, customer_id=None, date_entered=None, purchase_order=None): # noqa: E501 48 | """SalesorderHistoryItem - a model defined in Swagger""" # noqa: E501 49 | 50 | self._salesorder_id = None 51 | self._customer_id = None 52 | self._date_entered = None 53 | self._purchase_order = None 54 | self.discriminator = None 55 | 56 | if salesorder_id is not None: 57 | self.salesorder_id = salesorder_id 58 | if customer_id is not None: 59 | self.customer_id = customer_id 60 | if date_entered is not None: 61 | self.date_entered = date_entered 62 | if purchase_order is not None: 63 | self.purchase_order = purchase_order 64 | 65 | @property 66 | def salesorder_id(self): 67 | """Gets the salesorder_id of this SalesorderHistoryItem. # noqa: E501 68 | 69 | The Salesorder Id. You can use this Id to look up details on the order. # noqa: E501 70 | 71 | :return: The salesorder_id of this SalesorderHistoryItem. # noqa: E501 72 | :rtype: int 73 | """ 74 | return self._salesorder_id 75 | 76 | @salesorder_id.setter 77 | def salesorder_id(self, salesorder_id): 78 | """Sets the salesorder_id of this SalesorderHistoryItem. 79 | 80 | The Salesorder Id. You can use this Id to look up details on the order. # noqa: E501 81 | 82 | :param salesorder_id: The salesorder_id of this SalesorderHistoryItem. # noqa: E501 83 | :type: int 84 | """ 85 | 86 | self._salesorder_id = salesorder_id 87 | 88 | @property 89 | def customer_id(self): 90 | """Gets the customer_id of this SalesorderHistoryItem. # noqa: E501 91 | 92 | The CustomerId associated with the Salesorder # noqa: E501 93 | 94 | :return: The customer_id of this SalesorderHistoryItem. # noqa: E501 95 | :rtype: int 96 | """ 97 | return self._customer_id 98 | 99 | @customer_id.setter 100 | def customer_id(self, customer_id): 101 | """Sets the customer_id of this SalesorderHistoryItem. 102 | 103 | The CustomerId associated with the Salesorder # noqa: E501 104 | 105 | :param customer_id: The customer_id of this SalesorderHistoryItem. # noqa: E501 106 | :type: int 107 | """ 108 | 109 | self._customer_id = customer_id 110 | 111 | @property 112 | def date_entered(self): 113 | """Gets the date_entered of this SalesorderHistoryItem. # noqa: E501 114 | 115 | Date in which the order was entered in ISO 8601 format. # noqa: E501 116 | 117 | :return: The date_entered of this SalesorderHistoryItem. # noqa: E501 118 | :rtype: str 119 | """ 120 | return self._date_entered 121 | 122 | @date_entered.setter 123 | def date_entered(self, date_entered): 124 | """Sets the date_entered of this SalesorderHistoryItem. 125 | 126 | Date in which the order was entered in ISO 8601 format. # noqa: E501 127 | 128 | :param date_entered: The date_entered of this SalesorderHistoryItem. # noqa: E501 129 | :type: str 130 | """ 131 | 132 | self._date_entered = date_entered 133 | 134 | @property 135 | def purchase_order(self): 136 | """Gets the purchase_order of this SalesorderHistoryItem. # noqa: E501 137 | 138 | Purchase order if available # noqa: E501 139 | 140 | :return: The purchase_order of this SalesorderHistoryItem. # noqa: E501 141 | :rtype: str 142 | """ 143 | return self._purchase_order 144 | 145 | @purchase_order.setter 146 | def purchase_order(self, purchase_order): 147 | """Sets the purchase_order of this SalesorderHistoryItem. 148 | 149 | Purchase order if available # noqa: E501 150 | 151 | :param purchase_order: The purchase_order of this SalesorderHistoryItem. # noqa: E501 152 | :type: str 153 | """ 154 | 155 | self._purchase_order = purchase_order 156 | 157 | def to_dict(self): 158 | """Returns the model properties as a dict""" 159 | result = {} 160 | 161 | for attr, _ in six.iteritems(self.swagger_types): 162 | value = getattr(self, attr) 163 | if isinstance(value, list): 164 | result[attr] = list(map( 165 | lambda x: x.to_dict() if hasattr(x, "to_dict") else x, 166 | value 167 | )) 168 | elif hasattr(value, "to_dict"): 169 | result[attr] = value.to_dict() 170 | elif isinstance(value, dict): 171 | result[attr] = dict(map( 172 | lambda item: (item[0], item[1].to_dict()) 173 | if hasattr(item[1], "to_dict") else item, 174 | value.items() 175 | )) 176 | else: 177 | result[attr] = value 178 | if issubclass(SalesorderHistoryItem, dict): 179 | for key, value in self.items(): 180 | result[key] = value 181 | 182 | return result 183 | 184 | def to_str(self): 185 | """Returns the string representation of the model""" 186 | return pprint.pformat(self.to_dict()) 187 | 188 | def __repr__(self): 189 | """For `print` and `pprint`""" 190 | return self.to_str() 191 | 192 | def __eq__(self, other): 193 | """Returns true if both objects are equal""" 194 | if not isinstance(other, SalesorderHistoryItem): 195 | return False 196 | 197 | return self.__dict__ == other.__dict__ 198 | 199 | def __ne__(self, other): 200 | """Returns true if both objects are not equal""" 201 | return not self == other 202 | -------------------------------------------------------------------------------- /digikey/v3/ordersupport/models/schedule.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | """ 4 | Order Details 5 | 6 | Retrieve information about current and past orders. # noqa: E501 7 | 8 | OpenAPI spec version: v3 9 | 10 | Generated by: https://github.com/swagger-api/swagger-codegen.git 11 | """ 12 | 13 | 14 | import pprint 15 | import re # noqa: F401 16 | 17 | import six 18 | 19 | 20 | class Schedule(object): 21 | """NOTE: This class is auto generated by the swagger code generator program. 22 | 23 | Do not edit the class manually. 24 | """ 25 | 26 | """ 27 | Attributes: 28 | swagger_types (dict): The key is attribute name 29 | and the value is attribute type. 30 | attribute_map (dict): The key is attribute name 31 | and the value is json key in definition. 32 | """ 33 | swagger_types = { 34 | 'scheduled_quantity': 'int', 35 | 'scheduled_date': 'str' 36 | } 37 | 38 | attribute_map = { 39 | 'scheduled_quantity': 'ScheduledQuantity', 40 | 'scheduled_date': 'ScheduledDate' 41 | } 42 | 43 | def __init__(self, scheduled_quantity=None, scheduled_date=None): # noqa: E501 44 | """Schedule - a model defined in Swagger""" # noqa: E501 45 | 46 | self._scheduled_quantity = None 47 | self._scheduled_date = None 48 | self.discriminator = None 49 | 50 | if scheduled_quantity is not None: 51 | self.scheduled_quantity = scheduled_quantity 52 | if scheduled_date is not None: 53 | self.scheduled_date = scheduled_date 54 | 55 | @property 56 | def scheduled_quantity(self): 57 | """Gets the scheduled_quantity of this Schedule. # noqa: E501 58 | 59 | The total quantity for the schedule. # noqa: E501 60 | 61 | :return: The scheduled_quantity of this Schedule. # noqa: E501 62 | :rtype: int 63 | """ 64 | return self._scheduled_quantity 65 | 66 | @scheduled_quantity.setter 67 | def scheduled_quantity(self, scheduled_quantity): 68 | """Sets the scheduled_quantity of this Schedule. 69 | 70 | The total quantity for the schedule. # noqa: E501 71 | 72 | :param scheduled_quantity: The scheduled_quantity of this Schedule. # noqa: E501 73 | :type: int 74 | """ 75 | 76 | self._scheduled_quantity = scheduled_quantity 77 | 78 | @property 79 | def scheduled_date(self): 80 | """Gets the scheduled_date of this Schedule. # noqa: E501 81 | 82 | The Date of the Schedule ISO 8601 format # noqa: E501 83 | 84 | :return: The scheduled_date of this Schedule. # noqa: E501 85 | :rtype: str 86 | """ 87 | return self._scheduled_date 88 | 89 | @scheduled_date.setter 90 | def scheduled_date(self, scheduled_date): 91 | """Sets the scheduled_date of this Schedule. 92 | 93 | The Date of the Schedule ISO 8601 format # noqa: E501 94 | 95 | :param scheduled_date: The scheduled_date of this Schedule. # noqa: E501 96 | :type: str 97 | """ 98 | 99 | self._scheduled_date = scheduled_date 100 | 101 | def to_dict(self): 102 | """Returns the model properties as a dict""" 103 | result = {} 104 | 105 | for attr, _ in six.iteritems(self.swagger_types): 106 | value = getattr(self, attr) 107 | if isinstance(value, list): 108 | result[attr] = list(map( 109 | lambda x: x.to_dict() if hasattr(x, "to_dict") else x, 110 | value 111 | )) 112 | elif hasattr(value, "to_dict"): 113 | result[attr] = value.to_dict() 114 | elif isinstance(value, dict): 115 | result[attr] = dict(map( 116 | lambda item: (item[0], item[1].to_dict()) 117 | if hasattr(item[1], "to_dict") else item, 118 | value.items() 119 | )) 120 | else: 121 | result[attr] = value 122 | if issubclass(Schedule, dict): 123 | for key, value in self.items(): 124 | result[key] = value 125 | 126 | return result 127 | 128 | def to_str(self): 129 | """Returns the string representation of the model""" 130 | return pprint.pformat(self.to_dict()) 131 | 132 | def __repr__(self): 133 | """For `print` and `pprint`""" 134 | return self.to_str() 135 | 136 | def __eq__(self, other): 137 | """Returns true if both objects are equal""" 138 | if not isinstance(other, Schedule): 139 | return False 140 | 141 | return self.__dict__ == other.__dict__ 142 | 143 | def __ne__(self, other): 144 | """Returns true if both objects are not equal""" 145 | return not self == other 146 | -------------------------------------------------------------------------------- /digikey/v3/productinformation/__init__.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | # flake8: noqa 4 | 5 | """ 6 | PartSearch Api 7 | 8 | Search for products and retrieve details and pricing. # noqa: E501 9 | 10 | OpenAPI spec version: v3 11 | 12 | Generated by: https://github.com/swagger-api/swagger-codegen.git 13 | """ 14 | 15 | 16 | from __future__ import absolute_import 17 | 18 | # import apis into sdk package 19 | from digikey.v3.productinformation.api.part_search_api import PartSearchApi 20 | 21 | # import ApiClient 22 | from digikey.v3.productinformation.api_client import ApiClient 23 | from digikey.v3.productinformation.configuration import Configuration 24 | # import models into sdk package 25 | from digikey.v3.productinformation.models.api_error_response import ApiErrorResponse 26 | from digikey.v3.productinformation.models.api_validation_error import ApiValidationError 27 | from digikey.v3.productinformation.models.associated_product import AssociatedProduct 28 | from digikey.v3.productinformation.models.basic_product import BasicProduct 29 | from digikey.v3.productinformation.models.digi_reel_pricing import DigiReelPricing 30 | from digikey.v3.productinformation.models.filters import Filters 31 | from digikey.v3.productinformation.models.iso_search_locale import IsoSearchLocale 32 | from digikey.v3.productinformation.models.keyword_search_request import KeywordSearchRequest 33 | from digikey.v3.productinformation.models.keyword_search_response import KeywordSearchResponse 34 | from digikey.v3.productinformation.models.kit_part import KitPart 35 | from digikey.v3.productinformation.models.limited_parameter import LimitedParameter 36 | from digikey.v3.productinformation.models.limited_taxonomy import LimitedTaxonomy 37 | from digikey.v3.productinformation.models.manufacturer_product_details_request import ManufacturerProductDetailsRequest 38 | from digikey.v3.productinformation.models.media_links import MediaLinks 39 | from digikey.v3.productinformation.models.parametric_filter import ParametricFilter 40 | from digikey.v3.productinformation.models.pid_vid import PidVid 41 | from digikey.v3.productinformation.models.price_break import PriceBreak 42 | from digikey.v3.productinformation.models.product import Product 43 | from digikey.v3.productinformation.models.product_details import ProductDetails 44 | from digikey.v3.productinformation.models.product_details_response import ProductDetailsResponse 45 | from digikey.v3.productinformation.models.search_option import SearchOption 46 | from digikey.v3.productinformation.models.sort_direction import SortDirection 47 | from digikey.v3.productinformation.models.sort_option import SortOption 48 | from digikey.v3.productinformation.models.sort_parameters import SortParameters 49 | from digikey.v3.productinformation.models.value_pair import ValuePair 50 | -------------------------------------------------------------------------------- /digikey/v3/productinformation/api/__init__.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import 2 | 3 | # flake8: noqa 4 | 5 | # import apis into api package 6 | from digikey.v3.productinformation.api.part_search_api import PartSearchApi 7 | -------------------------------------------------------------------------------- /digikey/v3/productinformation/models/__init__.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | # flake8: noqa 4 | """ 5 | PartSearch Api 6 | 7 | Search for products and retrieve details and pricing. # noqa: E501 8 | 9 | OpenAPI spec version: v3 10 | 11 | Generated by: https://github.com/swagger-api/swagger-codegen.git 12 | """ 13 | 14 | 15 | from __future__ import absolute_import 16 | 17 | # import models into model package 18 | from digikey.v3.productinformation.models.api_error_response import ApiErrorResponse 19 | from digikey.v3.productinformation.models.api_validation_error import ApiValidationError 20 | from digikey.v3.productinformation.models.associated_product import AssociatedProduct 21 | from digikey.v3.productinformation.models.basic_product import BasicProduct 22 | from digikey.v3.productinformation.models.digi_reel_pricing import DigiReelPricing 23 | from digikey.v3.productinformation.models.filters import Filters 24 | from digikey.v3.productinformation.models.iso_search_locale import IsoSearchLocale 25 | from digikey.v3.productinformation.models.keyword_search_request import KeywordSearchRequest 26 | from digikey.v3.productinformation.models.keyword_search_response import KeywordSearchResponse 27 | from digikey.v3.productinformation.models.kit_part import KitPart 28 | from digikey.v3.productinformation.models.limited_parameter import LimitedParameter 29 | from digikey.v3.productinformation.models.limited_taxonomy import LimitedTaxonomy 30 | from digikey.v3.productinformation.models.manufacturer_product_details_request import ManufacturerProductDetailsRequest 31 | from digikey.v3.productinformation.models.media_links import MediaLinks 32 | from digikey.v3.productinformation.models.parametric_filter import ParametricFilter 33 | from digikey.v3.productinformation.models.pid_vid import PidVid 34 | from digikey.v3.productinformation.models.price_break import PriceBreak 35 | from digikey.v3.productinformation.models.product import Product 36 | from digikey.v3.productinformation.models.product_details import ProductDetails 37 | from digikey.v3.productinformation.models.product_details_response import ProductDetailsResponse 38 | from digikey.v3.productinformation.models.search_option import SearchOption 39 | from digikey.v3.productinformation.models.sort_direction import SortDirection 40 | from digikey.v3.productinformation.models.sort_option import SortOption 41 | from digikey.v3.productinformation.models.sort_parameters import SortParameters 42 | from digikey.v3.productinformation.models.value_pair import ValuePair 43 | -------------------------------------------------------------------------------- /digikey/v3/productinformation/models/api_validation_error.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | """ 4 | PartSearch Api 5 | 6 | Search for products and retrieve details and pricing. # noqa: E501 7 | 8 | OpenAPI spec version: v3 9 | 10 | Generated by: https://github.com/swagger-api/swagger-codegen.git 11 | """ 12 | 13 | 14 | import pprint 15 | import re # noqa: F401 16 | 17 | import six 18 | 19 | 20 | class ApiValidationError(object): 21 | """NOTE: This class is auto generated by the swagger code generator program. 22 | 23 | Do not edit the class manually. 24 | """ 25 | 26 | """ 27 | Attributes: 28 | swagger_types (dict): The key is attribute name 29 | and the value is attribute type. 30 | attribute_map (dict): The key is attribute name 31 | and the value is json key in definition. 32 | """ 33 | swagger_types = { 34 | 'field': 'str', 35 | 'message': 'str' 36 | } 37 | 38 | attribute_map = { 39 | 'field': 'Field', 40 | 'message': 'Message' 41 | } 42 | 43 | def __init__(self, field=None, message=None): # noqa: E501 44 | """ApiValidationError - a model defined in Swagger""" # noqa: E501 45 | 46 | self._field = None 47 | self._message = None 48 | self.discriminator = None 49 | 50 | if field is not None: 51 | self.field = field 52 | if message is not None: 53 | self.message = message 54 | 55 | @property 56 | def field(self): 57 | """Gets the field of this ApiValidationError. # noqa: E501 58 | 59 | 60 | :return: The field of this ApiValidationError. # noqa: E501 61 | :rtype: str 62 | """ 63 | return self._field 64 | 65 | @field.setter 66 | def field(self, field): 67 | """Sets the field of this ApiValidationError. 68 | 69 | 70 | :param field: The field of this ApiValidationError. # noqa: E501 71 | :type: str 72 | """ 73 | 74 | self._field = field 75 | 76 | @property 77 | def message(self): 78 | """Gets the message of this ApiValidationError. # noqa: E501 79 | 80 | 81 | :return: The message of this ApiValidationError. # noqa: E501 82 | :rtype: str 83 | """ 84 | return self._message 85 | 86 | @message.setter 87 | def message(self, message): 88 | """Sets the message of this ApiValidationError. 89 | 90 | 91 | :param message: The message of this ApiValidationError. # noqa: E501 92 | :type: str 93 | """ 94 | 95 | self._message = message 96 | 97 | def to_dict(self): 98 | """Returns the model properties as a dict""" 99 | result = {} 100 | 101 | for attr, _ in six.iteritems(self.swagger_types): 102 | value = getattr(self, attr) 103 | if isinstance(value, list): 104 | result[attr] = list(map( 105 | lambda x: x.to_dict() if hasattr(x, "to_dict") else x, 106 | value 107 | )) 108 | elif hasattr(value, "to_dict"): 109 | result[attr] = value.to_dict() 110 | elif isinstance(value, dict): 111 | result[attr] = dict(map( 112 | lambda item: (item[0], item[1].to_dict()) 113 | if hasattr(item[1], "to_dict") else item, 114 | value.items() 115 | )) 116 | else: 117 | result[attr] = value 118 | if issubclass(ApiValidationError, dict): 119 | for key, value in self.items(): 120 | result[key] = value 121 | 122 | return result 123 | 124 | def to_str(self): 125 | """Returns the string representation of the model""" 126 | return pprint.pformat(self.to_dict()) 127 | 128 | def __repr__(self): 129 | """For `print` and `pprint`""" 130 | return self.to_str() 131 | 132 | def __eq__(self, other): 133 | """Returns true if both objects are equal""" 134 | if not isinstance(other, ApiValidationError): 135 | return False 136 | 137 | return self.__dict__ == other.__dict__ 138 | 139 | def __ne__(self, other): 140 | """Returns true if both objects are not equal""" 141 | return not self == other 142 | -------------------------------------------------------------------------------- /digikey/v3/productinformation/models/filters.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | """ 4 | PartSearch Api 5 | 6 | Search for products and retrieve details and pricing. # noqa: E501 7 | 8 | OpenAPI spec version: v3 9 | 10 | Generated by: https://github.com/swagger-api/swagger-codegen.git 11 | """ 12 | 13 | 14 | import pprint 15 | import re # noqa: F401 16 | 17 | import six 18 | 19 | 20 | class Filters(object): 21 | """NOTE: This class is auto generated by the swagger code generator program. 22 | 23 | Do not edit the class manually. 24 | """ 25 | 26 | """ 27 | Attributes: 28 | swagger_types (dict): The key is attribute name 29 | and the value is attribute type. 30 | attribute_map (dict): The key is attribute name 31 | and the value is json key in definition. 32 | """ 33 | swagger_types = { 34 | 'taxonomy_ids': 'list[int]', 35 | 'manufacturer_ids': 'list[int]', 36 | 'parametric_filters': 'list[ParametricFilter]' 37 | } 38 | 39 | attribute_map = { 40 | 'taxonomy_ids': 'TaxonomyIds', 41 | 'manufacturer_ids': 'ManufacturerIds', 42 | 'parametric_filters': 'ParametricFilters' 43 | } 44 | 45 | def __init__(self, taxonomy_ids=None, manufacturer_ids=None, parametric_filters=None): # noqa: E501 46 | """Filters - a model defined in Swagger""" # noqa: E501 47 | 48 | self._taxonomy_ids = None 49 | self._manufacturer_ids = None 50 | self._parametric_filters = None 51 | self.discriminator = None 52 | 53 | if taxonomy_ids is not None: 54 | self.taxonomy_ids = taxonomy_ids 55 | if manufacturer_ids is not None: 56 | self.manufacturer_ids = manufacturer_ids 57 | if parametric_filters is not None: 58 | self.parametric_filters = parametric_filters 59 | 60 | @property 61 | def taxonomy_ids(self): 62 | """Gets the taxonomy_ids of this Filters. # noqa: E501 63 | 64 | A collection of Taxonomy Ids to filter on. Ids can be found in the initial search response. # noqa: E501 65 | 66 | :return: The taxonomy_ids of this Filters. # noqa: E501 67 | :rtype: list[int] 68 | """ 69 | return self._taxonomy_ids 70 | 71 | @taxonomy_ids.setter 72 | def taxonomy_ids(self, taxonomy_ids): 73 | """Sets the taxonomy_ids of this Filters. 74 | 75 | A collection of Taxonomy Ids to filter on. Ids can be found in the initial search response. # noqa: E501 76 | 77 | :param taxonomy_ids: The taxonomy_ids of this Filters. # noqa: E501 78 | :type: list[int] 79 | """ 80 | 81 | self._taxonomy_ids = taxonomy_ids 82 | 83 | @property 84 | def manufacturer_ids(self): 85 | """Gets the manufacturer_ids of this Filters. # noqa: E501 86 | 87 | A collection of Manufacturer Ids to filter on. Ids can be found in the initial search response. # noqa: E501 88 | 89 | :return: The manufacturer_ids of this Filters. # noqa: E501 90 | :rtype: list[int] 91 | """ 92 | return self._manufacturer_ids 93 | 94 | @manufacturer_ids.setter 95 | def manufacturer_ids(self, manufacturer_ids): 96 | """Sets the manufacturer_ids of this Filters. 97 | 98 | A collection of Manufacturer Ids to filter on. Ids can be found in the initial search response. # noqa: E501 99 | 100 | :param manufacturer_ids: The manufacturer_ids of this Filters. # noqa: E501 101 | :type: list[int] 102 | """ 103 | 104 | self._manufacturer_ids = manufacturer_ids 105 | 106 | @property 107 | def parametric_filters(self): 108 | """Gets the parametric_filters of this Filters. # noqa: E501 109 | 110 | A collection of ParametricFilters. A ParametricFilter consists of a ParameterId and a ValueId. Those Ids can also be found in the Search response. # noqa: E501 111 | 112 | :return: The parametric_filters of this Filters. # noqa: E501 113 | :rtype: list[ParametricFilter] 114 | """ 115 | return self._parametric_filters 116 | 117 | @parametric_filters.setter 118 | def parametric_filters(self, parametric_filters): 119 | """Sets the parametric_filters of this Filters. 120 | 121 | A collection of ParametricFilters. A ParametricFilter consists of a ParameterId and a ValueId. Those Ids can also be found in the Search response. # noqa: E501 122 | 123 | :param parametric_filters: The parametric_filters of this Filters. # noqa: E501 124 | :type: list[ParametricFilter] 125 | """ 126 | 127 | self._parametric_filters = parametric_filters 128 | 129 | def to_dict(self): 130 | """Returns the model properties as a dict""" 131 | result = {} 132 | 133 | for attr, _ in six.iteritems(self.swagger_types): 134 | value = getattr(self, attr) 135 | if isinstance(value, list): 136 | result[attr] = list(map( 137 | lambda x: x.to_dict() if hasattr(x, "to_dict") else x, 138 | value 139 | )) 140 | elif hasattr(value, "to_dict"): 141 | result[attr] = value.to_dict() 142 | elif isinstance(value, dict): 143 | result[attr] = dict(map( 144 | lambda item: (item[0], item[1].to_dict()) 145 | if hasattr(item[1], "to_dict") else item, 146 | value.items() 147 | )) 148 | else: 149 | result[attr] = value 150 | if issubclass(Filters, dict): 151 | for key, value in self.items(): 152 | result[key] = value 153 | 154 | return result 155 | 156 | def to_str(self): 157 | """Returns the string representation of the model""" 158 | return pprint.pformat(self.to_dict()) 159 | 160 | def __repr__(self): 161 | """For `print` and `pprint`""" 162 | return self.to_str() 163 | 164 | def __eq__(self, other): 165 | """Returns true if both objects are equal""" 166 | if not isinstance(other, Filters): 167 | return False 168 | 169 | return self.__dict__ == other.__dict__ 170 | 171 | def __ne__(self, other): 172 | """Returns true if both objects are not equal""" 173 | return not self == other 174 | -------------------------------------------------------------------------------- /digikey/v3/productinformation/models/iso_search_locale.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | """ 4 | PartSearch Api 5 | 6 | Search for products and retrieve details and pricing. # noqa: E501 7 | 8 | OpenAPI spec version: v3 9 | 10 | Generated by: https://github.com/swagger-api/swagger-codegen.git 11 | """ 12 | 13 | 14 | import pprint 15 | import re # noqa: F401 16 | 17 | import six 18 | 19 | 20 | class IsoSearchLocale(object): 21 | """NOTE: This class is auto generated by the swagger code generator program. 22 | 23 | Do not edit the class manually. 24 | """ 25 | 26 | """ 27 | Attributes: 28 | swagger_types (dict): The key is attribute name 29 | and the value is attribute type. 30 | attribute_map (dict): The key is attribute name 31 | and the value is json key in definition. 32 | """ 33 | swagger_types = { 34 | 'site': 'str', 35 | 'language': 'str', 36 | 'currency': 'str', 37 | 'ship_to_country': 'str' 38 | } 39 | 40 | attribute_map = { 41 | 'site': 'Site', 42 | 'language': 'Language', 43 | 'currency': 'Currency', 44 | 'ship_to_country': 'ShipToCountry' 45 | } 46 | 47 | def __init__(self, site=None, language=None, currency=None, ship_to_country=None): # noqa: E501 48 | """IsoSearchLocale - a model defined in Swagger""" # noqa: E501 49 | 50 | self._site = None 51 | self._language = None 52 | self._currency = None 53 | self._ship_to_country = None 54 | self.discriminator = None 55 | 56 | if site is not None: 57 | self.site = site 58 | if language is not None: 59 | self.language = language 60 | if currency is not None: 61 | self.currency = currency 62 | if ship_to_country is not None: 63 | self.ship_to_country = ship_to_country 64 | 65 | @property 66 | def site(self): 67 | """Gets the site of this IsoSearchLocale. # noqa: E501 68 | 69 | The site used for the API call. # noqa: E501 70 | 71 | :return: The site of this IsoSearchLocale. # noqa: E501 72 | :rtype: str 73 | """ 74 | return self._site 75 | 76 | @site.setter 77 | def site(self, site): 78 | """Sets the site of this IsoSearchLocale. 79 | 80 | The site used for the API call. # noqa: E501 81 | 82 | :param site: The site of this IsoSearchLocale. # noqa: E501 83 | :type: str 84 | """ 85 | 86 | self._site = site 87 | 88 | @property 89 | def language(self): 90 | """Gets the language of this IsoSearchLocale. # noqa: E501 91 | 92 | The language used for the API call. If the provided language is not valid for the site, it will be set to the site default. # noqa: E501 93 | 94 | :return: The language of this IsoSearchLocale. # noqa: E501 95 | :rtype: str 96 | """ 97 | return self._language 98 | 99 | @language.setter 100 | def language(self, language): 101 | """Sets the language of this IsoSearchLocale. 102 | 103 | The language used for the API call. If the provided language is not valid for the site, it will be set to the site default. # noqa: E501 104 | 105 | :param language: The language of this IsoSearchLocale. # noqa: E501 106 | :type: str 107 | """ 108 | 109 | self._language = language 110 | 111 | @property 112 | def currency(self): 113 | """Gets the currency of this IsoSearchLocale. # noqa: E501 114 | 115 | The currency used for the API call. If the provided currency is not valid for the site, it will be set to the site default. # noqa: E501 116 | 117 | :return: The currency of this IsoSearchLocale. # noqa: E501 118 | :rtype: str 119 | """ 120 | return self._currency 121 | 122 | @currency.setter 123 | def currency(self, currency): 124 | """Sets the currency of this IsoSearchLocale. 125 | 126 | The currency used for the API call. If the provided currency is not valid for the site, it will be set to the site default. # noqa: E501 127 | 128 | :param currency: The currency of this IsoSearchLocale. # noqa: E501 129 | :type: str 130 | """ 131 | 132 | self._currency = currency 133 | 134 | @property 135 | def ship_to_country(self): 136 | """Gets the ship_to_country of this IsoSearchLocale. # noqa: E501 137 | 138 | The destination for shipping the product. This is used for tariffs and regional pricing. # noqa: E501 139 | 140 | :return: The ship_to_country of this IsoSearchLocale. # noqa: E501 141 | :rtype: str 142 | """ 143 | return self._ship_to_country 144 | 145 | @ship_to_country.setter 146 | def ship_to_country(self, ship_to_country): 147 | """Sets the ship_to_country of this IsoSearchLocale. 148 | 149 | The destination for shipping the product. This is used for tariffs and regional pricing. # noqa: E501 150 | 151 | :param ship_to_country: The ship_to_country of this IsoSearchLocale. # noqa: E501 152 | :type: str 153 | """ 154 | 155 | self._ship_to_country = ship_to_country 156 | 157 | def to_dict(self): 158 | """Returns the model properties as a dict""" 159 | result = {} 160 | 161 | for attr, _ in six.iteritems(self.swagger_types): 162 | value = getattr(self, attr) 163 | if isinstance(value, list): 164 | result[attr] = list(map( 165 | lambda x: x.to_dict() if hasattr(x, "to_dict") else x, 166 | value 167 | )) 168 | elif hasattr(value, "to_dict"): 169 | result[attr] = value.to_dict() 170 | elif isinstance(value, dict): 171 | result[attr] = dict(map( 172 | lambda item: (item[0], item[1].to_dict()) 173 | if hasattr(item[1], "to_dict") else item, 174 | value.items() 175 | )) 176 | else: 177 | result[attr] = value 178 | if issubclass(IsoSearchLocale, dict): 179 | for key, value in self.items(): 180 | result[key] = value 181 | 182 | return result 183 | 184 | def to_str(self): 185 | """Returns the string representation of the model""" 186 | return pprint.pformat(self.to_dict()) 187 | 188 | def __repr__(self): 189 | """For `print` and `pprint`""" 190 | return self.to_str() 191 | 192 | def __eq__(self, other): 193 | """Returns true if both objects are equal""" 194 | if not isinstance(other, IsoSearchLocale): 195 | return False 196 | 197 | return self.__dict__ == other.__dict__ 198 | 199 | def __ne__(self, other): 200 | """Returns true if both objects are not equal""" 201 | return not self == other 202 | -------------------------------------------------------------------------------- /digikey/v3/productinformation/models/kit_part.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | """ 4 | PartSearch Api 5 | 6 | Search for products and retrieve details and pricing. # noqa: E501 7 | 8 | OpenAPI spec version: v3 9 | 10 | Generated by: https://github.com/swagger-api/swagger-codegen.git 11 | """ 12 | 13 | 14 | import pprint 15 | import re # noqa: F401 16 | 17 | import six 18 | 19 | 20 | class KitPart(object): 21 | """NOTE: This class is auto generated by the swagger code generator program. 22 | 23 | Do not edit the class manually. 24 | """ 25 | 26 | """ 27 | Attributes: 28 | swagger_types (dict): The key is attribute name 29 | and the value is attribute type. 30 | attribute_map (dict): The key is attribute name 31 | and the value is json key in definition. 32 | """ 33 | swagger_types = { 34 | 'associated_product': 'AssociatedProduct', 35 | 'kit_part_quantity': 'int' 36 | } 37 | 38 | attribute_map = { 39 | 'associated_product': 'AssociatedProduct', 40 | 'kit_part_quantity': 'KitPartQuantity' 41 | } 42 | 43 | def __init__(self, associated_product=None, kit_part_quantity=None): # noqa: E501 44 | """KitPart - a model defined in Swagger""" # noqa: E501 45 | 46 | self._associated_product = None 47 | self._kit_part_quantity = None 48 | self.discriminator = None 49 | 50 | if associated_product is not None: 51 | self.associated_product = associated_product 52 | if kit_part_quantity is not None: 53 | self.kit_part_quantity = kit_part_quantity 54 | 55 | @property 56 | def associated_product(self): 57 | """Gets the associated_product of this KitPart. # noqa: E501 58 | 59 | 60 | :return: The associated_product of this KitPart. # noqa: E501 61 | :rtype: AssociatedProduct 62 | """ 63 | return self._associated_product 64 | 65 | @associated_product.setter 66 | def associated_product(self, associated_product): 67 | """Sets the associated_product of this KitPart. 68 | 69 | 70 | :param associated_product: The associated_product of this KitPart. # noqa: E501 71 | :type: AssociatedProduct 72 | """ 73 | 74 | self._associated_product = associated_product 75 | 76 | @property 77 | def kit_part_quantity(self): 78 | """Gets the kit_part_quantity of this KitPart. # noqa: E501 79 | 80 | Number of the product in the Kit. # noqa: E501 81 | 82 | :return: The kit_part_quantity of this KitPart. # noqa: E501 83 | :rtype: int 84 | """ 85 | return self._kit_part_quantity 86 | 87 | @kit_part_quantity.setter 88 | def kit_part_quantity(self, kit_part_quantity): 89 | """Sets the kit_part_quantity of this KitPart. 90 | 91 | Number of the product in the Kit. # noqa: E501 92 | 93 | :param kit_part_quantity: The kit_part_quantity of this KitPart. # noqa: E501 94 | :type: int 95 | """ 96 | 97 | self._kit_part_quantity = kit_part_quantity 98 | 99 | def to_dict(self): 100 | """Returns the model properties as a dict""" 101 | result = {} 102 | 103 | for attr, _ in six.iteritems(self.swagger_types): 104 | value = getattr(self, attr) 105 | if isinstance(value, list): 106 | result[attr] = list(map( 107 | lambda x: x.to_dict() if hasattr(x, "to_dict") else x, 108 | value 109 | )) 110 | elif hasattr(value, "to_dict"): 111 | result[attr] = value.to_dict() 112 | elif isinstance(value, dict): 113 | result[attr] = dict(map( 114 | lambda item: (item[0], item[1].to_dict()) 115 | if hasattr(item[1], "to_dict") else item, 116 | value.items() 117 | )) 118 | else: 119 | result[attr] = value 120 | if issubclass(KitPart, dict): 121 | for key, value in self.items(): 122 | result[key] = value 123 | 124 | return result 125 | 126 | def to_str(self): 127 | """Returns the string representation of the model""" 128 | return pprint.pformat(self.to_dict()) 129 | 130 | def __repr__(self): 131 | """For `print` and `pprint`""" 132 | return self.to_str() 133 | 134 | def __eq__(self, other): 135 | """Returns true if both objects are equal""" 136 | if not isinstance(other, KitPart): 137 | return False 138 | 139 | return self.__dict__ == other.__dict__ 140 | 141 | def __ne__(self, other): 142 | """Returns true if both objects are not equal""" 143 | return not self == other 144 | -------------------------------------------------------------------------------- /digikey/v3/productinformation/models/limited_parameter.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | """ 4 | PartSearch Api 5 | 6 | Search for products and retrieve details and pricing. # noqa: E501 7 | 8 | OpenAPI spec version: v3 9 | 10 | Generated by: https://github.com/swagger-api/swagger-codegen.git 11 | """ 12 | 13 | 14 | import pprint 15 | import re # noqa: F401 16 | 17 | import six 18 | 19 | 20 | class LimitedParameter(object): 21 | """NOTE: This class is auto generated by the swagger code generator program. 22 | 23 | Do not edit the class manually. 24 | """ 25 | 26 | """ 27 | Attributes: 28 | swagger_types (dict): The key is attribute name 29 | and the value is attribute type. 30 | attribute_map (dict): The key is attribute name 31 | and the value is json key in definition. 32 | """ 33 | swagger_types = { 34 | 'values': 'list[ValuePair]', 35 | 'parameter_id': 'int', 36 | 'parameter': 'str' 37 | } 38 | 39 | attribute_map = { 40 | 'values': 'Values', 41 | 'parameter_id': 'ParameterId', 42 | 'parameter': 'Parameter' 43 | } 44 | 45 | def __init__(self, values=None, parameter_id=None, parameter=None): # noqa: E501 46 | """LimitedParameter - a model defined in Swagger""" # noqa: E501 47 | 48 | self._values = None 49 | self._parameter_id = None 50 | self._parameter = None 51 | self.discriminator = None 52 | 53 | if values is not None: 54 | self.values = values 55 | if parameter_id is not None: 56 | self.parameter_id = parameter_id 57 | if parameter is not None: 58 | self.parameter = parameter 59 | 60 | @property 61 | def values(self): 62 | """Gets the values of this LimitedParameter. # noqa: E501 63 | 64 | List of values for the parameter that are contained in the products. # noqa: E501 65 | 66 | :return: The values of this LimitedParameter. # noqa: E501 67 | :rtype: list[ValuePair] 68 | """ 69 | return self._values 70 | 71 | @values.setter 72 | def values(self, values): 73 | """Sets the values of this LimitedParameter. 74 | 75 | List of values for the parameter that are contained in the products. # noqa: E501 76 | 77 | :param values: The values of this LimitedParameter. # noqa: E501 78 | :type: list[ValuePair] 79 | """ 80 | 81 | self._values = values 82 | 83 | @property 84 | def parameter_id(self): 85 | """Gets the parameter_id of this LimitedParameter. # noqa: E501 86 | 87 | The Id of the parameter. # noqa: E501 88 | 89 | :return: The parameter_id of this LimitedParameter. # noqa: E501 90 | :rtype: int 91 | """ 92 | return self._parameter_id 93 | 94 | @parameter_id.setter 95 | def parameter_id(self, parameter_id): 96 | """Sets the parameter_id of this LimitedParameter. 97 | 98 | The Id of the parameter. # noqa: E501 99 | 100 | :param parameter_id: The parameter_id of this LimitedParameter. # noqa: E501 101 | :type: int 102 | """ 103 | 104 | self._parameter_id = parameter_id 105 | 106 | @property 107 | def parameter(self): 108 | """Gets the parameter of this LimitedParameter. # noqa: E501 109 | 110 | The name of the parameter. # noqa: E501 111 | 112 | :return: The parameter of this LimitedParameter. # noqa: E501 113 | :rtype: str 114 | """ 115 | return self._parameter 116 | 117 | @parameter.setter 118 | def parameter(self, parameter): 119 | """Sets the parameter of this LimitedParameter. 120 | 121 | The name of the parameter. # noqa: E501 122 | 123 | :param parameter: The parameter of this LimitedParameter. # noqa: E501 124 | :type: str 125 | """ 126 | 127 | self._parameter = parameter 128 | 129 | def to_dict(self): 130 | """Returns the model properties as a dict""" 131 | result = {} 132 | 133 | for attr, _ in six.iteritems(self.swagger_types): 134 | value = getattr(self, attr) 135 | if isinstance(value, list): 136 | result[attr] = list(map( 137 | lambda x: x.to_dict() if hasattr(x, "to_dict") else x, 138 | value 139 | )) 140 | elif hasattr(value, "to_dict"): 141 | result[attr] = value.to_dict() 142 | elif isinstance(value, dict): 143 | result[attr] = dict(map( 144 | lambda item: (item[0], item[1].to_dict()) 145 | if hasattr(item[1], "to_dict") else item, 146 | value.items() 147 | )) 148 | else: 149 | result[attr] = value 150 | if issubclass(LimitedParameter, dict): 151 | for key, value in self.items(): 152 | result[key] = value 153 | 154 | return result 155 | 156 | def to_str(self): 157 | """Returns the string representation of the model""" 158 | return pprint.pformat(self.to_dict()) 159 | 160 | def __repr__(self): 161 | """For `print` and `pprint`""" 162 | return self.to_str() 163 | 164 | def __eq__(self, other): 165 | """Returns true if both objects are equal""" 166 | if not isinstance(other, LimitedParameter): 167 | return False 168 | 169 | return self.__dict__ == other.__dict__ 170 | 171 | def __ne__(self, other): 172 | """Returns true if both objects are not equal""" 173 | return not self == other 174 | -------------------------------------------------------------------------------- /digikey/v3/productinformation/models/parametric_filter.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | """ 4 | PartSearch Api 5 | 6 | Search for products and retrieve details and pricing. # noqa: E501 7 | 8 | OpenAPI spec version: v3 9 | 10 | Generated by: https://github.com/swagger-api/swagger-codegen.git 11 | """ 12 | 13 | 14 | import pprint 15 | import re # noqa: F401 16 | 17 | import six 18 | 19 | 20 | class ParametricFilter(object): 21 | """NOTE: This class is auto generated by the swagger code generator program. 22 | 23 | Do not edit the class manually. 24 | """ 25 | 26 | """ 27 | Attributes: 28 | swagger_types (dict): The key is attribute name 29 | and the value is attribute type. 30 | attribute_map (dict): The key is attribute name 31 | and the value is json key in definition. 32 | """ 33 | swagger_types = { 34 | 'parameter_id': 'int', 35 | 'value_id': 'str' 36 | } 37 | 38 | attribute_map = { 39 | 'parameter_id': 'ParameterId', 40 | 'value_id': 'ValueId' 41 | } 42 | 43 | def __init__(self, parameter_id=None, value_id=None): # noqa: E501 44 | """ParametricFilter - a model defined in Swagger""" # noqa: E501 45 | 46 | self._parameter_id = None 47 | self._value_id = None 48 | self.discriminator = None 49 | 50 | if parameter_id is not None: 51 | self.parameter_id = parameter_id 52 | if value_id is not None: 53 | self.value_id = value_id 54 | 55 | @property 56 | def parameter_id(self): 57 | """Gets the parameter_id of this ParametricFilter. # noqa: E501 58 | 59 | The parameter identifier. # noqa: E501 60 | 61 | :return: The parameter_id of this ParametricFilter. # noqa: E501 62 | :rtype: int 63 | """ 64 | return self._parameter_id 65 | 66 | @parameter_id.setter 67 | def parameter_id(self, parameter_id): 68 | """Sets the parameter_id of this ParametricFilter. 69 | 70 | The parameter identifier. # noqa: E501 71 | 72 | :param parameter_id: The parameter_id of this ParametricFilter. # noqa: E501 73 | :type: int 74 | """ 75 | if parameter_id is not None and parameter_id > 2147483647: # noqa: E501 76 | raise ValueError("Invalid value for `parameter_id`, must be a value less than or equal to `2147483647`") # noqa: E501 77 | if parameter_id is not None and parameter_id < -2147483648: # noqa: E501 78 | raise ValueError("Invalid value for `parameter_id`, must be a value greater than or equal to `-2147483648`") # noqa: E501 79 | 80 | self._parameter_id = parameter_id 81 | 82 | @property 83 | def value_id(self): 84 | """Gets the value_id of this ParametricFilter. # noqa: E501 85 | 86 | The value identifier. # noqa: E501 87 | 88 | :return: The value_id of this ParametricFilter. # noqa: E501 89 | :rtype: str 90 | """ 91 | return self._value_id 92 | 93 | @value_id.setter 94 | def value_id(self, value_id): 95 | """Sets the value_id of this ParametricFilter. 96 | 97 | The value identifier. # noqa: E501 98 | 99 | :param value_id: The value_id of this ParametricFilter. # noqa: E501 100 | :type: str 101 | """ 102 | if value_id is not None and len(value_id) > 100: 103 | raise ValueError("Invalid value for `value_id`, length must be less than or equal to `100`") # noqa: E501 104 | if value_id is not None and len(value_id) < 1: 105 | raise ValueError("Invalid value for `value_id`, length must be greater than or equal to `1`") # noqa: E501 106 | 107 | self._value_id = value_id 108 | 109 | def to_dict(self): 110 | """Returns the model properties as a dict""" 111 | result = {} 112 | 113 | for attr, _ in six.iteritems(self.swagger_types): 114 | value = getattr(self, attr) 115 | if isinstance(value, list): 116 | result[attr] = list(map( 117 | lambda x: x.to_dict() if hasattr(x, "to_dict") else x, 118 | value 119 | )) 120 | elif hasattr(value, "to_dict"): 121 | result[attr] = value.to_dict() 122 | elif isinstance(value, dict): 123 | result[attr] = dict(map( 124 | lambda item: (item[0], item[1].to_dict()) 125 | if hasattr(item[1], "to_dict") else item, 126 | value.items() 127 | )) 128 | else: 129 | result[attr] = value 130 | if issubclass(ParametricFilter, dict): 131 | for key, value in self.items(): 132 | result[key] = value 133 | 134 | return result 135 | 136 | def to_str(self): 137 | """Returns the string representation of the model""" 138 | return pprint.pformat(self.to_dict()) 139 | 140 | def __repr__(self): 141 | """For `print` and `pprint`""" 142 | return self.to_str() 143 | 144 | def __eq__(self, other): 145 | """Returns true if both objects are equal""" 146 | if not isinstance(other, ParametricFilter): 147 | return False 148 | 149 | return self.__dict__ == other.__dict__ 150 | 151 | def __ne__(self, other): 152 | """Returns true if both objects are not equal""" 153 | return not self == other 154 | -------------------------------------------------------------------------------- /digikey/v3/productinformation/models/pid_vid.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | """ 4 | PartSearch Api 5 | 6 | Search for products and retrieve details and pricing. # noqa: E501 7 | 8 | OpenAPI spec version: v3 9 | 10 | Generated by: https://github.com/swagger-api/swagger-codegen.git 11 | """ 12 | 13 | 14 | import pprint 15 | import re # noqa: F401 16 | 17 | import six 18 | 19 | 20 | class PidVid(object): 21 | """NOTE: This class is auto generated by the swagger code generator program. 22 | 23 | Do not edit the class manually. 24 | """ 25 | 26 | """ 27 | Attributes: 28 | swagger_types (dict): The key is attribute name 29 | and the value is attribute type. 30 | attribute_map (dict): The key is attribute name 31 | and the value is json key in definition. 32 | """ 33 | swagger_types = { 34 | 'parameter_id': 'int', 35 | 'value_id': 'str', 36 | 'parameter': 'str', 37 | 'value': 'str' 38 | } 39 | 40 | attribute_map = { 41 | 'parameter_id': 'ParameterId', 42 | 'value_id': 'ValueId', 43 | 'parameter': 'Parameter', 44 | 'value': 'Value' 45 | } 46 | 47 | def __init__(self, parameter_id=None, value_id=None, parameter=None, value=None): # noqa: E501 48 | """PidVid - a model defined in Swagger""" # noqa: E501 49 | 50 | self._parameter_id = None 51 | self._value_id = None 52 | self._parameter = None 53 | self._value = None 54 | self.discriminator = None 55 | 56 | if parameter_id is not None: 57 | self.parameter_id = parameter_id 58 | if value_id is not None: 59 | self.value_id = value_id 60 | if parameter is not None: 61 | self.parameter = parameter 62 | if value is not None: 63 | self.value = value 64 | 65 | @property 66 | def parameter_id(self): 67 | """Gets the parameter_id of this PidVid. # noqa: E501 68 | 69 | The Id of the parameter. # noqa: E501 70 | 71 | :return: The parameter_id of this PidVid. # noqa: E501 72 | :rtype: int 73 | """ 74 | return self._parameter_id 75 | 76 | @parameter_id.setter 77 | def parameter_id(self, parameter_id): 78 | """Sets the parameter_id of this PidVid. 79 | 80 | The Id of the parameter. # noqa: E501 81 | 82 | :param parameter_id: The parameter_id of this PidVid. # noqa: E501 83 | :type: int 84 | """ 85 | 86 | self._parameter_id = parameter_id 87 | 88 | @property 89 | def value_id(self): 90 | """Gets the value_id of this PidVid. # noqa: E501 91 | 92 | The Id of the value. # noqa: E501 93 | 94 | :return: The value_id of this PidVid. # noqa: E501 95 | :rtype: str 96 | """ 97 | return self._value_id 98 | 99 | @value_id.setter 100 | def value_id(self, value_id): 101 | """Sets the value_id of this PidVid. 102 | 103 | The Id of the value. # noqa: E501 104 | 105 | :param value_id: The value_id of this PidVid. # noqa: E501 106 | :type: str 107 | """ 108 | 109 | self._value_id = value_id 110 | 111 | @property 112 | def parameter(self): 113 | """Gets the parameter of this PidVid. # noqa: E501 114 | 115 | The name of the parameter. # noqa: E501 116 | 117 | :return: The parameter of this PidVid. # noqa: E501 118 | :rtype: str 119 | """ 120 | return self._parameter 121 | 122 | @parameter.setter 123 | def parameter(self, parameter): 124 | """Sets the parameter of this PidVid. 125 | 126 | The name of the parameter. # noqa: E501 127 | 128 | :param parameter: The parameter of this PidVid. # noqa: E501 129 | :type: str 130 | """ 131 | 132 | self._parameter = parameter 133 | 134 | @property 135 | def value(self): 136 | """Gets the value of this PidVid. # noqa: E501 137 | 138 | The name of the value. # noqa: E501 139 | 140 | :return: The value of this PidVid. # noqa: E501 141 | :rtype: str 142 | """ 143 | return self._value 144 | 145 | @value.setter 146 | def value(self, value): 147 | """Sets the value of this PidVid. 148 | 149 | The name of the value. # noqa: E501 150 | 151 | :param value: The value of this PidVid. # noqa: E501 152 | :type: str 153 | """ 154 | 155 | self._value = value 156 | 157 | def to_dict(self): 158 | """Returns the model properties as a dict""" 159 | result = {} 160 | 161 | for attr, _ in six.iteritems(self.swagger_types): 162 | value = getattr(self, attr) 163 | if isinstance(value, list): 164 | result[attr] = list(map( 165 | lambda x: x.to_dict() if hasattr(x, "to_dict") else x, 166 | value 167 | )) 168 | elif hasattr(value, "to_dict"): 169 | result[attr] = value.to_dict() 170 | elif isinstance(value, dict): 171 | result[attr] = dict(map( 172 | lambda item: (item[0], item[1].to_dict()) 173 | if hasattr(item[1], "to_dict") else item, 174 | value.items() 175 | )) 176 | else: 177 | result[attr] = value 178 | if issubclass(PidVid, dict): 179 | for key, value in self.items(): 180 | result[key] = value 181 | 182 | return result 183 | 184 | def to_str(self): 185 | """Returns the string representation of the model""" 186 | return pprint.pformat(self.to_dict()) 187 | 188 | def __repr__(self): 189 | """For `print` and `pprint`""" 190 | return self.to_str() 191 | 192 | def __eq__(self, other): 193 | """Returns true if both objects are equal""" 194 | if not isinstance(other, PidVid): 195 | return False 196 | 197 | return self.__dict__ == other.__dict__ 198 | 199 | def __ne__(self, other): 200 | """Returns true if both objects are not equal""" 201 | return not self == other 202 | -------------------------------------------------------------------------------- /digikey/v3/productinformation/models/price_break.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | """ 4 | PartSearch Api 5 | 6 | Search for products and retrieve details and pricing. # noqa: E501 7 | 8 | OpenAPI spec version: v3 9 | 10 | Generated by: https://github.com/swagger-api/swagger-codegen.git 11 | """ 12 | 13 | 14 | import pprint 15 | import re # noqa: F401 16 | 17 | import six 18 | 19 | 20 | class PriceBreak(object): 21 | """NOTE: This class is auto generated by the swagger code generator program. 22 | 23 | Do not edit the class manually. 24 | """ 25 | 26 | """ 27 | Attributes: 28 | swagger_types (dict): The key is attribute name 29 | and the value is attribute type. 30 | attribute_map (dict): The key is attribute name 31 | and the value is json key in definition. 32 | """ 33 | swagger_types = { 34 | 'break_quantity': 'int', 35 | 'unit_price': 'float', 36 | 'total_price': 'float' 37 | } 38 | 39 | attribute_map = { 40 | 'break_quantity': 'BreakQuantity', 41 | 'unit_price': 'UnitPrice', 42 | 'total_price': 'TotalPrice' 43 | } 44 | 45 | def __init__(self, break_quantity=None, unit_price=None, total_price=None): # noqa: E501 46 | """PriceBreak - a model defined in Swagger""" # noqa: E501 47 | 48 | self._break_quantity = None 49 | self._unit_price = None 50 | self._total_price = None 51 | self.discriminator = None 52 | 53 | if break_quantity is not None: 54 | self.break_quantity = break_quantity 55 | if unit_price is not None: 56 | self.unit_price = unit_price 57 | if total_price is not None: 58 | self.total_price = total_price 59 | 60 | @property 61 | def break_quantity(self): 62 | """Gets the break_quantity of this PriceBreak. # noqa: E501 63 | 64 | Price tiers based on the available quantities of the product. # noqa: E501 65 | 66 | :return: The break_quantity of this PriceBreak. # noqa: E501 67 | :rtype: int 68 | """ 69 | return self._break_quantity 70 | 71 | @break_quantity.setter 72 | def break_quantity(self, break_quantity): 73 | """Sets the break_quantity of this PriceBreak. 74 | 75 | Price tiers based on the available quantities of the product. # noqa: E501 76 | 77 | :param break_quantity: The break_quantity of this PriceBreak. # noqa: E501 78 | :type: int 79 | """ 80 | 81 | self._break_quantity = break_quantity 82 | 83 | @property 84 | def unit_price(self): 85 | """Gets the unit_price of this PriceBreak. # noqa: E501 86 | 87 | Price of a single unit of the product at this break. # noqa: E501 88 | 89 | :return: The unit_price of this PriceBreak. # noqa: E501 90 | :rtype: float 91 | """ 92 | return self._unit_price 93 | 94 | @unit_price.setter 95 | def unit_price(self, unit_price): 96 | """Sets the unit_price of this PriceBreak. 97 | 98 | Price of a single unit of the product at this break. # noqa: E501 99 | 100 | :param unit_price: The unit_price of this PriceBreak. # noqa: E501 101 | :type: float 102 | """ 103 | 104 | self._unit_price = unit_price 105 | 106 | @property 107 | def total_price(self): 108 | """Gets the total_price of this PriceBreak. # noqa: E501 109 | 110 | Price of BreakQuantity units of the product. # noqa: E501 111 | 112 | :return: The total_price of this PriceBreak. # noqa: E501 113 | :rtype: float 114 | """ 115 | return self._total_price 116 | 117 | @total_price.setter 118 | def total_price(self, total_price): 119 | """Sets the total_price of this PriceBreak. 120 | 121 | Price of BreakQuantity units of the product. # noqa: E501 122 | 123 | :param total_price: The total_price of this PriceBreak. # noqa: E501 124 | :type: float 125 | """ 126 | 127 | self._total_price = total_price 128 | 129 | def to_dict(self): 130 | """Returns the model properties as a dict""" 131 | result = {} 132 | 133 | for attr, _ in six.iteritems(self.swagger_types): 134 | value = getattr(self, attr) 135 | if isinstance(value, list): 136 | result[attr] = list(map( 137 | lambda x: x.to_dict() if hasattr(x, "to_dict") else x, 138 | value 139 | )) 140 | elif hasattr(value, "to_dict"): 141 | result[attr] = value.to_dict() 142 | elif isinstance(value, dict): 143 | result[attr] = dict(map( 144 | lambda item: (item[0], item[1].to_dict()) 145 | if hasattr(item[1], "to_dict") else item, 146 | value.items() 147 | )) 148 | else: 149 | result[attr] = value 150 | if issubclass(PriceBreak, dict): 151 | for key, value in self.items(): 152 | result[key] = value 153 | 154 | return result 155 | 156 | def to_str(self): 157 | """Returns the string representation of the model""" 158 | return pprint.pformat(self.to_dict()) 159 | 160 | def __repr__(self): 161 | """For `print` and `pprint`""" 162 | return self.to_str() 163 | 164 | def __eq__(self, other): 165 | """Returns true if both objects are equal""" 166 | if not isinstance(other, PriceBreak): 167 | return False 168 | 169 | return self.__dict__ == other.__dict__ 170 | 171 | def __ne__(self, other): 172 | """Returns true if both objects are not equal""" 173 | return not self == other 174 | -------------------------------------------------------------------------------- /digikey/v3/productinformation/models/product_details_response.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | """ 4 | PartSearch Api 5 | 6 | Search for products and retrieve details and pricing. # noqa: E501 7 | 8 | OpenAPI spec version: v3 9 | 10 | Generated by: https://github.com/swagger-api/swagger-codegen.git 11 | """ 12 | 13 | 14 | import pprint 15 | import re # noqa: F401 16 | 17 | import six 18 | 19 | 20 | class ProductDetailsResponse(object): 21 | """NOTE: This class is auto generated by the swagger code generator program. 22 | 23 | Do not edit the class manually. 24 | """ 25 | 26 | """ 27 | Attributes: 28 | swagger_types (dict): The key is attribute name 29 | and the value is attribute type. 30 | attribute_map (dict): The key is attribute name 31 | and the value is json key in definition. 32 | """ 33 | swagger_types = { 34 | 'product_details': 'list[ProductDetails]' 35 | } 36 | 37 | attribute_map = { 38 | 'product_details': 'ProductDetails' 39 | } 40 | 41 | def __init__(self, product_details=None): # noqa: E501 42 | """ProductDetailsResponse - a model defined in Swagger""" # noqa: E501 43 | 44 | self._product_details = None 45 | self.discriminator = None 46 | 47 | if product_details is not None: 48 | self.product_details = product_details 49 | 50 | @property 51 | def product_details(self): 52 | """Gets the product_details of this ProductDetailsResponse. # noqa: E501 53 | 54 | List of ProductDetails # noqa: E501 55 | 56 | :return: The product_details of this ProductDetailsResponse. # noqa: E501 57 | :rtype: list[ProductDetails] 58 | """ 59 | return self._product_details 60 | 61 | @product_details.setter 62 | def product_details(self, product_details): 63 | """Sets the product_details of this ProductDetailsResponse. 64 | 65 | List of ProductDetails # noqa: E501 66 | 67 | :param product_details: The product_details of this ProductDetailsResponse. # noqa: E501 68 | :type: list[ProductDetails] 69 | """ 70 | 71 | self._product_details = product_details 72 | 73 | def to_dict(self): 74 | """Returns the model properties as a dict""" 75 | result = {} 76 | 77 | for attr, _ in six.iteritems(self.swagger_types): 78 | value = getattr(self, attr) 79 | if isinstance(value, list): 80 | result[attr] = list(map( 81 | lambda x: x.to_dict() if hasattr(x, "to_dict") else x, 82 | value 83 | )) 84 | elif hasattr(value, "to_dict"): 85 | result[attr] = value.to_dict() 86 | elif isinstance(value, dict): 87 | result[attr] = dict(map( 88 | lambda item: (item[0], item[1].to_dict()) 89 | if hasattr(item[1], "to_dict") else item, 90 | value.items() 91 | )) 92 | else: 93 | result[attr] = value 94 | if issubclass(ProductDetailsResponse, dict): 95 | for key, value in self.items(): 96 | result[key] = value 97 | 98 | return result 99 | 100 | def to_str(self): 101 | """Returns the string representation of the model""" 102 | return pprint.pformat(self.to_dict()) 103 | 104 | def __repr__(self): 105 | """For `print` and `pprint`""" 106 | return self.to_str() 107 | 108 | def __eq__(self, other): 109 | """Returns true if both objects are equal""" 110 | if not isinstance(other, ProductDetailsResponse): 111 | return False 112 | 113 | return self.__dict__ == other.__dict__ 114 | 115 | def __ne__(self, other): 116 | """Returns true if both objects are not equal""" 117 | return not self == other 118 | -------------------------------------------------------------------------------- /digikey/v3/productinformation/models/result_code.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | """ 4 | PartSearch Api 5 | 6 | Search for products and retrieve details and pricing. # noqa: E501 7 | 8 | OpenAPI spec version: v3 9 | Contact: api.support@digikey.com 10 | Generated by: https://github.com/swagger-api/swagger-codegen.git 11 | """ 12 | 13 | 14 | import pprint 15 | import re # noqa: F401 16 | 17 | import six 18 | 19 | 20 | class ResultCode(object): 21 | """NOTE: This class is auto generated by the swagger code generator program. 22 | 23 | Do not edit the class manually. 24 | """ 25 | 26 | """ 27 | allowed enum values 28 | """ 29 | RESULTCODESUCCESS = "ResultCodeSuccess" 30 | RESULTCODEFAIL = "ResultCodeFail" 31 | RESULTCODERESTRICTEDBYCUSTOMERCLASS = "ResultCodeRestrictedByCustomerClass" 32 | RESULTCODERESTRICTEDBYCUSTOMERROOT = "ResultCodeRestrictedByCustomerRoot" 33 | RESULTCODERESTRICTEDBYCURRENCY = "ResultCodeRestrictedByCurrency" 34 | RESULTCODERESTRICTEDBYVENDOR = "ResultCodeRestrictedByVendor" 35 | RESULTCODERESTRICTEDBYDK = "ResultCodeRestrictedByDK" 36 | RESULTCODERESTRICTEDBYCERTIFICATE = "ResultCodeRestrictedByCertificate" 37 | RESULTCODERESTRICTEDBYCOUNTRY = "ResultCodeRestrictedByCountry" 38 | RESULTCODENOMPOFFERS = "ResultCodeNoMpOffers" 39 | RESULTCODEMPPARTNOTALLOWED = "ResultCodeMpPartNotAllowed" 40 | 41 | """ 42 | Attributes: 43 | swagger_types (dict): The key is attribute name 44 | and the value is attribute type. 45 | attribute_map (dict): The key is attribute name 46 | and the value is json key in definition. 47 | """ 48 | swagger_types = { 49 | } 50 | 51 | attribute_map = { 52 | } 53 | 54 | def __init__(self): # noqa: E501 55 | """ResultCode - a model defined in Swagger""" # noqa: E501 56 | self.discriminator = None 57 | 58 | def to_dict(self): 59 | """Returns the model properties as a dict""" 60 | result = {} 61 | 62 | for attr, _ in six.iteritems(self.swagger_types): 63 | value = getattr(self, attr) 64 | if isinstance(value, list): 65 | result[attr] = list(map( 66 | lambda x: x.to_dict() if hasattr(x, "to_dict") else x, 67 | value 68 | )) 69 | elif hasattr(value, "to_dict"): 70 | result[attr] = value.to_dict() 71 | elif isinstance(value, dict): 72 | result[attr] = dict(map( 73 | lambda item: (item[0], item[1].to_dict()) 74 | if hasattr(item[1], "to_dict") else item, 75 | value.items() 76 | )) 77 | else: 78 | result[attr] = value 79 | if issubclass(ResultCode, dict): 80 | for key, value in self.items(): 81 | result[key] = value 82 | 83 | return result 84 | 85 | def to_str(self): 86 | """Returns the string representation of the model""" 87 | return pprint.pformat(self.to_dict()) 88 | 89 | def __repr__(self): 90 | """For `print` and `pprint`""" 91 | return self.to_str() 92 | 93 | def __eq__(self, other): 94 | """Returns true if both objects are equal""" 95 | if not isinstance(other, ResultCode): 96 | return False 97 | 98 | return self.__dict__ == other.__dict__ 99 | 100 | def __ne__(self, other): 101 | """Returns true if both objects are not equal""" 102 | return not self == other 103 | -------------------------------------------------------------------------------- /digikey/v3/productinformation/models/search_option.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | """ 4 | PartSearch Api 5 | 6 | Search for products and retrieve details and pricing. # noqa: E501 7 | 8 | OpenAPI spec version: v3 9 | 10 | Generated by: https://github.com/swagger-api/swagger-codegen.git 11 | """ 12 | 13 | 14 | import pprint 15 | import re # noqa: F401 16 | 17 | import six 18 | 19 | 20 | class SearchOption(object): 21 | """NOTE: This class is auto generated by the swagger code generator program. 22 | 23 | Do not edit the class manually. 24 | """ 25 | 26 | """ 27 | allowed enum values 28 | """ 29 | MANUFACTURERPARTSEARCH = "ManufacturerPartSearch" 30 | INSTOCK = "InStock" 31 | NEWPRODUCTSONLY = "NewProductsOnly" 32 | ROHSCOMPLIANT = "RoHSCompliant" 33 | LEADFREE = "LeadFree" 34 | COLLAPSEPACKAGINGTYPES = "CollapsePackagingTypes" 35 | EXCLUDENONSTOCK = "ExcludeNonStock" 36 | HAS3DMODEL = "Has3DModel" 37 | HASMENTORFOOTPRINT = "HasMentorFootprint" 38 | 39 | """ 40 | Attributes: 41 | swagger_types (dict): The key is attribute name 42 | and the value is attribute type. 43 | attribute_map (dict): The key is attribute name 44 | and the value is json key in definition. 45 | """ 46 | swagger_types = { 47 | } 48 | 49 | attribute_map = { 50 | } 51 | 52 | def __init__(self): # noqa: E501 53 | """SearchOption - a model defined in Swagger""" # noqa: E501 54 | self.discriminator = None 55 | 56 | def to_dict(self): 57 | """Returns the model properties as a dict""" 58 | result = {} 59 | 60 | for attr, _ in six.iteritems(self.swagger_types): 61 | value = getattr(self, attr) 62 | if isinstance(value, list): 63 | result[attr] = list(map( 64 | lambda x: x.to_dict() if hasattr(x, "to_dict") else x, 65 | value 66 | )) 67 | elif hasattr(value, "to_dict"): 68 | result[attr] = value.to_dict() 69 | elif isinstance(value, dict): 70 | result[attr] = dict(map( 71 | lambda item: (item[0], item[1].to_dict()) 72 | if hasattr(item[1], "to_dict") else item, 73 | value.items() 74 | )) 75 | else: 76 | result[attr] = value 77 | if issubclass(SearchOption, dict): 78 | for key, value in self.items(): 79 | result[key] = value 80 | 81 | return result 82 | 83 | def to_str(self): 84 | """Returns the string representation of the model""" 85 | return pprint.pformat(self.to_dict()) 86 | 87 | def __repr__(self): 88 | """For `print` and `pprint`""" 89 | return self.to_str() 90 | 91 | def __eq__(self, other): 92 | """Returns true if both objects are equal""" 93 | if not isinstance(other, SearchOption): 94 | return False 95 | 96 | return self.__dict__ == other.__dict__ 97 | 98 | def __ne__(self, other): 99 | """Returns true if both objects are not equal""" 100 | return not self == other 101 | -------------------------------------------------------------------------------- /digikey/v3/productinformation/models/sort_direction.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | """ 4 | PartSearch Api 5 | 6 | Search for products and retrieve details and pricing. # noqa: E501 7 | 8 | OpenAPI spec version: v3 9 | 10 | Generated by: https://github.com/swagger-api/swagger-codegen.git 11 | """ 12 | 13 | 14 | import pprint 15 | import re # noqa: F401 16 | 17 | import six 18 | 19 | 20 | class SortDirection(object): 21 | """NOTE: This class is auto generated by the swagger code generator program. 22 | 23 | Do not edit the class manually. 24 | """ 25 | 26 | """ 27 | allowed enum values 28 | """ 29 | ASCENDING = "Ascending" 30 | DESCENDING = "Descending" 31 | 32 | """ 33 | Attributes: 34 | swagger_types (dict): The key is attribute name 35 | and the value is attribute type. 36 | attribute_map (dict): The key is attribute name 37 | and the value is json key in definition. 38 | """ 39 | swagger_types = { 40 | } 41 | 42 | attribute_map = { 43 | } 44 | 45 | def __init__(self): # noqa: E501 46 | """SortDirection - a model defined in Swagger""" # noqa: E501 47 | self.discriminator = None 48 | 49 | def to_dict(self): 50 | """Returns the model properties as a dict""" 51 | result = {} 52 | 53 | for attr, _ in six.iteritems(self.swagger_types): 54 | value = getattr(self, attr) 55 | if isinstance(value, list): 56 | result[attr] = list(map( 57 | lambda x: x.to_dict() if hasattr(x, "to_dict") else x, 58 | value 59 | )) 60 | elif hasattr(value, "to_dict"): 61 | result[attr] = value.to_dict() 62 | elif isinstance(value, dict): 63 | result[attr] = dict(map( 64 | lambda item: (item[0], item[1].to_dict()) 65 | if hasattr(item[1], "to_dict") else item, 66 | value.items() 67 | )) 68 | else: 69 | result[attr] = value 70 | if issubclass(SortDirection, dict): 71 | for key, value in self.items(): 72 | result[key] = value 73 | 74 | return result 75 | 76 | def to_str(self): 77 | """Returns the string representation of the model""" 78 | return pprint.pformat(self.to_dict()) 79 | 80 | def __repr__(self): 81 | """For `print` and `pprint`""" 82 | return self.to_str() 83 | 84 | def __eq__(self, other): 85 | """Returns true if both objects are equal""" 86 | if not isinstance(other, SortDirection): 87 | return False 88 | 89 | return self.__dict__ == other.__dict__ 90 | 91 | def __ne__(self, other): 92 | """Returns true if both objects are not equal""" 93 | return not self == other 94 | -------------------------------------------------------------------------------- /digikey/v3/productinformation/models/sort_option.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | """ 4 | PartSearch Api 5 | 6 | Search for products and retrieve details and pricing. # noqa: E501 7 | 8 | OpenAPI spec version: v3 9 | 10 | Generated by: https://github.com/swagger-api/swagger-codegen.git 11 | """ 12 | 13 | 14 | import pprint 15 | import re # noqa: F401 16 | 17 | import six 18 | 19 | 20 | class SortOption(object): 21 | """NOTE: This class is auto generated by the swagger code generator program. 22 | 23 | Do not edit the class manually. 24 | """ 25 | 26 | """ 27 | allowed enum values 28 | """ 29 | SORTBYDIGIKEYPARTNUMBER = "SortByDigiKeyPartNumber" 30 | SORTBYMANUFACTURERPARTNUMBER = "SortByManufacturerPartNumber" 31 | SORTBYDESCRIPTION = "SortByDescription" 32 | SORTBYMANUFACTURER = "SortByManufacturer" 33 | SORTBYMINIMUMORDERQUANTITY = "SortByMinimumOrderQuantity" 34 | SORTBYQUANTITYAVAILABLE = "SortByQuantityAvailable" 35 | SORTBYUNITPRICE = "SortByUnitPrice" 36 | SORTBYPARAMETER = "SortByParameter" 37 | 38 | """ 39 | Attributes: 40 | swagger_types (dict): The key is attribute name 41 | and the value is attribute type. 42 | attribute_map (dict): The key is attribute name 43 | and the value is json key in definition. 44 | """ 45 | swagger_types = { 46 | } 47 | 48 | attribute_map = { 49 | } 50 | 51 | def __init__(self): # noqa: E501 52 | """SortOption - a model defined in Swagger""" # noqa: E501 53 | self.discriminator = None 54 | 55 | def to_dict(self): 56 | """Returns the model properties as a dict""" 57 | result = {} 58 | 59 | for attr, _ in six.iteritems(self.swagger_types): 60 | value = getattr(self, attr) 61 | if isinstance(value, list): 62 | result[attr] = list(map( 63 | lambda x: x.to_dict() if hasattr(x, "to_dict") else x, 64 | value 65 | )) 66 | elif hasattr(value, "to_dict"): 67 | result[attr] = value.to_dict() 68 | elif isinstance(value, dict): 69 | result[attr] = dict(map( 70 | lambda item: (item[0], item[1].to_dict()) 71 | if hasattr(item[1], "to_dict") else item, 72 | value.items() 73 | )) 74 | else: 75 | result[attr] = value 76 | if issubclass(SortOption, dict): 77 | for key, value in self.items(): 78 | result[key] = value 79 | 80 | return result 81 | 82 | def to_str(self): 83 | """Returns the string representation of the model""" 84 | return pprint.pformat(self.to_dict()) 85 | 86 | def __repr__(self): 87 | """For `print` and `pprint`""" 88 | return self.to_str() 89 | 90 | def __eq__(self, other): 91 | """Returns true if both objects are equal""" 92 | if not isinstance(other, SortOption): 93 | return False 94 | 95 | return self.__dict__ == other.__dict__ 96 | 97 | def __ne__(self, other): 98 | """Returns true if both objects are not equal""" 99 | return not self == other 100 | -------------------------------------------------------------------------------- /digikey/v3/productinformation/models/sort_parameters.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | """ 4 | PartSearch Api 5 | 6 | Search for products and retrieve details and pricing. # noqa: E501 7 | 8 | OpenAPI spec version: v3 9 | 10 | Generated by: https://github.com/swagger-api/swagger-codegen.git 11 | """ 12 | 13 | 14 | import pprint 15 | import re # noqa: F401 16 | 17 | import six 18 | 19 | 20 | class SortParameters(object): 21 | """NOTE: This class is auto generated by the swagger code generator program. 22 | 23 | Do not edit the class manually. 24 | """ 25 | 26 | """ 27 | Attributes: 28 | swagger_types (dict): The key is attribute name 29 | and the value is attribute type. 30 | attribute_map (dict): The key is attribute name 31 | and the value is json key in definition. 32 | """ 33 | swagger_types = { 34 | 'sort_option': 'SortOption', 35 | 'direction': 'SortDirection', 36 | 'sort_parameter_id': 'int' 37 | } 38 | 39 | attribute_map = { 40 | 'sort_option': 'SortOption', 41 | 'direction': 'Direction', 42 | 'sort_parameter_id': 'SortParameterId' 43 | } 44 | 45 | def __init__(self, sort_option=None, direction=None, sort_parameter_id=None): # noqa: E501 46 | """SortParameters - a model defined in Swagger""" # noqa: E501 47 | 48 | self._sort_option = None 49 | self._direction = None 50 | self._sort_parameter_id = None 51 | self.discriminator = None 52 | 53 | self.sort_option = sort_option 54 | self.direction = direction 55 | if sort_parameter_id is not None: 56 | self.sort_parameter_id = sort_parameter_id 57 | 58 | @property 59 | def sort_option(self): 60 | """Gets the sort_option of this SortParameters. # noqa: E501 61 | 62 | 63 | :return: The sort_option of this SortParameters. # noqa: E501 64 | :rtype: SortOption 65 | """ 66 | return self._sort_option 67 | 68 | @sort_option.setter 69 | def sort_option(self, sort_option): 70 | """Sets the sort_option of this SortParameters. 71 | 72 | 73 | :param sort_option: The sort_option of this SortParameters. # noqa: E501 74 | :type: SortOption 75 | """ 76 | if sort_option is None: 77 | raise ValueError("Invalid value for `sort_option`, must not be `None`") # noqa: E501 78 | 79 | self._sort_option = sort_option 80 | 81 | @property 82 | def direction(self): 83 | """Gets the direction of this SortParameters. # noqa: E501 84 | 85 | 86 | :return: The direction of this SortParameters. # noqa: E501 87 | :rtype: SortDirection 88 | """ 89 | return self._direction 90 | 91 | @direction.setter 92 | def direction(self, direction): 93 | """Sets the direction of this SortParameters. 94 | 95 | 96 | :param direction: The direction of this SortParameters. # noqa: E501 97 | :type: SortDirection 98 | """ 99 | if direction is None: 100 | raise ValueError("Invalid value for `direction`, must not be `None`") # noqa: E501 101 | 102 | self._direction = direction 103 | 104 | @property 105 | def sort_parameter_id(self): 106 | """Gets the sort_parameter_id of this SortParameters. # noqa: E501 107 | 108 | The ParameterId of the parameter to sort on. The ParameterId can be found in the Search response. This is only used with SortByParameter. # noqa: E501 109 | 110 | :return: The sort_parameter_id of this SortParameters. # noqa: E501 111 | :rtype: int 112 | """ 113 | return self._sort_parameter_id 114 | 115 | @sort_parameter_id.setter 116 | def sort_parameter_id(self, sort_parameter_id): 117 | """Sets the sort_parameter_id of this SortParameters. 118 | 119 | The ParameterId of the parameter to sort on. The ParameterId can be found in the Search response. This is only used with SortByParameter. # noqa: E501 120 | 121 | :param sort_parameter_id: The sort_parameter_id of this SortParameters. # noqa: E501 122 | :type: int 123 | """ 124 | 125 | self._sort_parameter_id = sort_parameter_id 126 | 127 | def to_dict(self): 128 | """Returns the model properties as a dict""" 129 | result = {} 130 | 131 | for attr, _ in six.iteritems(self.swagger_types): 132 | value = getattr(self, attr) 133 | if isinstance(value, list): 134 | result[attr] = list(map( 135 | lambda x: x.to_dict() if hasattr(x, "to_dict") else x, 136 | value 137 | )) 138 | elif hasattr(value, "to_dict"): 139 | result[attr] = value.to_dict() 140 | elif isinstance(value, dict): 141 | result[attr] = dict(map( 142 | lambda item: (item[0], item[1].to_dict()) 143 | if hasattr(item[1], "to_dict") else item, 144 | value.items() 145 | )) 146 | else: 147 | result[attr] = value 148 | if issubclass(SortParameters, dict): 149 | for key, value in self.items(): 150 | result[key] = value 151 | 152 | return result 153 | 154 | def to_str(self): 155 | """Returns the string representation of the model""" 156 | return pprint.pformat(self.to_dict()) 157 | 158 | def __repr__(self): 159 | """For `print` and `pprint`""" 160 | return self.to_str() 161 | 162 | def __eq__(self, other): 163 | """Returns true if both objects are equal""" 164 | if not isinstance(other, SortParameters): 165 | return False 166 | 167 | return self.__dict__ == other.__dict__ 168 | 169 | def __ne__(self, other): 170 | """Returns true if both objects are not equal""" 171 | return not self == other 172 | -------------------------------------------------------------------------------- /digikey/v3/productinformation/models/value_pair.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | """ 4 | PartSearch Api 5 | 6 | Search for products and retrieve details and pricing. # noqa: E501 7 | 8 | OpenAPI spec version: v3 9 | 10 | Generated by: https://github.com/swagger-api/swagger-codegen.git 11 | """ 12 | 13 | 14 | import pprint 15 | import re # noqa: F401 16 | 17 | import six 18 | 19 | 20 | class ValuePair(object): 21 | """NOTE: This class is auto generated by the swagger code generator program. 22 | 23 | Do not edit the class manually. 24 | """ 25 | 26 | """ 27 | Attributes: 28 | swagger_types (dict): The key is attribute name 29 | and the value is attribute type. 30 | attribute_map (dict): The key is attribute name 31 | and the value is json key in definition. 32 | """ 33 | swagger_types = { 34 | 'value_id': 'str', 35 | 'value': 'str' 36 | } 37 | 38 | attribute_map = { 39 | 'value_id': 'ValueId', 40 | 'value': 'Value' 41 | } 42 | 43 | def __init__(self, value_id=None, value=None): # noqa: E501 44 | """ValuePair - a model defined in Swagger""" # noqa: E501 45 | 46 | self._value_id = None 47 | self._value = None 48 | self.discriminator = None 49 | 50 | if value_id is not None: 51 | self.value_id = value_id 52 | if value is not None: 53 | self.value = value 54 | 55 | @property 56 | def value_id(self): 57 | """Gets the value_id of this ValuePair. # noqa: E501 58 | 59 | The Id of the value. # noqa: E501 60 | 61 | :return: The value_id of this ValuePair. # noqa: E501 62 | :rtype: str 63 | """ 64 | return self._value_id 65 | 66 | @value_id.setter 67 | def value_id(self, value_id): 68 | """Sets the value_id of this ValuePair. 69 | 70 | The Id of the value. # noqa: E501 71 | 72 | :param value_id: The value_id of this ValuePair. # noqa: E501 73 | :type: str 74 | """ 75 | 76 | self._value_id = value_id 77 | 78 | @property 79 | def value(self): 80 | """Gets the value of this ValuePair. # noqa: E501 81 | 82 | The name of the value. # noqa: E501 83 | 84 | :return: The value of this ValuePair. # noqa: E501 85 | :rtype: str 86 | """ 87 | return self._value 88 | 89 | @value.setter 90 | def value(self, value): 91 | """Sets the value of this ValuePair. 92 | 93 | The name of the value. # noqa: E501 94 | 95 | :param value: The value of this ValuePair. # noqa: E501 96 | :type: str 97 | """ 98 | 99 | self._value = value 100 | 101 | def to_dict(self): 102 | """Returns the model properties as a dict""" 103 | result = {} 104 | 105 | for attr, _ in six.iteritems(self.swagger_types): 106 | value = getattr(self, attr) 107 | if isinstance(value, list): 108 | result[attr] = list(map( 109 | lambda x: x.to_dict() if hasattr(x, "to_dict") else x, 110 | value 111 | )) 112 | elif hasattr(value, "to_dict"): 113 | result[attr] = value.to_dict() 114 | elif isinstance(value, dict): 115 | result[attr] = dict(map( 116 | lambda item: (item[0], item[1].to_dict()) 117 | if hasattr(item[1], "to_dict") else item, 118 | value.items() 119 | )) 120 | else: 121 | result[attr] = value 122 | if issubclass(ValuePair, dict): 123 | for key, value in self.items(): 124 | result[key] = value 125 | 126 | return result 127 | 128 | def to_str(self): 129 | """Returns the string representation of the model""" 130 | return pprint.pformat(self.to_dict()) 131 | 132 | def __repr__(self): 133 | """For `print` and `pprint`""" 134 | return self.to_str() 135 | 136 | def __eq__(self, other): 137 | """Returns true if both objects are equal""" 138 | if not isinstance(other, ValuePair): 139 | return False 140 | 141 | return self.__dict__ == other.__dict__ 142 | 143 | def __ne__(self, other): 144 | """Returns true if both objects are not equal""" 145 | return not self == other 146 | -------------------------------------------------------------------------------- /docs/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/peeter123/digikey-api/0c7707ce2359703526e3ecdeef15646d299801f5/docs/.keep -------------------------------------------------------------------------------- /requirements-dev.txt: -------------------------------------------------------------------------------- 1 | bump2version==1.0.0 2 | wheel 3 | twine 4 | gitpython -------------------------------------------------------------------------------- /requirements-test.txt: -------------------------------------------------------------------------------- 1 | coverage==4.5.4 2 | flake8==3.7.8 3 | mock==3.0.5 4 | mypy==0.720 5 | pytest==5.1.2 6 | pytest-cov==2.7.1 7 | responses==0.10.6 -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | inflection 2 | certauth 3 | requests 4 | retrying 5 | urllib3 6 | responses 7 | six 8 | certifi 9 | setuptools -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [bumpversion] 2 | current_version = 1.0.0 3 | commit = True 4 | tag = True 5 | tag_name = {new_version} 6 | message = Release {new_version} 7 | 8 | [aliases] 9 | test = nosetests 10 | 11 | [flake8] 12 | exclude = .git,venv,tests/fixtures.py 13 | max-complexity = 10 14 | 15 | [bumpversion:file:setup.py] 16 | search = version="{current_version}" 17 | replace = version="{new_version}" 18 | 19 | [metadata] 20 | description-file = README.md 21 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | import setuptools 2 | 3 | with open("README.md", "r") as fh: 4 | long_description = fh.read() 5 | 6 | setuptools.setup( 7 | name="digikey-api", 8 | version="1.0.0", 9 | author="Peter Oostewechel", 10 | author_email="peter_oostewechel@hotmail.com", 11 | license="GPL v3", 12 | url="https://github.com/peeter123/digikey-api", 13 | description="Python client for Digikey API", 14 | long_description=long_description, 15 | long_description_content_type="text/markdown", 16 | packages=setuptools.find_packages(exclude=['contrib', 'docs', 'tests']), 17 | include_package_data=True, 18 | classifiers=[ 19 | "Development Status :: 3 - Alpha", 20 | "Environment :: Web Environment", 21 | "Intended Audience :: Developers", 22 | "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", 23 | "Programming Language :: Python :: 3.6", 24 | "Topic :: Software Development", 25 | ], 26 | install_requires=[ 27 | 'requests>=2.22.0', 28 | 'retrying>=1.3.3', 29 | 'inflection>=0.3.1', 30 | 'certauth>=1.3.0', 31 | 'urllib3>=1.25.3' 32 | ], 33 | tests_requires=['pytest>=5.1.2'], 34 | ) 35 | -------------------------------------------------------------------------------- /tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/peeter123/digikey-api/0c7707ce2359703526e3ecdeef15646d299801f5/tests/__init__.py -------------------------------------------------------------------------------- /tests/fixtures.py: -------------------------------------------------------------------------------- 1 | import json 2 | from json import JSONDecodeError 3 | from pathlib import Path 4 | 5 | oauth2_response = None 6 | try: 7 | with open(Path(__file__).resolve().parent.joinpath('responses/oauth2_response.json'), 'r') as f: 8 | oauth2_response = json.load(f) 9 | except (EnvironmentError, JSONDecodeError): 10 | print('Token response does not exist or malformed') 11 | -------------------------------------------------------------------------------- /tests/local/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/peeter123/digikey-api/0c7707ce2359703526e3ecdeef15646d299801f5/tests/local/.keep -------------------------------------------------------------------------------- /tests/responses/oauth2_response.json: -------------------------------------------------------------------------------- 1 | { 2 | "access_token": "MOCK_ACCESS", 3 | "refresh_token": "MOCK_REFRESH", 4 | "token_type": "Bearer", 5 | "expires_in": 86400 6 | } -------------------------------------------------------------------------------- /tests/test_oauth2.py: -------------------------------------------------------------------------------- 1 | import logging 2 | import os 3 | import re 4 | import ssl 5 | import json 6 | import sys 7 | import urllib.request 8 | import urllib.parse as urlparse 9 | from json.decoder import JSONDecodeError 10 | from unittest import TestCase 11 | import unittest.mock as mock 12 | from pathlib import Path 13 | from datetime import datetime, timezone 14 | import threading 15 | 16 | import responses 17 | 18 | from digikey.oauth import oauth2 19 | from . import fixtures 20 | 21 | logger = logging.getLogger(__name__) 22 | logger.level = logging.DEBUG 23 | 24 | 25 | def mock_open_new(url): 26 | parsed = urlparse.parse_qs(urlparse.urlparse(url).query) 27 | assert parsed['client_id'][0] == 'MOCK_CLIENT_ID' 28 | assert parsed['redirect_uri'][0] == 'https://localhost:8139/digikey_callback' 29 | 30 | # Call the redirect URI 31 | values = {'code': 'MOCK_AUTH_CODE'} 32 | data = urllib.parse.urlencode(values) 33 | req = parsed['redirect_uri'][0] + '?' + data 34 | threading.Thread(target=lambda: urllib.request.urlopen(req, context=ssl._create_unverified_context())).start() 35 | pass 36 | 37 | 38 | class Oauth2Tests(TestCase): 39 | def setUp(self): 40 | self.old_token_storage_path = os.getenv('DIGIKEY_STORAGE_PATH', "") 41 | self.old_client_id = os.getenv('DIGIKEY_CLIENT_ID', "") 42 | self.old_client_secret = os.getenv('DIGIKEY_CLIENT_SECRET', "") 43 | 44 | os.environ['DIGIKEY_STORAGE_PATH'] = str(Path(__file__).parent) 45 | os.environ['DIGIKEY_CLIENT_ID'] = 'MOCK_CLIENT_ID' 46 | os.environ['DIGIKEY_CLIENT_SECRET'] = 'MOCK_CLIENT_SECRET' 47 | 48 | self.stream_handler = logging.StreamHandler(sys.stdout) 49 | logger.addHandler(self.stream_handler) 50 | 51 | def tearDown(self): 52 | os.environ['DIGIKEY_STORAGE_PATH'] = self.old_token_storage_path 53 | os.environ['DIGIKEY_CLIENT_ID'] = self.old_client_id 54 | os.environ['DIGIKEY_CLIENT_SECRET'] = self.old_client_secret 55 | 56 | logger.removeHandler(self.stream_handler) 57 | 58 | @responses.activate 59 | @mock.patch('digikey.oauth.oauth2.open_new', side_effect=mock_open_new) 60 | def test_authentication(self, mock_on): 61 | """Tests that token is retrieved correctly from authorization""" 62 | 63 | urls = {2: oauth2.TOKEN_URL_V2 + r'.*', 64 | 3: oauth2.TOKEN_URL_V3_PROD + r'.*'} 65 | 66 | for version in [2, 3]: 67 | logger.info(f'Tests that token is retrieved correctly from authorization [API V{version}]') 68 | 69 | # Mock out all calls to token endpoint. 70 | url_auth = re.compile(urls[version]) 71 | responses.add( 72 | responses.POST, 73 | url_auth, 74 | status=200, 75 | content_type='application/json', 76 | json=fixtures.oauth2_response 77 | ) 78 | 79 | token = oauth2.TokenHandler(version=version).get_access_token() 80 | assert token.access_token == 'MOCK_ACCESS' 81 | assert token.refresh_token == 'MOCK_REFRESH' 82 | expires_in = (token.expires - datetime.now(timezone.utc)).seconds 83 | assert 86200 <= expires_in <= 86340 84 | 85 | token_file = Path(os.getenv('DIGIKEY_STORAGE_PATH', "")).joinpath(oauth2.TOKEN_STORAGE) 86 | cacert = Path(os.getenv('DIGIKEY_STORAGE_PATH', "")).joinpath(oauth2.CA_CERT) 87 | pemfile = Path(os.getenv('DIGIKEY_STORAGE_PATH', "")).joinpath('localhost.pem') 88 | 89 | # Test if temporary files have been cleaned up 90 | assert not cacert.is_file() 91 | assert not pemfile.is_file() 92 | 93 | # Test if token has been saved 94 | assert token_file.is_file() 95 | 96 | # Test for correct storage 97 | token_json = None 98 | try: 99 | with open(token_file, 'r') as f: 100 | token_json = json.load(f) 101 | except (EnvironmentError, JSONDecodeError): 102 | print('Token storage does not exist or malformed') 103 | assert False 104 | 105 | os.remove(token_file) 106 | 107 | assert token_json['access_token'] == 'MOCK_ACCESS' 108 | assert token_json['refresh_token'] == 'MOCK_REFRESH' 109 | -------------------------------------------------------------------------------- /tests/utils.py: -------------------------------------------------------------------------------- 1 | """ Utility functions for testing, _not_ tests for utilities""" 2 | from contextlib import contextmanager 3 | import json 4 | import re 5 | 6 | import responses 7 | 8 | 9 | @contextmanager 10 | def digikey_api_mock_response(data=None): 11 | """Boilerplate for mocking all Dgikey API URLs with an empty response""" 12 | if data is None: 13 | data = {"results": []} 14 | 15 | with responses.RequestsMock() as rsps: 16 | rsps.add( 17 | responses.GET, 18 | re.compile(r'https://api.digikey\.com/services/.*'), 19 | body=json.dumps(data), 20 | status=200, 21 | content_type='application/json' 22 | ) 23 | 24 | yield rsps 25 | 26 | @contextmanager 27 | def digikey_sso_mock_response(data=None): 28 | """Boilerplate for mocking all Dgikey SSO URLs with an empty response""" 29 | if data is None: 30 | data = {"results": []} 31 | 32 | with responses.RequestsMock() as rsps: 33 | rsps.add( 34 | responses.GET, 35 | re.compile(r'https://sso.digikey\.com/as/.*'), 36 | body=json.dumps(data), 37 | status=200, 38 | content_type='application/json' 39 | ) 40 | 41 | yield rsps 42 | 43 | 44 | 45 | def request_url_from_request_mock(reqmock): 46 | """Given responses.RequestsMock, get URL of first recorded request 47 | Utility method for asserting that the correct URL was generated. Fails 48 | if more than one request was made against the RequestMock. 49 | """ 50 | assert len(reqmock.calls) == 1 51 | request, _ = reqmock.calls[0] 52 | return request.url 53 | -------------------------------------------------------------------------------- /tests/v3/ordersupport/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/peeter123/digikey-api/0c7707ce2359703526e3ecdeef15646d299801f5/tests/v3/ordersupport/__init__.py -------------------------------------------------------------------------------- /tests/v3/ordersupport/test_address.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | """ 4 | Order Details 5 | 6 | Retrieve information about current and past orders. # noqa: E501 7 | 8 | OpenAPI spec version: v3 9 | Contact: api.contact@digikey.com 10 | Generated by: https://github.com/swagger-api/swagger-codegen.git 11 | """ 12 | 13 | 14 | from __future__ import absolute_import 15 | 16 | import unittest 17 | 18 | import digikey.v3.ordersupport 19 | from digikey.v3.ordersupport.models.address import Address # noqa: E501 20 | from digikey.v3.ordersupport.rest import ApiException 21 | 22 | 23 | class TestAddress(unittest.TestCase): 24 | """Address unit test stubs""" 25 | 26 | def setUp(self): 27 | pass 28 | 29 | def tearDown(self): 30 | pass 31 | 32 | def testAddress(self): 33 | """Test Address""" 34 | # FIXME: construct object with mandatory attributes with example values 35 | # model = digikey.v3.ordersupport.models.address.Address() # noqa: E501 36 | pass 37 | 38 | 39 | if __name__ == '__main__': 40 | unittest.main() 41 | -------------------------------------------------------------------------------- /tests/v3/ordersupport/test_api_error_response.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | """ 4 | Order Details 5 | 6 | Retrieve information about current and past orders. # noqa: E501 7 | 8 | OpenAPI spec version: v3 9 | Contact: api.contact@digikey.com 10 | Generated by: https://github.com/swagger-api/swagger-codegen.git 11 | """ 12 | 13 | 14 | from __future__ import absolute_import 15 | 16 | import unittest 17 | 18 | import digikey.v3.ordersupport 19 | from digikey.v3.ordersupport.models.api_error_response import ApiErrorResponse # noqa: E501 20 | from digikey.v3.ordersupport.rest import ApiException 21 | 22 | 23 | class TestApiErrorResponse(unittest.TestCase): 24 | """ApiErrorResponse unit test stubs""" 25 | 26 | def setUp(self): 27 | pass 28 | 29 | def tearDown(self): 30 | pass 31 | 32 | def testApiErrorResponse(self): 33 | """Test ApiErrorResponse""" 34 | # FIXME: construct object with mandatory attributes with example values 35 | # model = digikey.v3.ordersupport.models.api_error_response.ApiErrorResponse() # noqa: E501 36 | pass 37 | 38 | 39 | if __name__ == '__main__': 40 | unittest.main() 41 | -------------------------------------------------------------------------------- /tests/v3/ordersupport/test_api_validation_error.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | """ 4 | Order Details 5 | 6 | Retrieve information about current and past orders. # noqa: E501 7 | 8 | OpenAPI spec version: v3 9 | Contact: api.contact@digikey.com 10 | Generated by: https://github.com/swagger-api/swagger-codegen.git 11 | """ 12 | 13 | 14 | from __future__ import absolute_import 15 | 16 | import unittest 17 | 18 | import digikey.v3.ordersupport 19 | from digikey.v3.ordersupport.models.api_validation_error import ApiValidationError # noqa: E501 20 | from digikey.v3.ordersupport.rest import ApiException 21 | 22 | 23 | class TestApiValidationError(unittest.TestCase): 24 | """ApiValidationError unit test stubs""" 25 | 26 | def setUp(self): 27 | pass 28 | 29 | def tearDown(self): 30 | pass 31 | 32 | def testApiValidationError(self): 33 | """Test ApiValidationError""" 34 | # FIXME: construct object with mandatory attributes with example values 35 | # model = digikey.v3.ordersupport.models.api_validation_error.ApiValidationError() # noqa: E501 36 | pass 37 | 38 | 39 | if __name__ == '__main__': 40 | unittest.main() 41 | -------------------------------------------------------------------------------- /tests/v3/ordersupport/test_line_item.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | """ 4 | Order Details 5 | 6 | Retrieve information about current and past orders. # noqa: E501 7 | 8 | OpenAPI spec version: v3 9 | Contact: api.contact@digikey.com 10 | Generated by: https://github.com/swagger-api/swagger-codegen.git 11 | """ 12 | 13 | 14 | from __future__ import absolute_import 15 | 16 | import unittest 17 | 18 | import digikey.v3.ordersupport 19 | from digikey.v3.ordersupport.models.line_item import LineItem # noqa: E501 20 | from digikey.v3.ordersupport.rest import ApiException 21 | 22 | 23 | class TestLineItem(unittest.TestCase): 24 | """LineItem unit test stubs""" 25 | 26 | def setUp(self): 27 | pass 28 | 29 | def tearDown(self): 30 | pass 31 | 32 | def testLineItem(self): 33 | """Test LineItem""" 34 | # FIXME: construct object with mandatory attributes with example values 35 | # model = digikey.v3.ordersupport.models.line_item.LineItem() # noqa: E501 36 | pass 37 | 38 | 39 | if __name__ == '__main__': 40 | unittest.main() 41 | -------------------------------------------------------------------------------- /tests/v3/ordersupport/test_order_details_api.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | """ 4 | Order Details 5 | 6 | Retrieve information about current and past orders. # noqa: E501 7 | 8 | OpenAPI spec version: v3 9 | Contact: api.contact@digikey.com 10 | Generated by: https://github.com/swagger-api/swagger-codegen.git 11 | """ 12 | 13 | 14 | from __future__ import absolute_import 15 | 16 | import unittest 17 | 18 | import digikey.v3.ordersupport 19 | from digikey.v3.ordersupport.api.order_details_api import OrderDetailsApi # noqa: E501 20 | from digikey.v3.ordersupport.rest import ApiException 21 | 22 | 23 | class TestOrderDetailsApi(unittest.TestCase): 24 | """OrderDetailsApi unit test stubs""" 25 | 26 | def setUp(self): 27 | self.api = digikey.v3.ordersupport.api.order_details_api.OrderDetailsApi() # noqa: E501 28 | 29 | def tearDown(self): 30 | pass 31 | 32 | def test_history_get(self): 33 | """Test case for history_get 34 | 35 | Retrieves a list of SalesorderIds and dates for all Salesorders within a date range belonging to a CustomerId. # noqa: E501 36 | """ 37 | pass 38 | 39 | def test_status_salesorder_id_get(self): 40 | """Test case for status_salesorder_id_get 41 | 42 | Retrieve order status for given SalesorderId # noqa: E501 43 | """ 44 | pass 45 | 46 | 47 | if __name__ == '__main__': 48 | unittest.main() 49 | -------------------------------------------------------------------------------- /tests/v3/ordersupport/test_order_status_response.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | """ 4 | Order Details 5 | 6 | Retrieve information about current and past orders. # noqa: E501 7 | 8 | OpenAPI spec version: v3 9 | Contact: api.contact@digikey.com 10 | Generated by: https://github.com/swagger-api/swagger-codegen.git 11 | """ 12 | 13 | 14 | from __future__ import absolute_import 15 | 16 | import unittest 17 | 18 | import digikey.v3.ordersupport 19 | from digikey.v3.ordersupport.models.order_status_response import OrderStatusResponse # noqa: E501 20 | from digikey.v3.ordersupport.rest import ApiException 21 | 22 | 23 | class TestOrderStatusResponse(unittest.TestCase): 24 | """OrderStatusResponse unit test stubs""" 25 | 26 | def setUp(self): 27 | pass 28 | 29 | def tearDown(self): 30 | pass 31 | 32 | def testOrderStatusResponse(self): 33 | """Test OrderStatusResponse""" 34 | # FIXME: construct object with mandatory attributes with example values 35 | # model = digikey.v3.ordersupport.models.order_status_response.OrderStatusResponse() # noqa: E501 36 | pass 37 | 38 | 39 | if __name__ == '__main__': 40 | unittest.main() 41 | -------------------------------------------------------------------------------- /tests/v3/ordersupport/test_salesorder_history_item.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | """ 4 | Order Details 5 | 6 | Retrieve information about current and past orders. # noqa: E501 7 | 8 | OpenAPI spec version: v3 9 | Contact: api.contact@digikey.com 10 | Generated by: https://github.com/swagger-api/swagger-codegen.git 11 | """ 12 | 13 | 14 | from __future__ import absolute_import 15 | 16 | import unittest 17 | 18 | import digikey.v3.ordersupport 19 | from digikey.v3.ordersupport.models.salesorder_history_item import SalesorderHistoryItem # noqa: E501 20 | from digikey.v3.ordersupport.rest import ApiException 21 | 22 | 23 | class TestSalesorderHistoryItem(unittest.TestCase): 24 | """SalesorderHistoryItem unit test stubs""" 25 | 26 | def setUp(self): 27 | pass 28 | 29 | def tearDown(self): 30 | pass 31 | 32 | def testSalesorderHistoryItem(self): 33 | """Test SalesorderHistoryItem""" 34 | # FIXME: construct object with mandatory attributes with example values 35 | # model = digikey.v3.ordersupport.models.salesorder_history_item.SalesorderHistoryItem() # noqa: E501 36 | pass 37 | 38 | 39 | if __name__ == '__main__': 40 | unittest.main() 41 | -------------------------------------------------------------------------------- /tests/v3/ordersupport/test_schedule.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | """ 4 | Order Details 5 | 6 | Retrieve information about current and past orders. # noqa: E501 7 | 8 | OpenAPI spec version: v3 9 | Contact: api.contact@digikey.com 10 | Generated by: https://github.com/swagger-api/swagger-codegen.git 11 | """ 12 | 13 | 14 | from __future__ import absolute_import 15 | 16 | import unittest 17 | 18 | import digikey.v3.ordersupport 19 | from digikey.v3.ordersupport.models.schedule import Schedule # noqa: E501 20 | from digikey.v3.ordersupport.rest import ApiException 21 | 22 | 23 | class TestSchedule(unittest.TestCase): 24 | """Schedule unit test stubs""" 25 | 26 | def setUp(self): 27 | pass 28 | 29 | def tearDown(self): 30 | pass 31 | 32 | def testSchedule(self): 33 | """Test Schedule""" 34 | # FIXME: construct object with mandatory attributes with example values 35 | # model = digikey.v3.ordersupport.models.schedule.Schedule() # noqa: E501 36 | pass 37 | 38 | 39 | if __name__ == '__main__': 40 | unittest.main() 41 | -------------------------------------------------------------------------------- /tests/v3/ordersupport/test_shipping_detail.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | """ 4 | Order Details 5 | 6 | Retrieve information about current and past orders. # noqa: E501 7 | 8 | OpenAPI spec version: v3 9 | Contact: api.contact@digikey.com 10 | Generated by: https://github.com/swagger-api/swagger-codegen.git 11 | """ 12 | 13 | 14 | from __future__ import absolute_import 15 | 16 | import unittest 17 | 18 | import digikey.v3.ordersupport 19 | from digikey.v3.ordersupport.models.shipping_detail import ShippingDetail # noqa: E501 20 | from digikey.v3.ordersupport.rest import ApiException 21 | 22 | 23 | class TestShippingDetail(unittest.TestCase): 24 | """ShippingDetail unit test stubs""" 25 | 26 | def setUp(self): 27 | pass 28 | 29 | def tearDown(self): 30 | pass 31 | 32 | def testShippingDetail(self): 33 | """Test ShippingDetail""" 34 | # FIXME: construct object with mandatory attributes with example values 35 | # model = digikey.v3.ordersupport.models.shipping_detail.ShippingDetail() # noqa: E501 36 | pass 37 | 38 | 39 | if __name__ == '__main__': 40 | unittest.main() 41 | -------------------------------------------------------------------------------- /tests/v3/productinformation/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/peeter123/digikey-api/0c7707ce2359703526e3ecdeef15646d299801f5/tests/v3/productinformation/__init__.py -------------------------------------------------------------------------------- /tests/v3/productinformation/test_api_error_response.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | """ 4 | PartSearch Api 5 | 6 | Search for products and retrieve details and pricing. # noqa: E501 7 | 8 | OpenAPI spec version: v3 9 | Contact: api.support@digikey.com 10 | Generated by: https://github.com/swagger-api/swagger-codegen.git 11 | """ 12 | 13 | 14 | from __future__ import absolute_import 15 | 16 | import unittest 17 | 18 | import digikey.v3.productinformation 19 | from digikey.v3.productinformation.models.api_error_response import ApiErrorResponse # noqa: E501 20 | from digikey.v3.productinformation.rest import ApiException 21 | 22 | 23 | class TestApiErrorResponse(unittest.TestCase): 24 | """ApiErrorResponse unit test stubs""" 25 | 26 | def setUp(self): 27 | pass 28 | 29 | def tearDown(self): 30 | pass 31 | 32 | def testApiErrorResponse(self): 33 | """Test ApiErrorResponse""" 34 | # FIXME: construct object with mandatory attributes with example values 35 | # model = digikey.v3.productinformation.models.api_error_response.ApiErrorResponse() # noqa: E501 36 | pass 37 | 38 | 39 | if __name__ == '__main__': 40 | unittest.main() 41 | -------------------------------------------------------------------------------- /tests/v3/productinformation/test_api_validation_error.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | """ 4 | PartSearch Api 5 | 6 | Search for products and retrieve details and pricing. # noqa: E501 7 | 8 | OpenAPI spec version: v3 9 | Contact: api.support@digikey.com 10 | Generated by: https://github.com/swagger-api/swagger-codegen.git 11 | """ 12 | 13 | 14 | from __future__ import absolute_import 15 | 16 | import unittest 17 | 18 | import digikey.v3.productinformation 19 | from digikey.v3.productinformation.models.api_validation_error import ApiValidationError # noqa: E501 20 | from digikey.v3.productinformation.rest import ApiException 21 | 22 | 23 | class TestApiValidationError(unittest.TestCase): 24 | """ApiValidationError unit test stubs""" 25 | 26 | def setUp(self): 27 | pass 28 | 29 | def tearDown(self): 30 | pass 31 | 32 | def testApiValidationError(self): 33 | """Test ApiValidationError""" 34 | # FIXME: construct object with mandatory attributes with example values 35 | # model = digikey.v3.productinformation.models.api_validation_error.ApiValidationError() # noqa: E501 36 | pass 37 | 38 | 39 | if __name__ == '__main__': 40 | unittest.main() 41 | -------------------------------------------------------------------------------- /tests/v3/productinformation/test_basic_product.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | """ 4 | PartSearch Api 5 | 6 | Search for products and retrieve details and pricing. # noqa: E501 7 | 8 | OpenAPI spec version: v3 9 | Contact: api.support@digikey.com 10 | Generated by: https://github.com/swagger-api/swagger-codegen.git 11 | """ 12 | 13 | 14 | from __future__ import absolute_import 15 | 16 | import unittest 17 | 18 | import digikey.v3.productinformation 19 | from digikey.v3.productinformation.models.basic_product import BasicProduct # noqa: E501 20 | from digikey.v3.productinformation.rest import ApiException 21 | 22 | 23 | class TestBasicProduct(unittest.TestCase): 24 | """BasicProduct unit test stubs""" 25 | 26 | def setUp(self): 27 | pass 28 | 29 | def tearDown(self): 30 | pass 31 | 32 | def testBasicProduct(self): 33 | """Test BasicProduct""" 34 | # FIXME: construct object with mandatory attributes with example values 35 | # model = digikey.v3.productinformation.models.basic_product.BasicProduct() # noqa: E501 36 | pass 37 | 38 | 39 | if __name__ == '__main__': 40 | unittest.main() 41 | -------------------------------------------------------------------------------- /tests/v3/productinformation/test_digi_reel_pricing.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | """ 4 | PartSearch Api 5 | 6 | Search for products and retrieve details and pricing. # noqa: E501 7 | 8 | OpenAPI spec version: v3 9 | Contact: api.support@digikey.com 10 | Generated by: https://github.com/swagger-api/swagger-codegen.git 11 | """ 12 | 13 | 14 | from __future__ import absolute_import 15 | 16 | import unittest 17 | 18 | import digikey.v3.productinformation 19 | from digikey.v3.productinformation.models.digi_reel_pricing import DigiReelPricing # noqa: E501 20 | from digikey.v3.productinformation.rest import ApiException 21 | 22 | 23 | class TestDigiReelPricing(unittest.TestCase): 24 | """DigiReelPricing unit test stubs""" 25 | 26 | def setUp(self): 27 | pass 28 | 29 | def tearDown(self): 30 | pass 31 | 32 | def testDigiReelPricing(self): 33 | """Test DigiReelPricing""" 34 | # FIXME: construct object with mandatory attributes with example values 35 | # model = digikey.v3.productinformation.models.digi_reel_pricing.DigiReelPricing() # noqa: E501 36 | pass 37 | 38 | 39 | if __name__ == '__main__': 40 | unittest.main() 41 | -------------------------------------------------------------------------------- /tests/v3/productinformation/test_filters.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | """ 4 | PartSearch Api 5 | 6 | Search for products and retrieve details and pricing. # noqa: E501 7 | 8 | OpenAPI spec version: v3 9 | Contact: api.support@digikey.com 10 | Generated by: https://github.com/swagger-api/swagger-codegen.git 11 | """ 12 | 13 | 14 | from __future__ import absolute_import 15 | 16 | import unittest 17 | 18 | import digikey.v3.productinformation 19 | from digikey.v3.productinformation.models.filters import Filters # noqa: E501 20 | from digikey.v3.productinformation.rest import ApiException 21 | 22 | 23 | class TestFilters(unittest.TestCase): 24 | """Filters unit test stubs""" 25 | 26 | def setUp(self): 27 | pass 28 | 29 | def tearDown(self): 30 | pass 31 | 32 | def testFilters(self): 33 | """Test Filters""" 34 | # FIXME: construct object with mandatory attributes with example values 35 | # model = digikey.v3.productinformation.models.filters.Filters() # noqa: E501 36 | pass 37 | 38 | 39 | if __name__ == '__main__': 40 | unittest.main() 41 | -------------------------------------------------------------------------------- /tests/v3/productinformation/test_iso_search_locale.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | """ 4 | PartSearch Api 5 | 6 | Search for products and retrieve details and pricing. # noqa: E501 7 | 8 | OpenAPI spec version: v3 9 | Contact: api.support@digikey.com 10 | Generated by: https://github.com/swagger-api/swagger-codegen.git 11 | """ 12 | 13 | 14 | from __future__ import absolute_import 15 | 16 | import unittest 17 | 18 | import digikey.v3.productinformation 19 | from digikey.v3.productinformation.models.iso_search_locale import IsoSearchLocale # noqa: E501 20 | from digikey.v3.productinformation.rest import ApiException 21 | 22 | 23 | class TestIsoSearchLocale(unittest.TestCase): 24 | """IsoSearchLocale unit test stubs""" 25 | 26 | def setUp(self): 27 | pass 28 | 29 | def tearDown(self): 30 | pass 31 | 32 | def testIsoSearchLocale(self): 33 | """Test IsoSearchLocale""" 34 | # FIXME: construct object with mandatory attributes with example values 35 | # model = digikey.v3.productinformation.models.iso_search_locale.IsoSearchLocale() # noqa: E501 36 | pass 37 | 38 | 39 | if __name__ == '__main__': 40 | unittest.main() 41 | -------------------------------------------------------------------------------- /tests/v3/productinformation/test_keyword_search_request.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | """ 4 | PartSearch Api 5 | 6 | Search for products and retrieve details and pricing. # noqa: E501 7 | 8 | OpenAPI spec version: v3 9 | Contact: api.support@digikey.com 10 | Generated by: https://github.com/swagger-api/swagger-codegen.git 11 | """ 12 | 13 | 14 | from __future__ import absolute_import 15 | 16 | import unittest 17 | 18 | import digikey.v3.productinformation 19 | from digikey.v3.productinformation.models.keyword_search_request import KeywordSearchRequest # noqa: E501 20 | from digikey.v3.productinformation.rest import ApiException 21 | 22 | 23 | class TestKeywordSearchRequest(unittest.TestCase): 24 | """KeywordSearchRequest unit test stubs""" 25 | 26 | def setUp(self): 27 | pass 28 | 29 | def tearDown(self): 30 | pass 31 | 32 | def testKeywordSearchRequest(self): 33 | """Test KeywordSearchRequest""" 34 | # FIXME: construct object with mandatory attributes with example values 35 | # model = digikey.v3.productinformation.models.keyword_search_request.KeywordSearchRequest() # noqa: E501 36 | pass 37 | 38 | 39 | if __name__ == '__main__': 40 | unittest.main() 41 | -------------------------------------------------------------------------------- /tests/v3/productinformation/test_keyword_search_response.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | """ 4 | PartSearch Api 5 | 6 | Search for products and retrieve details and pricing. # noqa: E501 7 | 8 | OpenAPI spec version: v3 9 | Contact: api.support@digikey.com 10 | Generated by: https://github.com/swagger-api/swagger-codegen.git 11 | """ 12 | 13 | 14 | from __future__ import absolute_import 15 | 16 | import unittest 17 | 18 | import digikey.v3.productinformation 19 | from digikey.v3.productinformation.models.keyword_search_response import KeywordSearchResponse # noqa: E501 20 | from digikey.v3.productinformation.rest import ApiException 21 | 22 | 23 | class TestKeywordSearchResponse(unittest.TestCase): 24 | """KeywordSearchResponse unit test stubs""" 25 | 26 | def setUp(self): 27 | pass 28 | 29 | def tearDown(self): 30 | pass 31 | 32 | def testKeywordSearchResponse(self): 33 | """Test KeywordSearchResponse""" 34 | # FIXME: construct object with mandatory attributes with example values 35 | # model = digikey.v3.productinformation.models.keyword_search_response.KeywordSearchResponse() # noqa: E501 36 | pass 37 | 38 | 39 | if __name__ == '__main__': 40 | unittest.main() 41 | -------------------------------------------------------------------------------- /tests/v3/productinformation/test_limited_parameter.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | """ 4 | PartSearch Api 5 | 6 | Search for products and retrieve details and pricing. # noqa: E501 7 | 8 | OpenAPI spec version: v3 9 | Contact: api.support@digikey.com 10 | Generated by: https://github.com/swagger-api/swagger-codegen.git 11 | """ 12 | 13 | 14 | from __future__ import absolute_import 15 | 16 | import unittest 17 | 18 | import digikey.v3.productinformation 19 | from digikey.v3.productinformation.models.limited_parameter import LimitedParameter # noqa: E501 20 | from digikey.v3.productinformation.rest import ApiException 21 | 22 | 23 | class TestLimitedParameter(unittest.TestCase): 24 | """LimitedParameter unit test stubs""" 25 | 26 | def setUp(self): 27 | pass 28 | 29 | def tearDown(self): 30 | pass 31 | 32 | def testLimitedParameter(self): 33 | """Test LimitedParameter""" 34 | # FIXME: construct object with mandatory attributes with example values 35 | # model = digikey.v3.productinformation.models.limited_parameter.LimitedParameter() # noqa: E501 36 | pass 37 | 38 | 39 | if __name__ == '__main__': 40 | unittest.main() 41 | -------------------------------------------------------------------------------- /tests/v3/productinformation/test_limited_taxonomy.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | """ 4 | PartSearch Api 5 | 6 | Search for products and retrieve details and pricing. # noqa: E501 7 | 8 | OpenAPI spec version: v3 9 | Contact: api.support@digikey.com 10 | Generated by: https://github.com/swagger-api/swagger-codegen.git 11 | """ 12 | 13 | 14 | from __future__ import absolute_import 15 | 16 | import unittest 17 | 18 | import digikey.v3.productinformation 19 | from digikey.v3.productinformation.models.limited_taxonomy import LimitedTaxonomy # noqa: E501 20 | from digikey.v3.productinformation.rest import ApiException 21 | 22 | 23 | class TestLimitedTaxonomy(unittest.TestCase): 24 | """LimitedTaxonomy unit test stubs""" 25 | 26 | def setUp(self): 27 | pass 28 | 29 | def tearDown(self): 30 | pass 31 | 32 | def testLimitedTaxonomy(self): 33 | """Test LimitedTaxonomy""" 34 | # FIXME: construct object with mandatory attributes with example values 35 | # model = digikey.v3.productinformation.models.limited_taxonomy.LimitedTaxonomy() # noqa: E501 36 | pass 37 | 38 | 39 | if __name__ == '__main__': 40 | unittest.main() 41 | -------------------------------------------------------------------------------- /tests/v3/productinformation/test_manufacturer_product_details_request.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | """ 4 | PartSearch Api 5 | 6 | Search for products and retrieve details and pricing. # noqa: E501 7 | 8 | OpenAPI spec version: v3 9 | Contact: api.support@digikey.com 10 | Generated by: https://github.com/swagger-api/swagger-codegen.git 11 | """ 12 | 13 | 14 | from __future__ import absolute_import 15 | 16 | import unittest 17 | 18 | import digikey.v3.productinformation 19 | from digikey.v3.productinformation.models.manufacturer_product_details_request import ManufacturerProductDetailsRequest # noqa: E501 20 | from digikey.v3.productinformation.rest import ApiException 21 | 22 | 23 | class TestManufacturerProductDetailsRequest(unittest.TestCase): 24 | """ManufacturerProductDetailsRequest unit test stubs""" 25 | 26 | def setUp(self): 27 | pass 28 | 29 | def tearDown(self): 30 | pass 31 | 32 | def testManufacturerProductDetailsRequest(self): 33 | """Test ManufacturerProductDetailsRequest""" 34 | # FIXME: construct object with mandatory attributes with example values 35 | # model = digikey.v3.productinformation.models.manufacturer_product_details_request.ManufacturerProductDetailsRequest() # noqa: E501 36 | pass 37 | 38 | 39 | if __name__ == '__main__': 40 | unittest.main() 41 | -------------------------------------------------------------------------------- /tests/v3/productinformation/test_parametric_filter.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | """ 4 | PartSearch Api 5 | 6 | Search for products and retrieve details and pricing. # noqa: E501 7 | 8 | OpenAPI spec version: v3 9 | Contact: api.support@digikey.com 10 | Generated by: https://github.com/swagger-api/swagger-codegen.git 11 | """ 12 | 13 | 14 | from __future__ import absolute_import 15 | 16 | import unittest 17 | 18 | import digikey.v3.productinformation 19 | from digikey.v3.productinformation.models.parametric_filter import ParametricFilter # noqa: E501 20 | from digikey.v3.productinformation.rest import ApiException 21 | 22 | 23 | class TestParametricFilter(unittest.TestCase): 24 | """ParametricFilter unit test stubs""" 25 | 26 | def setUp(self): 27 | pass 28 | 29 | def tearDown(self): 30 | pass 31 | 32 | def testParametricFilter(self): 33 | """Test ParametricFilter""" 34 | # FIXME: construct object with mandatory attributes with example values 35 | # model = digikey.v3.productinformation.models.parametric_filter.ParametricFilter() # noqa: E501 36 | pass 37 | 38 | 39 | if __name__ == '__main__': 40 | unittest.main() 41 | -------------------------------------------------------------------------------- /tests/v3/productinformation/test_part_search_api.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | """ 4 | PartSearch Api 5 | 6 | Search for products and retrieve details and pricing. # noqa: E501 7 | 8 | OpenAPI spec version: v3 9 | Contact: api.support@digikey.com 10 | Generated by: https://github.com/swagger-api/swagger-codegen.git 11 | """ 12 | 13 | 14 | from __future__ import absolute_import 15 | 16 | import unittest 17 | 18 | import digikey.v3.productinformation 19 | from digikey.v3.productinformation.api.part_search_api import PartSearchApi # noqa: E501 20 | from digikey.v3.productinformation.rest import ApiException 21 | 22 | 23 | class TestPartSearchApi(unittest.TestCase): 24 | """PartSearchApi unit test stubs""" 25 | 26 | def setUp(self): 27 | self.api = digikey.v3.productinformation.api.part_search_api.PartSearchApi() # noqa: E501 28 | 29 | def tearDown(self): 30 | pass 31 | 32 | def test_products_digi_key_part_number_digi_reel_pricing_get(self): 33 | """Test case for products_digi_key_part_number_digi_reel_pricing_get 34 | 35 | Calculate the DigiReel pricing for the given DigiKeyPartNumber and RequestedQuantity # noqa: E501 36 | """ 37 | pass 38 | 39 | def test_products_digi_key_part_number_get(self): 40 | """Test case for products_digi_key_part_number_get 41 | 42 | Retrieve detailed product information including real time pricing and availability. # noqa: E501 43 | """ 44 | pass 45 | 46 | def test_products_keyword_post(self): 47 | """Test case for products_keyword_post 48 | 49 | KeywordSearch can search for any product in the Digi-Key catalog. # noqa: E501 50 | """ 51 | pass 52 | 53 | def test_products_manufacturer_product_details_post(self): 54 | """Test case for products_manufacturer_product_details_post 55 | 56 | Create list of ProductDetails from the matches of the requested manufacturer product name. # noqa: E501 57 | """ 58 | pass 59 | 60 | def test_products_part_number_with_suggested_products_get(self): 61 | """Test case for products_part_number_with_suggested_products_get 62 | 63 | Retrieve detailed product information and two suggested products # noqa: E501 64 | """ 65 | pass 66 | 67 | 68 | if __name__ == '__main__': 69 | unittest.main() 70 | -------------------------------------------------------------------------------- /tests/v3/productinformation/test_pid_vid.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | """ 4 | PartSearch Api 5 | 6 | Search for products and retrieve details and pricing. # noqa: E501 7 | 8 | OpenAPI spec version: v3 9 | Contact: api.support@digikey.com 10 | Generated by: https://github.com/swagger-api/swagger-codegen.git 11 | """ 12 | 13 | 14 | from __future__ import absolute_import 15 | 16 | import unittest 17 | 18 | import digikey.v3.productinformation 19 | from digikey.v3.productinformation.models.pid_vid import PidVid # noqa: E501 20 | from digikey.v3.productinformation.rest import ApiException 21 | 22 | 23 | class TestPidVid(unittest.TestCase): 24 | """PidVid unit test stubs""" 25 | 26 | def setUp(self): 27 | pass 28 | 29 | def tearDown(self): 30 | pass 31 | 32 | def testPidVid(self): 33 | """Test PidVid""" 34 | # FIXME: construct object with mandatory attributes with example values 35 | # model = digikey.v3.productinformation.models.pid_vid.PidVid() # noqa: E501 36 | pass 37 | 38 | 39 | if __name__ == '__main__': 40 | unittest.main() 41 | -------------------------------------------------------------------------------- /tests/v3/productinformation/test_price_break.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | """ 4 | PartSearch Api 5 | 6 | Search for products and retrieve details and pricing. # noqa: E501 7 | 8 | OpenAPI spec version: v3 9 | Contact: api.support@digikey.com 10 | Generated by: https://github.com/swagger-api/swagger-codegen.git 11 | """ 12 | 13 | 14 | from __future__ import absolute_import 15 | 16 | import unittest 17 | 18 | import digikey.v3.productinformation 19 | from digikey.v3.productinformation.models.price_break import PriceBreak # noqa: E501 20 | from digikey.v3.productinformation.rest import ApiException 21 | 22 | 23 | class TestPriceBreak(unittest.TestCase): 24 | """PriceBreak unit test stubs""" 25 | 26 | def setUp(self): 27 | pass 28 | 29 | def tearDown(self): 30 | pass 31 | 32 | def testPriceBreak(self): 33 | """Test PriceBreak""" 34 | # FIXME: construct object with mandatory attributes with example values 35 | # model = digikey.v3.productinformation.models.price_break.PriceBreak() # noqa: E501 36 | pass 37 | 38 | 39 | if __name__ == '__main__': 40 | unittest.main() 41 | -------------------------------------------------------------------------------- /tests/v3/productinformation/test_product.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | """ 4 | PartSearch Api 5 | 6 | Search for products and retrieve details and pricing. # noqa: E501 7 | 8 | OpenAPI spec version: v3 9 | Contact: api.support@digikey.com 10 | Generated by: https://github.com/swagger-api/swagger-codegen.git 11 | """ 12 | 13 | 14 | from __future__ import absolute_import 15 | 16 | import unittest 17 | 18 | import digikey.v3.productinformation 19 | from digikey.v3.productinformation.models.product import Product # noqa: E501 20 | from digikey.v3.productinformation.rest import ApiException 21 | 22 | 23 | class TestProduct(unittest.TestCase): 24 | """Product unit test stubs""" 25 | 26 | def setUp(self): 27 | pass 28 | 29 | def tearDown(self): 30 | pass 31 | 32 | def testProduct(self): 33 | """Test Product""" 34 | # FIXME: construct object with mandatory attributes with example values 35 | # model = digikey.v3.productinformation.models.product.Product() # noqa: E501 36 | pass 37 | 38 | 39 | if __name__ == '__main__': 40 | unittest.main() 41 | -------------------------------------------------------------------------------- /tests/v3/productinformation/test_product_details.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | """ 4 | PartSearch Api 5 | 6 | Search for products and retrieve details and pricing. # noqa: E501 7 | 8 | OpenAPI spec version: v3 9 | Contact: api.support@digikey.com 10 | Generated by: https://github.com/swagger-api/swagger-codegen.git 11 | """ 12 | 13 | 14 | from __future__ import absolute_import 15 | 16 | import unittest 17 | 18 | import digikey.v3.productinformation 19 | from digikey.v3.productinformation.models.product_details import ProductDetails # noqa: E501 20 | from digikey.v3.productinformation.rest import ApiException 21 | 22 | 23 | class TestProductDetails(unittest.TestCase): 24 | """ProductDetails unit test stubs""" 25 | 26 | def setUp(self): 27 | pass 28 | 29 | def tearDown(self): 30 | pass 31 | 32 | def testProductDetails(self): 33 | """Test ProductDetails""" 34 | # FIXME: construct object with mandatory attributes with example values 35 | # model = digikey.v3.productinformation.models.product_details.ProductDetails() # noqa: E501 36 | pass 37 | 38 | 39 | if __name__ == '__main__': 40 | unittest.main() 41 | -------------------------------------------------------------------------------- /tests/v3/productinformation/test_search_option.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | """ 4 | PartSearch Api 5 | 6 | Search for products and retrieve details and pricing. # noqa: E501 7 | 8 | OpenAPI spec version: v3 9 | Contact: api.support@digikey.com 10 | Generated by: https://github.com/swagger-api/swagger-codegen.git 11 | """ 12 | 13 | 14 | from __future__ import absolute_import 15 | 16 | import unittest 17 | 18 | import digikey.v3.productinformation 19 | from digikey.v3.productinformation.models.search_option import SearchOption # noqa: E501 20 | from digikey.v3.productinformation.rest import ApiException 21 | 22 | 23 | class TestSearchOption(unittest.TestCase): 24 | """SearchOption unit test stubs""" 25 | 26 | def setUp(self): 27 | pass 28 | 29 | def tearDown(self): 30 | pass 31 | 32 | def testSearchOption(self): 33 | """Test SearchOption""" 34 | # FIXME: construct object with mandatory attributes with example values 35 | # model = digikey.v3.productinformation.models.search_option.SearchOption() # noqa: E501 36 | pass 37 | 38 | 39 | if __name__ == '__main__': 40 | unittest.main() 41 | -------------------------------------------------------------------------------- /tests/v3/productinformation/test_sort_direction.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | """ 4 | PartSearch Api 5 | 6 | Search for products and retrieve details and pricing. # noqa: E501 7 | 8 | OpenAPI spec version: v3 9 | Contact: api.support@digikey.com 10 | Generated by: https://github.com/swagger-api/swagger-codegen.git 11 | """ 12 | 13 | 14 | from __future__ import absolute_import 15 | 16 | import unittest 17 | 18 | import digikey.v3.productinformation 19 | from digikey.v3.productinformation.models.sort_direction import SortDirection # noqa: E501 20 | from digikey.v3.productinformation.rest import ApiException 21 | 22 | 23 | class TestSortDirection(unittest.TestCase): 24 | """SortDirection unit test stubs""" 25 | 26 | def setUp(self): 27 | pass 28 | 29 | def tearDown(self): 30 | pass 31 | 32 | def testSortDirection(self): 33 | """Test SortDirection""" 34 | # FIXME: construct object with mandatory attributes with example values 35 | # model = digikey.v3.productinformation.models.sort_direction.SortDirection() # noqa: E501 36 | pass 37 | 38 | 39 | if __name__ == '__main__': 40 | unittest.main() 41 | -------------------------------------------------------------------------------- /tests/v3/productinformation/test_sort_option.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | """ 4 | PartSearch Api 5 | 6 | Search for products and retrieve details and pricing. # noqa: E501 7 | 8 | OpenAPI spec version: v3 9 | Contact: api.support@digikey.com 10 | Generated by: https://github.com/swagger-api/swagger-codegen.git 11 | """ 12 | 13 | 14 | from __future__ import absolute_import 15 | 16 | import unittest 17 | 18 | import digikey.v3.productinformation 19 | from digikey.v3.productinformation.models.sort_option import SortOption # noqa: E501 20 | from digikey.v3.productinformation.rest import ApiException 21 | 22 | 23 | class TestSortOption(unittest.TestCase): 24 | """SortOption unit test stubs""" 25 | 26 | def setUp(self): 27 | pass 28 | 29 | def tearDown(self): 30 | pass 31 | 32 | def testSortOption(self): 33 | """Test SortOption""" 34 | # FIXME: construct object with mandatory attributes with example values 35 | # model = digikey.v3.productinformation.models.sort_option.SortOption() # noqa: E501 36 | pass 37 | 38 | 39 | if __name__ == '__main__': 40 | unittest.main() 41 | -------------------------------------------------------------------------------- /tests/v3/productinformation/test_sort_parameters.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | """ 4 | PartSearch Api 5 | 6 | Search for products and retrieve details and pricing. # noqa: E501 7 | 8 | OpenAPI spec version: v3 9 | Contact: api.support@digikey.com 10 | Generated by: https://github.com/swagger-api/swagger-codegen.git 11 | """ 12 | 13 | 14 | from __future__ import absolute_import 15 | 16 | import unittest 17 | 18 | import digikey.v3.productinformation 19 | from digikey.v3.productinformation.models.sort_parameters import SortParameters # noqa: E501 20 | from digikey.v3.productinformation.rest import ApiException 21 | 22 | 23 | class TestSortParameters(unittest.TestCase): 24 | """SortParameters unit test stubs""" 25 | 26 | def setUp(self): 27 | pass 28 | 29 | def tearDown(self): 30 | pass 31 | 32 | def testSortParameters(self): 33 | """Test SortParameters""" 34 | # FIXME: construct object with mandatory attributes with example values 35 | # model = digikey.v3.productinformation.models.sort_parameters.SortParameters() # noqa: E501 36 | pass 37 | 38 | 39 | if __name__ == '__main__': 40 | unittest.main() 41 | -------------------------------------------------------------------------------- /tests/v3/productinformation/test_value_pair.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | """ 4 | PartSearch Api 5 | 6 | Search for products and retrieve details and pricing. # noqa: E501 7 | 8 | OpenAPI spec version: v3 9 | Contact: api.support@digikey.com 10 | Generated by: https://github.com/swagger-api/swagger-codegen.git 11 | """ 12 | 13 | 14 | from __future__ import absolute_import 15 | 16 | import unittest 17 | 18 | import digikey.v3.productinformation 19 | from digikey.v3.productinformation.models.value_pair import ValuePair # noqa: E501 20 | from digikey.v3.productinformation.rest import ApiException 21 | 22 | 23 | class TestValuePair(unittest.TestCase): 24 | """ValuePair unit test stubs""" 25 | 26 | def setUp(self): 27 | pass 28 | 29 | def tearDown(self): 30 | pass 31 | 32 | def testValuePair(self): 33 | """Test ValuePair""" 34 | # FIXME: construct object with mandatory attributes with example values 35 | # model = digikey.v3.productinformation.models.value_pair.ValuePair() # noqa: E501 36 | pass 37 | 38 | 39 | if __name__ == '__main__': 40 | unittest.main() 41 | --------------------------------------------------------------------------------