Methods
# async createProject(payload) → {ProjectResponse|undefined}
Create the project by using a Stark key
Parameters:
Name | Type | Description |
---|---|---|
payload |
CreateProjectParams
|
create project request input (companyName / name / contactEmail / Stark key) |
Exception: CompanyName is required
string
Exception: Name is required
string
Exception: Contact email address is required
string
Exception: StarkKey is required
string
Exception: Create project failed with internal server error
string
Project information data
ProjectResponse
|
undefined
Example
const projectManager: ProjectManager = new ProjectManager(EnvTypes.STAGING);
const starkKey: string = config.stark_key; // Your stark key in Myria system
const params: CreateProjectParams = {
name: "Game Project Test",
companyName: "GamePartnerWithMyria",
contactEmail: "world.game@myria.com",
starkKey: starkKey,
};
console.log("Creating the project...");
const newProjectResponse: ProjectResponse = await projectManager.createProject(params);
console.log("Created project response:");
console.log(JSON.stringify(newProjectResponse, null, 2));
# async createProjectByApiKey(payload) → {ProjectResponse}
Create project by using Myria user Id and API key
Parameters:
Name | Type | Description |
---|---|---|
payload |
CreateProjectParamsByAPIKey
|
Create project request params with API Key |
Exception: API Key is required
string
Exception: Company name is required
string
Exception: Contact email is required
string
Exception: Myria User ID is required
string
Exception: Name is required
string
Project details (project basic info, number of collections allow....)
Example
const projectManager: ProjectManager = new ProjectManager(EnvTypes.STAGING);
const params: CreateProjectParamsByAPIKey = {
name: "Game Project Test",
companyName: "GamePartnerWithMyria",
contactEmail: "world.game@myria.com",
apiKey: 'Your api key', // could generate on the myria portal for partner
myriaUserID: 'your unique user ID in myria system',
};
console.log("Getting project details information...");
const data: ProjectResponse = await projectManager.createProjectByApiKey(params);
console.log("New project details response:");
console.log(JSON.stringify(data, null, 2));
# async getCollectionListByProjectId(id) → {CollectionListResponseData}
Function to get the list of collections by project ID
Parameters:
Name | Type | Description |
---|---|---|
id |
number
|
unique ID of project |
Exception: Project id is required
string
Exception: Get collection list failed with internal server error
string
Exception: Get collection list failed with ${serverError}
string
Project details information which include collection list
Example
const projectManager: ProjectManager = new ProjectManager(EnvTypes.STAGING);
const starkKey: string = config.stark_key; // Your stark key in Myria system
const projectId = 1;
console.log("Getting list of the collection...");
const data: CollectionListResponseData = await projectManager.getCollectionListByProjectId(projectId);
console.log("List of collection response:");
console.log(JSON.stringify(data, null, 2));
# async getProjectDetail(id) → {ProjectResponse}
Get project details information by project ID
Parameters:
Name | Type | Description |
---|---|---|
id |
number
|
unique ID of project |
Exception: Project id is required
string
Project details information (basic info of project, number of collections allow....)
Example
const projectManager: ProjectManager = new ProjectManager(EnvTypes.STAGING);
const starkKey: string = config.stark_key; // Your stark key in Myria system
const projectId = 1;
console.log("Getting project details information...");
const data: CollectionListResponseData = await projectManager.getProjectDetail(projectId);
console.log("Project details response:");
console.log(JSON.stringify(data, null, 2));
# async getProjectsByUserIDAndApiKey(userID, apiKey) → {Promise.<(ProjectResponse|undefined)>}
Get Project List By Myria User ID and API Key
Parameters:
Name | Type | Description |
---|---|---|
userID |
string
|
Unique ID (uuid) of myria user |
apiKey |
string
|
Partner's API key |
Exception: User ID is required
string
Exception: Partner API Key is required
string
Http Status Code 401: x-api-key is not found (x-api-key is required to secure the call to Myria marketplace service)
string
Http Status Code 403: The API KEY (example: aed.....) is unavailable means the API key is invalid or has been deactivated
string
Promise.<(ProjectResponse|undefined)>
Example
const projectManager: ProjectManager = new ProjectManager(EnvTypes.STAGING);
const myriaUserID = 'uuid myria user ID'; // 'your unique user ID in myria system';
const apiKey = 'Your api key'; // could generate on the myria portal
console.log("Getting project list data...");
const data: ProjectResponse = await projectManager.getProjectsByUserIDAndApiKey(myriaUserID, apiKey);
console.log("Data project list response:");
console.log(JSON.stringify(data, null, 2));
# async updateProject(payload) → {ProjectResponse|undefined}
Update the project by using project ID and the stark key
Parameters:
Name | Type | Description |
---|---|---|
payload |
UpdateProjectParams
|
update projects request input (id / companyName / name / contactEmail / Stark key) |
Exception: Project Id is required
string
Exception: Company name is required
string
Exception: Name is required
string
Exception: Contact email address is required
string
Exception: StarkKey is required
string
Project information data
ProjectResponse
|
undefined
Example
const projectManager: ProjectManager = new ProjectManager(EnvTypes.STAGING);
const starkKey: string = config.stark_key; // Your stark key in Myria system
const params: UpdateProjectParams = {
id: 1,
name: "Update Game Project Test",
companyName: "GamePartnerWithMyria",
contactEmail: "world.game@myria.com",
starkKey: starkKey,
};
console.log("Update the project...");
const updatedProjectResponse: ProjectResponse = await projectManager.updateProject(params);
console.log("Updated project response:");
console.log(JSON.stringify(updatedProjectResponse, null, 2));
# async updateProjectByApiKey(payload) → {ProjectResponse}
Update project by using Myria user Id and API key
Parameters:
Name | Type | Description |
---|---|---|
payload |
UpdateProjectByAPIKey
|
Update project request params |
Exception: API Key is required
string
Exception: Company name is required
string
Exception: Contact email is required
string
Exception: Myria User ID is required
string
Exception: Name is required
string
Http Status Code 500: Create project failure => ${server error}
string
Project details information (basic info of project, number of collections allow....)
Example
const projectManager: ProjectManager = new ProjectManager(EnvTypes.STAGING);
const params: UpdateProjectByAPIKey = {
id: 1,
name: "Game Project Test",
companyName: "GamePartnerWithMyria",
contactEmail: "world.game@myria.com",
apiKey: 'Your api key', // could generate on the myria portal
myriaUserID: 'your unique user ID in myria system',
};
console.log("Getting project details information...");
const data: ProjectResponse = await projectManager.updateProjectByApiKey(params);
console.log("New project details response:");
console.log(JSON.stringify(data, null, 2));