| 8 | ) |
| 9 | |
| 10 | func ExampleClient_Sync() { |
| 11 | client := gitsync.New(gitsync.Options{ |
| 12 | HTTPClient: &http.Client{}, |
| 13 | Auth: gitsync.StaticAuthProvider{ |
| 14 | Source: gitsync.EndpointAuth{Token: "source-token"}, |
| 15 | Target: gitsync.EndpointAuth{Token: "target-token"}, |
| 16 | }, |
| 17 | }) |
| 18 | |
| 19 | if _, err := client.Sync(context.Background(), gitsync.SyncRequest{ |
| 20 | Source: gitsync.Endpoint{URL: "https://github.example/source/repo.git"}, |
| 21 | Target: gitsync.Endpoint{URL: "https://git.example/target/repo.git"}, |
| 22 | Scope: gitsync.RefScope{Branches: []string{"main"}}, |
| 23 | Policy: gitsync.SyncPolicy{ |
| 24 | IncludeTags: true, |
| 25 | Protocol: gitsync.ProtocolAuto, |
| 26 | }, |
| 27 | }); err != nil { |
| 28 | return // network error expected in example environment |
| 29 | } |
| 30 | |
| 31 | // Output: |
| 32 | } |