dpmaconnect

package module
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 16, 2026 License: MIT Imports: 13 Imported by: 0

README

DPMA Connect Plus Go Client

Go Reference

A Go client library for the German Patent and Trademark Office (DPMA) Connect Plus REST API.

Getting Started

Authentication

DPMA Connect Plus is a paid service requiring authentication:

Installation

go get github.com/patent-dev/dpma-connect-plus

Quick Start

package main

import (
    "context"
    "fmt"
    "log"

    dpma "github.com/patent-dev/dpma-connect-plus"
)

func main() {
    client, err := dpma.NewClient(&dpma.Config{
        Username: "your-dpma-username",
        Password: "your-dpma-password",
    })
    if err != nil {
        log.Fatal(err)
    }

    ctx := context.Background()

    // Get service version
    version, err := client.GetVersion(ctx, dpma.ServicePatent)
    if err != nil {
        log.Fatal(err)
    }
    fmt.Printf("Version: %s\n", version)

    // Validate query before sending (optional but recommended)
    if err := dpma.ValidatePatentQuery("TI=Elektrofahrzeug"); err != nil {
        log.Fatal(err)
    }

    // Search patents (uses DPMAregister expert search syntax)
    results, err := client.SearchPatents(ctx, "TI=Elektrofahrzeug")
    if err != nil {
        log.Fatal(err)
    }
    fmt.Printf("Results: %d bytes\n", len(results))
}

API Methods

All methods accept context.Context for timeout and cancellation support.

Common Operations
// Get service version
GetVersion(ctx, service string) (string, error)

Use the service constants: dpma.ServicePatent, dpma.ServiceDesign, dpma.ServiceTrademark.

Query Validation
// Validate a query against service-specific field codes (returns nil or error)
ValidatePatentQuery(query string) error
ValidateDesignQuery(query string) error
ValidateTrademarkQuery(query string) error

For advanced usage (tokenization, field inspection), use the query sub-package directly.

Patent Service
// Search patents and utility models
SearchPatents(ctx, query string) ([]byte, error)

// Get patent info by registered number
GetPatentInfo(ctx, registeredNumber string) ([]byte, error)

// Get searchable full text for a document
GetSearchableFullText(ctx, documentID string) ([]byte, error)

// Download single patent publication PDF
GetPatentPublicationPDF(ctx, documentID string) ([]byte, error)

// Weekly bulk downloads (XML)
GetDisclosureDocumentsXML(ctx, year, week int) ([]byte, error)
GetPatentSpecificationsXML(ctx, year, week int) ([]byte, error)
GetUtilityModelsXML(ctx, year, week int) ([]byte, error)
GetPublicationDataXML(ctx, year, week int) ([]byte, error)
GetApplicantCitationsXML(ctx, year, week int) ([]byte, error)
GetEuropeanPatentSpecificationsXML(ctx, year, week int) ([]byte, error)

// Weekly bulk downloads (PDF)
GetDisclosureDocumentsPDF(ctx, year, week int) ([]byte, error)
GetPatentSpecificationsPDF(ctx, year, week int) ([]byte, error)
GetEuropeanPatentSpecificationsPDF(ctx, year, week int) ([]byte, error)
GetUtilityModelsPDF(ctx, year, week int) ([]byte, error)

// Register extract
GetPatentRegisterExtract(ctx, date time.Time, period string) ([]byte, error)
Design Service
// Search designs
SearchDesigns(ctx, query string) ([]byte, error)

// Get design info by design number
GetDesignInfo(ctx, designNumber string) ([]byte, error)

// Get design image/thumbnail
GetDesignImage(ctx, designNumber, imageNumber string) ([]byte, error)
GetDesignThumbnail(ctx, designNumber, thumbnailNumber string) ([]byte, error)

// Weekly bulk downloads
GetDesignBibliographicDataXML(ctx, year, week int) ([]byte, error)
GetDesignImages(ctx, year, week int) ([]byte, error)

// Register extract
GetDesignRegisterExtract(ctx, date time.Time, period string) ([]byte, error)
Trademark Service
// Search trademarks
SearchTrademarks(ctx, query string) ([]byte, error)

// Get trademark info by application number
GetTrademarkInfo(ctx, applicationNumber string) ([]byte, error)

// Get trademark image/thumbnail
GetTrademarkImage(ctx, applicationNumber string) ([]byte, error)
GetTrademarkThumbnail(ctx, applicationNumber string) ([]byte, error)

// Weekly bulk downloads
GetTrademarkBibDataApplied(ctx, year, week int) ([]byte, error)
GetTrademarkBibDataRegistered(ctx, year, week int) ([]byte, error)
GetTrademarkBibDataRejected(ctx, year, week int) ([]byte, error)

// Register extract
GetTrademarkRegisterExtract(ctx, date time.Time, period string) ([]byte, error)
Streaming Downloads (Memory-Efficient)

Every bulk download and register extract method has a *Stream variant that writes to an io.Writer:

// Patent streams
GetDisclosureDocumentsXMLStream(ctx, year, week int, dst io.Writer) error
GetPatentSpecificationsXMLStream(ctx, year, week int, dst io.Writer) error
GetUtilityModelsXMLStream(ctx, year, week int, dst io.Writer) error
GetPublicationDataXMLStream(ctx, year, week int, dst io.Writer) error
GetApplicantCitationsXMLStream(ctx, year, week int, dst io.Writer) error
GetEuropeanPatentSpecificationsXMLStream(ctx, year, week int, dst io.Writer) error
GetDisclosureDocumentsPDFStream(ctx, year, week int, dst io.Writer) error
GetPatentSpecificationsPDFStream(ctx, year, week int, dst io.Writer) error
GetEuropeanPatentSpecificationsPDFStream(ctx, year, week int, dst io.Writer) error
GetUtilityModelsPDFStream(ctx, year, week int, dst io.Writer) error
GetPatentRegisterExtractStream(ctx, date time.Time, period string, dst io.Writer) error

// Design streams
GetDesignBibliographicDataXMLStream(ctx, year, week int, dst io.Writer) error
GetDesignImagesStream(ctx, year, week int, dst io.Writer) error
GetDesignRegisterExtractStream(ctx, date time.Time, period string, dst io.Writer) error

// Trademark streams
GetTrademarkBibDataAppliedStream(ctx, year, week int, dst io.Writer) error
GetTrademarkBibDataRegisteredStream(ctx, year, week int, dst io.Writer) error
GetTrademarkBibDataRejectedStream(ctx, year, week int, dst io.Writer) error
GetTrademarkRegisterExtractStream(ctx, date time.Time, period string, dst io.Writer) error

Configuration

config := &dpma.Config{
    Username: "your-username",           // Required
    Password: "your-password",           // Required
    BaseURL:  "https://dpmaconnect.dpma.de/dpmaws/rest-services", // Default
    Timeout:  20 * time.Minute,           // Request timeout (default: 20 minutes)
    HTTPClient: myCustomHTTPClient,      // Optional: provide your own *http.Client
}

client, err := dpma.NewClient(config)

Usage Examples

Download Patent PDF
ctx := context.Background()
pdf, err := client.GetPatentPublicationPDF(ctx, "DE102023000001A1")
if err != nil {
    log.Fatal(err)
}

err = os.WriteFile("patent.pdf", pdf, 0644)
if err != nil {
    log.Fatal(err)
}
Download Publication Week Data
ctx := context.Background()

zipData, err := client.GetDisclosureDocumentsXML(ctx, 2024, 45)
if err != nil {
    if _, ok := err.(*dpma.DataNotAvailableError); ok {
        fmt.Println("Data not available for this week")
        return
    }
    log.Fatal(err)
}

err = os.WriteFile("disclosure_202445.zip", zipData, 0644)
if err != nil {
    log.Fatal(err)
}
Stream Large Files
ctx := context.Background()

file, err := os.Create("patents_202445.zip")
if err != nil {
    log.Fatal(err)
}
defer file.Close()

err = client.GetPatentSpecificationsXMLStream(ctx, 2024, 45, file)
if err != nil {
    log.Fatal(err)
}
Search Designs
ctx := context.Background()

// Validate query against design field codes
if err := dpma.ValidateDesignQuery("INH=Samsung"); err != nil {
    log.Fatal(err)
}

results, err := client.SearchDesigns(ctx, "INH=Samsung")
if err != nil {
    log.Fatal(err)
}

fmt.Printf("Received %d bytes of XML results\n", len(results))
Register Extract
ctx := context.Background()

date := time.Date(2024, 10, 23, 0, 0, 0, 0, time.UTC)
data, err := client.GetPatentRegisterExtract(ctx, date, dpma.PeriodDaily)
if err != nil {
    log.Fatal(err)
}

fmt.Printf("Register extract: %d bytes\n", len(data))

Query Validation

The query sub-package provides a parser and validator for DPMAregister expert search syntax:

import "github.com/patent-dev/dpma-connect-plus/query"

// Parse and validate a patent query
q, err := query.ParseQuery("TI=Elektrofahrzeug AND INH=Siemens", query.ServicePatent)
if err != nil {
    log.Fatal(err)
}
if err := q.Validate(); err != nil {
    log.Fatal(err) // e.g. unknown field, unmatched parentheses
}

// Inspect the query
fmt.Println(q.GetFields())  // ["TI", "INH"]
fmt.Println(q.HasField("TI")) // true

// Validate against a specific service
q, _ = query.ParseQuery("MARKE=test", query.ServiceTrademark) // valid
q, _ = query.ParseQuery("MARKE=test", query.ServicePatent)    // invalid: unknown field

// Look up field definitions
f, ok := query.GetField("TI", query.ServicePatent)
fmt.Println(f.Description) // "title / designation"

// List all valid fields for a service
fields := query.GetValidFields(query.ServiceDesign)
Features
  • Tokenizer with support for quoted values, comparison operators (=, >=, <=, >, <), parentheses, and curly braces (procedure data)
  • Field validation per service (Patent, Design, Trademark) based on official DPMAregister field codes
  • Bracket and brace matching
  • Recognizes both English (AND, OR, NOT) and German (UND, ODER, NICHT) Boolean operators
  • Field lookup with German name, English description, and input type (text/date)

Search Query Syntax

All search methods use DPMAregister expert search syntax. The format is FIELD=value with Boolean operators AND, OR, NOT.

Patent Field Codes
Code Description
TI Title/designation
INH Applicant/proprietor
IN Inventor
IC IPC classification
AKZ File number
PN Publication number
PUB Publication date
AB Abstract
Design Field Codes
Code Description
TI Designation
INH Proprietor
ENTW Designer
ERZ Product(s)
WKL Commodity class
RN Registration number
DNR Design number
Trademark Field Codes
Code Description
md Trademark text
INH Proprietor
WKL Class(es)

For a full reference, see the DPMAregister help pages:

Error Handling

The library provides custom error types for different scenarios:

// Resource not found (404)
if notFoundErr, ok := err.(*dpma.NotFoundError); ok {
    fmt.Printf("Not found: %s %s\n", notFoundErr.Resource, notFoundErr.ID)
}

// Data not available (common for old/future publication weeks)
if _, ok := err.(*dpma.DataNotAvailableError); ok {
    fmt.Println("Data not available for the requested period")
}

// Generic API errors
if apiErr, ok := err.(*dpma.APIError); ok {
    fmt.Printf("API error: %s (code: %s, HTTP %d)\n", apiErr.Message, apiErr.Code, apiErr.StatusCode)
}

// XML parsing failures (malformed response data)
if xmlErr, ok := err.(*dpma.XMLParseError); ok {
    fmt.Printf("Failed to parse response in %s: %v\n", xmlErr.Operation, xmlErr.Unwrap())
}

Date and Week Formatting

Publication Week Format

Publication weeks use YYYYWW format (6 digits):

pubWeek, err := dpma.FormatPublicationWeek(2024, 45)  // Returns "202445", nil

year, week, err := dpma.ParsePublicationWeek("202445")  // Returns 2024, 45, nil
Register Extract Date Format

Register extracts use YYYY-MM-DD format:

date := time.Date(2024, 10, 23, 0, 0, 0, 0, time.UTC)
dateStr := dpma.FormatDate(date)  // Returns "2024-10-23"

Services

DPMA Connect Plus provides three services:

Service Description Constant
Patents & Utility Models Patent applications, grants, utility models dpma.ServicePatent
Designs Design applications and registrations dpma.ServiceDesign
Trademarks Trademark applications and registrations dpma.ServiceTrademark

Package Structure

├── client.go              # Core client (Config, NewClient, GetVersion)
├── client_patent.go       # Patent service methods
├── client_design.go       # Design service methods
├── client_trademark.go    # Trademark service methods
├── errors.go              # Custom error types
├── helpers.go             # Date/week formatting, constants
├── query/                 # Query parser and field validation
│   ├── query.go           # Parser, tokenizer, validator
│   ├── fields.go          # Field definitions per service
│   └── query_test.go      # Query package tests
├── client_test.go         # Core unit tests
├── client_patent_test.go  # Patent unit tests
├── client_design_test.go  # Design unit tests
├── client_trademark_test.go # Trademark unit tests
├── integration_test.go    # Integration tests (real API)
├── generated/             # Auto-generated OpenAPI code
│   ├── types_gen.go       # Generated types
│   └── client_gen.go      # Generated client
├── openapi.yaml           # OpenAPI 3.0 specification
└── demo/                  # Interactive demo application
    └── demo.go

Implementation

This library follows a clean architecture:

  1. OpenAPI Specification: Hand-crafted openapi.yaml based on official DPMA documentation
  2. Code Generation: Types and client generated using oapi-codegen
  3. Idiomatic Wrapper: Clean Go client wrapping generated code with error handling and convenience methods

Testing

Unit Tests (Mock Server)

Offline tests using mock HTTP server with realistic responses:

go test -v
go test -v -cover
Integration Tests (Real API)

Tests that make actual requests to the DPMA API:

export DPMA_CONNECT_PLUS_USERNAME=your-username
export DPMA_CONNECT_PLUS_PASSWORD=your-password

go test -tags=integration -v

Note: Integration tests require valid DPMA Connect Plus credentials and will skip if environment variables are not set.

Demo Application

An interactive demo application is included:

export DPMA_CONNECT_PLUS_USERNAME=your-username
export DPMA_CONNECT_PLUS_PASSWORD=your-password

cd demo
go run demo.go

The demo provides an interactive menu for testing all three services: patents, designs, and trademarks.

Implementation Status

All endpoints defined in the DPMA Connect Plus API are implemented. Verification status depends on the permissions granted to the test account.

Fully Verified

The following endpoints have been tested against the live API with real data:

Service Endpoint Description
General GetVersion Service version info
Patent SearchPatent Expert search
Patent GetRegisterInfo Register data for a patent
Patent GetFulltextXML / Stream Full-text XML
Patent GetFulltextPDF / Stream Full-text PDF
Patent GetDocumentIdList Document IDs for a publication week
Patent GetBulkFulltextXML / Stream Bulk full-text XML
Patent GetBulkFulltextPDF / Stream Bulk full-text PDF
Patent GetRegisterExtractXML / Stream Register extract
Patent GetDisclosureDocumentsXML / Stream Weekly disclosure documents
Design SearchDesign Expert search
Design GetDesignRegisterInfo Register data for a design
Trademark SearchTrademark Expert search
Trademark GetTrademarkRegisterInfo Register data for a trademark
Not Yet Verified (Permission-Restricted)

The following endpoints are implemented but could not be verified with the current test account. We are in talks with DPMA to achieve broader test coverage.

Service Endpoint Description
Patent GetPublicationDataXML / Stream Weekly publication data
Patent GetApplicantCitationsXML / Stream Applicant citations
Design GetDesignBibliographicDataXML / Stream Bibliographic bulk data
Design GetDesignImages / Stream Design images bulk download
Trademark GetTrademarkBibDataApplied / Stream Applied trademarks bulk data
Trademark GetTrademarkBibDataRegistered / Stream Registered trademarks bulk data
Trademark GetTrademarkBibDataRejected / Stream Rejected trademarks bulk data

Data Availability

  • Publication Data: Updated weekly
    • Patents/Utility Models: Thursdays
    • Designs/Trademarks: Fridays
  • Register Data: Updated daily
  • Historical Data: Varies by document type

Note: "Data not available" errors are common for:

  • Future publication weeks
  • Old publication weeks (before digital archiving)
  • Weeks with no publications

Development

Regenerating from OpenAPI

If the OpenAPI spec is updated:

go install github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen@latest

oapi-codegen -package generated -generate types openapi.yaml > generated/types_gen.go
oapi-codegen -package generated -generate client openapi.yaml > generated/client_gen.go
Code Quality
go fmt ./...
go vet ./...
go test -v ./...

Part of the patent.dev open-source patent data ecosystem:

  • uspto-odp - USPTO Open Data Portal client (search, PTAB, XML full text)
  • epo-ops - EPO Open Patent Services client (search, biblio, legal status, family, images)
  • epo-bdds - EPO Bulk Data Distribution Service client

The bulk-file-loader uses these libraries for automated patent data downloads.

License

MIT License - see LICENSE file for details.

Credits

Developed by:

Documentation

Overview

Package dpmaconnect provides a Go client for the DPMA Connect Plus API (DPMAregister web services) for accessing German patent, design, and trademark data from the German Patent and Trade Mark Office (DPMA).

Usage:

config := dpmaconnect.DefaultConfig()
config.Username = "your-username"
config.Password = "your-password"
client, err := dpmaconnect.NewClient(config)

The client is safe for concurrent use by multiple goroutines.

Index

Constants

View Source
const (
	PeriodDaily   = "daily"
	PeriodWeekly  = "weekly"
	PeriodMonthly = "monthly"
	PeriodYearly  = "yearly"
)

Period constants for register extract queries

View Source
const (
	ServicePatent    = "DPMAregisterPatService"
	ServiceDesign    = "DPMAregisterGsmService"
	ServiceTrademark = "DPMAregisterMarkeService"
)

Service name constants for GetVersion

Variables

This section is empty.

Functions

func FormatDate

func FormatDate(date time.Time) string

FormatDate formats a time.Time into YYYY-MM-DD format for register extract queries. The date is formatted in the input's location (no timezone conversion). Example: FormatDate(time.Date(2024, 10, 23, 0, 0, 0, 0, time.UTC)) returns "2024-10-23"

func FormatPublicationWeek

func FormatPublicationWeek(year, week int) (string, error)

FormatPublicationWeek formats year and week into YYYYWW format. Returns an error if year < 1 or week is outside [1, 53]. Example: FormatPublicationWeek(2024, 45) returns "202445"

func ParsePublicationWeek

func ParsePublicationWeek(pubWeek string) (year, week int, err error)

ParsePublicationWeek parses a publication week string (YYYYWW) into year and week integers Returns an error if the format is invalid

func ValidateDesignQuery

func ValidateDesignQuery(q string) error

ValidateDesignQuery parses and validates a query against design field codes. Returns nil if valid, or an error describing the validation failure.

func ValidatePatentQuery

func ValidatePatentQuery(q string) error

ValidatePatentQuery parses and validates a query against patent field codes. Returns nil if valid, or an error describing the validation failure.

func ValidatePeriod

func ValidatePeriod(period string) error

ValidatePeriod checks that a period string is one of the valid values.

func ValidateTrademarkQuery

func ValidateTrademarkQuery(q string) error

ValidateTrademarkQuery parses and validates a query against trademark field codes. Returns nil if valid, or an error describing the validation failure.

Types

type APIError

type APIError struct {
	Code       string
	Message    string
	StatusCode int
}

APIError represents a generic API error from DPMA

func (*APIError) Error

func (e *APIError) Error() string

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is the main DPMA Connect Plus API client. It is safe for concurrent use by multiple goroutines.

func NewClient

func NewClient(config *Config) (*Client, error)

NewClient creates a new DPMA Connect Plus API client

func (*Client) GetApplicantCitationsXML

func (c *Client) GetApplicantCitationsXML(ctx context.Context, year, week int) ([]byte, error)

GetApplicantCitationsXML downloads applicant citations as XML for a publication week

func (*Client) GetApplicantCitationsXMLStream

func (c *Client) GetApplicantCitationsXMLStream(ctx context.Context, year, week int, dst io.Writer) error

GetApplicantCitationsXMLStream downloads applicant citations as XML and writes to dst

func (*Client) GetDesignBibliographicDataXML

func (c *Client) GetDesignBibliographicDataXML(ctx context.Context, year, week int) ([]byte, error)

GetDesignBibliographicDataXML downloads design bibliographic data as XML for a publication week

func (*Client) GetDesignBibliographicDataXMLStream

func (c *Client) GetDesignBibliographicDataXMLStream(ctx context.Context, year, week int, dst io.Writer) error

GetDesignBibliographicDataXMLStream downloads design bibliographic data as XML and writes to dst

func (*Client) GetDesignImage

func (c *Client) GetDesignImage(ctx context.Context, designNumber, imageNumber string) ([]byte, error)

GetDesignImage downloads a design image by design number and image number

func (*Client) GetDesignImages

func (c *Client) GetDesignImages(ctx context.Context, year, week int) ([]byte, error)

GetDesignImages downloads design images for a publication week

func (*Client) GetDesignImagesStream

func (c *Client) GetDesignImagesStream(ctx context.Context, year, week int, dst io.Writer) error

GetDesignImagesStream downloads design images and writes to dst

func (*Client) GetDesignInfo

func (c *Client) GetDesignInfo(ctx context.Context, designNumber string) ([]byte, error)

GetDesignInfo retrieves design information by design number

func (*Client) GetDesignInfoParsed

func (c *Client) GetDesignInfoParsed(ctx context.Context, designNumber string) (*DesignInfo, error)

GetDesignInfoParsed retrieves design info and returns parsed data.

func (*Client) GetDesignRegisterExtract

func (c *Client) GetDesignRegisterExtract(ctx context.Context, date time.Time, period string) ([]byte, error)

GetDesignRegisterExtract downloads design register extract data for a date and period

func (*Client) GetDesignRegisterExtractStream

func (c *Client) GetDesignRegisterExtractStream(ctx context.Context, date time.Time, period string, dst io.Writer) error

GetDesignRegisterExtractStream downloads design register extract data and writes to dst

func (*Client) GetDesignThumbnail

func (c *Client) GetDesignThumbnail(ctx context.Context, designNumber, thumbnailNumber string) ([]byte, error)

GetDesignThumbnail downloads a design thumbnail by design number and thumbnail number

func (*Client) GetDisclosureDocumentsPDF

func (c *Client) GetDisclosureDocumentsPDF(ctx context.Context, year, week int) ([]byte, error)

GetDisclosureDocumentsPDF downloads disclosure documents as PDF for a publication week

func (*Client) GetDisclosureDocumentsPDFStream

func (c *Client) GetDisclosureDocumentsPDFStream(ctx context.Context, year, week int, dst io.Writer) error

GetDisclosureDocumentsPDFStream downloads disclosure documents as PDF and writes to dst

func (*Client) GetDisclosureDocumentsXML

func (c *Client) GetDisclosureDocumentsXML(ctx context.Context, year, week int) ([]byte, error)

GetDisclosureDocumentsXML downloads disclosure documents (A) as XML for a publication week

func (*Client) GetDisclosureDocumentsXMLStream

func (c *Client) GetDisclosureDocumentsXMLStream(ctx context.Context, year, week int, dst io.Writer) error

GetDisclosureDocumentsXMLStream downloads disclosure documents as XML and writes to dst

func (*Client) GetEuropeanPatentSpecificationsPDF

func (c *Client) GetEuropeanPatentSpecificationsPDF(ctx context.Context, year, week int) ([]byte, error)

GetEuropeanPatentSpecificationsPDF downloads European patent specifications as PDF for a publication week

func (*Client) GetEuropeanPatentSpecificationsPDFStream

func (c *Client) GetEuropeanPatentSpecificationsPDFStream(ctx context.Context, year, week int, dst io.Writer) error

GetEuropeanPatentSpecificationsPDFStream downloads European patent specifications as PDF and writes to dst

func (*Client) GetEuropeanPatentSpecificationsXML

func (c *Client) GetEuropeanPatentSpecificationsXML(ctx context.Context, year, week int) ([]byte, error)

GetEuropeanPatentSpecificationsXML downloads European patent specifications as XML for a publication week

func (*Client) GetEuropeanPatentSpecificationsXMLStream

func (c *Client) GetEuropeanPatentSpecificationsXMLStream(ctx context.Context, year, week int, dst io.Writer) error

GetEuropeanPatentSpecificationsXMLStream downloads European patent specifications as XML and writes to dst

func (*Client) GetPatentInfo

func (c *Client) GetPatentInfo(ctx context.Context, registeredNumber string) ([]byte, error)

GetPatentInfo retrieves patent information by registered number (digits only, including check digit).

func (*Client) GetPatentInfoByPublicationNumber

func (c *Client) GetPatentInfoByPublicationNumber(ctx context.Context, publicationNumber string) (*PatentInfo, error)

GetPatentInfoByPublicationNumber resolves a DE publication number (e.g. "DE102019200907A1") to a registered number via search and returns the parsed patent info.

func (*Client) GetPatentInfoParsed

func (c *Client) GetPatentInfoParsed(ctx context.Context, patentNumber string) (*PatentInfo, error)

GetPatentInfoParsed retrieves patent info and returns parsed bibliographic data. Accepts either a bare registered number (e.g., "100273629") or a DE patent number with country prefix and/or kind code (e.g., "DE10027362C2", "DE102019200907A1"). For non-registered numbers, it resolves via publication number search automatically.

func (*Client) GetPatentPublicationPDF

func (c *Client) GetPatentPublicationPDF(ctx context.Context, documentID string) ([]byte, error)

GetPatentPublicationPDF downloads a single patent publication in PDF format

func (*Client) GetPatentRegisterExtract

func (c *Client) GetPatentRegisterExtract(ctx context.Context, date time.Time, period string) ([]byte, error)

GetPatentRegisterExtract downloads patent register extract data for a date and period

func (*Client) GetPatentRegisterExtractStream

func (c *Client) GetPatentRegisterExtractStream(ctx context.Context, date time.Time, period string, dst io.Writer) error

GetPatentRegisterExtractStream downloads patent register extract data and writes to dst

func (*Client) GetPatentSpecificationsPDF

func (c *Client) GetPatentSpecificationsPDF(ctx context.Context, year, week int) ([]byte, error)

GetPatentSpecificationsPDF downloads patent specifications as PDF for a publication week

func (*Client) GetPatentSpecificationsPDFStream

func (c *Client) GetPatentSpecificationsPDFStream(ctx context.Context, year, week int, dst io.Writer) error

GetPatentSpecificationsPDFStream downloads patent specifications as PDF and writes to dst

func (*Client) GetPatentSpecificationsXML

func (c *Client) GetPatentSpecificationsXML(ctx context.Context, year, week int) ([]byte, error)

GetPatentSpecificationsXML downloads patent specifications (B, C) as XML for a publication week

func (*Client) GetPatentSpecificationsXMLStream

func (c *Client) GetPatentSpecificationsXMLStream(ctx context.Context, year, week int, dst io.Writer) error

GetPatentSpecificationsXMLStream downloads patent specifications as XML and writes to dst

func (*Client) GetPublicationDataXML

func (c *Client) GetPublicationDataXML(ctx context.Context, year, week int) ([]byte, error)

GetPublicationDataXML downloads publication data as XML for a publication week

func (*Client) GetPublicationDataXMLStream

func (c *Client) GetPublicationDataXMLStream(ctx context.Context, year, week int, dst io.Writer) error

GetPublicationDataXMLStream downloads publication data as XML and writes to dst

func (*Client) GetSearchableFullText

func (c *Client) GetSearchableFullText(ctx context.Context, documentID string) ([]byte, error)

GetSearchableFullText retrieves the searchable full text for a document

func (*Client) GetTrademarkBibDataApplied

func (c *Client) GetTrademarkBibDataApplied(ctx context.Context, year, week int) ([]byte, error)

GetTrademarkBibDataApplied downloads trademark bibliographic data (applied) for a publication week

func (*Client) GetTrademarkBibDataAppliedStream

func (c *Client) GetTrademarkBibDataAppliedStream(ctx context.Context, year, week int, dst io.Writer) error

GetTrademarkBibDataAppliedStream downloads trademark bib data (applied) and writes to dst

func (*Client) GetTrademarkBibDataRegistered

func (c *Client) GetTrademarkBibDataRegistered(ctx context.Context, year, week int) ([]byte, error)

GetTrademarkBibDataRegistered downloads trademark bibliographic data (registered) for a publication week

func (*Client) GetTrademarkBibDataRegisteredStream

func (c *Client) GetTrademarkBibDataRegisteredStream(ctx context.Context, year, week int, dst io.Writer) error

GetTrademarkBibDataRegisteredStream downloads trademark bib data (registered) and writes to dst

func (*Client) GetTrademarkBibDataRejected

func (c *Client) GetTrademarkBibDataRejected(ctx context.Context, year, week int) ([]byte, error)

GetTrademarkBibDataRejected downloads trademark bibliographic data (rejected) for a publication week

func (*Client) GetTrademarkBibDataRejectedStream

func (c *Client) GetTrademarkBibDataRejectedStream(ctx context.Context, year, week int, dst io.Writer) error

GetTrademarkBibDataRejectedStream downloads trademark bib data (rejected) and writes to dst

func (*Client) GetTrademarkImage

func (c *Client) GetTrademarkImage(ctx context.Context, applicationNumber string) ([]byte, error)

GetTrademarkImage downloads a trademark image by application number

func (*Client) GetTrademarkInfo

func (c *Client) GetTrademarkInfo(ctx context.Context, applicationNumber string) ([]byte, error)

GetTrademarkInfo retrieves trademark information by application number

func (*Client) GetTrademarkInfoParsed

func (c *Client) GetTrademarkInfoParsed(ctx context.Context, applicationNumber string) (*TrademarkInfo, error)

GetTrademarkInfoParsed retrieves trademark info and returns parsed data.

func (*Client) GetTrademarkRegisterExtract

func (c *Client) GetTrademarkRegisterExtract(ctx context.Context, date time.Time, period string) ([]byte, error)

GetTrademarkRegisterExtract downloads trademark register extract data for a date and period

func (*Client) GetTrademarkRegisterExtractStream

func (c *Client) GetTrademarkRegisterExtractStream(ctx context.Context, date time.Time, period string, dst io.Writer) error

GetTrademarkRegisterExtractStream downloads trademark register extract data and writes to dst

func (*Client) GetTrademarkThumbnail

func (c *Client) GetTrademarkThumbnail(ctx context.Context, applicationNumber string) ([]byte, error)

GetTrademarkThumbnail downloads a trademark thumbnail by application number

func (*Client) GetUtilityModelsPDF

func (c *Client) GetUtilityModelsPDF(ctx context.Context, year, week int) ([]byte, error)

GetUtilityModelsPDF downloads utility models as PDF for a publication week

func (*Client) GetUtilityModelsPDFStream

func (c *Client) GetUtilityModelsPDFStream(ctx context.Context, year, week int, dst io.Writer) error

GetUtilityModelsPDFStream downloads utility models as PDF and writes to dst

func (*Client) GetUtilityModelsXML

func (c *Client) GetUtilityModelsXML(ctx context.Context, year, week int) ([]byte, error)

GetUtilityModelsXML downloads utility models (U) as XML for a publication week

func (*Client) GetUtilityModelsXMLStream

func (c *Client) GetUtilityModelsXMLStream(ctx context.Context, year, week int, dst io.Writer) error

GetUtilityModelsXMLStream downloads utility models as XML and writes to dst

func (*Client) GetVersion

func (c *Client) GetVersion(ctx context.Context, service string) (string, error)

GetVersion retrieves version information for a service

func (*Client) SearchDesigns

func (c *Client) SearchDesigns(ctx context.Context, query string) ([]byte, error)

SearchDesigns executes a design expert search query

func (*Client) SearchDesignsParsed

func (c *Client) SearchDesignsParsed(ctx context.Context, query string) (*DesignSearchResult, error)

SearchDesignsParsed executes a design search and returns parsed results.

func (*Client) SearchPatents

func (c *Client) SearchPatents(ctx context.Context, query string) ([]byte, error)

SearchPatents executes a patent/utility model expert search query

func (*Client) SearchPatentsParsed

func (c *Client) SearchPatentsParsed(ctx context.Context, query string) (*PatentSearchResult, error)

SearchPatentsParsed executes a patent search and returns parsed results.

func (*Client) SearchTrademarks

func (c *Client) SearchTrademarks(ctx context.Context, query string) ([]byte, error)

SearchTrademarks executes a trademark expert search query

func (*Client) SearchTrademarksParsed

func (c *Client) SearchTrademarksParsed(ctx context.Context, query string) (*TrademarkSearchResult, error)

SearchTrademarksParsed executes a trademark search and returns parsed results.

type Config

type Config struct {
	BaseURL    string
	Username   string
	Password   string
	Timeout    time.Duration // HTTP client timeout (default: 20 minutes for bulk downloads)
	HTTPClient *http.Client  // Optional custom HTTP client; if set, Timeout is ignored
}

Config holds client configuration.

If HTTPClient is set, Timeout is ignored and the custom client's timeout applies instead. Callers should configure timeouts on the custom client directly.

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns default configuration

type DataNotAvailableError

type DataNotAvailableError struct{}

DataNotAvailableError represents data unavailable for requested period

func (*DataNotAvailableError) Error

func (e *DataNotAvailableError) Error() string

type DesignHit

type DesignHit struct {
	DesignIdentifier   string
	ApplicationNumber  string
	RegistrationNumber string
	Title              string
	Applicant          string
	ClassNumber        string
	Status             string
	ApplicationDate    string
	RegistrationDate   string
	PublicationDate    string
}

DesignHit represents a single design search result entry.

type DesignInfo

type DesignInfo struct {
	DesignIdentifier   string
	ApplicationNumber  string
	RegistrationNumber string
	ApplicationDate    string
	RegistrationDate   string
	Title              string
	Status             string
	Applicants         []Party
	ClassNumber        string
	ClassDescription   string
}

DesignInfo holds parsed design register info (ST86).

func ParseDesignInfo

func ParseDesignInfo(data []byte) (*DesignInfo, error)

ParseDesignInfo parses a design info XML response (ST86 format).

type DesignSearchResult

type DesignSearchResult struct {
	TotalHits int
	Hits      []DesignHit
	RawXML    []byte // original XML response bytes
}

DesignSearchResult holds parsed design search results.

func ParseDesignSearch

func ParseDesignSearch(data []byte) (*DesignSearchResult, error)

ParseDesignSearch parses a design search XML response.

type ErrorResponse

type ErrorResponse struct {
	XMLName       xml.Name        `xml:"Transaction"`
	TradeMarkBody transactionBody `xml:"TradeMarkTransactionBody"`
	DesignBody    transactionBody `xml:"DesignTransactionBody"`
	PatentBody    transactionBody `xml:"PatentTransactionBody"`
}

ErrorResponse represents the XML error response structure from DPMA API. The DPMA API uses different body element names depending on the service:

  • TradeMarkTransactionBody (trademark service)
  • DesignTransactionBody (design service)
  • PatentTransactionBody (patent service)

All share the same nested TransactionErrorDetails structure. We parse all three variants and use whichever has error content.

type NotFoundError

type NotFoundError struct {
	Resource string
	ID       string
}

NotFoundError represents resource not found errors

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

type Party

type Party struct {
	Name    string
	Address string
	Country string
}

Party represents a person or organization (applicant, inventor, etc.)

type PatentDocumentRef

type PatentDocumentRef struct {
	Country string
	Number  string
	Date    string
}

PatentDocumentRef represents an application or document reference.

type PatentHit

type PatentHit struct {
	LeadingRegisteredNumber string
	RegisteredNumber        string
	Type                    string // "Patent", "Utility model"
	LegalStatus             string
	Title                   string
	Applicants              []string
	IPCClasses              []string // main + further classifications
	ApplicationDate         string
	PublicationDate         string
	RegistrationDate        string
}

PatentHit represents a single patent search result entry.

type PatentInfo

type PatentInfo struct {
	Publications   []PatentPublication
	ApplicationRef PatentDocumentRef
	Title          string
	IPCClasses     []string
	Applicants     []Party
	Inventors      []Party
	IPRightType    string // patent, gebrauchsmuster, schutzzertifikat, etc.
	Status         string // anhaengig-in-kraft, nicht-anhaengig-erloschen
	Abstract       string
	FilingDate     string
	FirstPubDate   string
}

PatentInfo holds parsed patent register info (ST36 bibliographic data).

func ParsePatentInfo

func ParsePatentInfo(data []byte) (*PatentInfo, error)

ParsePatentInfo parses a patent info XML response (ST36 format).

type PatentPublication

type PatentPublication struct {
	Country string
	Number  string
	Kind    string
}

PatentPublication represents a publication reference within patent info.

type PatentSearchResult

type PatentSearchResult struct {
	TotalHits int
	Hits      []PatentHit
	RawXML    []byte // original XML response bytes
}

PatentSearchResult holds parsed patent search results.

func ParsePatentSearch

func ParsePatentSearch(data []byte) (*PatentSearchResult, error)

ParsePatentSearch parses a patent search XML response.

type TrademarkClass

type TrademarkClass struct {
	Number      string
	Description string
}

TrademarkClass represents a Nice classification entry.

type TrademarkHit

type TrademarkHit struct {
	ApplicationNumber string
	MarkText          string
	MarkFeature       string // wortmarke, wort-bildmarke, etc.
	Classification    string
	Status            string
	ApplicationDate   string
	RegistrationDate  string
	Applicant         string
}

TrademarkHit represents a single trademark search result entry.

type TrademarkInfo

type TrademarkInfo struct {
	ApplicationNumber  string
	RegistrationNumber string
	ApplicationDate    string
	RegistrationDate   string
	ExpiryDate         string
	Status             string
	MarkFeature        string
	MarkText           string
	Applicants         []Party
	Classifications    []TrademarkClass
}

TrademarkInfo holds parsed trademark register info (ST66).

func ParseTrademarkInfo

func ParseTrademarkInfo(data []byte) (*TrademarkInfo, error)

ParseTrademarkInfo parses a trademark info XML response (ST66 format).

type TrademarkSearchResult

type TrademarkSearchResult struct {
	TotalHits int
	Hits      []TrademarkHit
	RawXML    []byte // original XML response bytes
}

TrademarkSearchResult holds parsed trademark search results.

func ParseTrademarkSearch

func ParseTrademarkSearch(data []byte) (*TrademarkSearchResult, error)

ParseTrademarkSearch parses a trademark search XML response.

type XMLParseError

type XMLParseError struct {
	Operation string // e.g. "ParsePatentSearch"
	Err       error  // underlying xml.Unmarshal error
}

XMLParseError indicates a failure to parse XML response data.

func (*XMLParseError) Error

func (e *XMLParseError) Error() string

func (*XMLParseError) Unwrap

func (e *XMLParseError) Unwrap() error

Directories

Path Synopsis
Package generated provides primitives to interact with the openapi HTTP API.
Package generated provides primitives to interact with the openapi HTTP API.
Package query provides a query parser and validator for DPMAregister expert search syntax.
Package query provides a query parser and validator for DPMAregister expert search syntax.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL