export async function listArtifactsFunc()

in operations/packages/artifacts.ts [19:61]


export async function listArtifactsFunc(
  organizationId: string,
  repoId: string,
  repoType: string,
  page?: number,
  perPage?: number,
  search?: string,
  orderBy: string = "latestUpdate",
  sort: string = "desc"
): Promise<Artifact[]> {
  const baseUrl = `/oapi/v1/packages/organizations/${organizationId}/repositories/${repoId}/artifacts`;

  const queryParams: Record<string, string | number | undefined> = {
    repoType,
  };

  if (page !== undefined) {
    queryParams.page = page;
  }

  if (perPage !== undefined) {
    queryParams.perPage = perPage;
  }

  if (search !== undefined) {
    queryParams.search = search;
  }

  queryParams.orderBy = orderBy;
  queryParams.sort = sort;

  const url = buildUrl(baseUrl, queryParams);

  const response = await yunxiaoRequest(url, {
    method: "GET",
  });

  if (!Array.isArray(response)) {
    return [];
  }

  return response.map(artifact => ArtifactSchema.parse(artifact));
}