Skip to content

Instantly share code, notes, and snippets.

View lfmundim's full-sized avatar

Lucas Fonseca Mundim lfmundim

View GitHub Profile
@lfmundim
lfmundim / NuGet.md
Last active August 8, 2018 21:22
Notes on how to manage NuGet package publishing

NuGet Management

Notes on commands and configs to manage NuGet packages

Template - Setting Up

Folder structure

📁Blip.Api.Template
    📁content
        📁.template.config
            📃template.json
@lfmundim
lfmundim / SwaggerDocInNET.md
Last active August 9, 2018 00:25
Overview on how to use Swagger/Swashbuckle to document your REST APIs
@lfmundim
lfmundim / BLiPFirebase.md
Last active October 20, 2018 17:34
BLiP Firebase integration workaround

BLiP Firebase Workaround

As BLiP's integration with Firebase is not working (?) right now, I have found this workaround. Note: all tests were done using a mockup Kotlin app on Android 7.1.1 and 8.0

  1. Add Firebase and BLiP to the app
// on app level gradle
dependencies{
    [...]
    implementation 'com.google.firebase:firebase-core:16.0.1'
@lfmundim
lfmundim / BLiP_Script.md
Last active October 22, 2018 23:09
HTML Script to send user basic data to BLiP

How to send info from a script to the bot using HTML

Base script:

    <div id="chat"></div>

    <script src="https://unpkg.com/blip-chat-widget@1.3.*" type="text/javascript">
    </script>
    <script>
@lfmundim
lfmundim / FirebaseCloudMessagingAndroid.md
Created October 29, 2018 23:07
Integrating an BLiP Chat enabled Android App with Firebase Cloud Messaging

On Firebase

  1. Create a Firebase account

  2. Go to your Console and create a new project

  3. Open your newly created project and click on Grow->Cloud Messaging

  4. Click on the Android Logo in the top banner and follow the steps indicated there. They are:

    1. Write your Android Package Name in the required field. Your package name is generally the applicationId in your app-level build.gradle file
    2. Download the generated google-services.json
    3. Add Firebase to your Android project. In Android Studio:
    • in the project-level .gradle file:
@lfmundim
lfmundim / BotMigration.md
Last active November 21, 2018 17:17
Quick overview on how to migrate bots on BLiP using the Builder feature

Migrating Flows

Suppose you have a chatbot on BLiP and you want to migrate it's flow to another one, either to update your production environment with your beta one, or to create a beta using your production alltogether. With BLiP's versioning feature it is quite simple.

Create your target bot (if you haven't)

If you haven't already, create a bot that is going to receive the updated source flow. It works just as creating any bot. Ideally you would want to name it as '[BETA] BotName' or anything like that just to flag it as an obvious non-production version.

Manually update the new bot's configuration

The versioning tool works for the Builder's flow. The rest of the configuration you must do by hand. Thankfully they remain simple and you can copy-paste some of them, if it is not a problem for you (e.g: a beta and production bot can share the same Watson credentials. Note that any intents, entities and any other configuration is not credential-bound and you need to re-enter those).

Usage

After installing the package, you'll need to tell your API to use this scheme in the Startup.cs file. The simplest way is using the extension method provided with the package:

public void ConfigureServices(IServiceCollection services)
{
    // ...
    // If only a single bot is authorized
    services.UseBotAuthentication("bot authorization key");
    // If multiple bots
 services.UseBotAuthentication(authorizationKeyEnumerable); // pass any enumerable containing your keys
@lfmundim
lfmundim / BirdStub.md
Last active April 27, 2020 22:49
To be used in medium
public class Bird
{
    // whatever properties do birds have
    public BirdType Type { get; set; }
}

public enum BirdType
{
 African,
public class Bird
{
    // whatever properties do birds have
    public BirdType Type { get; set; }

    public double GetSpeed()
    {
        switch(Type)
 {
public enum BirdType
{
    African,
    American,
    European,
    Asian // new type
}