@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.
@@ -210,6 +210,10 @@ var sifaQueryKeys = {
210
210
  teaser: (handleOrDid) => ["sifa", "activity", "teaser", handleOrDid],
211
211
  feed: (handleOrDid, opts) => ["sifa", "activity", "feed", handleOrDid, opts]
212
212
  },
213
+ github: {
214
+ all: () => ["sifa", "github"],
215
+ myPullRequests: (opts) => ["sifa", "github", "my-pull-requests", opts]
216
+ },
213
217
  endorsement: {
214
218
  all: () => ["sifa", "endorsement"],
215
219
  count: (did) => ["sifa", "endorsement", "count", did]
@@ -1967,6 +1971,52 @@ function useActivityFeed(handleOrDid, opts = {}, options) {
1967
1971
  ...options
1968
1972
  });
1969
1973
  }
1974
+ var GithubPullRequestSchema = zod.z.object({
1975
+ prNumber: zod.z.number(),
1976
+ repoOwner: zod.z.string(),
1977
+ repoName: zod.z.string(),
1978
+ title: zod.z.string(),
1979
+ url: zod.z.string(),
1980
+ language: zod.z.string().nullable(),
1981
+ additions: zod.z.number(),
1982
+ deletions: zod.z.number(),
1983
+ /** ISO 8601 merge timestamp. */
1984
+ mergedAt: zod.z.string()
1985
+ });
1986
+ var MyGithubPullRequestsResponseSchema = zod.z.object({
1987
+ items: zod.z.array(GithubPullRequestSchema),
1988
+ hasMore: zod.z.boolean()
1989
+ });
1990
+ async function fetchMyGithubPullRequests(config, options = {}) {
1991
+ const { limit, offset, cookieHeader, ...fetchOptions } = options;
1992
+ const params = new URLSearchParams();
1993
+ if (limit !== void 0) params.set("limit", String(limit));
1994
+ if (offset !== void 0) params.set("offset", String(offset));
1995
+ const qs = params.toString();
1996
+ const headers = { ...options.headers ?? {} };
1997
+ if (cookieHeader) headers.cookie = cookieHeader;
1998
+ const data = await apiFetch(
1999
+ config,
2000
+ `/api/me/github/pull-requests${qs ? `?${qs}` : ""}`,
2001
+ {
2002
+ credentials: "include",
2003
+ cache: "no-store",
2004
+ ...fetchOptions,
2005
+ headers
2006
+ }
2007
+ );
2008
+ return MyGithubPullRequestsResponseSchema.parse(data);
2009
+ }
2010
+
2011
+ // src/query/hooks/use-github-prs.ts
2012
+ function useMyGithubPullRequests(params = {}, options) {
2013
+ const config = useSifaConfig();
2014
+ return reactQuery.useQuery({
2015
+ queryKey: sifaQueryKeys.github.myPullRequests(params),
2016
+ queryFn: () => fetchMyGithubPullRequests(config, params),
2017
+ ...options
2018
+ });
2019
+ }
1970
2020
 
1971
2021
  // src/query/fetchers/endorsement.ts
1972
2022
  async function fetchEndorsementCount(config, did, options = {}) {
@@ -2601,6 +2651,7 @@ exports.useHideStandardPublication = useHideStandardPublication;
2601
2651
  exports.useImportSearchEntities = useImportSearchEntities;
2602
2652
  exports.useLinkSkillToPosition = useLinkSkillToPosition;
2603
2653
  exports.useMutuals = useMutuals;
2654
+ exports.useMyGithubPullRequests = useMyGithubPullRequests;
2604
2655
  exports.useMyRoadmapVotes = useMyRoadmapVotes;
2605
2656
  exports.useNetworkStreamCount = useNetworkStreamCount;
2606
2657
  exports.useOrgClaim = useOrgClaim;