短链
Go to file
renzhiyuan a7351afd2d 更新单元测试 2026-05-29 14:36:00 +08:00
README.md 更新单元测试 2026-05-29 14:36:00 +08:00
entity.go 1 2026-05-29 14:18:26 +08:00
func.go 1 2026-05-29 14:18:26 +08:00
go.mod 1 2026-05-29 14:23:48 +08:00
option.go 1 2026-05-29 14:18:26 +08:00
request.go 1 2026-05-29 14:18:26 +08:00
short_url.go 1 2026-05-29 14:18:26 +08:00
short_url_test.go 更新单元测试 2026-05-29 14:27:57 +08:00

README.md

安装

$ go get -u gitea.cdlsxd.cn/self-tools/l_short_url
func TestBatchCreate(t *testing.T) {
in := &ShortUrlBatchCreate{
BatchName: "test_query_" + time.Now().Format("20060102150405"),
Urls: []string{
"https://www.baidu.com",
"https://github.com/trending",
"https://www.sojson.com/",
},
StartTimeStr: time.Now().Format(time.DateOnly),
EndTimeStr:   time.Now().AddDate(0, 0, 2).Format(time.DateOnly),
WithBatchMap: true,
}
res, err := NewClient(WithAuth(access)).BatchCreate(in)
t.Log(res, err)
}
func TestBatchQuery(t *testing.T) {
// 查询批次
queryIn := &BatchQueryReq{
BatchNo: 4233953069,
}

	queryRes, err := NewClient(WithAuth(access)).BatchQuery(queryIn)
	if err != nil {
		t.Errorf("BatchQuery failed: %v", err)
	}

	t.Logf("Query Response: %+v", queryRes)
}