Compare commits
6 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
a7351afd2d | |
|
|
837e70ed59 | |
|
|
f2ce4b1538 | |
|
|
6b6cdc78ab | |
|
|
49f0387c1e | |
|
|
d635ad4b9e |
|
|
@ -1,8 +0,0 @@
|
|||
# 默认忽略的文件
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# 基于编辑器的 HTTP 客户端请求
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
|
||||
## 安装
|
||||
|
||||
```bash
|
||||
$ go get -u gitea.cdlsxd.cn/self-tools/l_short_url
|
||||
```
|
||||
```bash
|
||||
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)
|
||||
}
|
||||
```
|
||||
```bash
|
||||
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)
|
||||
}
|
||||
```
|
||||
4
go.mod
4
go.mod
|
|
@ -1,3 +1,3 @@
|
|||
module l_short_utl_request
|
||||
module gitea.cdlsxd.cn/self-tools/l_short_url
|
||||
|
||||
go 1.26.2
|
||||
go 1.21
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ import (
|
|||
"time"
|
||||
)
|
||||
|
||||
var access = "eW10OjkxMmU3MWE2NGI3ZjkzNzlkYWRkNWYzMzRhM2M3MjM2OTdiNjJmOTJkMThkZDY3NTNjZWI1MzMwOWIwNjE2NDg="
|
||||
|
||||
func TestBatchCreate(t *testing.T) {
|
||||
in := &ShortUrlBatchCreate{
|
||||
BatchName: "test_query_" + time.Now().Format("20060102150405"),
|
||||
|
|
@ -17,7 +19,7 @@ func TestBatchCreate(t *testing.T) {
|
|||
EndTimeStr: time.Now().AddDate(0, 0, 2).Format(time.DateOnly),
|
||||
WithBatchMap: true,
|
||||
}
|
||||
res, err := NewClient(WithAuth("eW10OjkxMmU3MWE2NGI3ZjkzNzlkYWRkNWYzMzRhM2M3MjM2OTdiNjJmOTJkMThkZDY3NTNjZWI1MzMwOWIwNjE2NDg=")).BatchCreate(in)
|
||||
res, err := NewClient(WithAuth(access)).BatchCreate(in)
|
||||
t.Log(res, err)
|
||||
}
|
||||
|
||||
|
|
@ -27,7 +29,7 @@ func TestBatchQuery(t *testing.T) {
|
|||
BatchNo: 4233953069,
|
||||
}
|
||||
|
||||
queryRes, err := NewClient().BatchQuery(queryIn)
|
||||
queryRes, err := NewClient(WithAuth(access)).BatchQuery(queryIn)
|
||||
if err != nil {
|
||||
t.Errorf("BatchQuery failed: %v", err)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue