Skip to content

Commit

Permalink
feat(wecom): jssdk add ticket get
Browse files Browse the repository at this point in the history
  • Loading branch information
Matrix-X committed May 30, 2023
1 parent 6b199a8 commit 29067a6
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/work/jssdk/client.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package jssdk

import (
"context"
"github.com/ArtisanCloud/PowerLibs/v3/object"
"github.com/ArtisanCloud/PowerWeChat/v3/src/basicService/jssdk"
"github.com/ArtisanCloud/PowerWeChat/v3/src/kernel"
response2 "github.com/ArtisanCloud/PowerWeChat/v3/src/work/jssdk/response"
)

type Client struct {
Expand Down Expand Up @@ -38,3 +41,15 @@ func (comp *Client) OverrideGetAppID() {
func (comp *Client) GetAgentConfigArray() {

}

func (comp *Client) GetTicket(ctx context.Context) (*response2.ResponseGetTicket, error) {
result := &response2.ResponseGetTicket{}

params := &object.StringMap{
"type": "agent_config",
}

_, err := comp.BaseClient.HttpGet(ctx, "cgi-bin/ticket/get", params, nil, result)

return result, err
}
10 changes: 10 additions & 0 deletions src/work/jssdk/response/response.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package response

import "github.com/ArtisanCloud/PowerWeChat/v3/src/kernel/response"

type ResponseGetTicket struct {
response.ResponseWork

Ticket string `json:"ticket"`
ExpiresIn int `json:"expires_in"`
}

0 comments on commit 29067a6

Please sign in to comment.