Skip to content

Commit

Permalink
added simple example
Browse files Browse the repository at this point in the history
  • Loading branch information
allan committed Jul 5, 2024
1 parent 3eafbe4 commit 652d9ad
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
version: 2
updates:
- package-ecosystem: gomod
directory: /
schedule:
interval: weekly
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
- package-ecosystem: gomod
directory: /tests
schedule:
interval: weekly
27 changes: 27 additions & 0 deletions .github/workflows/go-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Go build
#
on:
push:
branches: [ "main", "dev"]
pull_request:
branches: [ "main", "dev" ]
#
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [ '1.18.x', '1.19.x', '1.20.x', '1.21.x' ]
steps:
- uses: actions/checkout@v3
#
- name: Setup Go ${{ matrix.go-version }}
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
#cache-dependency-path: subdir/go.sum
cache: true
#
- name: Build
run: go build -v ./...
#
8 changes: 8 additions & 0 deletions env/config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package env

type Configuration struct {
AppEnv string `env:"APP_ENV"`
AppName string `env:"APP_NAME"`
LogLevel string `env:"LOG_LEVEL"`
RunningMode string `env:"RUNNING_MODE"`
}
26 changes: 26 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
package main

import (
"context"
"log"

"google.golang.org/api/youtube/v3"
)

func main() {

ctx := context.Background()
service, err := youtube.NewService(ctx)
if err != nil {
log.Fatalf("Unable to create YouTube service: %v", err)
}

upload := &youtube.Video{
Snippet: &youtube.VideoSnippet{
Title: "Test Title",
Description: "Test Description", // can not use non-alpha-numeric characters
CategoryId: "22",
},
Status: &youtube.VideoStatus{PrivacyStatus: "unlisted"},
}

// The API returns a 400 Bad Request response if tags is an empty string.
upload.Snippet.Tags = []string{"test", "upload", "api"}
log.Println("Uploading video...", service)
//call := service.Videos.Insert([]string{"snippet", "status"}, upload)
}

0 comments on commit 652d9ad

Please sign in to comment.