mirror of
https://github.com/FlipsideCrypto/go-data-bridge-client.git
synced 2026-02-06 10:48:12 +00:00
return nil/nil on 404
This commit is contained in:
parent
5a0e58ab63
commit
d4920637e1
@ -1,11 +1,13 @@
|
||||
package databridge
|
||||
|
||||
// Config allows a consuming app to set up API Key, Consumer ID, and Topic Slug
|
||||
type Config struct {
|
||||
APIKey string
|
||||
ConsumerID string
|
||||
TopicSlug string
|
||||
}
|
||||
|
||||
// Client allows access to the Databridge API
|
||||
type Client struct {
|
||||
BaseURL string
|
||||
APIKey string
|
||||
@ -13,6 +15,7 @@ type Client struct {
|
||||
ConsumerID string
|
||||
}
|
||||
|
||||
// NewClient returns a new Databridge Client
|
||||
func NewClient(config Config) (Client, error) {
|
||||
c := Client{}
|
||||
c.APIKey = config.APIKey
|
||||
@ -23,14 +26,17 @@ func NewClient(config Config) (Client, error) {
|
||||
return c, nil
|
||||
}
|
||||
|
||||
// GetNextRecord returns the topic's next record. Will return nil without an error when there are no more records.
|
||||
func (c Client) GetNextRecord() (*Record, error) {
|
||||
return getNextRecord(c)
|
||||
}
|
||||
|
||||
// CompleteRecord allows the record to be marked as completed
|
||||
func (c Client) CompleteRecord(r Record) error {
|
||||
return r.updateRecordState(c, "completed")
|
||||
}
|
||||
|
||||
// FailRecord allows the record to be marked as failed
|
||||
func (c Client) FailRecord(r Record) error {
|
||||
return r.updateRecordState(c, "failed")
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user