This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
openapi: 3.0.0 | |
info: | |
title: Chill Vibes CBD Drinks API | |
description: > | |
Welcome to the Chill Vibes CBD Drinks API! | |
We're here to quench your thirst and soothe your soul, | |
one API call at a time. Remember, our drinks are high | |
in CBD, but our server responses are always 200 OK! | |
version: 1.0.0 | |
contact: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"openapi": "3.0.0", | |
"info": { | |
"title": "Slice of Heaven Pizza API", | |
"description": "Welcome to the Slice of Heaven Pizza API! We're serving up hot, fresh endpoints faster than you can say 'extra cheese'. Whether you're looking to order a pizza, track your delivery, or browse our menu, we've got you covered. So sit back, relax, and let our API do the heavy lifting (unlike our delivery drivers, who are strictly forbidden from lifting heavy objects).", | |
"version": "1.0.0", | |
"contact": { | |
"name": "Pizza Support", | |
"email": "[email protected]", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
==== Custom Roles-Based Access Control (RBAC) ==== rbac.ts | |
// Check user is in correct role, or return 403 | |
if (request.user.data.roles.includes(options.role)) { | |
return request; | |
} | |
else { | |
return new Response('Access denied', { status: 403 }); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import fetch from "node-fetch"; | |
import ProgressBar from "progress"; | |
// Function to handle the individual fetch operation | |
async function sendRequest(url, index) { | |
try { | |
// console.log(`Sending request ${index + 1} to ${url}`); | |
const startTime = process.hrtime(); // Start timing here | |
const response = await fetch(url); | |
const duration = process.hrtime(startTime); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {ZuploContext, ZuploRequest} from "@zuplo/runtime"; | |
export default async function policy( | |
request: ZuploRequest, | |
context: ZuploContext, | |
options: never, | |
policyName: string | |
) { | |
context.custom.originalQuery = request.query; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
ZuploContext, | |
ZuploRequest, | |
OpenIdJwtInboundPolicy, | |
InboundPolicyHandler, | |
OpenIdJwtInboundPolicyOptions, | |
Auth0JwtInboundPolicy, | |
Auth0JwtInboundPolicyOptions, | |
} from "@zuplo/runtime"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ZuploContext, ZuploRequest } from "@zuplo/runtime"; | |
import environment from "@app/environment"; | |
import { parse, visit } from "graphql"; | |
import { BQWriter } from "./bg-writer"; | |
interface LoggingEntry { | |
url: string; | |
method: string; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { getTokenFromGCPServiceAccount } from "@sagi.io/workers-jwt"; | |
import { Logger, ZuploContext } from "@zuplo/runtime"; | |
const aud = "https://bigquery.googleapis.com/"; | |
export class BQWriter<T> { | |
constructor(serviceAccountJson: string, projectId: string, datasetId: string, tableId: string) { | |
this.#serviceAccountJson = JSON.parse(serviceAccountJson); | |
this.#insertUrl = `${aud}bigquery/v2/projects/${projectId}/datasets/${datasetId}/tables/${tableId}/insertAll`; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default async () => { | |
const response = await fetch('https://your-api.com'); | |
const transformed = await transformBody(response); | |
return transformed; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## GoPro Fusion Script to move files into grouped folders | |
# Where do you want your files moved to? | |
$targetFolder = "D:\GoPro Fusion\" | |
# For easiest workflow, just set the friendly/file system label for your front and back SD cards to "FusionSD" | |
$volumes = Get-Volume | Where FileSystemLabel -eq "fusionsd" | |
#### ==== support functions |