8 changed files with 545 additions and 6 deletions
-
1.goreleaser.yml
-
6cmd/main/main.go
-
200docs/docs.go
-
179docs/swagger.json
-
114docs/swagger.yaml
-
8internal/auth/auth.go
-
12internal/index/index.go
-
31internal/whatsapp/whatsapp.go
@ -0,0 +1,200 @@ |
|||
// Package docs GENERATED BY SWAG; DO NOT EDIT
|
|||
// This file was generated by swaggo/swag
|
|||
package docs |
|||
|
|||
import "github.com/swaggo/swag" |
|||
|
|||
const docTemplate = `{ |
|||
"schemes": {{ marshal .Schemes }}, |
|||
"swagger": "2.0", |
|||
"info": { |
|||
"description": "{{escape .Description}}", |
|||
"title": "{{.Title}}", |
|||
"contact": { |
|||
"name": "Dimas Restu Hidayanto", |
|||
"url": "https://github.com/dimaskiddo", |
|||
"email": "drh.dimasrestu@gmail.com" |
|||
}, |
|||
"version": "{{.Version}}" |
|||
}, |
|||
"host": "{{.Host}}", |
|||
"basePath": "{{.BasePath}}", |
|||
"paths": { |
|||
"/api/v1/whatsapp": { |
|||
"get": { |
|||
"description": "Get The Server Status", |
|||
"consumes": [ |
|||
"*/*" |
|||
], |
|||
"produces": [ |
|||
"application/json" |
|||
], |
|||
"tags": [ |
|||
"Root" |
|||
], |
|||
"summary": "Show The Status of The Server", |
|||
"responses": { |
|||
"200": { |
|||
"description": "" |
|||
} |
|||
} |
|||
} |
|||
}, |
|||
"/api/v1/whatsapp/auth": { |
|||
"get": { |
|||
"security": [ |
|||
{ |
|||
"BasicAuth": [] |
|||
} |
|||
], |
|||
"description": "Get Authentication Token", |
|||
"consumes": [ |
|||
"*/*" |
|||
], |
|||
"produces": [ |
|||
"application/json" |
|||
], |
|||
"tags": [ |
|||
"Root" |
|||
], |
|||
"summary": "Generate Authentication Token", |
|||
"responses": { |
|||
"200": { |
|||
"description": "" |
|||
} |
|||
} |
|||
} |
|||
}, |
|||
"/api/v1/whatsapp/login": { |
|||
"post": { |
|||
"security": [ |
|||
{ |
|||
"BearerAuth": [] |
|||
} |
|||
], |
|||
"description": "Get QR Code for WhatsApp Multi-Device Login", |
|||
"consumes": [ |
|||
"*/*" |
|||
], |
|||
"produces": [ |
|||
"application/json", |
|||
"text/html" |
|||
], |
|||
"tags": [ |
|||
"WhatsApp" |
|||
], |
|||
"summary": "Generate QR Code for WhatsApp Multi-Device Login", |
|||
"parameters": [ |
|||
{ |
|||
"enum": [ |
|||
"html", |
|||
"json" |
|||
], |
|||
"type": "string", |
|||
"default": "html", |
|||
"description": "Change Output Format in HTML or JSON", |
|||
"name": "output", |
|||
"in": "query" |
|||
} |
|||
], |
|||
"responses": { |
|||
"200": { |
|||
"description": "" |
|||
} |
|||
} |
|||
} |
|||
}, |
|||
"/api/v1/whatsapp/logout": { |
|||
"post": { |
|||
"security": [ |
|||
{ |
|||
"BearerAuth": [] |
|||
} |
|||
], |
|||
"description": "Make Device Logout from WhatsApp Multi-Device", |
|||
"consumes": [ |
|||
"*/*" |
|||
], |
|||
"produces": [ |
|||
"application/json" |
|||
], |
|||
"tags": [ |
|||
"WhatsApp" |
|||
], |
|||
"summary": "Logout Device from WhatsApp Multi-Device", |
|||
"responses": { |
|||
"200": { |
|||
"description": "" |
|||
} |
|||
} |
|||
} |
|||
}, |
|||
"/api/v1/whatsapp/send/text": { |
|||
"post": { |
|||
"security": [ |
|||
{ |
|||
"BearerAuth": [] |
|||
} |
|||
], |
|||
"description": "Make Device Logout from WhatsApp Multi-Device", |
|||
"consumes": [ |
|||
"*/*" |
|||
], |
|||
"produces": [ |
|||
"application/json" |
|||
], |
|||
"tags": [ |
|||
"WhatsApp" |
|||
], |
|||
"summary": "Logout Device from WhatsApp Multi-Device", |
|||
"parameters": [ |
|||
{ |
|||
"type": "string", |
|||
"description": "Destination Phone Number", |
|||
"name": "msisdn", |
|||
"in": "query", |
|||
"required": true |
|||
}, |
|||
{ |
|||
"type": "string", |
|||
"description": "Text Message Content", |
|||
"name": "message", |
|||
"in": "query", |
|||
"required": true |
|||
} |
|||
], |
|||
"responses": { |
|||
"200": { |
|||
"description": "" |
|||
} |
|||
} |
|||
} |
|||
} |
|||
}, |
|||
"securityDefinitions": { |
|||
"BasicAuth": { |
|||
"type": "basic" |
|||
}, |
|||
"BearerAuth": { |
|||
"type": "apiKey", |
|||
"name": "Authorization", |
|||
"in": "header" |
|||
} |
|||
} |
|||
}` |
|||
|
|||
// SwaggerInfo holds exported Swagger Info so clients can modify it
|
|||
var SwaggerInfo = &swag.Spec{ |
|||
Version: "1.x", |
|||
Host: "127.0.0.1:3000", |
|||
BasePath: "", |
|||
Schemes: []string{"http"}, |
|||
Title: "Go WhatsApp Multi-Device REST API", |
|||
Description: "This is WhatsApp Multi-Device Implementation in Go REST API", |
|||
InfoInstanceName: "swagger", |
|||
SwaggerTemplate: docTemplate, |
|||
} |
|||
|
|||
func init() { |
|||
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo) |
|||
} |
|||
@ -0,0 +1,179 @@ |
|||
{ |
|||
"schemes": [ |
|||
"http" |
|||
], |
|||
"swagger": "2.0", |
|||
"info": { |
|||
"description": "This is WhatsApp Multi-Device Implementation in Go REST API", |
|||
"title": "Go WhatsApp Multi-Device REST API", |
|||
"contact": { |
|||
"name": "Dimas Restu Hidayanto", |
|||
"url": "https://github.com/dimaskiddo", |
|||
"email": "drh.dimasrestu@gmail.com" |
|||
}, |
|||
"version": "1.x" |
|||
}, |
|||
"host": "127.0.0.1:3000", |
|||
"paths": { |
|||
"/api/v1/whatsapp": { |
|||
"get": { |
|||
"description": "Get The Server Status", |
|||
"consumes": [ |
|||
"*/*" |
|||
], |
|||
"produces": [ |
|||
"application/json" |
|||
], |
|||
"tags": [ |
|||
"Root" |
|||
], |
|||
"summary": "Show The Status of The Server", |
|||
"responses": { |
|||
"200": { |
|||
"description": "" |
|||
} |
|||
} |
|||
} |
|||
}, |
|||
"/api/v1/whatsapp/auth": { |
|||
"get": { |
|||
"security": [ |
|||
{ |
|||
"BasicAuth": [] |
|||
} |
|||
], |
|||
"description": "Get Authentication Token", |
|||
"consumes": [ |
|||
"*/*" |
|||
], |
|||
"produces": [ |
|||
"application/json" |
|||
], |
|||
"tags": [ |
|||
"Root" |
|||
], |
|||
"summary": "Generate Authentication Token", |
|||
"responses": { |
|||
"200": { |
|||
"description": "" |
|||
} |
|||
} |
|||
} |
|||
}, |
|||
"/api/v1/whatsapp/login": { |
|||
"post": { |
|||
"security": [ |
|||
{ |
|||
"BearerAuth": [] |
|||
} |
|||
], |
|||
"description": "Get QR Code for WhatsApp Multi-Device Login", |
|||
"consumes": [ |
|||
"*/*" |
|||
], |
|||
"produces": [ |
|||
"application/json", |
|||
"text/html" |
|||
], |
|||
"tags": [ |
|||
"WhatsApp" |
|||
], |
|||
"summary": "Generate QR Code for WhatsApp Multi-Device Login", |
|||
"parameters": [ |
|||
{ |
|||
"enum": [ |
|||
"html", |
|||
"json" |
|||
], |
|||
"type": "string", |
|||
"default": "html", |
|||
"description": "Change Output Format in HTML or JSON", |
|||
"name": "output", |
|||
"in": "query" |
|||
} |
|||
], |
|||
"responses": { |
|||
"200": { |
|||
"description": "" |
|||
} |
|||
} |
|||
} |
|||
}, |
|||
"/api/v1/whatsapp/logout": { |
|||
"post": { |
|||
"security": [ |
|||
{ |
|||
"BearerAuth": [] |
|||
} |
|||
], |
|||
"description": "Make Device Logout from WhatsApp Multi-Device", |
|||
"consumes": [ |
|||
"*/*" |
|||
], |
|||
"produces": [ |
|||
"application/json" |
|||
], |
|||
"tags": [ |
|||
"WhatsApp" |
|||
], |
|||
"summary": "Logout Device from WhatsApp Multi-Device", |
|||
"responses": { |
|||
"200": { |
|||
"description": "" |
|||
} |
|||
} |
|||
} |
|||
}, |
|||
"/api/v1/whatsapp/send/text": { |
|||
"post": { |
|||
"security": [ |
|||
{ |
|||
"BearerAuth": [] |
|||
} |
|||
], |
|||
"description": "Make Device Logout from WhatsApp Multi-Device", |
|||
"consumes": [ |
|||
"*/*" |
|||
], |
|||
"produces": [ |
|||
"application/json" |
|||
], |
|||
"tags": [ |
|||
"WhatsApp" |
|||
], |
|||
"summary": "Logout Device from WhatsApp Multi-Device", |
|||
"parameters": [ |
|||
{ |
|||
"type": "string", |
|||
"description": "Destination Phone Number", |
|||
"name": "msisdn", |
|||
"in": "query", |
|||
"required": true |
|||
}, |
|||
{ |
|||
"type": "string", |
|||
"description": "Text Message Content", |
|||
"name": "message", |
|||
"in": "query", |
|||
"required": true |
|||
} |
|||
], |
|||
"responses": { |
|||
"200": { |
|||
"description": "" |
|||
} |
|||
} |
|||
} |
|||
} |
|||
}, |
|||
"securityDefinitions": { |
|||
"BasicAuth": { |
|||
"type": "basic" |
|||
}, |
|||
"BearerAuth": { |
|||
"type": "apiKey", |
|||
"name": "Authorization", |
|||
"in": "header" |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,114 @@ |
|||
host: 127.0.0.1:3000 |
|||
info: |
|||
contact: |
|||
email: drh.dimasrestu@gmail.com |
|||
name: Dimas Restu Hidayanto |
|||
url: https://github.com/dimaskiddo |
|||
description: This is WhatsApp Multi-Device Implementation in Go REST API |
|||
title: Go WhatsApp Multi-Device REST API |
|||
version: 1.x |
|||
paths: |
|||
/api/v1/whatsapp: |
|||
get: |
|||
consumes: |
|||
- '*/*' |
|||
description: Get The Server Status |
|||
produces: |
|||
- application/json |
|||
responses: |
|||
"200": |
|||
description: "" |
|||
summary: Show The Status of The Server |
|||
tags: |
|||
- Root |
|||
/api/v1/whatsapp/auth: |
|||
get: |
|||
consumes: |
|||
- '*/*' |
|||
description: Get Authentication Token |
|||
produces: |
|||
- application/json |
|||
responses: |
|||
"200": |
|||
description: "" |
|||
security: |
|||
- BasicAuth: [] |
|||
summary: Generate Authentication Token |
|||
tags: |
|||
- Root |
|||
/api/v1/whatsapp/login: |
|||
post: |
|||
consumes: |
|||
- '*/*' |
|||
description: Get QR Code for WhatsApp Multi-Device Login |
|||
parameters: |
|||
- default: html |
|||
description: Change Output Format in HTML or JSON |
|||
enum: |
|||
- html |
|||
- json |
|||
in: query |
|||
name: output |
|||
type: string |
|||
produces: |
|||
- application/json |
|||
- text/html |
|||
responses: |
|||
"200": |
|||
description: "" |
|||
security: |
|||
- BearerAuth: [] |
|||
summary: Generate QR Code for WhatsApp Multi-Device Login |
|||
tags: |
|||
- WhatsApp |
|||
/api/v1/whatsapp/logout: |
|||
post: |
|||
consumes: |
|||
- '*/*' |
|||
description: Make Device Logout from WhatsApp Multi-Device |
|||
produces: |
|||
- application/json |
|||
responses: |
|||
"200": |
|||
description: "" |
|||
security: |
|||
- BearerAuth: [] |
|||
summary: Logout Device from WhatsApp Multi-Device |
|||
tags: |
|||
- WhatsApp |
|||
/api/v1/whatsapp/send/text: |
|||
post: |
|||
consumes: |
|||
- '*/*' |
|||
description: Make Device Logout from WhatsApp Multi-Device |
|||
parameters: |
|||
- description: Destination Phone Number |
|||
in: query |
|||
name: msisdn |
|||
required: true |
|||
type: string |
|||
- description: Text Message Content |
|||
in: query |
|||
name: message |
|||
required: true |
|||
type: string |
|||
produces: |
|||
- application/json |
|||
responses: |
|||
"200": |
|||
description: "" |
|||
security: |
|||
- BearerAuth: [] |
|||
summary: Logout Device from WhatsApp Multi-Device |
|||
tags: |
|||
- WhatsApp |
|||
schemes: |
|||
- http |
|||
securityDefinitions: |
|||
BasicAuth: |
|||
type: basic |
|||
BearerAuth: |
|||
in: header |
|||
name: Authorization |
|||
type: apiKey |
|||
swagger: "2.0" |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue