Google API Go Client自动生成 Go 语言 API

联合创作 · 2023-09-28 15:52

Google API Go Client 可以自动生成 Google 的 Go 语言 API。

示例代码:

package main
import (
    "container/list"
    "encoding/json"
    "fmt"
    "io/ioutil"
    "log"
    "math"
    "math/rand"
    "net/http"
    "os"
    "strconv"
    "strings"
    "time"
    bigquery "google.golang.org/api/bigquery/v2"
    storage "google.golang.org/api/storage/v1"
)
const (
    GB                         = 1 << 30
    MaxBackoff                 = 30000
    BaseBackoff                = 250
    BackoffGrowthFactor        = 1.8
    BackoffGrowthDamper        = 0.25
    JobStatusDone              = "DONE"
    DatasetAlreadyExists       = "Already Exists: Dataset"
    TableWriteEmptyDisposition = "WRITE_EMPTY"
)
func init() {
    scope := fmt.Sprintf("%s %s %s", bigquery.BigqueryScope,
        storage.DevstorageRead_onlyScope,
        "https://www.googleapis.com/auth/userinfo.profile")
    registerDemo("bigquery", scope, bqMain)
}

 

浏览 12
点赞
评论
收藏
分享

手机扫一扫分享

编辑
举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

编辑
举报