@wefunder/sdk 0.1.0-beta.6 → 0.1.0-beta.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -132,6 +132,20 @@ const page = await wf.offerings.list({ sort: "newest" });
132
132
  console.log(page.data, page.meta?.next_cursor);
133
133
  ```
134
134
 
135
+ ## Portfolio
136
+
137
+ Portfolio endpoints require an authorization-code token with
138
+ `read:investments`.
139
+
140
+ ```ts
141
+ const summary = await wf.portfolio.get();
142
+ console.log(summary.attributes?.total_current_value_cents);
143
+
144
+ for await (const position of wf.portfolio.positions.all({ status: "active" })) {
145
+ console.log(position.id, position.attributes?.current_value_cents);
146
+ }
147
+ ```
148
+
135
149
  ## Errors
136
150
 
137
151
  Failed requests throw `WefunderError` with the fields from the API's error envelope,
package/dist/index.cjs CHANGED
@@ -1191,8 +1191,10 @@ __export(sdk_gen_exports, {
1191
1191
  getCurrentUser: () => getCurrentUser,
1192
1192
  getIntent: () => getIntent,
1193
1193
  getOffering: () => getOffering,
1194
+ getPortfolio: () => getPortfolio,
1194
1195
  getSyndicate: () => getSyndicate,
1195
1196
  getSyndicateDeal: () => getSyndicateDeal,
1197
+ getSyndicatePortfolio: () => getSyndicatePortfolio,
1196
1198
  getSyndicateStatistics: () => getSyndicateStatistics,
1197
1199
  getWebhookSubscription: () => getWebhookSubscription,
1198
1200
  hideSyndicateMember: () => hideSyndicateMember,
@@ -1206,10 +1208,12 @@ __export(sdk_gen_exports, {
1206
1208
  listInvestments: () => listInvestments,
1207
1209
  listOfferings: () => listOfferings,
1208
1210
  listPartnerInvites: () => listPartnerInvites,
1211
+ listPortfolioPositions: () => listPortfolioPositions,
1209
1212
  listSyndicateDealInvestors: () => listSyndicateDealInvestors,
1210
1213
  listSyndicateDeals: () => listSyndicateDeals,
1211
1214
  listSyndicateMemberInvestments: () => listSyndicateMemberInvestments,
1212
1215
  listSyndicateMembers: () => listSyndicateMembers,
1216
+ listSyndicatePortfolioPositions: () => listSyndicatePortfolioPositions,
1213
1217
  listSyndicates: () => listSyndicates,
1214
1218
  listWebhookSubscriptions: () => listWebhookSubscriptions,
1215
1219
  promoteSyndicateMember: () => promoteSyndicateMember,
@@ -1251,6 +1255,16 @@ var listInvestments = (options) => (options?.client ?? client).get({
1251
1255
  url: "/investments",
1252
1256
  ...options
1253
1257
  });
1258
+ var getPortfolio = (options) => (options?.client ?? client).get({
1259
+ security: [{ scheme: "bearer", type: "http" }],
1260
+ url: "/portfolio",
1261
+ ...options
1262
+ });
1263
+ var listPortfolioPositions = (options) => (options?.client ?? client).get({
1264
+ security: [{ scheme: "bearer", type: "http" }],
1265
+ url: "/portfolio/positions",
1266
+ ...options
1267
+ });
1254
1268
  var listCampaigns = (options) => (options?.client ?? client).get({
1255
1269
  security: [{ scheme: "bearer", type: "http" }],
1256
1270
  url: "/campaigns",
@@ -1372,6 +1386,16 @@ var getSyndicateStatistics = (options) => (options.client ?? client).get({
1372
1386
  url: "/syndicates/{syndicate_id}/statistics",
1373
1387
  ...options
1374
1388
  });
1389
+ var getSyndicatePortfolio = (options) => (options.client ?? client).get({
1390
+ security: [{ scheme: "bearer", type: "http" }],
1391
+ url: "/syndicates/{syndicate_id}/portfolio",
1392
+ ...options
1393
+ });
1394
+ var listSyndicatePortfolioPositions = (options) => (options.client ?? client).get({
1395
+ security: [{ scheme: "bearer", type: "http" }],
1396
+ url: "/syndicates/{syndicate_id}/portfolio/positions",
1397
+ ...options
1398
+ });
1375
1399
  var closeSyndicateDeal = (options) => (options.client ?? client).post({
1376
1400
  security: [{ scheme: "bearer", type: "http" }],
1377
1401
  url: "/syndicates/{syndicate_id}/deals/{fundraise_id}/close",
@@ -1648,6 +1672,16 @@ var Wefunder = class _Wefunder {
1648
1672
  all: () => paginate((cursor) => this.investments.list({ cursor })),
1649
1673
  collect: () => collect((cursor) => this.investments.list({ cursor }))
1650
1674
  };
1675
+ portfolio = {
1676
+ get: (query) => this.#unwrapData(getPortfolio({ client: this.#client, query })),
1677
+ positions: {
1678
+ list: this.#page(
1679
+ listPortfolioPositions
1680
+ ),
1681
+ all: (query) => paginate((cursor) => this.portfolio.positions.list({ ...query, cursor })),
1682
+ collect: (query) => collect((cursor) => this.portfolio.positions.list({ ...query, cursor }))
1683
+ }
1684
+ };
1651
1685
  campaigns = {
1652
1686
  list: this.#page(listCampaigns),
1653
1687
  all: () => paginate((cursor) => this.campaigns.list({ cursor })),
@@ -1655,12 +1689,12 @@ var Wefunder = class _Wefunder {
1655
1689
  };
1656
1690
  syndicates = {
1657
1691
  list: this.#page(listSyndicates),
1658
- all: () => paginate((cursor) => this.syndicates.list({ cursor })),
1692
+ all: (query) => paginate((cursor) => this.syndicates.list({ ...query, cursor })),
1659
1693
  get: (id) => this.#unwrapData(getSyndicate({ client: this.#client, path: { id } }))
1660
1694
  };
1661
1695
  intents = {
1662
1696
  list: this.#page(listIntents),
1663
- all: () => paginate((cursor) => this.intents.list({ cursor })),
1697
+ all: (query) => paginate((cursor) => this.intents.list({ ...query, cursor })),
1664
1698
  get: (id) => this.#unwrapData(getIntent({ client: this.#client, path: { id } }))
1665
1699
  };
1666
1700
  attribution = {