Getting Lichess games in Teams
- benhaguenz
- May 22, 2021
- 1 min read
I wanted to play around with getting games from LiChess and displaying them in Teams. Currently just the raw PGN.
Starting with a custom connector with this Swagger definition:
swagger: '2.0'
info: {title: Lichess Games, description: '', version: '1.0'}
host: lichess.org
basePath: /api/games/user/
schemes: [https]
consumes: []
produces: []
paths:
/{username}:
get:
produces: [application/x-chess-pgn]
responses:
'200':
description: OK
schema: {type: object, title: games}
parameters:
- {in: path, name: username, type: string, required: true}
- {in: query, name: max, type: integer, required: false}
- {in: query, name: color, type: string, required: false}
- {in: query, name: pgnInJson, type: boolean, required: false}
operationId: GetGames
summary: Get games of a player
definitions: {}
parameters: {}
responses: {}
securityDefinitions: {}
security: []
tags: []
The flow is basically:

and

Starts of by splitting the input using:
split(triggerOutputs()?['body/body/content'],' ')
Then check the length.
length(variables('Game Query'))
If it's three inputs assume it's ok, otherwise show the help message.
For some reason the PGN games are passed through as a Base64 encoded string in the body content variable, so use
decodeBase64(outputs('Get_games_of_a_player')?['body']['$content'])
to get the human readable version.
The result is:

Komentarze