RequestContext

RequestContext

RequestContext

The RequestContext holds information relevant to the current request, which may be required at various points of the stack.

Signature

class RequestContext {
  static fromObject(ctxObject: any) => RequestContext;
  apiType: ApiType
  channel: Channel
  channelId: ID
  languageCode: LanguageCode
  session: Session | undefined
  activeUserId: ID | undefined
  activeUser: User | undefined
  isAuthorized: boolean
  authorizedAsOwnerOnly: boolean
  translate(key: string, variables?: { [k: string]: any }) => string;
}

Members

fromObject

static method
type:
(ctxObject: any) => RequestContext
Creates a new RequestContext object from a plain object which is the result of a JSON serialization - deserialization operation.

apiType

property
type:
ApiType

channel

property
type:
Channel

channelId

property
type:
ID

languageCode

property
type:
LanguageCode

session

property
type:
Session | undefined

activeUserId

property
type:
ID | undefined

activeUser

property
type:
User | undefined

isAuthorized

property
type:
boolean
True if the current session is authorized to access the current resolver method.

authorizedAsOwnerOnly

property
type:
boolean
True if the current anonymous session is only authorized to operate on entities that are owned by the current session.

translate

method
type:
(key: string, variables?: { [k: string]: any }) => string
Translate the given i18n key