OData Client

Hierarchy

  • OData

Constructors

  • Private

    OData

    Parameters

    • serviceEndpoint: string
    • Optional credential: Credential
    • headers: any = {}
    • Optional fetchProxy: FetchProxy
    • processCsrfToken: boolean = false

      auto fetch csrf token before broken operation

    Returns OData

    Deprecated

    please use static method OData.New to create instance

Properties

commonHeader: {
    [headerName: string]: string;
} = DEFULAT_HEADERS

dont direct use this object

use client.getHeaders()

Type declaration

  • [headerName: string]: string
credential: Credential

http basic credential

csrfToken: string = ""

internal csrf token

csrfTokenName: string = S_X_CSRF_TOKEN
fetchProxy: FetchProxy = defaultProxy
lock: Mutex = ...
oauthClient: ClientCredentialsOAuthClient

oauth client for client credential flow

processCsrfToken: boolean = false
serviceEndpoint: string

odata service path, like /sap/c4c/odata/v1/c4codata/

variant: ODataVariant = "default"
version: ODataVersion = "v2"

Methods

  • odata request

    Type Parameters

    • T = any

    Parameters

    • collection: string

      CollectionName

    • Optional id: any

      entity uuid or compound key

    • Optional systemOptions: SystemQueryOptions<any>

      query param, not work for single entity uri

    • method: HTTPMethod = "GET"

      request method

    • Optional entity: any

      odata Entity instance

    Returns Promise<PlainODataMultiResponse<T>>

  • Experimental

    execute batch requests in OData V4.01 Json format, and get response

    this feature is experimental, use it on your own risk.

    Type Parameters

    Parameters

    • requests: T

    Returns BatchResponses<T>

  • format batch request parameter

    Parameters

    Returns Promise<{
        req: RequestInit;
        url: string;
    }>

  • convert the odata key predicate object/value to string

    Parameters

    Returns string

    Example

    this.formatIdString(1) // => String('(1)')
    this.formatIdString({UUID:'xxx'}) // => String('(UUID='xxx')')
  • fetch CSRF Token

    Parameters

    • withCache: boolean = true

      set to false if you want to force to retrieve the refresh csrf token

    Returns Promise<string>

  • getEntitySet

    Type Parameters

    • T = any

    Parameters

    • entitySetName: string

      the name of entity set, you can get it from metadata

    Returns EntitySet<T>

  • generate dynamic header

    Returns Promise<{}>

  • Returns Transformation

  • Set OData Client Http Basic credential

    Parameters

    Returns void

  • create odata client instance for odata v4

    Parameters

    Returns ODataV4

  • new transformation

    Returns Transformation

Generated using TypeDoc