Coder Social home page Coder Social logo

jh1x000f93 / gourl Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 3 KB

oUrl es un paquete en Go diseñado para acortar URLs utilizando un servicio de acortamiento de URL externo. Este paquete incluye una función llamada `Short` que facilita la tarea de acortar URLs largas.

Go 100.00%

gourl's Introduction

GoUrl

GoUrl es un paquete en Go diseñado para acortar URLs utilizando un servicio de acortamiento de URL externo. Este paquete incluye una función llamada Short que facilita la tarea de acortar URLs largas.

Uso

Para utilizar este paquete, primero importa el paquete GoUrl en tu proyecto:

go get github.com/JH1x000f93/GoURL
import "github.com/JH1x000f93/GoURL"

A continuación, puedes usar la función Short de la siguiente manera:

package main

import (
    "fmt"

    "github.com/JH1x000f93/GoURL"
)
func main(){
    url := "https://example.com/long"
    apiKey := "678GHJghj78IG0osh7GJi7hmK"

    shortResponse, err := GoUrl.Short(url, apiKey)
    if err != nil {
        fmt.Fatal(err)
    }

    if shortResponse.Status == "OK" {
        fmt.Println(shortResponse.Short)
    } else {
        fmt.Println("Error: ", shortResponse.Info)
    }

La función Short toma dos argumentos: la URL larga que deseas acortar y una APIKEY para autenticarte con el servicio de acortamiento de URL externo. Devolverá una estructura ShortResponse que contiene información sobre la respuesta, incluido el enlace acortado si la solicitud se realizó correctamente.

Puedes optener una APIKEY Aqui

Estructura de Respuesta (ShortResponse)

La estructura ShortResponse se utiliza para representar la respuesta JSON del servicio de acortamiento de URL. Puede incluir los siguientes campos:

  • Status: El estado de la solicitud.
  • Permalink: El enlace permanente (si está disponible).
  • Short: El enlace acortado.
  • Info: Información adicional (si está disponible).

Contribución

Si deseas contribuir a este proyecto, ¡no dudes en abrir una solicitud de extracción (pull request)!

gourl's People

Contributors

jh1x000f93 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.