🔍 Code Extractor

class ODataV4MetadataLevel

Maturity: 32

A class that defines constants for OData V4 metadata level options used in HTTP Accept headers or $format query parameters.

File:
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/runtime/odata/v4/metadata_level.py
Lines:
1 - 11
Complexity:
simple

Purpose

This class serves as a container for OData V4 metadata level constants that control how much control information (metadata) is included in OData service responses. It provides three standard metadata levels defined by the OData V4 specification: Full (all control information), NoMetadata (minimal control information), and Minimal (computable control information removed). These constants are used when making requests to OData services to specify the desired level of metadata in responses.

Source Code

class ODataV4MetadataLevel:
    Full = "full"
    """Indicates that the service MUST include all control information explicitly in the payload."""

    NoMetadata = "none"
    """Indicates that the service SHOULD omit control information other than odata.nextLink and odata.count"""

    Minimal = "minimal"
    """Indicates that the service SHOULD remove computable control information from the payload wherever possible.
    This is the default value for the odata.metadata parameter and will be assumed if no other value is specified in
    the Accept header or $format query option"""

Parameters

Name Type Default Kind
bases - -

Parameter Details

bases: This parameter is automatically provided by Python's class creation mechanism and represents the base classes from which ODataV4MetadataLevel inherits. In this case, it implicitly inherits from 'object' (the default base class in Python 3).

Return Value

Instantiating this class returns an ODataV4MetadataLevel object. However, this class is designed to be used as a namespace for constants rather than being instantiated. The class attributes (Full, NoMetadata, Minimal) return string values representing OData metadata levels: 'full', 'none', and 'minimal' respectively.

Class Interface

Attributes

Name Type Description Scope
Full str Constant representing the 'full' metadata level. Indicates that the service MUST include all control information explicitly in the payload. class
NoMetadata str Constant representing the 'none' metadata level. Indicates that the service SHOULD omit control information other than odata.nextLink and odata.count. class
Minimal str Constant representing the 'minimal' metadata level. Indicates that the service SHOULD remove computable control information from the payload wherever possible. This is the default value for the odata.metadata parameter. class

Usage Example

# This class is used as a constant container, not instantiated
# Access the metadata level constants directly from the class

# Example 1: Using in an OData request header
metadata_level = ODataV4MetadataLevel.Minimal
headers = {'Accept': f'application/json;odata.metadata={metadata_level}'}

# Example 2: Checking metadata level
if metadata_level == ODataV4MetadataLevel.Full:
    print('Full metadata requested')

# Example 3: Using all available levels
for level in [ODataV4MetadataLevel.Full, ODataV4MetadataLevel.NoMetadata, ODataV4MetadataLevel.Minimal]:
    print(f'Metadata level: {level}')

# Output:
# Metadata level: full
# Metadata level: none
# Metadata level: minimal

Best Practices

  • Do not instantiate this class - use it as a namespace for constants by accessing class attributes directly (e.g., ODataV4MetadataLevel.Minimal)
  • Use these constants when constructing OData V4 API requests to ensure correct metadata level values
  • The Minimal metadata level is the default in OData V4 specification if no metadata parameter is specified
  • Use Full metadata level when you need all control information for debugging or when working with dynamic clients
  • Use NoMetadata level to minimize payload size when you only need data and don't require control information
  • These constants should be used in the Accept header as 'odata.metadata={value}' or in the $format query parameter

Similar Components

AI-powered semantic similarity - components with related functionality:

  • class ODataV3MetadataLevel 89.4% similar

    A class that defines constants for OData v3 metadata level options, controlling the amount of metadata information included in OData response payloads.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/runtime/odata/v3/metadata_level.py
  • class ODataJsonFormat 65.6% similar

    Abstract base class defining the interface for OData JSON format implementations with configurable metadata levels.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/runtime/odata/json_format.py
  • class V4JsonFormat 65.5% similar

    V4JsonFormat is a class that implements OData V4 JSON format specifications, managing metadata levels, IEEE754 compatibility, and streaming options for JSON serialization.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/runtime/odata/v4/json_format.py
  • class ODataMethod 60.3% similar

    A data class representing an OData method with its metadata including name, parameters, beta status, and return type information.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/runtime/odata/method.py
  • class ODataV4Reader 55.8% similar

    ODataV4Reader is a specialized reader class for parsing OData v4 metadata documents, extending the base ODataReader with v4-specific XML namespace configurations.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/runtime/odata/v4/metadata_reader.py
← Back to Browse