Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
steven-tey committed Dec 2, 2023
1 parent dd131e0 commit 5c0dc04
Show file tree
Hide file tree
Showing 14 changed files with 47 additions and 35 deletions.
1 change: 1 addition & 0 deletions apps/docs/api-reference/endpoint/bulk-create-links.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
openapi: post /links/bulk
description: Bulk create up to 100 links for the authenticated project.
---

<Note>
Expand Down
1 change: 1 addition & 0 deletions apps/docs/api-reference/endpoint/create-a-new-link.mdx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
openapi: post /links
description: Create a new link for the authenticated project.
---
1 change: 1 addition & 0 deletions apps/docs/api-reference/endpoint/create-a-new-tag.mdx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
openapi: post /projects/{projectSlug}/tags
description: Create a new tag for the authenticated project.
---
1 change: 1 addition & 0 deletions apps/docs/api-reference/endpoint/delete-a-link.mdx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
openapi: delete /links/{linkId}
description: Delete a link for the authenticated project.
---
1 change: 1 addition & 0 deletions apps/docs/api-reference/endpoint/edit-a-link.mdx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
openapi: put /links/{linkId}
description: Edit a link for the authenticated project.
---
1 change: 1 addition & 0 deletions apps/docs/api-reference/endpoint/retrieve-a-link.mdx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
openapi: get /links/info
description: Retrieve the info for a link from their domain and key.
---
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
openapi: get /links
description: Retrieve a list of links for the authenticated project. The list will be paginated and the provided query parameters allow filtering the returned links.
---
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
openapi: get /projects
description: Retrieve a list of projects for the authenticated user.
---
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
openapi: get /projects/{projectSlug}/tags
description: Retrieve a list of tags for the authenticated project.
---
1 change: 1 addition & 0 deletions apps/docs/api-reference/endpoint/retrieve-a-project.mdx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
openapi: get /projects/{projectSlug}
description: Retrieve a project for the authenticated user.
---
2 changes: 1 addition & 1 deletion apps/web/app/api/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ export function GET(): NextResponse<OpenAPIV3.Document> {
},
"/links/{linkId}": {
put: {
description: "Edit link for the authenticated project.",
description: "Edit a link for the authenticated project.",
operationId: "editLink",
security: [
{
Expand Down
32 changes: 0 additions & 32 deletions apps/web/lib/github.ts

This file was deleted.

12 changes: 10 additions & 2 deletions apps/web/scripts/download-links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import "dotenv-flow/config";
import prisma from "@/lib/prisma";
import * as Papa from "papaparse";
import * as fs from "fs";
import { linkConstructor } from "./utils";

const projectId = "xxx";

Expand All @@ -15,14 +16,21 @@ async function main() {
domain: true,
url: true,
},
orderBy: {
createdAt: "asc",
},
skip: 99999,
});

const processedLinks = links.map(({ key, domain, url }) => ({
link: `${domain}:${key}`,
link: linkConstructor({
domain,
key,
}),
url,
}));

fs.writeFileSync("links.csv", Papa.unparse(processedLinks));
fs.writeFileSync("xxx.csv", Papa.unparse(processedLinks));
}

main();
26 changes: 26 additions & 0 deletions apps/web/scripts/download-top-links.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import "dotenv-flow/config";
import * as Papa from "papaparse";
import * as fs from "fs";
import { linkConstructor } from "./utils";
import { getStats } from "@/lib/stats";

const domain = "xxx";

async function main() {
const topLinks = await getStats({
domain,
endpoint: "top_links",
});

const processedLinks = topLinks.map(({ domain, key, clicks }) => ({
link: linkConstructor({
domain,
key,
}),
clicks,
}));

fs.writeFileSync("xxx.csv", Papa.unparse(processedLinks));
}

main();

0 comments on commit 5c0dc04

Please # to comment.