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 Respuesta
2
Respuesta aceptada

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
EXPERTO
respondido hace un año
profile pictureAWS
EXPERTO
revisado hace un año
profile picture
EXPERTO
revisado hace un año
  • Thanks for the clarification! The first link really helped me understand the syntax differences between the v3 style versus the v2 style.

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas