Skip to content

WazapIO/client-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go API client for WhatsAPI

The V2 of WhatsAPI Go

Overview

This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.

  • API version: 2.0
  • Package version: 1.0.0
  • Build package: org.openapitools.codegen.languages.GoClientCodegen

Installation

Install the following dependencies:

go get github.com/stretchr/testify/assert
go get golang.org/x/oauth2
go get golang.org/x/net/context

Put the package under your project folder and add the following in import:

import WhatsAPI "github.com/GIT_USER_ID/GIT_REPO_ID"

To use a proxy, set the environment variable HTTP_PROXY:

os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")

Configuration of Server URL

Default configuration comes with Servers field that contains server objects as defined in the OpenAPI specification.

Select Server Configuration

For using other server than the one defined on index 0 set context value sw.ContextServerIndex of type int.

ctx := context.WithValue(context.Background(), WhatsAPI.ContextServerIndex, 1)

Templated Server URL

Templated server URL is formatted using default variables from configuration or from context value sw.ContextServerVariables of type map[string]string.

ctx := context.WithValue(context.Background(), WhatsAPI.ContextServerVariables, map[string]string{
	"basePath": "v2",
})

Note, enum values are always validated and all unused variables are silently ignored.

URLs Configuration per Operation

Each operation can use different server URL defined using OperationServers map in the Configuration. An operation is uniquely identified by "{classname}Service.{nickname}" string. Similar rules for overriding default operation server index and variables applies by using sw.ContextOperationServerIndices and sw.ContextOperationServerVariables context maps.

ctx := context.WithValue(context.Background(), WhatsAPI.ContextOperationServerIndices, map[string]int{
	"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), WhatsAPI.ContextOperationServerVariables, map[string]map[string]string{
	"{classname}Service.{nickname}": {
		"port": "8443",
	},
})

Documentation for API Endpoints

All URIs are relative to /api

Class Method HTTP request Description
BusinessManagementApi FetchCatlog Get /instances/{instance_key}/business/catalog Fetches the catlog.
BusinessManagementApi SendPaymentRequest Post /instances/{instance_key}/business/payment-request Send a payment request.
GroupManagementApi AddParticipant Post /instances/{instance_key}/groups/{group_id}/participants/add Add participant.
GroupManagementApi CreateGroup Post /instances/{instance_key}/groups/create Create group.
GroupManagementApi DemoteParticipant Put /instances/{instance_key}/groups/{group_id}/participants/demote Demote participant.
GroupManagementApi GetAdminGroups Get /instances/{instance_key}/groups/admin Get admin groups.
GroupManagementApi GetAllGroups Get /instances/{instance_key}/groups/ Get all groups.
GroupManagementApi GetAllParticipants Get /instances/{instance_key}/groups/{group_id}/participants Get all participants.
GroupManagementApi GetGroup Get /instances/{instance_key}/groups/{group_id} Get group.
GroupManagementApi GetGroupFromInviteLink Get /instances/{instance_key}/groups/invite-info Get group from invite link.
GroupManagementApi GetGroupInviteCode Get /instances/{instance_key}/groups/{group_id}/invite-code Get group invite code.
GroupManagementApi JoinGroupWithLink Get /instances/{instance_key}/groups/join Join group with invite code.
GroupManagementApi LeaveGroup Delete /instances/{instance_key}/groups/{group_id}/ Leaves the group.
GroupManagementApi PromoteParticipant Put /instances/{instance_key}/groups/{group_id}/participants/promote Promote participant.
GroupManagementApi RemoveParticipant Delete /instances/{instance_key}/groups/{group_id}/participants/remove Remove participant.
GroupManagementApi SetGroupAnnounce Put /instances/{instance_key}/groups/{group_id}/announce Set group announce.
GroupManagementApi SetGroupDescription Put /instances/{instance_key}/groups/{group_id}/description Set group description.
GroupManagementApi SetGroupLocked Put /instances/{instance_key}/groups/{group_id}/lock Set group locked.
GroupManagementApi SetGroupName Put /instances/{instance_key}/groups/{group_id}/name Set group name.
GroupManagementApi SetGroupPicture Put /instances/{instance_key}/groups/{group_id}/profile-pic Set group picture.
InstanceApi ChangeWebhookUrl Put /instances/{instance_key}/webhook Change Webhook url.
InstanceApi CreateInstance Post /instances/create Creates a new instance key.
InstanceApi DeleteInstance Delete /instances/{instance_key}/delete Delete Instance.
InstanceApi GetContacts Get /instances/{instance_key}/contacts Get contacts.
InstanceApi GetInstance Get /instances/{instance_key}/ Get Instance.
InstanceApi GetQrCode Get /instances/{instance_key}/qrcode Get QrCode.
InstanceApi ListInstances Get /instances/list Get all instances.
InstanceApi LogoutInstance Delete /instances/{instance_key}/logout Logout Instance.
MessageSendingApi SendAudio Post /instances/{instance_key}/send/audio Send raw audio.
MessageSendingApi SendButtonMessage Post /instances/{instance_key}/send/buttons Send a button message.
MessageSendingApi SendButtonWithMedia Post /instances/{instance_key}/send/button-media Send a button message with a media header.
MessageSendingApi SendContact Post /instances/{instance_key}/send/contact Send a contact message.
MessageSendingApi SendDocument Post /instances/{instance_key}/send/document Send raw document.
MessageSendingApi SendGroupInvite Post /instances/{instance_key}/send/group-invite Send a group invite message
MessageSendingApi SendImage Post /instances/{instance_key}/send/image Send raw image.
MessageSendingApi SendListMessage Post /instances/{instance_key}/send/list Send a List message.
MessageSendingApi SendLocation Post /instances/{instance_key}/send/location Send a location message.
MessageSendingApi SendMediaMessage Post /instances/{instance_key}/send/media Send a media message.
MessageSendingApi SendPollMessage Post /instances/{instance_key}/send/poll Send a Poll message.
MessageSendingApi SendTemplate Post /instances/{instance_key}/send/template Send a template message.
MessageSendingApi SendTemplateWithMedia Post /instances/{instance_key}/send/template-media Send a template message with media.
MessageSendingApi SendTextMessage Post /instances/{instance_key}/send/text Send a text message.
MessageSendingApi SendVideo Post /instances/{instance_key}/send/video Send raw video.
MessageSendingApi UploadMedia Post /instances/{instance_key}/send/upload Upload media.
MessageSendingApi UploadMediaFromUrl Post /instances/{instance_key}/send/upload-url Upload media from url.
MiscellaneousApi DownloadMedia Post /instances/{instance_key}/misc/download Download media
MiscellaneousApi GetProfilePic Get /instances/{instance_key}/misc/profile-pic Get profile pic.
MiscellaneousApi GetUsersInfo Post /instances/{instance_key}/misc/user-info Fetches the users info.
MiscellaneousApi SetChatPresence Post /instances/{instance_key}/misc/chat-presence Set chat presence
MiscellaneousApi UpdateProfilePic Put /instances/{instance_key}/misc/profile-pic Update profile picture

Documentation For Models

Documentation For Authorization

ApiKeyAuth

  • Type: API key
  • API key parameter name: Authorization
  • Location: HTTP header

Note, each API key must be added to a map of map[string]APIKey where the key is: Authorization and passed in as the auth context for each request.

Documentation for Utility Methods

Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:

  • PtrBool
  • PtrInt
  • PtrInt32
  • PtrInt64
  • PtrFloat
  • PtrFloat32
  • PtrFloat64
  • PtrString
  • PtrTime

Author

[email protected]

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages