top of page
Search

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:



 
 
 

Recent Posts

See All
A daily random XKCD in Teams

This builds on the previous post to get a random post rather than just the latest. That post can be found here:...

 
 
 

Komentarze


Join my mailing list

Thanks for submitting!

© 2023 by The Book Lover. Proudly created with Wix.com

bottom of page