eternal-core
v1.1.3
Published
<!-- Start SDK Installation [installation] --> ## SDK Installation
Readme
archivista-sdk-eternal-core
SDK Installation
NPM
npm install @archivista/eternal-coreYarn
yarn add @archivista/eternal-coreSDK Example Usage
Example
import { EternalCoreSDK } from "@archivista/eternal-core";
import { CreateAccessRequestRole } from "@archivista/eternal-core/dist/sdk/models/shared";
async function run() {
const sdk = new EternalCoreSDK({
security: {
bearer: "<YOUR_BEARER_TOKEN_HERE>",
},
});
const res = await sdk.accessRequest.createAccessRequest({
email: "",
fullName: "",
isEmailVerified: false,
promoCode: "promoCode",
role: CreateAccessRequestRole.User,
signature: "0x0",
wallet: "0x0",
});
if (res.statusCode == 200) {
// handle response
}
}
run();
Available Resources and Operations
accessRequest
- createAccessRequest - Create access request
- getMessageAccessRequest - Get message for user to sign
- getAccessRequest - Get access request status
auth
certifyRequest
- createOnBehalfCertifyRequest - Create a certify request on behalf of another address
- createOneCertifyRequest - Create a certify request for a draft
- findAllByWalletCertifyRequest - Get certify requests made by wallet connected
- findByIdCertifyRequest - Get certify request by id
cloudMedia
- consolidateAndDownloadCloudMedia
- deleteFileCloudMedia
- getFileMetadataCloudMedia - Get Metadata file by file id
- getFileCloudMedia
- getThumbnailCloudMedia
- uploadChunkCloudMedia
- uploadFileCloudMedia
customApp
- createAppSettingsCustomApp - Create App Settings for a CustomApp
- createBrandSettingsCustomApp - Create Brand Settings for a CustomApp
- deleteCustomApp - Delete an advisor custom app
- getByIdCustomApp - Get a CustomApp by ID (public usage)
- getPublicOneBySubdomainOrWalletCustomApp - Get a CustomApp by subdomain and/or admin wallet (public usage)
- getCustomApp - Get a CustomApp by session
- updateAppSettingsCustomApp - Update App Settings for a CustomApp
- updateBrandSettingsCustomApp - Update Brand Settings for a CustomApp
health
- getHealthApp - Verify API status
payment
- createMultipleCheckoutPayment - Create a checkout session for multiple products
- createPortalPayment - Create a payment portal session
- createSingleCheckoutPayment - Create a Stripe checkout session for a specific product price
- getPriceDetailsByIdPayment - Get a specific price by ID
- getPricesByProductIdPayment - Get all prices associated with a product
- getProductByIdPayment - Get a specific product by ID
- getProductsPayment - Get all products, filter by category, or search by priceId
recordAccess
- authorizeToViewPrivateContentRecordAccess - Authorize a wallet to view private content of a record
- getRecordAccess - Get record access tokens information
- unauthorizeToViewPrivateContentRecordAccess - Unauthorized a wallet access to private content of a record
recordDraft
- createFromMasterRecordDraft - Create a record draft from a record master
- createRecordDraft - Create a record draft
- createRecordDraftTransfer - Create a transfer request for a record draft
- findAllByCreatorPaginatedRecordDrafts - Get record drafts made by wallet connected
- ~~findAllByCreatorRecordDraft~~ - Get record drafts made by wallet connected :warning: Deprecated
- findOneRecordDraft - Get record draft by id
- removeRecordDraft - Delete record draft by id
- updateRecordDraft - Update record draft by id
recordDraftShare
- createRecordDraftShare - Create a user request
- findAllByConnectedWalletRecordDraftShare - Get all records drafts shared to wallet connected
- findAllRedeemsRecordDraftShare - Get all user requests
- findRedeemRecordDraftShare - Get record draft shared for redeem
- redeemRecordDraftShare - Redeem user request
- removeRecordDraftShare - Remove draft share access
recordDraftTransfer
- acceptRecordDraftTransferRequest - Accept a transfer request for a record draft
- cancelRecordDraftTransferRequest - Cancel a transfer request for a record draft
- findRedeemableRecordDraftTransferRequest - Get record draft transfer request
- resendRecordDraftTransferRequest - Resend transfer request notification for a record draft
recordGallery
- createRecordGallery - Create a record gallery
- findByOwnerRecordGallery - Get record galleries made by a specific address
- removeAllRecordGallery - Delete all record galleries by wallet address
admin
- createRecordGallery - Create a record gallery
- removeAllRecordGallery - Delete all record galleries by wallet address
recordMasters
- createRecordMaster - Create a new Record Master
- deleteRecordMaster - Delete a Record Master by ID
- getAllRecordMaster - Get all Record Masters
- getByIdRecordMaster - Get a Record Master by ID
- publishRecordMaster - Publish a Record Master by ID
- unpublishRecordMaster - Unpublish a Record Master by ID
- updateRecordMaster - Update a Record Master by ID
user
- getUser - Get connected user details
- retryVerifyUserEmail - Retry sending verification email
- updateUserEmail - Update user email
- verifyUserEmail - Verify user email using token
userRequests
- getAllUserRequest - Retrieve all user requests
- getOneUserRequest - Retrieve details of a user request
- getPublicDetailsUserRequest - Retrieve public details of a user request
userWalletRegistries
- createUserWalletRegistry - Create a wallet registry
- deleteUserWalletRegistry - Delete a wallet registry
- findAllByOwnerUserWalletRegistry - Get wallet registries by wallet connected
- findOneByIdUserWalletRegistry - Get wallet registries by id
- updateUserWalletRegistry - Update a wallet registry
userWalletRegistriesInvitations
- acceptUserWalletRegistryInvitation - Accept an invitation
- cancelInvitationUserWalletRegistryInvitation - Delete an invitation
- createUserWalletRegistryInvitation - Create an invitation
- getInvitationUserWalletRegistryInvitation - Retrieve an invitation to accept
- getInvitationsUserWalletRegistryInvitation - Retrieve invitations
- resendUserWalletRegistryInvitation - resend an invitation
webhooks
Error Handling
Handling errors in this SDK should largely match your expectations. All operations return a response object or throw an error. If Error objects are specified in your OpenAPI Spec, the SDK will throw the appropriate Error type.
| Error Object | Status Code | Content Type | | ----------------------- | ----------------------- | ----------------------- | | errors.InvalidSignature | 403 | application/json | | errors.SDKError | 4xx-5xx | / |
Example
import { EternalCoreSDK } from "@archivista/eternal-core";
async function run() {
const sdk = new EternalCoreSDK({
security: {
bearer: "<YOUR_BEARER_TOKEN_HERE>",
},
});
let res;
try {
res = await sdk.auth.loginWalletAuth({
signature: "0x0",
wallet: "0x0",
});
} catch (err) {
if (err instanceof errors.InvalidSignature) {
console.error(err); // handle exception
throw err;
} else if (err instanceof errors.SDKError) {
console.error(err); // handle exception
throw err;
}
}
if (res.statusCode == 200) {
// handle response
}
}
run();
Server Selection
Select Server by Index
You can override the default server globally by passing a server index to the serverIdx: number optional parameter when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the indexes associated with the available servers:
| # | Server | Variables |
| - | ------ | --------- |
| 0 | https://eternal-core-{environment}.archivista.com/ | environment (default is dev) |
Example
import { EternalCoreSDK } from "@archivista/eternal-core";
import { CreateAccessRequestRole } from "@archivista/eternal-core/dist/sdk/models/shared";
async function run() {
const sdk = new EternalCoreSDK({
serverIdx: 0,
security: {
bearer: "<YOUR_BEARER_TOKEN_HERE>",
},
});
const res = await sdk.accessRequest.createAccessRequest({
email: "",
fullName: "",
isEmailVerified: false,
promoCode: "promoCode",
role: CreateAccessRequestRole.User,
signature: "0x0",
wallet: "0x0",
});
if (res.statusCode == 200) {
// handle response
}
}
run();
Variables
Some of the server options above contain variables. If you want to set the values of those variables, the following optional parameters are available when initializing the SDK client instance:
environment: models.ServerEnvironment
Override Server URL Per-Client
The default server can also be overridden globally by passing a URL to the serverURL: str optional parameter when initializing the SDK client instance. For example:
import { EternalCoreSDK } from "@archivista/eternal-core";
import { CreateAccessRequestRole } from "@archivista/eternal-core/dist/sdk/models/shared";
async function run() {
const sdk = new EternalCoreSDK({
serverURL: "https://eternal-core-{environment}.archivista.com/",
security: {
bearer: "<YOUR_BEARER_TOKEN_HERE>",
},
});
const res = await sdk.accessRequest.createAccessRequest({
email: "",
fullName: "",
isEmailVerified: false,
promoCode: "promoCode",
role: CreateAccessRequestRole.User,
signature: "0x0",
wallet: "0x0",
});
if (res.statusCode == 200) {
// handle response
}
}
run();
Custom HTTP Client
The Typescript SDK makes API calls using the axios HTTP library. In order to provide a convenient way to configure timeouts, cookies, proxies, custom headers, and other low-level configuration, you can initialize the SDK client with a custom AxiosInstance object.
For example, you could specify a header for every request that your sdk makes as follows:
import { @archivista/eternal-core } from "EternalCoreSDK";
import axios from "axios";
const httpClient = axios.create({
headers: {'x-custom-header': 'someValue'}
})
const sdk = new EternalCoreSDK({defaultClient: httpClient});Authentication
Per-Client Security Schemes
This SDK supports the following security scheme globally:
| Name | Type | Scheme |
| ----------- | ----------- | ----------- |
| bearer | http | HTTP Bearer |
You can set the security parameters through the security optional parameter when initializing the SDK client instance. For example:
import { EternalCoreSDK } from "@archivista/eternal-core";
import { CreateAccessRequestRole } from "@archivista/eternal-core/dist/sdk/models/shared";
async function run() {
const sdk = new EternalCoreSDK({
security: {
bearer: "<YOUR_BEARER_TOKEN_HERE>",
},
});
const res = await sdk.accessRequest.createAccessRequest({
email: "",
fullName: "",
isEmailVerified: false,
promoCode: "promoCode",
role: CreateAccessRequestRole.User,
signature: "0x0",
wallet: "0x0",
});
if (res.statusCode == 200) {
// handle response
}
}
run();
Per-Operation Security Schemes
Some operations in this SDK require the security scheme to be specified at the request level. For example:
import { EternalCoreSDK } from "@archivista/eternal-core";
import { CreateRecordGallerySecurity } from "@archivista/eternal-core/dist/sdk/models/operations";
async function run() {
const sdk = new EternalCoreSDK();
const operationSecurity: CreateRecordGallerySecurity = {
apiKey: "<YOUR_API_KEY_HERE>",
};
const res = await sdk.recordGallery.createRecordGallery(
{
address: "0x0",
name: "My Gallery",
},
operationSecurity
);
if (res.statusCode == 200) {
// handle response
}
}
run();
How to use available environments
const sdk = new EternalCoreSDK({
environment: "dev", // this could be handled dynamically to switch depending on the desired environment
});Development
Maturity
This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally looking for the latest version.
Contributions
While we value open-source contributions to this SDK, this library is generated programmatically. Feel free to open a PR or a Github issue as a proof of concept and we'll do our best to include it in a future release!
Install speakeasy CLI https://www.speakeasyapi.dev/docs/speakeasy-cli/getting-started Run command to generate the sdk code based on the swagger open api specs
Ensure you have the Speakeasy CLI version 1.346.3 installed:
brew install speakeasy-api/homebrew-tap/[email protected]Update SDK version
Before the latest version of the API is updated, run a local test to verify the SDK is generating as expected.
To do a local test, run the following command:
speakeasy generate sdk -s http://localhost:3000/api-json -o ./ -l typescript- If everything looks good, latest API version can be released
- Go to
gen.yamland bump the package version up - Once latest API version is deployed run the following command:
speakeasy generate sdk -s https://eternal-core-dev.archivista.com/api-json -o ./ -l typescript