Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@aws-sdk/client-appsync

Package Overview
Dependencies
Maintainers
5
Versions
428
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aws-sdk/client-appsync

AWS SDK for JavaScript Appsync Client for Node.js, Browser and React Native

  • 3.598.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
114K
decreased by-32.64%
Maintainers
5
Weekly downloads
 
Created

What is @aws-sdk/client-appsync?

@aws-sdk/client-appsync is a part of the AWS SDK for JavaScript, which allows developers to interact with AWS AppSync, a managed service that uses GraphQL to make it easy for applications to get exactly the data they need. This package provides methods to create, update, delete, and query AppSync resources such as GraphQL APIs, data sources, and resolvers.

What are @aws-sdk/client-appsync's main functionalities?

Create GraphQL API

This code sample demonstrates how to create a new GraphQL API using the @aws-sdk/client-appsync package. It initializes the AppSync client, sets the parameters for the new API, and sends a request to create the API.

const { AppSyncClient, CreateGraphqlApiCommand } = require('@aws-sdk/client-appsync');

const client = new AppSyncClient({ region: 'us-west-2' });

const params = {
  name: 'MyGraphQLAPI',
  authenticationType: 'API_KEY',
};

const run = async () => {
  try {
    const data = await client.send(new CreateGraphqlApiCommand(params));
    console.log(data);
  } catch (err) {
    console.error(err);
  }
};

run();

Update GraphQL API

This code sample shows how to update an existing GraphQL API. It uses the UpdateGraphqlApiCommand to change the name of the API.

const { AppSyncClient, UpdateGraphqlApiCommand } = require('@aws-sdk/client-appsync');

const client = new AppSyncClient({ region: 'us-west-2' });

const params = {
  apiId: 'your-api-id',
  name: 'UpdatedGraphQLAPI',
};

const run = async () => {
  try {
    const data = await client.send(new UpdateGraphqlApiCommand(params));
    console.log(data);
  } catch (err) {
    console.error(err);
  }
};

run();

Delete GraphQL API

This code sample demonstrates how to delete a GraphQL API using the DeleteGraphqlApiCommand. It requires the API ID of the API to be deleted.

const { AppSyncClient, DeleteGraphqlApiCommand } = require('@aws-sdk/client-appsync');

const client = new AppSyncClient({ region: 'us-west-2' });

const params = {
  apiId: 'your-api-id',
};

const run = async () => {
  try {
    const data = await client.send(new DeleteGraphqlApiCommand(params));
    console.log(data);
  } catch (err) {
    console.error(err);
  }
};

run();

List GraphQL APIs

This code sample shows how to list all GraphQL APIs in your account using the ListGraphqlApisCommand.

const { AppSyncClient, ListGraphqlApisCommand } = require('@aws-sdk/client-appsync');

const client = new AppSyncClient({ region: 'us-west-2' });

const run = async () => {
  try {
    const data = await client.send(new ListGraphqlApisCommand({}));
    console.log(data);
  } catch (err) {
    console.error(err);
  }
};

run();

Other packages similar to @aws-sdk/client-appsync

FAQs

Package last updated on 14 Jun 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc