Juno dev SDK
npm install juno-sdkJuno SDK is a development toolkit for interacting with Juno's central infrastructure. This SDK provides comprehensive API bindings to simplify common tasks such as authentication, email management, user management, and project-related operations. The following guide outlines the core structure of the SDK and provides basic usage examples to help new developers get started.
The SDK uses several models to structure the data exchanged between the client and Juno's services. These models represent the input data for API requests and the output data returned by the server.
#### Key Models:
- CreateProjectModel: Defines the structure for creating a new project.
- CreateUserModel: Contains the necessary fields to create a new user (email, name, password).
- IssueApiKeyRequest: Defines the request data for issuing an API key for a project.
- IssueApiKeyResponse: Contains the API key returned when a new API key is issued.
- EmailContent: Represents the content of an email, including its MIME type and body.
- EmailRecipient: Specifies the email and name of the recipient.
- EmailSender: Specifies the email and name of the sender.
- ProjectResponse: Represents the response received when querying project details.
The SDK includes API methods for interacting with Juno services. These methods abstract the complexities of making HTTP requests and ensure that data is structured according to Juno's requirements.
#### Core APIs:
- AuthApi: Handles authentication tasks, such as issuing API keys and generating JWT tokens.
- EmailApi: Manages email operations like sending emails and registering domains.
- ProjectApi: Manages project-related tasks, including creating projects and linking users.
- UserApi: Handles user operations, including creating users and managing user roles.
The Juno SDK provides a set of APIs for managing various services. Each API is built to simplify interactions with specific Juno infrastructure components. Below is an overview of how to use the main APIs.
- Issue API Key: Create a new API key for project access. This is necessary for authenticating requests to other services.
- Generate JWT: Once you have an API key, use it to generate a JWT, which is required to authenticate further API requests.
- Create Project: Define and create a new project using the provided model.
- Link User to Project: Associate a user with a project, allowing them to access or contribute to the project.
- Create User: Create a new user by providing necessary details like email, name, and password.
- Set User Role: Update a user's role to control access levels (e.g., ADMIN, SUPERADMIN).
- Register Domain: Register a domain to use as the sender of emails.
- Send Email: Send an email through Juno’s email service by specifying the sender, recipient, and content.