# ct-types

CommerceTools Typescript Types

## Index

### Modules

- Carts
- Categories
- Content
- Customers
- Orders
- Products
- Shipping
- Users

### Enumerations

- methods

### Interfaces

- Address
- AnonymousSignInResult
- Attribute
- Cart
- CartBase
- CartDiscountCode
- Category
- CategoryMap
- CategoryOrderHints
- Custom
- Customer
- CustomerSignInResult
- CustomerSignupDraft
- Dimensions
- Discount
- DiscountCode
- DiscountCodeReference
- DiscountReference
- DiscountValue
- DiscountedPrice
- DiscountedPricePerQuantity
- EncryptedTokenData
- IAddLineItem
- ICartAction
- IChangeLineItemQuantity
- IRemoveLineItem
- Image
- IncludedDiscount
- LineItem
- LineItemState
- LocalizedString
- Money
- OAuthToken
- Order
- OrderUpdateAction
- PaginatedCategoryResult
- PaginatedOrderResult
- PaginatedProductResult
- PaginatedResult
- Payment
- PaymentInfo
- PaymentMethodInfo
- PaymentReference
- PaymentStatus
- Price
- Product
- Reference
- SearchKeywords
- ShippingInfo
- ShippingMethod
- ShippingRate
- State
- StateReference
- Target
- TaxPortion
- TaxRate
- TaxedPrice
- TokenizedSignInResult
- Transaction
- UpdateAction
- Variant
- ZoneRate

### Type aliases

- ClientCredentials
- ClientRequest
- IntrospectionResponse
- SdkConfig
- Task
- TaskQueue

### Variables

- Commerce
- ENCRYPTION_KEY
- IV_LENGTH
- TEXT_SEPARATOR
- ___client
- ___services
- createAuthMiddlewareForClientCredentialsFlow
- createClient
- createHttpMiddleware
- createLoggerMiddleware
- createQueueMiddleware
- createRequestBuilder
- createUserAgentMiddleware
- customerCache
- features
- packageInfo
- userScopes

### Functions

- authenticatedFormRequest
- calculateExpirationTime
- clientExecute
- clientProcess
- createAuthMiddlewareForIntrospectionFlow
- createClientRequest
- decrypt
- encrypt
- encryptTokenResponse
- findCustomerById
- getAnonymousIdFromToken
- getClient
- getConfig
- getCustomerBillingAddress
- getCustomerCurrency
- getCustomerShippingAddress
- getServices
- getTokenData
- mergeAuthHeader
- nestify

## Type aliases

### ClientCredentials

ClientCredentials: object

- Defined in node_modules/@cxcloud/ct-types/sdk.ts:19

#### Type declaration

- ##### clientId: string

- ##### clientSecret: string

### ClientRequest

ClientRequest: object

- Defined in node_modules/@cxcloud/ct-types/sdk.ts:9

#### Type declaration

- ##### Optional body?: string | Object

- ##### Optional headers?: undefined | object

- ##### method: string

- ##### Optional token?: undefined | string

- ##### uri: string

### IntrospectionResponse

IntrospectionResponse: object

- Defined in src/commerce/sdk/introspection-middleware.ts:5

#### Type declaration

- ##### expiresIn: number

- ##### tokenScopes: string

### SdkConfig

SdkConfig: object

- Defined in node_modules/@cxcloud/ct-types/sdk.ts:24

#### Type declaration

- ##### admin: ClientCredentials

- ##### apiHost: string

- ##### authHost: string

- ##### projectKey: string

- ##### user: ClientCredentials

### Task

Task: object

- Defined in src/commerce/sdk/introspection-middleware.ts:10

#### Type declaration

- ##### isFetching: boolean

- ##### tasks: any[]

### TaskQueue

TaskQueue: object

- Defined in src/commerce/sdk/introspection-middleware.ts:15

#### Type declaration

- ##### [id: string]: Task

## Variables

### Commerce

Commerce: "/Users/sallar/Projects/cxcloud/cxcloud-facade/src/commerce/index" = commerceServices

- Defined in src/index.ts:4

### ENCRYPTION_KEY

ENCRYPTION_KEY: "wY[Ax)FC0AlQjruD$9J_tO3U+YiMZyL1" = "wY[Ax)FC0AlQjruD$9J_tO3U+YiMZyL1"

- Defined in src/tools/crypto.ts:4

### IV_LENGTH

IV_LENGTH: 16 = 16

- Defined in src/tools/crypto.ts:5

### TEXT_SEPARATOR

TEXT_SEPARATOR: ":" = ":"

- Defined in src/tools/crypto.ts:6

### ___client

___client: ContentfulClientApi

- Defined in src/commerce/sdk/index.ts:17
- Defined in src/content/sdk/index.ts:8

### ___services

___services: any

- Defined in src/commerce/sdk/index.ts:18

### createAuthMiddlewareForClientCredentialsFlow

createAuthMiddlewareForClientCredentialsFlow: any

- Defined in src/commerce/sdk/index.ts:7

### createClient

createClient: any

- Defined in src/commerce/sdk/index.ts:6

### createHttpMiddleware

createHttpMiddleware: any

- Defined in src/commerce/sdk/index.ts:8

### createLoggerMiddleware

createLoggerMiddleware: any

- Defined in src/commerce/sdk/index.ts:12

### createQueueMiddleware

createQueueMiddleware: any

- Defined in src/commerce/sdk/index.ts:9

### createRequestBuilder

createRequestBuilder: any

- Defined in src/commerce/sdk/index.ts:11

### createUserAgentMiddleware

createUserAgentMiddleware: any

- Defined in src/commerce/sdk/index.ts:10

### customerCache

customerCache: NodeCache = new Cache({stdTTL: 60 * 15 // 15 mins})

- Defined in src/commerce/services/customers.ts:26

### features

features: any

- Defined in src/commerce/sdk/index.ts:11

### packageInfo

packageInfo: any = require('../../../package.json')

- Defined in src/commerce/sdk/index.ts:16

### userScopes

userScopes: string[] = ['manage_my_orders','manage_my_profile','manage_my_shopping_lists','view_products','manage_my_profile','manage_my_payments']

- Defined in src/commerce/services/customers.ts:30

## Functions

### authenticatedFormRequest

- authenticatedFormRequest<T>(requestOptions: any, user?: boolean): Promise<T>

- - Defined in src/commerce/sdk/index.ts:114

  #### Type parameters

  - #### T

  #### Parameters

  - ##### requestOptions: any

  - ##### Default value user: boolean = false

  #### Returns Promise<T>

### calculateExpirationTime

- calculateExpirationTime(expiresIn: number): number

- - Defined in src/commerce/sdk/introspection-middleware.ts:27

  #### Parameters

  - ##### expiresIn: number

  #### Returns number

### clientExecute

- clientExecute<T>(request: ClientRequest): Promise<T>

- - Defined in src/commerce/sdk/index.ts:97

  #### Type parameters

  - #### T

  #### Parameters

  - ##### request: ClientRequest

  #### Returns Promise<T>

### clientProcess

- clientProcess<T>(request: ClientRequest): Promise<T>

- - Defined in src/commerce/sdk/index.ts:103

  #### Type parameters

  - #### T

  #### Parameters

  - ##### request: ClientRequest

  #### Returns Promise<T>

### createAuthMiddlewareForIntrospectionFlow

- createAuthMiddlewareForIntrospectionFlow(options: SdkConfig): (Anonymous function)

- - Defined in src/commerce/sdk/introspection-middleware.ts:30

  #### Parameters

  - ##### options: SdkConfig

  #### Returns (Anonymous function)

### createClientRequest

- createClientRequest(request: ClientRequest): ClientRequest

- - Defined in src/commerce/sdk/index.ts:80

  #### Parameters

  - ##### request: ClientRequest

  #### Returns ClientRequest

### decrypt

- decrypt(text: string): string

- - Defined in src/tools/crypto.ts:22

  #### Parameters

  - ##### text: string

  #### Returns string

### encrypt

- encrypt(text: string): string

- - Defined in src/tools/crypto.ts:8

  #### Parameters

  - ##### text: string

  #### Returns string

### encryptTokenResponse

- encryptTokenResponse(token: OAuthToken, customerId: string, isAnonymous?: boolean): OAuthToken

- - Defined in src/tools/crypto.ts:58

  #### Parameters

  - ##### token: OAuthToken

  - ##### customerId: string

  - ##### Default value isAnonymous: boolean = false

  #### Returns OAuthToken

### findCustomerById

- findCustomerById(customerId: string): Promise<Customer>

- - Defined in src/commerce/services/customers.ts:39

  #### Parameters

  - ##### customerId: string

  #### Returns Promise<Customer>

### getAnonymousIdFromToken

- getAnonymousIdFromToken(token?: undefined | string): string | null

- - Defined in src/tools/crypto.ts:72

  #### Parameters

  - ##### Optional token: undefined | string

  #### Returns string | null

### getClient

- getClient(): any

- - Defined in src/commerce/sdk/index.ts:27

  #### Returns any

### getConfig

- getConfig(): object

- - Defined in src/commerce/sdk/index.ts:20

  #### Returns object

  - ##### admin: ClientCredentials

  - ##### apiHost: string

  - ##### authHost: string

  - ##### projectKey: string

  - ##### user: ClientCredentials

### getCustomerBillingAddress

- getCustomerBillingAddress(customer: Customer): Address | undefined

- - Defined in src/tools/customers.ts:7

  #### Parameters

  - ##### customer: Customer

  #### Returns Address | undefined

### getCustomerCurrency

- getCustomerCurrency(customer: Customer): string

- - Defined in src/tools/customers.ts:37

  #### Parameters

  - ##### customer: Customer

  #### Returns string

### getCustomerShippingAddress

- getCustomerShippingAddress(customer: Customer): Address | undefined

- - Defined in src/tools/customers.ts:22

  #### Parameters

  - ##### customer: Customer

  #### Returns Address | undefined

### getServices

- getServices(): any

- - Defined in src/commerce/sdk/index.ts:57

  #### Returns any

### getTokenData

- getTokenData(encryptedToken: string): EncryptedTokenData

- - Defined in src/tools/crypto.ts:38

  #### Parameters

  - ##### encryptedToken: string

  #### Returns EncryptedTokenData

### mergeAuthHeader

- mergeAuthHeader(token: string, req: any): any

- - Defined in src/commerce/sdk/introspection-middleware.ts:19

  #### Parameters

  - ##### token: string

  - ##### req: any

  #### Returns any

### nestify

- nestify(categories: Category[]): Category[]

- - Defined in src/commerce/services/categories.ts:8

  #### Parameters

  - ##### categories: Category[]

  #### Returns Category[]

Generated using TypeDoc