@singi-labs/sifa-sdk 0.12.27 → 0.12.28

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.
@@ -1022,6 +1022,42 @@ async function fetchActivityFeed(config, handleOrDid, options = {}) {
1022
1022
  return null;
1023
1023
  }
1024
1024
  }
1025
+ var GithubPullRequestSchema = zod.z.object({
1026
+ prNumber: zod.z.number(),
1027
+ repoOwner: zod.z.string(),
1028
+ repoName: zod.z.string(),
1029
+ title: zod.z.string(),
1030
+ url: zod.z.string(),
1031
+ language: zod.z.string().nullable(),
1032
+ additions: zod.z.number(),
1033
+ deletions: zod.z.number(),
1034
+ /** ISO 8601 merge timestamp. */
1035
+ mergedAt: zod.z.string()
1036
+ });
1037
+ var MyGithubPullRequestsResponseSchema = zod.z.object({
1038
+ items: zod.z.array(GithubPullRequestSchema),
1039
+ hasMore: zod.z.boolean()
1040
+ });
1041
+ async function fetchMyGithubPullRequests(config, options = {}) {
1042
+ const { limit, offset, cookieHeader, ...fetchOptions } = options;
1043
+ const params = new URLSearchParams();
1044
+ if (limit !== void 0) params.set("limit", String(limit));
1045
+ if (offset !== void 0) params.set("offset", String(offset));
1046
+ const qs = params.toString();
1047
+ const headers = { ...options.headers ?? {} };
1048
+ if (cookieHeader) headers.cookie = cookieHeader;
1049
+ const data = await apiFetch(
1050
+ config,
1051
+ `/api/me/github/pull-requests${qs ? `?${qs}` : ""}`,
1052
+ {
1053
+ credentials: "include",
1054
+ cache: "no-store",
1055
+ ...fetchOptions,
1056
+ headers
1057
+ }
1058
+ );
1059
+ return MyGithubPullRequestsResponseSchema.parse(data);
1060
+ }
1025
1061
 
1026
1062
  // src/query/fetchers/endorsement.ts
1027
1063
  async function fetchEndorsementCount(config, did, options = {}) {
@@ -1346,6 +1382,10 @@ var sifaQueryKeys = {
1346
1382
  teaser: (handleOrDid) => ["sifa", "activity", "teaser", handleOrDid],
1347
1383
  feed: (handleOrDid, opts) => ["sifa", "activity", "feed", handleOrDid, opts]
1348
1384
  },
1385
+ github: {
1386
+ all: () => ["sifa", "github"],
1387
+ myPullRequests: (opts) => ["sifa", "github", "my-pull-requests", opts]
1388
+ },
1349
1389
  endorsement: {
1350
1390
  all: () => ["sifa", "endorsement"],
1351
1391
  count: (did) => ["sifa", "endorsement", "count", did]
@@ -2395,6 +2435,14 @@ function useActivityFeed(handleOrDid, opts = {}, options) {
2395
2435
  ...options
2396
2436
  });
2397
2437
  }
2438
+ function useMyGithubPullRequests(params = {}, options) {
2439
+ const config = useSifaConfig();
2440
+ return reactQuery.useQuery({
2441
+ queryKey: sifaQueryKeys.github.myPullRequests(params),
2442
+ queryFn: () => fetchMyGithubPullRequests(config, params),
2443
+ ...options
2444
+ });
2445
+ }
2398
2446
  function useEndorsementCount(did, options) {
2399
2447
  const config = useSifaConfig();
2400
2448
  return reactQuery.useQuery({
@@ -2769,6 +2817,7 @@ exports.fetchFollowing = fetchFollowing;
2769
2817
  exports.fetchGetProfileView = fetchGetProfileView;
2770
2818
  exports.fetchHeatmapData = fetchHeatmapData;
2771
2819
  exports.fetchHiddenApps = fetchHiddenApps;
2820
+ exports.fetchMyGithubPullRequests = fetchMyGithubPullRequests;
2772
2821
  exports.fetchMyRoadmapVotes = fetchMyRoadmapVotes;
2773
2822
  exports.fetchNetworkMap = fetchNetworkMap;
2774
2823
  exports.fetchNetworkStreamCount = fetchNetworkStreamCount;
@@ -2894,6 +2943,7 @@ exports.useImportSearchEntities = useImportSearchEntities;
2894
2943
  exports.useLinkSkillToPosition = useLinkSkillToPosition;
2895
2944
  exports.useMintEntityDomain = useMintEntityDomain;
2896
2945
  exports.useMutuals = useMutuals;
2946
+ exports.useMyGithubPullRequests = useMyGithubPullRequests;
2897
2947
  exports.useMyRoadmapVotes = useMyRoadmapVotes;
2898
2948
  exports.useNetworkStreamCount = useNetworkStreamCount;
2899
2949
  exports.useOrgClaim = useOrgClaim;