### Getting Started with CardScan API Client in Dart Source: https://github.com/cardscan-ai/api-clients/blob/main/clients/cardscan-dart/README.md A basic example demonstrating how to initialize the CardscanClient, get an instance of the CardScanApi, and call the cardPerformance method. It includes error handling for DioException. ```dart import 'package:cardscan_client/cardscan_client.dart'; final api = CardscanClient().getCardScanApi(); final String cardId = 38400000-8cf0-11bd-b23e-10b96e4ef00d; // String | final JsonObject body = Object; // JsonObject | try { final response = await api.cardPerformance(cardId, body); print(response); } catch on DioException (e) { print("Exception when calling CardScanApi->cardPerformance: $e\n"); } ``` -------------------------------- ### TypeScript Quick Start: Check Eligibility Source: https://github.com/cardscan-ai/api-clients/blob/main/README.md Demonstrates a quick start example for the TypeScript Cardscan client, showing how to initialize the API client and perform an eligibility check with subscriber and provider details. Requires an API key and card ID. ```typescript import { CardScanApi } from "@cardscan.ai/cardscan-client"; const cardScanApi = new CardScanApi({ apiKey: "", }); // Example: Eligibility checking const response = await cardScanApi.checkEligibility("", { subscriber: { firstName: "John", lastName: "Doe", dateOfBirth: "18020101", }, provider: { firstName: "John", lastName: "Doe", npi: "0123456789", }, }); ``` -------------------------------- ### Get Eligibility by ID using CardScan API Client Source: https://github.com/cardscan-ai/api-clients/blob/main/clients/cardscan-python/cardscan_client/docs/CardScanApi.md This Python example illustrates how to fetch eligibility information using the CardScan API client, identified by an `eligibility_id`. It shows the setup for bearer authentication and the basic structure for making the API call within a context manager. The code includes placeholders for configuration and handles potential exceptions during the API interaction. It requires the `cardscan_client` library. ```python import cardscan_client from cardscan_client.models.eligibility_api_response import EligibilityApiResponse from cardscan_client.rest import ApiException from pprint import pprint import os # Defining the host is optional and defaults to https://sandbox.cardscan.ai/v1 # See configuration.py for a list of all supported configuration parameters. configuration = cardscan_client.Configuration( host = "https://sandbox.cardscan.ai/v1" ) # The client must configure the authentication and authorization parameters # in accordance with the API server security policy. # Examples for each auth method are provided below, use the example that # satisfies your auth use case. # Configure Bearer authorization: bearerAuth configuration = cardscan_client.Configuration( access_token = os.environ["BEARER_TOKEN"] ) # Enter a context with an instance of the API client with cardscan_client.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = cardscan_client.CardScanApi(api_client) # eligibility_id = 'eligibility_id_example' # str | The ID of the eligibility # try: # Get Eligibility # api_response = api_instance.get_eligibility_by_id(eligibility_id) # print("The response of CardScanApi->get_eligibility_by_id:\n") # pprint(api_response) # except Exception as e: # print("Exception when calling CardScanApi->get_eligibility_by_id: %s\n" % e) ``` -------------------------------- ### Instantiate Address Object in TypeScript Source: https://github.com/cardscan-ai/api-clients/blob/main/clients/cardscan-ts/docs/Address.md Demonstrates how to create an instance of the Address model using TypeScript. This example shows the import statement and the structure of the object literal, assigning values to properties like address1, city, and postal_code. Ensure 'cardscan-ai/typescript' is correctly installed. ```typescript import { Address } from 'cardscan-ai/typescript'; const instance: Address = { address1, address2, city, state, postal_code, }; ``` -------------------------------- ### Get Access Token Example (Dart) Source: https://github.com/cardscan-ai/api-clients/blob/main/clients/cardscan-dart/doc/CardScanApi.md Retrieves an access token for a given user ID. This is an optional parameter. The response includes the access token and its expiration. Ensure the cardscan_client package is imported. ```dart import 'package:cardscan_client/api.dart'; final api = CardscanClient().getCardScanApi(); final String userId = userId_example; // String | The ID of the user try { final response = api.getAccessToken(userId); print(response); } catch on DioException (e) { print('Exception when calling CardScanApi->getAccessToken: $e\n'); } ``` -------------------------------- ### Install Python Cardscan Client Source: https://github.com/cardscan-ai/api-clients/blob/main/README.md Installs the Cardscan.ai Python client library using pip. This client provides comprehensive access to the Cardscan.ai API. ```bash pip install cardscan-client ``` -------------------------------- ### DirectUpload200ResponseMetadata TypeScript Example Source: https://github.com/cardscan-ai/api-clients/blob/main/clients/cardscan-ts/docs/DirectUpload200ResponseMetadata.md An example demonstrating how to instantiate the DirectUpload200ResponseMetadata model in TypeScript. This model includes an optional 'ocr_latency' property for OCR processing time. ```typescript import { DirectUpload200ResponseMetadata } from 'cardscan-ai/typescript'; const instance: DirectUpload200ResponseMetadata = { ocr_latency, }; ``` -------------------------------- ### Get Access Token using CardScan AI API Client Source: https://github.com/cardscan-ai/api-clients/blob/main/clients/cardscan-python/cardscan_client/docs/CardScanApi.md This snippet illustrates how to obtain an access token from the CardScan AI API. It configures the API client, including setting the access token from an environment variable, and demonstrates the initialization process. This function can optionally take a user_id parameter. The example focuses on setting up the client for Bearer Authentication. ```python import cardscan_client import os from cardscan_client.rest import ApiException from pprint import pprint # Defining the host is optional and defaults to https://sandbox.cardscan.ai/v1 configuration = cardscan_client.Configuration( host = "https://sandbox.cardscan.ai/v1" ) # Configure Bearer authorization: bearerAuth configuration.access_token = os.environ.get("BEARER_TOKEN") # The client must configure the authentication and authorization parameters # in accordance with the API server security policy. # Examples for each auth method are provided below, use the example that # satisfies your auth use case. # Enter a context with an instance of the API client with cardscan_client.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = cardscan_client.CardScanApi(api_client) # user_id = "example_user_id" # try: # # Get Access Token # api_response = api_instance.get_access_token(user_id=user_id) # print("The response of CardScanApi->get_access_token:\n") # pprint(api_response) # except ApiException as e: # print("Exception when calling CardScanApi->get_access_token: %s\n" % e) ``` -------------------------------- ### List Eligibility - TypeScript Example Source: https://github.com/cardscan-ai/api-clients/blob/main/clients/cardscan-ts/docs/CardScanApi.md Provides an example of how to list all eligibility entries using the CardScan API client in TypeScript. Similar to listCards, it accepts optional limit and cursor parameters for pagination. The function returns the status and a list of eligibility items. ```typescript import { CardScanApi, Configuration } from 'cardscan-ai/typescript'; const configuration = new Configuration(); const apiInstance = new CardScanApi(configuration); let limit: number; // (optional) (default to undefined) let cursor: string; // (optional) (default to undefined) const { status, data } = await apiInstance.listEligibility( limit, cursor ); ``` -------------------------------- ### Python Full Scan Example Source: https://context7.com/cardscan-ai/api-clients/llms.txt A comprehensive Python example demonstrating a full card scan, including error handling and result processing. It utilizes the CardScan API client to scan a front image, extract details, and perform an eligibility check. Requires API key configuration and handles API exceptions. ```python from cardscan_client.api_client import ApiClient from cardscan_client.api.card_scan_api import CardScanApi from cardscan_client.configuration import Configuration from cardscan_client.exceptions import ApiException import os configuration = Configuration( api_key=os.environ.get('CARDSCAN_API_KEY'), environment='sandbox' # or 'production' ) client = CardScanApi(api_client=ApiClient(configuration=configuration)) try: # Full scan with front image only result = client.full_scan( front_image_path="./front-card.jpg" ) print(f"Scan completed: {result.card_id}") print(f"State: {result.state}") if result.details: print(f"Member ID: {result.details.member_id}") print(f"Group Number: {result.details.group_number}") print(f"Plan Name: {result.details.plan_name}") print(f"Insurance Company: {result.details.insurance_company}") if result.enriched_results: print(f"Phone Numbers: {result.enriched_results.phone_numbers}") print(f"Addresses: {result.enriched_results.addresses}") # Perform eligibility check eligibility = client.create_eligibility( card_id=result.card_id, eligibility={ "provider": { "first_name": "Jane", "last_name": "Smith", "npi": "1234567890" }, "subscriber": { "first_name": "John", "last_name": "Doe", "date_of_birth": "19850615" } } ) print(f"Eligibility check created: {eligibility.eligibility_id}") except ApiException as e: print(f"API Error: {e.status}") print(f"Error details: {e.body}") except Exception as e: print(f"Unexpected error: {str(e)}") ``` -------------------------------- ### Instantiate ScanMetadataCameraCapabilities from JSON Source: https://github.com/cardscan-ai/api-clients/blob/main/clients/cardscan-python/docs/ScanMetadataCameraCapabilities.md Demonstrates how to create an instance of the ScanMetadataCameraCapabilities model from a JSON string. This involves importing the model and using the `from_json` class method. The JSON string is currently a placeholder and needs to be updated with actual data. ```python from cardscan_client.models.scan_metadata_camera_capabilities import ScanMetadataCameraCapabilities # TODO update the JSON string below json_string = "{}" # create an instance of ScanMetadataCameraCapabilities from a JSON string scan_metadata_camera_capabilities_instance = ScanMetadataCameraCapabilities.from_json(json_string) ``` -------------------------------- ### TypeScript ScanMetadata Initialization Source: https://github.com/cardscan-ai/api-clients/blob/main/clients/cardscan-ts/docs/ScanMetadata.md Initializes a ScanMetadata object in TypeScript. This example demonstrates how to instantiate the object with various properties, including capture type, guides, image processing thresholds, and package details. It serves as a foundational example for using the ScanMetadata type within the cardscan-ai library. ```typescript import { ScanMetadata } from 'cardscan-ai/typescript'; const instance: ScanMetadata = { captureType, guides, captureCanvas, videoBackground, windowInner, mlThreshold, laplacianThreshold, package_name, package_version, videoTrack, cameraCapabilities, capture_score, }; ``` -------------------------------- ### Service Model Creation and Manipulation (Python) Source: https://github.com/cardscan-ai/api-clients/blob/main/clients/cardscan-python/cardscan_client/docs/Service.md Demonstrates how to create a Service model instance from a JSON string and a dictionary, and how to convert it back to JSON and a dictionary. This requires the Service model and related models (Deductible, OOP, CoInsurance, CoPayment) to be defined. ```python from cardscan_client.models.service import Service # TODO update the JSON string below json = "{}" # create an instance of Service from a JSON string service_instance = Service.from_json(json) # print the JSON string representation of the object print(Service.to_json()) # convert the object into a dict service_dict = service_instance.to_dict() # create an instance of Service from a dict service_from_dict = Service.from_dict(service_dict) ``` -------------------------------- ### Instantiate CardApiResponseImagesBack from JSON in Python Source: https://github.com/cardscan-ai/api-clients/blob/main/clients/cardscan-python/docs/CardApiResponseImagesBack.md Demonstrates how to create an instance of the CardApiResponseImagesBack model from a JSON string. This involves importing the model and using the `from_json` class method. It also shows how to convert the object to a dictionary using `to_dict` and back using `from_dict`. ```python from cardscan_client.models.card_api_response_images_back import CardApiResponseImagesBack # TODO update the JSON string below json = "{}" # create an instance of CardApiResponseImagesBack from a JSON string card_api_response_images_back_instance = CardApiResponseImagesBack.from_json(json) # print the JSON string representation of the object print CardApiResponseImagesBack.to_json() # convert the object into a dict card_api_response_images_back_dict = card_api_response_images_back_instance.to_dict() # create an instance of CardApiResponseImagesBack from a dict card_api_response_images_back_form_dict = card_api_response_images_back.from_dict(card_api_response_images_back_dict) ``` -------------------------------- ### CardScan API: Generate Upload URL (TypeScript) Source: https://github.com/cardscan-ai/api-clients/blob/main/clients/cardscan-ts/docs/CardScanApi.md Generates a general upload URL for data within the CardScan system. This is a GET request and requires Bearer Token authentication. No specific parameters are shown in the example. ```typescript import { CardScanApi, Configuration } from 'cardscan-ai/typescript'; const configuration = new Configuration(); const apiInstance = new CardScanApi(configuration); const { status, data } = await apiInstance.generateUploadUrl(); ``` -------------------------------- ### EligibilitySummarizedResponse Model Usage (Python) Source: https://github.com/cardscan-ai/api-clients/blob/main/clients/cardscan-python/cardscan_client/docs/EligibilitySummarizedResponse.md Demonstrates how to create an instance of EligibilitySummarizedResponse from a JSON string and a dictionary, and how to convert the instance back to JSON and a dictionary. Requires the cardscan_client library. ```python from cardscan_client.models.eligibility_summarized_response import EligibilitySummarizedResponse # TODO update the JSON string below json_string = "{}" # create an instance of EligibilitySummarizedResponse from a JSON string eligibility_summarized_response_instance = EligibilitySummarizedResponse.from_json(json_string) # print the JSON string representation of the object print(EligibilitySummarizedResponse.to_json()) # convert the object into a dict eligibility_summarized_response_dict = eligibility_summarized_response_instance.to_dict() # create an instance of EligibilitySummarizedResponse from a dict eligibility_summarized_response_from_dict = EligibilitySummarizedResponse.from_dict(eligibility_summarized_response_dict) ``` -------------------------------- ### Get Eligibility by ID Example (Dart) Source: https://github.com/cardscan-ai/api-clients/blob/main/clients/cardscan-dart/doc/CardScanApi.md Retrieves eligibility information based on a provided eligibility ID. This function takes a string eligibility ID as input and returns an EligibilityApiResponse. Ensure the cardscan_client package is imported. ```dart import 'package:cardscan_client/api.dart'; final api = CardscanClient().getCardScanApi(); final String eligibilityId = eligibilityId_example; // String | try { final response = api.getEligibilityById(eligibilityId); print(response); } catch on DioException (e) { print('Exception when calling CardScanApi->getEligibilityById: $e\n'); } ``` -------------------------------- ### Instantiate PlanDetails from JSON - Python Source: https://github.com/cardscan-ai/api-clients/blob/main/clients/cardscan-python/cardscan_client/docs/PlanDetails.md Demonstrates how to create a PlanDetails object by parsing a JSON string. It also shows how to convert the object back to a JSON string and a dictionary, and how to instantiate from a dictionary. Assumes the 'cardscan_client' library is installed. ```python from cardscan_client.models.plan_details import PlanDetails # TODO update the JSON string below json_string = "{}" # create an instance of PlanDetails from a JSON string plan_details_instance = PlanDetails.from_json(json_string) # print the JSON string representation of the object print(PlanDetails.to_json()) # convert the object into a dict plan_details_dict = plan_details_instance.to_dict() # create an instance of PlanDetails from a dict plan_details_from_dict = PlanDetails.from_dict(plan_details_dict) ``` -------------------------------- ### CardScan API: Generate Magic Link (TypeScript) Source: https://github.com/cardscan-ai/api-clients/blob/main/clients/cardscan-ts/docs/CardScanApi.md Generates a magic link for a specific purpose within the CardScan system. This is a GET request and requires authentication via Bearer Token. No specific parameters are detailed in the example. ```typescript import { CardScanApi, Configuration } from 'cardscan-ai/typescript'; const configuration = new Configuration(); const apiInstance = new CardScanApi(configuration); const { status, data } = await apiInstance.generateMagicLink(); ``` -------------------------------- ### Instantiate and Convert Service Object (Python) Source: https://github.com/cardscan-ai/api-clients/blob/main/clients/cardscan-python/docs/Service.md Demonstrates how to create a Service object from a JSON string, convert it to JSON, and convert it to a dictionary using the cardscan_client library. Requires the 'Service' model to be available. ```python from cardscan_client.models.service import Service # TODO update the JSON string below json_string = "{}" # create an instance of Service from a JSON string service_instance = Service.from_json(json_string) # print the JSON string representation of the object print(Service.to_json()) # convert the object into a dict service_dict = service_instance.to_dict() # create an instance of Service from a dict service_from_dict = Service.from_dict(service_dict) ``` -------------------------------- ### Get Card by ID Example (Dart) Source: https://github.com/cardscan-ai/api-clients/blob/main/clients/cardscan-dart/doc/CardScanApi.md Fetches card details using its unique identifier. This function requires a string representing the card ID. The response contains the CardApiResponse object. Ensure the cardscan_client package is imported. ```dart import 'package:cardscan_client/api.dart'; final api = CardscanClient().getCardScanApi(); final String cardId = 38400000-8cf0-11bd-b23e-10b96e4ef00d; // String | The ID of the card try { final response = api.getCardById(cardId); print(response); } catch on DioException (e) { print('Exception when calling CardScanApi->getCardById: $e\n'); } ``` -------------------------------- ### Python: Instantiate ScanMetadataCameraCapabilities from JSON Source: https://github.com/cardscan-ai/api-clients/blob/main/clients/cardscan-python/cardscan_client/docs/ScanMetadataCameraCapabilities.md Demonstrates how to create an instance of ScanMetadataCameraCapabilities from a JSON string using the `from_json` class method. It also shows how to convert the object to a dictionary and back using `to_dict` and `from_dict`. ```python from cardscan_client.models.scan_metadata_camera_capabilities import ScanMetadataCameraCapabilities # TODO update the JSON string below json_string = "{}" # create an instance of ScanMetadataCameraCapabilities from a JSON string scan_metadata_camera_capabilities_instance = ScanMetadataCameraCapabilities.from_json(json_string) # print the JSON string representation of the object print(ScanMetadataCameraCapabilities.to_json()) # convert the object into a dict scan_metadata_camera_capabilities_dict = scan_metadata_camera_capabilities_instance.to_dict() # create an instance of ScanMetadataCameraCapabilities from a dict scan_metadata_camera_capabilities_from_dict = ScanMetadataCameraCapabilities.from_dict(scan_metadata_camera_capabilities_dict) ``` -------------------------------- ### ScanMetadataGuides TypeScript Example Source: https://github.com/cardscan-ai/api-clients/blob/main/clients/cardscan-ts/docs/ScanMetadataGuides.md Demonstrates how to instantiate the ScanMetadataGuides object in TypeScript. This object is used to represent the capture guide's position and size. It requires 'x', 'y', 'width', and 'height' properties, which are optional and default to undefined. ```typescript import { ScanMetadataGuides } from 'cardscan-ai/typescript'; const instance: ScanMetadataGuides = { x, y, width, height, }; ``` -------------------------------- ### Install CardScan API Client Locally Source: https://github.com/cardscan-ai/api-clients/blob/main/clients/cardscan-dart/README.md Instructions for adding the cardscan_client package to your project's pubspec.yaml file when developing locally. This is useful for testing local changes. ```yaml dependencies: cardscan_client: path: /path/to/cardscan_client ``` -------------------------------- ### Get Eligibility by ID - TypeScript Example Source: https://github.com/cardscan-ai/api-clients/blob/main/clients/cardscan-ts/docs/CardScanApi.md Demonstrates how to retrieve eligibility information by its ID using the CardScan API client in TypeScript. It requires a configuration object and an instance of the CardScanApi. The function takes an eligibility ID as input and returns the status and data of the eligibility response. ```typescript import { CardScanApi, Configuration } from 'cardscan-ai/typescript'; const configuration = new Configuration(); const apiInstance = new CardScanApi(configuration); let eligibilityId: string; // (default to undefined) const { status, data } = await apiInstance.getEligibilityById( eligibilityId ); ``` -------------------------------- ### Generate Swift Client Source: https://github.com/cardscan-ai/api-clients/blob/main/README.md Example command to generate a Swift client using the OpenAPI generator. It specifies the 'swift5' generator, the OpenAPI definition, an output directory for the Swift client, a configuration file, and a custom template directory for Swift. ```bash openapi-generator generate -g swift5 -i openapi.yaml -o clients/cardscan-swift -c openapi-generator-configs/swift.config.json -t templates/swift-template ``` -------------------------------- ### Convert EligibilityApiResponseEligibilityRequestSubscriber to JSON String in Python Source: https://github.com/cardscan-ai/api-clients/blob/main/clients/cardscan-python/cardscan_client/docs/EligibilityApiResponseEligibilityRequestSubscriber.md This example demonstrates how to get a JSON string representation of an EligibilityApiResponseEligibilityRequestSubscriber object using the `to_json` class method. This is useful for sending data over a network or storing it. The input is typically an instance of the model, and the output is a JSON string. ```python from cardscan_client.models.eligibility_api_response_eligibility_request_subscriber import EligibilityApiResponseEligibilityRequestSubscriber # Assuming eligibility_api_response_eligibility_request_subscriber_instance is an existing instance # print the JSON string representation of the object print(EligibilityApiResponseEligibilityRequestSubscriber.to_json(eligibility_api_response_eligibility_request_subscriber_instance)) ``` -------------------------------- ### Instantiate ScanMetadataCameraCapabilities from Dictionary Source: https://github.com/cardscan-ai/api-clients/blob/main/clients/cardscan-python/docs/ScanMetadataCameraCapabilities.md Illustrates how to create a ScanMetadataCameraCapabilities object from a Python dictionary. This process uses the `from_dict` class method after obtaining or constructing a dictionary representation of the camera capabilities. ```python from cardscan_client.models.scan_metadata_camera_capabilities import ScanMetadataCameraCapabilities # Assuming scan_metadata_camera_capabilities_dict is an existing dictionary # create an instance of ScanMetadataCameraCapabilities from a dict scan_metadata_camera_capabilities_form_dict = ScanMetadataCameraCapabilities.from_dict(scan_metadata_camera_capabilities_dict) ``` -------------------------------- ### Create Eligibility Record using CardScan API Client Source: https://github.com/cardscan-ai/api-clients/blob/main/clients/cardscan-python/cardscan_client/docs/CardScanApi.md This example shows how to create an eligibility record via the CardScan API. It details the process of authenticating with a bearer token, initializing the API client, and making the `create_eligibility` call. Error handling for potential exceptions during the API call is also included. The `CreateEligibilityRequest` is optional. ```python import cardscan_client from cardscan_client.models.create_eligibility_request import CreateEligibilityRequest from cardscan_client.models.eligibility_api_response import EligibilityApiResponse from cardscan_client.rest import ApiException from pprint import pprint import os # Configuring the API host configuration = cardscan_client.Configuration( host = "https://sandbox.cardscan.ai/v1" ) # Configuring Bearer token authentication configuration = cardscan_client.Configuration( access_token = os.environ["BEARER_TOKEN"] ) # Entering a context with an API client instance with cardscan_client.ApiClient(configuration) as api_client: # Creating an instance of the CardScanApi api_instance = cardscan_client.CardScanApi(api_client) create_eligibility_request = cardscan_client.CreateEligibilityRequest() # CreateEligibilityRequest | (optional) try: # Creating an eligibility record api_response = api_instance.create_eligibility(create_eligibility_request=create_eligibility_request) print("The response of CardScanApi->create_eligibility:\n") pprint(api_response) except Exception as e: print("Exception when calling CardScanApi->create_eligibility: %s\n" % e) ``` -------------------------------- ### Set Scan Metadata using CardScan API Client (Dart) Source: https://github.com/cardscan-ai/api-clients/blob/main/clients/cardscan-dart/doc/CardScanApi.md Provides an example of setting scan metadata via the Cardscan client in Dart. This operation requires a 'scanId' and an optional 'body' (JsonObject). Error handling for DioException is included. Ensure the 'cardscan_client' package is installed. ```dart import 'package:cardscan_client/api.dart'; final api = CardscanClient().getCardScanApi(); final String scanId = 38400000-8cf0-11bd-b23e-10b96e4ef00d; // String | final JsonObject body = Object; // JsonObject | try { api.setScanMetadata(scanId, body); } catch on DioException (e) { print('Exception when calling CardScanApi->setScanMetadata: $e\n'); } ``` -------------------------------- ### Install CardScan API Client via pub.dev Source: https://github.com/cardscan-ai/api-clients/blob/main/clients/cardscan-dart/README.md Instructions for adding the cardscan_client package to your project's pubspec.yaml file when using the pub.dev repository. ```yaml dependencies: cardscan_client: 1.0.0 ``` -------------------------------- ### Generate Magic Link using Python Source: https://github.com/cardscan-ai/api-clients/blob/main/clients/cardscan-python/docs/CardScanApi.md This Python code snippet shows how to generate a magic link for accessing CardScan AI services. It requires Bearer authentication and returns a `GenerateMagicLink200Response` object upon successful generation. The example includes basic client configuration and authentication setup. ```python import time import os import cardscan_client from cardscan_client.models.generate_magic_link200_response import GenerateMagicLink200Response from cardscan_client.rest import ApiException from pprint import pprint # Defining the host is optional and defaults to https://sandbox.cardscan.ai/v1 # See configuration.py for a list of all supported configuration parameters. configuration = cardscan_client.Configuration( host = "https://sandbox.cardscan.ai/v1" ) # The client must configure the authentication and authorization parameters # in accordance with the API server security policy. # Examples for each auth method are provided below, use the example that # satisfies your auth use case. # Configure Bearer authorization: bearerAuth configuration = cardscan_client.Configuration( access_token = os.environ["BEARER_TOKEN"] ) # Note: The actual call to generate_magic_link is missing from the provided text. ``` -------------------------------- ### Instantiate SubscriberDto from JSON/Dict in Python Source: https://github.com/cardscan-ai/api-clients/blob/main/clients/cardscan-python/docs/SubscriberDto.md Demonstrates how to create a SubscriberDto object from a JSON string or a Python dictionary. It also shows how to convert the object back into a JSON string or a dictionary. This is useful for data serialization and deserialization. ```python from cardscan_client.models.subscriber_dto import SubscriberDto # TODO update the JSON string below json_data = "{}" # create an instance of SubscriberDto from a JSON string subscriber_dto_instance = SubscriberDto.from_json(json_data) # print the JSON string representation of the object # Note: The original example had a syntax error (missing instance) # Assuming you want to print the created instance's JSON representation: print(subscriber_dto_instance.to_json()) # convert the object into a dict subscriber_dto_dict = subscriber_dto_instance.to_dict() # create an instance of SubscriberDto from a dict subscriber_dto_form_dict = SubscriberDto.from_dict(subscriber_dto_dict) print("Instance created from JSON:", subscriber_dto_instance) print("Dictionary representation:", subscriber_dto_dict) print("Instance created from dictionary:", subscriber_dto_form_dict) ``` -------------------------------- ### Instantiate PayerMatchMatchesInner from JSON and Dict Source: https://github.com/cardscan-ai/api-clients/blob/main/clients/cardscan-python/cardscan_client/docs/PayerMatchMatchesInner.md Demonstrates how to create an instance of PayerMatchMatchesInner by parsing a JSON string or converting from a dictionary. It also shows how to convert the object back into a dictionary and its JSON string representation. This requires the 'cardscan_client' library. ```python from cardscan_client.models.payer_match_matches_inner import PayerMatchMatchesInner # TODO update the JSON string below json_string = "{}" # create an instance of PayerMatchMatchesInner from a JSON string payer_match_matches_inner_instance = PayerMatchMatchesInner.from_json(json_string) # print the JSON string representation of the object print(PayerMatchMatchesInner.to_json()) # convert the object into a dict payer_match_matches_inner_dict = payer_match_matches_inner_instance.to_dict() # create an instance of PayerMatchMatchesInner from a dict payer_match_matches_inner_from_dict = PayerMatchMatchesInner.from_dict(payer_match_matches_inner_dict) ``` -------------------------------- ### GET /cards/{card_id} Source: https://github.com/cardscan-ai/api-clients/blob/main/clients/cardscan-kotlin/docs/CardScanApi.md Get Card by ID. Retrieves the details of a specific card using its unique identifier. ```APIDOC ## GET /cards/{card_id} ### Description Get Card by ID. ### Method GET ### Endpoint /cards/{card_id} #### Path Parameters - **card_id** (string) - Required - The unique identifier of the card to retrieve. #### Query Parameters None ### Request Example ```json { "example": "request body" } ``` ### Response #### Success Response (200) - **CardDetails** (object) - The detailed information about the requested card. #### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### List Cards Example (Dart) Source: https://github.com/cardscan-ai/api-clients/blob/main/clients/cardscan-dart/doc/CardScanApi.md Lists cards with optional limit and cursor parameters for pagination. It requires an integer limit and an optional string cursor. The response is a SearchCards200Response object. Ensure the cardscan_client package is imported. ```dart import 'package:cardscan_client/api.dart'; final api = CardscanClient().getCardScanApi(); final int limit = 56; // int | final String cursor = cursor_example; // String | try { final response = api.listCards(limit, cursor); print(response); } catch on DioException (e) { print('Exception when calling CardScanApi->listCards: $e\n'); } ``` -------------------------------- ### Swift Client Usage for Card Scanning Source: https://context7.com/cardscan-ai/api-clients/llms.txt An example of using the CardScan client in Swift for iOS/macOS applications. It demonstrates how to initialize the client, scan a card using UIImages for the front and back, and handle the results or errors asynchronously. ```swift import CardScanClient let config = Configuration( apiKey: "your-api-key", environment: .sandbox ) let client = CardScanAPI(configuration: config) // Scan card with UIImage let frontImage = UIImage(named: "front-card.jpg")! let backImage = UIImage(named: "back-card.jpg")! client.fullScan( frontImage: frontImage, backImage: backImage ) { result in switch result { case .success(let card): print("Card ID: (card.cardId)") print("Member ID: (card.details?.memberId ?? "")") print("Plan: (card.details?.planName ?? "")") case .failure(let error): print("Error: (error.localizedDescription)") } } ``` -------------------------------- ### Get Access Token (Swift) Source: https://github.com/cardscan-ai/api-clients/blob/main/clients/cardscan-swift/docs/CardScanAPI.md Retrieves an access token, likely for authentication purposes. This GET request does not require parameters and returns the access token details. ```swift import CardScanClient CardScanAPI.getAccessToken { (response, error) in guard error == nil else { print(error) return } if let accessTokenResponse = response { dump(accessTokenResponse) } } ``` -------------------------------- ### Create ProviderDto Instance from JSON and Dict (Python) Source: https://github.com/cardscan-ai/api-clients/blob/main/clients/cardscan-python/cardscan_client/docs/ProviderDto.md Demonstrates how to create an instance of ProviderDto from a JSON string or a Python dictionary. It also shows how to convert the object back to JSON or a dictionary. This requires the 'cardscan-client' library. ```python from cardscan_client.models.provider_dto import ProviderDto # TODO update the JSON string below json_string = "{}" # create an instance of ProviderDto from a JSON string provider_dto_instance = ProviderDto.from_json(json_string) # print the JSON string representation of the object print(ProviderDto.to_json()) # convert the object into a dict provider_dto_dict = provider_dto_instance.to_dict() # create an instance of ProviderDto from a dict provider_dto_from_dict = ProviderDto.from_dict(provider_dto_dict) ``` -------------------------------- ### Instantiate and Convert ScanMetadataWindowInner in Python Source: https://github.com/cardscan-ai/api-clients/blob/main/clients/cardscan-python/cardscan_client/docs/ScanMetadataWindowInner.md Demonstrates how to create a ScanMetadataWindowInner object from a JSON string and convert it to a dictionary in Python. This involves using the `from_json` and `to_dict` methods provided by the `ScanMetadataWindowInner` class. It also shows how to create an instance from an existing dictionary. ```python from cardscan_client.models.scan_metadata_window_inner import ScanMetadataWindowInner # TODO update the JSON string below json = "{}" # create an instance of ScanMetadataWindowInner from a JSON string scan_metadata_window_inner_instance = ScanMetadataWindowInner.from_json(json) # print the JSON string representation of the object print(ScanMetadataWindowInner.to_json()) # convert the object into a dict scan_metadata_window_inner_dict = scan_metadata_window_inner_instance.to_dict() # create an instance of ScanMetadataWindowInner from a dict scan_metadata_window_inner_from_dict = ScanMetadataWindowInner.from_dict(scan_metadata_window_inner_dict) ``` -------------------------------- ### ProviderDto TypeScript Example Source: https://github.com/cardscan-ai/api-clients/blob/main/clients/cardscan-ts/docs/ProviderDto.md An example demonstrating how to instantiate and use the ProviderDto in TypeScript. This DTO is used to represent provider information, including optional and required fields like names, and the mandatory NPI. ```typescript import { ProviderDto } from 'cardscan-ai/typescript'; const instance: ProviderDto = { first_name, last_name, npi, organization_name, }; ``` -------------------------------- ### Install TypeScript/JavaScript Cardscan Client Source: https://github.com/cardscan-ai/api-clients/blob/main/README.md Installs the Cardscan.ai TypeScript client library using either npm or yarn. This client provides full-featured API access with WebSocket support for real-time card scanning. ```bash npm install @cardscan.ai/cardscan-client ``` ```bash yarn add @cardscan.ai/cardscan-client ``` -------------------------------- ### Install CardScan API Client via GitHub Source: https://github.com/cardscan-ai/api-clients/blob/main/clients/cardscan-dart/README.md Instructions for adding the cardscan_client package to your project's pubspec.yaml file when using a GitHub repository. This allows for direct integration from a Git source. ```yaml dependencies: cardscan_client: git: url: https://github.com/GIT_USER_ID/GIT_REPO_ID.git #ref: main ``` -------------------------------- ### Load cardscan_client Model Package (Dart) Source: https://github.com/cardscan-ai/api-clients/blob/main/clients/cardscan-dart/doc/CreateEligibilityRequest.md Demonstrates how to import the necessary package to use the cardscan_client models, specifically for creating an eligibility request. This is a prerequisite for instantiating or using related model classes. ```dart import 'package:cardscan_client/api.dart'; ``` -------------------------------- ### CardScan API: Get Access Token (TypeScript) Source: https://github.com/cardscan-ai/api-clients/blob/main/clients/cardscan-ts/docs/CardScanApi.md Retrieves an access token for authenticating with the CardScan API. This is a simple GET request and does not require any parameters. Bearer Token authentication is used for the request itself. ```typescript import { CardScanApi, Configuration } from 'cardscan-ai/typescript'; const configuration = new Configuration(); const apiInstance = new CardScanApi(configuration); const { status, data } = await apiInstance.getAccessToken(); ``` -------------------------------- ### CardScan API: Get Eligibility by ID (Python) Source: https://github.com/cardscan-ai/api-clients/blob/main/clients/cardscan-python/docs/CardScanApi.md Retrieves an eligibility record by its unique ID. This GET request to `/eligibility/{eligibility_id}` is used to fetch specific eligibility details. It requires the `eligibility_id` and Bearer authentication. ```python # ... (client and configuration setup as in other examples) ... # api_instance = cardscan_client.CardScanApi(api_client) # eligibility_id = 'eligibility_id_to_retrieve' # try: # api_response = api_instance.get_eligibility_by_id(eligibility_id) # pprint(api_response) # except Exception as e: # print(f"Exception when calling CardScanApi->get_eligibility_by_id: {e}") ``` -------------------------------- ### List Cards - TypeScript Example Source: https://github.com/cardscan-ai/api-clients/blob/main/clients/cardscan-ts/docs/CardScanApi.md Shows how to list available cards using the CardScan API client in TypeScript. This function supports optional limit and cursor parameters for pagination. It requires initializing the CardScanApi with a configuration object. The response includes the HTTP status and card data. ```typescript import { CardScanApi, Configuration } from 'cardscan-ai/typescript'; const configuration = new Configuration(); const apiInstance = new CardScanApi(configuration); let limit: number; // (optional) (default to undefined) let cursor: string; // (optional) (default to undefined) const { status, data } = await apiInstance.listCards( limit, cursor ); ``` -------------------------------- ### CardScan API: Get Access Token (Python) Source: https://github.com/cardscan-ai/api-clients/blob/main/clients/cardscan-python/docs/CardScanApi.md Retrieves an access token for API authentication. This is a GET request to `/access-token`. It's a fundamental step for authenticating subsequent API calls and requires appropriate credentials. ```python # ... (client and configuration setup as in other examples) ... # api_instance = cardscan_client.CardScanApi(api_client) # try: # api_response = api_instance.get_access_token() # pprint(api_response) # except Exception as e: # print("Exception when calling CardScanApi->get_access_token: %s\n" % e) ``` -------------------------------- ### TypeScript Example: CardApiResponseEnrichedResults Instance Creation Source: https://github.com/cardscan-ai/api-clients/blob/main/clients/cardscan-ts/docs/CardApiResponseEnrichedResults.md Demonstrates how to create an instance of CardApiResponseEnrichedResults in TypeScript. This example assumes that variables like 'addresses', 'phone_numbers', 'copays_deductibles', and 'processed_sides' are defined elsewhere and hold appropriate values. ```typescript import { CardApiResponseEnrichedResults } from 'cardscan-ai/typescript'; const instance: CardApiResponseEnrichedResults = { addresses, phone_numbers, copays_deductibles, processed_sides, }; ``` -------------------------------- ### CardScan API: Get Card by ID (Python) Source: https://github.com/cardscan-ai/api-clients/blob/main/clients/cardscan-python/docs/CardScanApi.md Retrieves details of a specific card using its ID. This GET request to `/cards/{card_id}` is essential for fetching card information. It requires the `card_id` and uses Bearer token authentication. ```python # ... (client and configuration setup as in other examples) ... # api_instance = cardscan_client.CardScanApi(api_client) # card_id = 'card_id_to_retrieve' # try: # api_response = api_instance.get_card_by_id(card_id) # pprint(api_response) # except Exception as e: # print(f"Exception when calling CardScanApi->get_card_by_id: {e}") ``` -------------------------------- ### Instantiate and Convert CoverageSummary in Python Source: https://github.com/cardscan-ai/api-clients/blob/main/clients/cardscan-python/docs/CoverageSummary.md Demonstrates how to create a CoverageSummary object from a JSON string and convert it to a dictionary using the cardscan-client library. It also shows how to create an object from a dictionary. Ensure the JSON string is valid and the library is installed. ```python from cardscan_client.models.coverage_summary import CoverageSummary # TODO update the JSON string below json_string = "{}" # create an instance of CoverageSummary from a JSON string coverage_summary_instance = CoverageSummary.from_json(json_string) # print the JSON string representation of the object print(CoverageSummary.to_json()) # convert the object into a dict coverage_summary_dict = coverage_summary_instance.to_dict() # create an instance of CoverageSummary from a dict coverage_summary_form_dict = CoverageSummary.from_dict(coverage_summary_dict) ``` -------------------------------- ### Get Access Token - Bash Source: https://context7.com/cardscan-ai/api-clients/llms.txt Generates temporary access tokens required for client-side operations. This Bash command makes a GET request to the access token endpoint, authenticating with an API key and returning a token, identity ID, and session ID. ```bash curl -X GET "https://sandbox.cardscan.ai/v1/access-token?user_id=user_12345" \ -H "Authorization: Bearer your-api-key" # Response: # { # "Token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...", # "IdentityId": "us-east-1:12345678-1234-1234-1234-123456789012", # "session_id": "session_abc123" # } ``` -------------------------------- ### Create GenerateCardUploadUrlRequest from JSON (Python) Source: https://github.com/cardscan-ai/api-clients/blob/main/clients/cardscan-python/cardscan_client/docs/GenerateCardUploadUrlRequest.md Demonstrates how to create an instance of the GenerateCardUploadUrlRequest model from a JSON string using the `from_json` method. It also shows how to convert the instance back to a dictionary and then create a new instance from that dictionary. Assumes `cardscan_client` library is installed. ```python from cardscan_client.models.generate_card_upload_url_request import GenerateCardUploadUrlRequest # TODO update the JSON string below json = "{}" # create an instance of GenerateCardUploadUrlRequest from a JSON string generate_card_upload_url_request_instance = GenerateCardUploadUrlRequest.from_json(json) # print the JSON string representation of the object print(GenerateCardUploadUrlRequest.to_json()) # convert the object into a dict generate_card_upload_url_request_dict = generate_card_upload_url_request_instance.to_dict() # create an instance of GenerateCardUploadUrlRequest from a dict generate_card_upload_url_request_from_dict = GenerateCardUploadUrlRequest.from_dict(generate_card_upload_url_request_dict) ``` -------------------------------- ### GET /eligibility Source: https://github.com/cardscan-ai/api-clients/blob/main/clients/cardscan-kotlin/docs/CardScanApi.md Lists eligibility entries, with options for pagination. ```APIDOC ## GET /eligibility ### Description Lists eligibility entries, with options for pagination using limit and cursor. ### Method GET ### Endpoint /eligibility #### Path Parameters None #### Query Parameters - **limit** (integer) - Optional - The maximum number of eligibility entries to return. - **cursor** (string) - Optional - A cursor for fetching the next page of results. #### Request Body None ### Request Example ```kotlin // Import classes: //import org.openapitools.client.infrastructure.* //import org.openapitools.client.models.* val apiInstance = CardScanApi() val limit : kotlin.Int = 56 // kotlin.Int | val cursor : kotlin.String = "cursor_example" // kotlin.String | try { val result : ListEligibility200Response = apiInstance.listEligibility(limit, cursor) println(result) } catch (e: ClientException) { println("4xx response calling CardScanApi#listEligibility") e.printStackTrace() } catch (e: ServerException) { println("5xx response calling CardScanApi#listEligibility") e.printStackTrace() } ``` ### Response #### Success Response (200) - **ListEligibility200Response** (object) - Contains a list of eligibility entries and pagination information. #### Response Example ```json { "example": "ListEligibility200Response object" } ``` ### Authorization Configure bearerAuth: ApiClient.accessToken = "YOUR_API_KEY" ``` -------------------------------- ### Instantiate ListEligibility200Response from JSON and Dict (Python) Source: https://github.com/cardscan-ai/api-clients/blob/main/clients/cardscan-python/docs/ListEligibility200Response.md Demonstrates how to create an instance of ListEligibility200Response from a JSON string or a Python dictionary. It also shows how to convert the object back to its JSON or dictionary representation. Requires the 'cardscan_client' library. ```python from cardscan_client.models.list_eligibility200_response import ListEligibility200Response # TODO update the JSON string below json_string = "{}" # create an instance of ListEligibility200Response from a JSON string list_eligibility200_response_instance = ListEligibility200Response.from_json(json_string) # print the JSON string representation of the object print(ListEligibility200Response.to_json()) # convert the object into a dict list_eligibility200_response_dict = list_eligibility200_response_instance.to_dict() # create an instance of ListEligibility200Response from a dict list_eligibility200_response_form_dict = ListEligibility200Response.from_dict(list_eligibility200_response_dict) ``` -------------------------------- ### GET /cards Source: https://github.com/cardscan-ai/api-clients/blob/main/clients/cardscan-kotlin/docs/CardScanApi.md Lists available cards, with options for pagination. ```APIDOC ## GET /cards ### Description Lists available cards, with options for pagination using limit and cursor. ### Method GET ### Endpoint /cards #### Path Parameters None #### Query Parameters - **limit** (integer) - Optional - The maximum number of cards to return. - **cursor** (string) - Optional - A cursor for fetching the next page of results. #### Request Body None ### Request Example ```kotlin // Import classes: //import org.openapitools.client.infrastructure.* //import org.openapitools.client.models.* val apiInstance = CardScanApi() val limit : kotlin.Int = 56 // kotlin.Int | val cursor : kotlin.String = "cursor_example" // kotlin.String | try { val result : SearchCards200Response = apiInstance.listCards(limit, cursor) println(result) } catch (e: ClientException) { println("4xx response calling CardScanApi#listCards") e.printStackTrace() } catch (e: ServerException) { println("5xx response calling CardScanApi#listCards") e.printStackTrace() } ``` ### Response #### Success Response (200) - **SearchCards200Response** (object) - Contains a list of cards and pagination information. #### Response Example ```json { "example": "SearchCards200Response object" } ``` ### Authorization Configure bearerAuth: ApiClient.accessToken = "YOUR_API_KEY" ``` -------------------------------- ### GET /validate-magic-link Source: https://github.com/cardscan-ai/api-clients/blob/main/clients/cardscan-dart/README.md Validates a magic link. ```APIDOC ## GET /validate-magic-link ### Description Validate Magic Link. ### Method GET ### Endpoint /validate-magic-link ### Parameters #### Query Parameters - **token** (string) - Required - The magic link token to validate. ### Response #### Success Response (200) - **example** (any) - Description of the success response. #### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### Instantiate ScanMetadataCameraCapabilities Source: https://github.com/cardscan-ai/api-clients/blob/main/clients/cardscan-ts/docs/ScanMetadataCameraCapabilities.md Demonstrates how to create an instance of ScanMetadataCameraCapabilities in TypeScript. This object holds various camera properties relevant to the scanning process. Ensure that the imported types and variables are correctly defined in your scope. ```typescript import { ScanMetadataCameraCapabilities } from 'cardscan-ai/typescript'; const instance: ScanMetadataCameraCapabilities = { aspectRatio, deviceId, facingMode, frameRate, groupId, height, resizeMode, width, }; ``` -------------------------------- ### Instantiate SearchCards200Response (TypeScript) Source: https://github.com/cardscan-ai/api-clients/blob/main/clients/cardscan-ts/docs/SearchCards200Response.md Demonstrates how to create an instance of the SearchCards200Response model in TypeScript. This requires importing the model and providing values for the 'cards' and 'response_metadata' properties. The 'cards' property is an array of CardApiResponse objects, and 'response_metadata' is a ResponseMetadata object. ```typescript import { SearchCards200Response } from 'cardscan-ai/typescript'; const instance: SearchCards200Response = { cards, response_metadata, }; ``` -------------------------------- ### GET /eligibility Source: https://github.com/cardscan-ai/api-clients/blob/main/clients/cardscan-dart/README.md Lists all eligibility records. ```APIDOC ## GET /eligibility ### Description List Eligibility. ### Method GET ### Endpoint /eligibility ### Parameters #### Query Parameters - **limit** (integer) - Optional - Maximum number of records to return. - **offset** (integer) - Optional - Number of records to skip. ### Response #### Success Response (200) - **example** (any) - Description of the success response. #### Response Example ```json { "example": "response body" } ``` ```