GitHub

RDK

Lookup Keys

You can use lookup keys to assign multiple references to instances. Most common use of a lookup key is to assign email and msisdn to a user's profile. Thus, you can reach the instance by calling it with email or msisdn.

  • You cannot get more than 100 keys in parallel.
  • You cannot set more than 25 keys in parallel.
  • You cannot delete more than 25 keys in parallel.
interface LookUpKey {
    key: {
        name: string
        value: string
    }
}


interface GetLookUpKey extends LookUpKey {
    classId?: string
}


interface OperationResponse {
    success: boolean
    data?: any
    error?: string
}


export interface GetLookupKeyResponse extends OperationResponse {
    data?: { instanceId: string }
}


async function getLookUpKey(input: GetLookUpKey): Promise<OperationResponse | undefined> {
    // ...
}


async function setLookUpKey(input: LookUpKey): Promise<OperationResponse | undefined> {
    // ...
}


async function deleteLookUpKey(input: LookUpKey): Promise<OperationResponse | undefined> {
    // ...
}

Usage

import RDK from '@retter/rdk'


const rdk = new RDK()


await rdk.getLookupKey({ key: { name: 'msisdn', value: '905987654321' } })
await rdk.getLookupKey({ classId: 'SampleClass', key: { name: 'msisdn', value: '905987654321' } })
await rdk.setLookupKey({ key: { name: 'msisdn', value: '905987654321' } })
await rdk.deleteLookupKey({ key: { name: 'msisdn', value: '905987654321' } })


await rdk.pipeline()
    .setLookupKey({ key: { name: 'msisdn', value: '905987654321' } })
    .getLookupKey({ key: { name: 'msisdn', value: '905987654321' } })
    .deleteLookupKey({ key: { name: 'msisdn', value: '905987654321' } })
    .send()

API Reference

Lookup Key Input

ParameterTypeRequiredDescription
key{ name: string, value: string }trueLookup key's name and value

Get Lookup Key Input

ParameterTypeRequiredDescription
classIdstringfalseClass id that instance id belongs to

Operation Output

ParameterTypeRequiredDescription
successbooleantrueReturns true if operation is successful
dataanyfalseSuccessful response
errorstringfalseReason of failure

Get Lookup Key Response

ParameterTypeRequiredDescription
successbooleantrueReturns true if operation is successful
data{ instanceId: string }falseSuccessful response
errorstringfalseReason of failure
Previous
Database