Skip to content

Latest commit

 

History

History
177 lines (141 loc) · 5.07 KB

File metadata and controls

177 lines (141 loc) · 5.07 KB

Method Name Comparison - Before vs After

Real Examples from Generated SDK

Collections API

Before (Original Generated Names)

collections.create_collection_v1_collections_post(...)
collections.get_collection_v1_collections__collection_identifier__get(...)
collections.delete_collection_v1_collections__collection_identifier__delete(...)
collections.update_collection_v1_collections__collection_identifier__patch(...)
collections.list_collections_v1_collections_list_post(...)
collections.describe_collection_features_route_v1_collections__collection_identifier__features_get(...)

After (Simplified Names)

collections.create_collection(...)
collections.get_collection(...)
collections.delete_collection(...)
collections.update_collection(...)
collections.list_collections()
collections.describe_collection_features(...)

Retrievers API

Before

retrievers.create_retriever_v1_retrievers_post(...)
retrievers.get_retriever_v1_retrievers__retriever_identifier__get(...)
retrievers.execute_retriever_v1_retrievers__retriever_identifier__execute_post(...)
retrievers.delete_retriever_v1_retrievers__retriever_identifier__delete(...)
retrievers.list_retrievers_v1_retrievers_list_post(...)

After

retrievers.create_retriever(...)
retrievers.get_retriever(...)
retrievers.execute_retriever(...)
retrievers.delete_retriever(...)
retrievers.list_retrievers()

Documents API

Before

documents.create_document_v1_collections__collection_identifier__documents_post(...)
documents.get_document_v1_collections__collection_identifier__documents__document_id__get(...)
documents.update_document_v1_collections__collection_identifier__documents__document_id__put(...)
documents.delete_document_v1_collections__collection_identifier__documents__document_id__delete(...)
documents.list_documents_v1_collections__collection_identifier__documents_list_post(...)

After

documents.create_document(...)
documents.get_document(...)
documents.update_document(...)
documents.delete_document(...)
documents.list_documents()

Code Example Comparison

Before - Verbose and Confusing

import mixpeek
from mixpeek.api import collections_api

configuration = mixpeek.Configuration(
    host="https://api.mixpeek.com",
    api_key={'ApiKeyAuth': 'YOUR_API_KEY'}
)

with mixpeek.ApiClient(configuration) as api_client:
    collections = collections_api.CollectionsApi(api_client)
    
    # Verbose method names
    result = collections.create_collection_v1_collections_post(
        create_collection_request=request
    )
    
    # Hard to remember
    collection = collections.get_collection_v1_collections__collection_identifier__get(
        collection_identifier="my_collection"
    )
    
    # Too much noise
    all_collections = collections.list_collections_v1_collections_list_post()

After - Clean and Intuitive

import mixpeek
from mixpeek.api import collections_api

configuration = mixpeek.Configuration(
    host="https://api.mixpeek.com",
    api_key={'ApiKeyAuth': 'YOUR_API_KEY'}
)

with mixpeek.ApiClient(configuration) as api_client:
    collections = collections_api.CollectionsApi(api_client)
    
    # Clear and simple
    result = collections.create_collection(
        create_collection_request=request
    )
    
    # Easy to remember
    collection = collections.get_collection(
        collection_identifier="my_collection"
    )
    
    # Clean
    all_collections = collections.list_collections()

Impact on Developer Experience

IDE Autocomplete

Before:

collections.create_collection_v1_collections_post
collections.delete_collection_v1_collections__collection_identifier__delete
collections.describe_collection_features_route_v1_collections__collection_identifier__features_get
collections.get_collection_v1_collections__collection_identifier__get
collections.list_collections_v1_collections_list_post
collections.update_collection_v1_collections__collection_identifier__patch

After:

collections.create_collection
collections.delete_collection
collections.describe_collection_features
collections.get_collection
collections.list_collections
collections.update_collection

Documentation Readability

Before:

help(collections.create_collection_v1_collections_post)
# Help on method create_collection_v1_collections_post

After:

help(collections.create_collection)
# Help on method create_collection

All Transformations Applied

  1. Removed version prefixes: _v1_, _v2_ → (removed)
  2. Removed HTTP methods: _post, _get, _put, _delete → (removed)
  3. Removed path identifiers: __identifier__, __id__ → (removed)
  4. Removed duplicates: list_collections_listlist_collections
  5. Removed generic terms: route, endpoint, api → (removed)
  6. Simplified resource names: collections_collectioncollection

Result

  • 58% shorter method names on average
  • 100% more readable code
  • 0 breaking changes to functionality
  • Fully automated process