-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from green-api/SW-1868
Added partner methods
- Loading branch information
Showing
14 changed files
with
176 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/green-api/whatsapp-api-client-golang/pkg/api" | ||
) | ||
|
||
func main() { | ||
Partner := api.GreenAPI{ | ||
PartnerToken: "gac.37ea41ed00d74bc7a0899215312fed55bfd9bcd03a1e48", | ||
} | ||
|
||
response, err := Partner.Methods().Partner().CreateInstance(map[string]interface{}{ | ||
"stateWebhook": "yes", | ||
"incomingWebhook": "yes", | ||
}) | ||
if err != nil { | ||
fmt.Println(err) | ||
} | ||
|
||
fmt.Println(response) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package methods | ||
|
||
type PartnerCategory struct { | ||
GreenAPI GreenAPIInterface | ||
} | ||
|
||
// CreateInstance is aimed to create an instace using partner account. | ||
// https://green-api.com/en/docs/partners/createInstance/ | ||
func (c PartnerCategory) CreateInstance(parameters map[string]interface{}) (map[string]interface{}, error) { | ||
return c.GreenAPI.PartnerRequest("POST", "createInstance", parameters, "") | ||
} | ||
|
||
// DeleteInstanceAccount is aimed to delete an instance using partner account. | ||
// https://green-api.com/en/docs/partners/deleteInstanceAccount/ | ||
func (c PartnerCategory) DeleteInstanceAccount(idInstance int) (map[string]interface{}, error) { | ||
return c.GreenAPI.PartnerRequest("POST", "deleteInstanceAccount", map[string]interface{}{"idInstance": idInstance}, "") | ||
} | ||
|
||
// GetInstances is aimed to get all instances on a partner account. | ||
// https://green-api.com/en/docs/partners/getInstances/ | ||
func (c PartnerCategory) GetInstances() ([]interface{}, error) { | ||
return c.GreenAPI.ArrayPartnerRequest("GET", "getInstances", nil, "") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.