-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexample_test.go
More file actions
46 lines (39 loc) · 971 Bytes
/
Copy pathexample_test.go
File metadata and controls
46 lines (39 loc) · 971 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package dpmaconnect_test
import (
"fmt"
"time"
dpma "github.com/patent-dev/dpma-connect-plus"
)
func ExampleNewClient() {
config := dpma.DefaultConfig()
config.Username = "your-username"
config.Password = "your-password"
client, err := dpma.NewClient(config)
if err != nil {
panic(err)
}
fmt.Println(client != nil)
// Output: true
}
func ExampleValidatePatentQuery() {
// A valid query against the patent field codes returns nil.
fmt.Println(dpma.ValidatePatentQuery("TI=Elektrofahrzeug AND INH=Siemens"))
// An unknown field code is rejected.
fmt.Println(dpma.ValidatePatentQuery("MARKE=test") != nil)
// Output:
// <nil>
// true
}
func ExampleFormatPublicationWeek() {
pubWeek, err := dpma.FormatPublicationWeek(2024, 45)
if err != nil {
panic(err)
}
fmt.Println(pubWeek)
// Output: 202445
}
func ExampleFormatDate() {
date := time.Date(2024, 10, 23, 0, 0, 0, 0, time.UTC)
fmt.Println(dpma.FormatDate(date))
// Output: 2024-10-23
}