/* tslint:disable */
/* eslint-disable */
/**
 * Scraper API
 * The scraping SaaS platform provides a RESTful API for developers to perform web scraping tasks. Users can submit scraping tasks, monitor task status, retrieve scraped data, and manage their account through the API.
 *
 * The version of the OpenAPI document: 1.0.0
 * 
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */

import { mapValues } from '../runtime';
import type { RateLimit } from './RateLimit';
import {
    RateLimitFromJSON,
    RateLimitFromJSONTyped,
    RateLimitToJSON,
} from './RateLimit';

/**
 * 
 * @export
 * @interface Key
 */
export interface Key {
    /**
     * 
     * @type {string}
     * @memberof Key
     */
    apikey?: string;
    /**
     * 
     * @type {RateLimit}
     * @memberof Key
     */
    rateLimit?: RateLimit;
    /**
     * 
     * @type {string}
     * @memberof Key
     */
    createdAt?: string;
}

/**
 * Check if a given object implements the Key interface.
 */
export function instanceOfKey(value: object): value is Key {
    return true;
}

export function KeyFromJSON(json: any): Key {
    return KeyFromJSONTyped(json, false);
}

export function KeyFromJSONTyped(json: any, ignoreDiscriminator: boolean): Key {
    if (json == null) {
        return json;
    }
    return {
        
        'apikey': json['apikey'] == null ? undefined : json['apikey'],
        'rateLimit': json['rate_limit'] == null ? undefined : RateLimitFromJSON(json['rate_limit']),
        'createdAt': json['created_at'] == null ? undefined : json['created_at'],
    };
}

export function KeyToJSON(value?: Key | null): any {
    if (value == null) {
        return value;
    }
    return {
        
        'apikey': value['apikey'],
        'rate_limit': RateLimitToJSON(value['rateLimit']),
        'created_at': value['createdAt'],
    };
}

