Skip to content

Instantly share code, notes, and snippets.

View nicolastakashi's full-sized avatar
🏠
Working from home

Nicolas Takashi nicolastakashi

🏠
Working from home
View GitHub Profile
// Custom Tool
---
// Prometheus is a tool that can query Prometheus for metrics.
type Prometheus struct {
CallbacksHandler callbacks.Handler
}
var _ tools.Tool = Prometheus{}
// Description returns a string describing the Prometheus tool.
import { RedocStandalone } from 'redoc';
import File from './api.json'
function App() {
return (
<RedocStandalone
specUrl={File}
/>
);
}
openapi: 3.0.0
info:
title: Todo App API
description: Todo App API.
version: v1
contact:
email: 'nicolas.tcs@hotmail.com'
name: 'Nicolas Takashi'
tags:
- name: Tasks
components:
parameters:
page:
in: query
description: Desired page
name: page
schema:
type: integer
format: int32
default: 1
components:
schemas:
Task:
type: object
required:
- name
- id
properties:
id:
description: Task unique identifier
get:
operationId: get-task
summary: Get task by id
description: Return a task
tags:
- Tasks
parameters:
- in: path
name: id
description: Task id
get:
operationId: get-tasks
summary: Returns a paged list of tasks.
description: Returns a paged list of active tasks
tags:
- Tasks
parameters:
- $ref: '../../parameters/page-parameters.yaml#/components/parameters/page'
- $ref: '../../parameters/page-parameters.yaml#/components/parameters/pageSize'
responses:
openapi: 3.0.0
info:
title: Todo App API
description: Todo App API.
version: v1
contact:
email: 'nicolas.tcs@hotmail.com'
name: 'Nicolas Takashi'
paths:
#... there more content here.
var calcularSalarioTask = CalcularSalarioAsync();
calcularSalarioTask.ContinueWith(t =>
{
var erros = t.Exception as AggregateException;
if (erros == null)
{
Console.WriteLine(t.Result);
}
try
{
var salario = await CalculaSalarioAsync();
Console.WriteLine(salario);
}
catch (Exception error)
{
Console.WriteLine(error.Message);
}