0.1.2 • Published 1 year ago

@bundly/ic-http-client v0.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

ic-http-client

HTTP client to call ICP API Rest

How to use

const agent = new HttpAgent({
  host,
  identity,
  //...
});

const backend = Actor.createActor(idlFactory, {
  agent,
  ...configuration,
});

const client = new HttpClient(backend);

// GET request
const result = await client.get("/users", config);

// POST request
const result = await client.post(
  "/users",
  {
    username: "some-username",
    password: "password",
  },
  {
    headers: {
      "Content-Type": "application/json",
    },
  }
);

// PUT request
const result = await client.put(
  "/users",
  {
    password: "password",
  },
  {
    headers: {
      "Content-Type": "application/json",
    },
  }
);

// DELETE request
const result = await client.delete("/users", config);
0.2.0-rc.1

1 year ago

0.2.0-rc.0

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago