-
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,38 +6,72 @@ type GreenAPICategories struct { | |
GreenAPI methods.GreenAPIInterface | ||
} | ||
|
||
// Account category presents methods for working with the account. | ||
// https://green-api.com/en/docs/api/account/ | ||
func (c GreenAPICategories) Account() methods.AccountCategory { | ||
return methods.AccountCategory{GreenAPI: c.GreenAPI} | ||
} | ||
|
||
// Device category presents methods for working with the device (phone). | ||
// https://green-api.com/en/docs/api/phone/ | ||
func (c GreenAPICategories) Device() methods.DeviceCategory { | ||
return methods.DeviceCategory{GreenAPI: c.GreenAPI} | ||
} | ||
|
||
// Groups category presents methods for working with group chats. | ||
// https://green-api.com/en/docs/api/groups/ | ||
func (c GreenAPICategories) Groups() methods.GroupsCategory { | ||
return methods.GroupsCategory{GreenAPI: c.GreenAPI} | ||
} | ||
|
||
// Journals present methods for working with incoming and outgoing messages. | ||
// https://green-api.com/en/docs/api/journals/ | ||
func (c GreenAPICategories) Journals() methods.JournalsCategory { | ||
return methods.JournalsCategory{GreenAPI: c.GreenAPI} | ||
} | ||
|
||
// Queues category presents methods for working with a messages queue. | ||
// https://green-api.com/en/docs/api/queues/ | ||
func (c GreenAPICategories) Queues() methods.QueuesCategory { | ||
return methods.QueuesCategory{GreenAPI: c.GreenAPI} | ||
} | ||
|
||
// ReadMark category presents methods for working with chat read mark. | ||
// https://green-api.com/en/docs/api/marks/ | ||
func (c GreenAPICategories) ReadMark() methods.ReadMarkCategory { | ||
return methods.ReadMarkCategory{GreenAPI: c.GreenAPI} | ||
} | ||
|
||
// Receiving category presents methods for working with receiving events. | ||
// https://green-api.com/en/docs/api/receiving/ | ||
func (c GreenAPICategories) Receiving() methods.ReceivingCategory { | ||
return methods.ReceivingCategory{GreenAPI: c.GreenAPI} | ||
} | ||
|
||
// Sending category presents methods for sending different messages. | ||
// https://green-api.com/en/docs/api/sending/ | ||
func (c GreenAPICategories) Sending() methods.SendingCategory { | ||
return methods.SendingCategory{GreenAPI: c.GreenAPI} | ||
} | ||
|
||
// Service category presents different service methods. | ||
// https://green-api.com/en/docs/api/service/ | ||
func (c GreenAPICategories) Service() methods.ServiceCategory { | ||
return methods.ServiceCategory{GreenAPI: c.GreenAPI} | ||
} | ||
|
||
// Partner category presents exclusive methods for partners. | ||
// The partnership scheme involves deeper integration with the service | ||
// and working with a larger number of instances on your side: | ||
// | ||
// * Instance management via API | ||
// * Postpaid billing system (starting from the second month of operation) | ||
// * Daily billing (for created and not deleted instances) | ||
// * Dedicated support line | ||
// For questions regarding connection to the partnership scheme | ||
// and additional conditions, please contact us via email | ||
// at [email protected] or via chat on the website. | ||
// https://green-api.com/en/docs/partners/ | ||
func (c GreenAPICategories) Partner() methods.PartnerCategory { | ||
return methods.PartnerCategory{GreenAPI: c.GreenAPI} | ||
} |
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.