haydenbleasel / corellium-typescript

A simple and beautiful TypeScript SDK for Corellium
https://www.npmjs.com/package/corellium-typescript
MIT License
1 stars 0 forks source link

Implement function chaining #18

Open kelvissu opened 1 month ago

kelvissu commented 1 month ago

Currently, only the indexing option on the projects collections object supports returning of the correct project response.

When performing a create or search on the collection of objects, these do not get an equivalent response.

image

haydenbleasel commented 1 month ago

@kelvissu I'm seeing the following in the types:

projects.create returns:

{
  id: string;
  name?: string | null;
  settings?: components["schemas"]["ProjectSettings"];
  quotas?: components["schemas"]["ProjectQuota"];
  quotasUsed?: components["schemas"]["ProjectUsage"];
}

projects.search returns:

{
  id: string;
  name?: string | null;
  settings?: components["schemas"]["ProjectSettings"];
  quotas?: components["schemas"]["ProjectQuota"];
  quotasUsed?: components["schemas"]["ProjectUsage"];
} | undefined

projects.list returns:

{
    id: string;
    name?: string | null;
    settings?: components["schemas"]["ProjectSettings"];
    quotas?: components["schemas"]["ProjectQuota"];
    quotasUsed?: components["schemas"]["ProjectUsage"];
}[]

Which endpoints do you reckon are out of sync?

kelvissu commented 1 month ago

I guess I'm trying to call .update on a .create object. I suppose I can try to set the quota: {cores:} property instead?

Edit: Doesn't seem to work. Is there a way to update the cores of the project after it has been added?

Edit 2: I guess if I ever wanted to edit, this is the only way to do it?

const id = chosenProject!.id; chosenProject?.quotas?.cores! >= 6 || await corellium.project(id).update({id:id, quotas: {cores: 6}});

haydenbleasel commented 1 month ago

Note from call: Asking if we can do something like

await corellium.project.create({ ... }).update({ ... }).delete()