Skip to content

Instantly share code, notes, and snippets.

View wtrocki's full-sized avatar
🚀
Making API Backends an Better Place!

Wojciech Trocki wtrocki

🚀
Making API Backends an Better Place!
View GitHub Profile
This file has been truncated, but you can view the full file.
openapi: 3.0.1
info:
description: |-
The MongoDB Atlas Administration API allows developers to manage all components in MongoDB Atlas.
The Atlas Administration API uses HTTP Digest Authentication to authenticate requests. Provide a programmatic API public key and corresponding private key as the username and password when constructing the HTTP request. For example, to [return database access history](#tag/Access-Tracking/operation/listAccessLogsByClusterName) with [cURL](https://en.wikipedia.org/wiki/CURL), run the following command in the terminal:
```
curl --user "{PUBLIC-KEY}:{PRIVATE-KEY}" \
--digest \
{"name":"redhat_sso","base_url":"https://sso.stage.redhat.com","token_url":"https://sso.stage.redhat.com/auth/realms/redhat-external/protocol/openid-connect/token","jwks":"https://sso.stage.redhat.com/auth/realms/redhat-external/protocol/openid-connect/certs","valid_issuer":"https://sso.stage.redhat.com/auth/realms/redhat-external"}

Think about your data

""" @model """
type YourDataSync {
 _id: MongoObjectID!
 yourData: String
}

Simple case

const SOMETHING_CHANGED_TOPIC = 'something_changed';

export const resolvers = {
  Subscription: {
    somethingChanged: {
      subscribe: () => pubsub.asyncIterator(SOMETHING_CHANGED_TOPIC),
 },
{
"$Version": "4.0",
"Jetsons.Models": {
"company": {
"$Kind": "EntityType",
"$Key": [
"stockSymbol"
],
"stockSymbol": {},
"name": {
echo "Installing required software on root account"
wget https://go.microsoft.com/fwlink/?LinkID=760867
rpm -i code-1.42.1-1581433057.el7.x86_64.rpm
sudo dnf install nodejs
dnf install git
npm install -g yarn
echo "Preconfigure workshop"
mkdir ~/Workshop
cd ~/Workshop
export JAVA_8_HOME='/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/'
export JAVA_8_HOME_GRAAL='/Library/Java/JavaVirtualMachines/graalvm-ce-java8-19.3.0/Contents/Home/'
export JAVA_11_HOME='/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk1/Contents/Home/'
alias java8='export JAVA_HOME=$JAVA_8_HOME'
alias java8graal='export JAVA_HOME=$JAVA_8_HOME_GRAAL'
alias java11='export JAVA_HOME=$JAVA_11_HOME'
# default
java8
@wtrocki
wtrocki / batchLoadData.ts
Last active November 13, 2019 23:28
GraphQL Data Loader Simplified
import DataLoader = require('dataloader');
/**
* Speciallized function that can utilize batching the data basing on
* DataLoader library
*
* @param context - resolver context object that will be used to apply new loader
* @param name - name of the object we want to load
* @param id - id of the object we want to load
*/

Add abstraction for ts/js generation in resolvers

Address all TODO's

Relationship support

Subscription support

Paggination support

swagger: '2.0'
info:
title: CodeGen
description: A brand new API with no content. Go nuts!
version: '1.0'
consumes:
- application/json
produces:
- application/json
paths: