Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kachit/branch-sdk-go
Golang SDK for Branch.io API (Unofficial)
https://github.com/kachit/branch-sdk-go
api-client branch go golang sdk statistics unofficial
Last synced: 1 day ago
JSON representation
Golang SDK for Branch.io API (Unofficial)
- Host: GitHub
- URL: https://github.com/kachit/branch-sdk-go
- Owner: Kachit
- License: mit
- Created: 2020-11-29T19:30:01.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2022-06-16T19:06:56.000Z (over 2 years ago)
- Last Synced: 2024-06-20T01:55:12.008Z (5 months ago)
- Topics: api-client, branch, go, golang, sdk, statistics, unofficial
- Language: Go
- Homepage: https://help.branch.io/developers-hub/docs/daily-exports
- Size: 128 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Branch.io SDK GO (Unofficial)
[![Build Status](https://app.travis-ci.com/Kachit/branch-sdk-go.svg?branch=master)](https://app.travis-ci.com/github/Kachit/branch-sdk-go)
[![Codecov](https://codecov.io/gh/Kachit/branch-sdk-go/branch/master/graph/badge.svg)](https://codecov.io/gh/Kachit/branch-sdk-go)
[![Go Report Card](https://goreportcard.com/badge/github.com/kachit/branch-sdk-go)](https://goreportcard.com/report/github.com/kachit/branch-sdk-go)
[![Version](https://img.shields.io/github/go-mod/go-version/Kachit/branch-sdk-go)](https://go.dev/doc/go1.13)
[![Release](https://img.shields.io/github/v/release/Kachit/branch-sdk-go.svg)](https://github.com/Kachit/branch-sdk-go/releases)
[![License](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/kachit/branch-sdk-go/blob/master/LICENSE)## Description
Unofficial Branch.io daily exports API Client for Go## API documentation
https://help.branch.io/developers-hub/docs/daily-exports## Installation
```shell
go get -u github.com/kachit/branch-sdk-go
```
## Usage
```go
package mainimport (
"fmt"
"github.com/kachit/branch-sdk-go/v1"
"time"
)func main(){
// Create a client instance
cfg := branchio.NewConfig("Your Branch key", "Your Branch secret key")
client, err := branchio.NewClientFromConfig(cfg, nil)
if err != nil {
fmt.Printf("config parameter error " + err.Error())
panic(err)
}
}
```
### Get events ontology
```go
ctx := context.Background()
dt := time.Date(2022, 1, 30, 0, 0, 0, 0, time.Local)
ontology, response, err := client.Export().GetEventOntology(ctx, dt)if err != nil {
fmt.Printf("Wrong API request " + err.Error())
panic(err)
}//Dump raw response
fmt.Println(response)//Dump result
fmt.Println(ontology.Data.Install[0])
fmt.Println(ontology.Data.BranchCtaView[0])
fmt.Println(ontology.Data.Click[0])
fmt.Println(ontology.Data.Impression[0])
fmt.Println(ontology.Data.Open[0])
```### Get events data
```go
ctx := context.Background()
events, response, err := client.Export().GetEventData(ctx, ontology.Data.Install[0])if err != nil {
fmt.Printf("Wrong API request " + err.Error())
panic(err)
}//Dump raw response
fmt.Println(response)//Dump result
fmt.Println(events.Data[0].Id)
fmt.Println(events.Data[0].Timestamp.Value())
fmt.Println(events.Data[0].LastAttributedTouchDataTildeId.Value())
fmt.Println(events.Data[0].DeepLinked.Value())
fmt.Println(events.Data[0].FirstEventForUser.Value())
fmt.Println(events.Data[0].DiMatchClickToken.Value())
fmt.Println(events.Data[0].EventDataRevenueInUsd.Value())
fmt.Println(events.Data[0].EventTimestamp.Value())
```