-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
144 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
ARG VARIANT="18" | ||
|
||
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:${VARIANT} | ||
|
||
RUN apt-get update | ||
|
||
# Install Python | ||
RUN apt-get install -y python3 python3-pip python-is-python3 | ||
|
||
# Install Ruby | ||
RUN apt-get install -y ruby ruby-dev | ||
|
||
RUN gem install seamapi | ||
RUN pip install seamapi --break-system-packages | ||
|
||
USER node | ||
WORKDIR /home/node | ||
|
||
# Install dotnet | ||
RUN wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh \ | ||
&& chmod +x dotnet-install.sh \ | ||
&& ./dotnet-install.sh --channel 7.0 | ||
ENV PATH="$PATH:/home/node/.dotnet" | ||
|
||
RUN mkdir -p .config/git \ | ||
&& echo ".vscode/*" >> .config/git/ignore \ | ||
&& echo "*.code-workspace" >> .config/git/ignore \ | ||
&& echo ".history/" >> .config/git/ignore |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"name": "API Docs", | ||
"build": { | ||
"dockerfile": "Dockerfile", | ||
"args": { | ||
"VARIANT": "18" | ||
} | ||
}, | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"ms-python.python", | ||
"rebornix.Ruby", | ||
"ms-dotnettools.csharp", | ||
"ms-vsliveshare.vsliveshare", | ||
"dbaeumer.vscode-eslint", | ||
"EditorConfig.EditorConfig", | ||
"esbenp.prettier-vscode" | ||
] | ||
} | ||
}, | ||
"postCreateCommand": "cd /workspaces/api-docs/snippet-playground/javascript && npm i seamapi && cd /workspaces/api-docs/snippet-playground/csharp && ./init.sh", | ||
"remoteUser": "node" | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
indent_style = space | ||
indent_size = 2 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
* | ||
!.gitignore | ||
!README.md | ||
!Program.cs | ||
!init.sh |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using Seam.Client; | ||
|
||
var r = new string(Enumerable.Range(0, 10).Select(_ => "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"[new Random().Next(36)]).ToArray()); | ||
|
||
|
||
// Get a Seam Client | ||
var seam = new SeamClient( | ||
basePath: string.Format("https://{0}.fakeseamconnect.seam.vc", r), | ||
apiToken: "seam_apikey1_token" | ||
); | ||
|
||
var devices = seam.Devices.List(); | ||
|
||
foreach (var device in devices) | ||
{ | ||
// NOTE: in the future Console.WriteLine(device) will print | ||
// something pretty, but currently it doesn't print pretty | ||
Console.WriteLine(device.Properties.Name); | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Running C# | ||
|
||
Just run `dotnet run`, the `Program.cs` file will be run |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/usr/bin/env sh | ||
|
||
set -e | ||
set -u | ||
|
||
mv Program.cs Program.cs.bak | ||
dotnet new console --force | ||
dotnet add package seam | ||
mv Program.cs.bak Program.cs |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
* | ||
!.gitignore | ||
!README.md | ||
!main.mjs |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Running Javascript | ||
|
||
Just run `node main.mjs` |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/usr/bin/env node | ||
|
||
import Seam from "seamapi" | ||
|
||
const seam = new Seam({ | ||
endpoint: `https://r${Math.random() | ||
.toString(16) | ||
.slice(2)}.fakeseamconnect.seam.vc`, | ||
apiKey: "seam_apikey1_token", | ||
}) | ||
|
||
console.log(await seam.devices.list()) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Running Python | ||
|
||
Just run `python main.py` |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/usr/bin/env python | ||
|
||
import random | ||
from seamapi import Seam | ||
from pprint import pprint | ||
|
||
seam = Seam( | ||
api_url=f"https://pws{random.randint(0,1e6)}{random.randint(0,1e6)}.fakeseamconnect.seam.vc", | ||
api_key="seam_apikey1_token" | ||
) | ||
|
||
pprint(seam.devices.list()) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Running Ruby | ||
|
||
Just run `ruby main.rb` |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/usr/bin/env ruby | ||
|
||
require 'seamapi' | ||
|
||
random_number = rand(1e6).to_i | ||
api_url = "https://pws#{random_number}#{random_number}.fakeseamconnect.seam.vc" | ||
|
||
client = Seam::Client.new(base_uri: api_url, api_key: 'seam_apikey1_token') | ||
|
||
print client.devices.list |