CodeSwitch

Any language, any framework, always secure

Integrate authentication into your APIs effortlessly with just a few lines of code. We offer SDKs for various languages and frameworks, alongside an intuitive REST API with a public OpenAPI specification.

                    
type Mood = "happy" | "tired" | "coding";
                        
const randomMood = (): Mood =>
["happy", "tired", "coding"][Math.floor(Math.random() * 3)] as Mood;
                        
const echo = (x: T) => ({ time: Date.now(), value: x });
                            
    class Bot {
        mood = randomMood();
        talk() {
            return `Beep boop, I'm feeling ${this.mood}`;
        }
    }
                            
    console.log(echo(new Bot().talk()));
                        
                    
                        
import random
                            
names = ["Alice", "Bob", "Charlie", "Kelsey"]
moods = ["happy", "tired", "excited", "confused"]
                            
name = random.choice(names)
mood = random.choice(moods)
                            
print(f"{name} is feeling {mood} today!")
                        
                    
                        
use rand::Rng;
                            
struct Dice;
                            
impl Dice {
    fn roll() -> u8 {
        rand::thread_rng().gen_range(1..=6)
    }
}
                            
fn main() {
    let rolls: Vec = (0..3).map(|_| Dice::roll()).collect();
        println!("You rolled: {:?}", rolls);
    }
                            
                        
                            
package main
                                
import (
    "fmt"
    "math/rand"
    "time"
    )
                                    
    func main() {
        rand.Seed(time.Now().UnixNano())
        names := []string{"Rusty", "GoBot", "KelseyBot", "Byte"}
        choice := names[rand.Intn(len(names))]
        fmt.Printf("%s says: Let's build something cool!\n", choice)
    }
                                
                            
                                
#!/bin/bash
                                    
name="Kelsey"
response=$(curl -s "https://api.agify.io?name=$name")
age=$(echo $response | jq '.age')
count=$(echo $response | jq '.count')
                                    
echo "$name might be $age years old (based on $count samples)."
                                
                            
                                
names = ["Alice", "Bob", "Charlie", "Kelsey"]
                                    moods = ["happy", "tired", "excited", "confused"]

name = Enum.random(names)
                                    mood = Enum.random(moods)
                                    
IO.puts("#{name} is feeling #{mood} today!")
                                
                            
                                
import java.util.*;
                                    
public class MoodBot {
public static void main(String[] args) {
String[] names = {"Alice", "Bob", "Charlie", "Kelsey"};
String[] moods = {"happy", "tired", "excited", "confused"};
        
Random rand = new Random();
String name = names[rand.nextInt(names.length)];
String mood = moods[rand.nextInt(moods.length)];
        
System.out.println(name + " is feeling " + mood + " today!");
        }
}
                    
                

oss/acc

Open-source

We believe strongly in the value of open source: our codebase and development process is available to learn from and contribute to.

GitPulse