def create_mapping(record, keys):
        """Create a field mapping for use in API updates and creates.

        Args:
            record (BaseModel): Record that should be mapped.
            keys (list[str]): Fields that should be mapped as keys.

        Returns:
            dict: Dictionary with keys:

                * ``field_mappings``: Field mappings as required by API.
                * ``data``: Ordered data dictionary for input record.
        """

        ordered = OrderedDict()
        field_mappings = []

        for key, value in record.items():
            ordered[key] = value
            field_mappings.append({
                'columnNumber': len(ordered),  # Five9 is not zero indexed.
                'fieldName': key,
                'key': key in keys,
            })

        return {
            'field_mappings': field_mappings,
            'data': ordered,
            'fields': list(ordered.values()),
        }
def create_mapping ( record , keys ) : ordered = OrderedDict ( ) field_mappings = [ ] for key , value in record . items ( ) : ordered [ key ] = value field_mappings . append ( { 'columnNumber' : len ( ordered ) , 'fieldName' : key , 'key' : key in keys , } ) return { 'field_mappings' : field_mappings , 'data' : ordered , 'fields' : list ( ordered . values ( ) ) , }
Create a field mapping for use in API updates and creates.

        Args:
            record (BaseModel): Record that should be mapped.
            keys (list[str]): Fields that should be mapped as keys.

        Returns:
            dict: Dictionary with keys:

                * ``field_mappings``: Field mappings as required by API.
                * ``data``: Ordered data dictionary for input record.