Skip to content

Why is this so complex to use compared to the JavaScript SDK?Β #1169

@danielniccoli

Description

@danielniccoli

Take the following example:

const options = { authProvider };
const client = Client.init(options);

let users = await client.api('/users')
	.header('ConsistencyLevel','eventual')
	.filter("endswith(mail,'[email protected]')")
	.orderby('userPrincipalName')
	.get();

In Python this becomes:

from msgraph import GraphServiceClient
from msgraph.generated.users.users_request_builder import UsersRequestBuilder
from kiota_abstractions.base_request_configuration import RequestConfiguration
from=snippets&tabs=python
query_params = UsersRequestBuilder.UsersRequestBuilderGetQueryParameters(
		filter = "endswith(mail,'[email protected]')",
		orderby = ["userPrincipalName"],
		count = True,
)

request_configuration = RequestConfiguration(
query_parameters = query_params,
)
request_configuration.headers.add("ConsistencyLevel", "eventual")

result = await graph_client.users.get(request_configuration = request_configuration)

This objectively is much more complex and verbose that it needs to be. Why is the Python SDK that way and not written in a similar way to the above, or e.g., the Django ORM?

users = await graph_client.Users \
    .filter("endswith(mail,'[email protected]')") \
    .orderby("userPrincipalName") \
    .header('ConsistencyLevel','eventual')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions