What is the difference between using the "Client" versus "non-Client" versions of AWS API calls?

0

I am confused as to when to use the "Client" versus "non-Client" versions from the AWS SDK. In the code I reproduced below, I am creating a lambda function to send input text to Amazon Lex for processing. Can someone explain what the differences are and when to use the different versions?

import { LexRuntimeV2Client, RecognizeTextCommand } from "@aws-sdk/client-lex-runtime-v2";
import { LexRuntimeV2 } from "@aws-sdk/client-lex-runtime-v2";

export const handler = async(event) => {

    const LEXRUNTIMEClient = new LexRuntimeV2Client({region: 'us-east-1'});
    const LEXRUNTIME = new LexRuntimeV2({region: 'us-east-1'});
};
1 Risposta
2
Risposta accettata

Hi Albert.

These two are equivalent versions of the same client. You can use either, however, please favor using LexRuntimeV2Client. per the documentation, the client can also send requests using v2 compatible style (LexRuntimeV2). However, it results in a bigger bundle size and may be dropped in next major version.

More details can be found here:

I hope this helps.

profile pictureAWS
ESPERTO
con risposta un anno fa
profile pictureAWS
ESPERTO
verificato un anno fa
profile picture
ESPERTO
verificato un anno fa
  • Thanks for the clarification! The first link really helped me understand the syntax differences between the v3 style versus the v2 style.

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande