mage.api_resources.abstract.util module

class mage.api_resources.abstract.util.class_or_instance_method

Bases: classmethod

Decorate a class method with this to know if it is called as a class method or instance method. Sourced from https://stackoverflow.com/questions/28237955/same-name-for-classmethod-and-instancemethod.

Example

class X:
    @class_or_instancemethod
    def foo(self_or_cls):
        if isinstance(self_or_cls, type):
            return f"bound to the class, {self_or_cls}"
        else:
            return f"bound to the instance, {self_or_cls}"
mage.api_resources.abstract.util.to_camel_case(snake_str)

From https://stackoverflow.com/questions/19053707/converting-snake-case-to-lower-camel-case-lowercamelcase

mage.api_resources.abstract.util.to_snake_case(camel_str)

From https://stackoverflow.com/questions/1175208/elegant-python-function-to-convert-camelcase-to-snake-case Note that this function doesn’t cover all cases in general, but it covers ours.

mage.api_resources.abstract.util.update_subfields(field, key, value, query)

This function goes through a request to the server to select and exclude fields from the request.