Skip to content

Commit

Permalink
docs(generated): add imports and service initializing into examples
Browse files Browse the repository at this point in the history
Generated SDK source code using:
- Generator version 3.98.0
- Specification version 1.0.0-dev0.1.22
- Automation (cloudant-sdks) version 4743b62
  • Loading branch information
cloudant-sdks-automation committed Dec 13, 2024
1 parent 2dffbe6 commit 4b36732
Show file tree
Hide file tree
Showing 85 changed files with 2,424 additions and 51 deletions.
1,254 changes: 1,227 additions & 27 deletions examples/README.md

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions examples/snippets/deleteAttachment/example_request.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
// section: code imports
import (
"encoding/json"
"fmt"

"github.com/IBM/cloudant-go-sdk/cloudantv1"
)
// section: code
service, err := cloudantv1.NewCloudantV1(
&cloudantv1.CloudantV1Options{},
)
if err != nil {
panic(err)
}

deleteAttachmentOptions := service.NewDeleteAttachmentOptions(
"products",
"1000042",
Expand Down
14 changes: 14 additions & 0 deletions examples/snippets/deleteDatabase/example_request.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
// section: code imports
import (
"encoding/json"
"fmt"

"github.com/IBM/cloudant-go-sdk/cloudantv1"
)
// section: code
service, err := cloudantv1.NewCloudantV1(
&cloudantv1.CloudantV1Options{},
)
if err != nil {
panic(err)
}

deleteDatabaseOptions := service.NewDeleteDatabaseOptions(
"<db-name>",
)
Expand Down
14 changes: 14 additions & 0 deletions examples/snippets/deleteDesignDocument/example_request.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
// section: code imports
import (
"encoding/json"
"fmt"

"github.com/IBM/cloudant-go-sdk/cloudantv1"
)
// section: code
service, err := cloudantv1.NewCloudantV1(
&cloudantv1.CloudantV1Options{},
)
if err != nil {
panic(err)
}

deleteDesignDocumentOptions := service.NewDeleteDesignDocumentOptions(
"products",
"appliances",
Expand Down
14 changes: 14 additions & 0 deletions examples/snippets/deleteDocument/example_request.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
// section: code imports
import (
"encoding/json"
"fmt"

"github.com/IBM/cloudant-go-sdk/cloudantv1"
)
// section: code
service, err := cloudantv1.NewCloudantV1(
&cloudantv1.CloudantV1Options{},
)
if err != nil {
panic(err)
}

deleteDocumentOptions := service.NewDeleteDocumentOptions(
"orders",
"order00058",
Expand Down
14 changes: 14 additions & 0 deletions examples/snippets/deleteIndex/example_request.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
// section: code imports
import (
"encoding/json"
"fmt"

"github.com/IBM/cloudant-go-sdk/cloudantv1"
)
// section: code
service, err := cloudantv1.NewCloudantV1(
&cloudantv1.CloudantV1Options{},
)
if err != nil {
panic(err)
}

deleteIndexOptions := service.NewDeleteIndexOptions(
"users",
"json-index",
Expand Down
14 changes: 14 additions & 0 deletions examples/snippets/deleteLocalDocument/example_request.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
// section: code imports
import (
"encoding/json"
"fmt"

"github.com/IBM/cloudant-go-sdk/cloudantv1"
)
// section: code
service, err := cloudantv1.NewCloudantV1(
&cloudantv1.CloudantV1Options{},
)
if err != nil {
panic(err)
}

deleteLocalDocumentOptions := service.NewDeleteLocalDocumentOptions(
"orders",
"local-0007741142412418284",
Expand Down
14 changes: 14 additions & 0 deletions examples/snippets/deleteReplicationDocument/example_request.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
// section: code imports
import (
"encoding/json"
"fmt"

"github.com/IBM/cloudant-go-sdk/cloudantv1"
)
// section: code
service, err := cloudantv1.NewCloudantV1(
&cloudantv1.CloudantV1Options{},
)
if err != nil {
panic(err)
}

deleteReplicationDocumentOptions := service.NewDeleteReplicationDocumentOptions(
"repldoc-example",
)
Expand Down
14 changes: 14 additions & 0 deletions examples/snippets/getActiveTasks/example_request.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
// section: code imports
import (
"encoding/json"
"fmt"

"github.com/IBM/cloudant-go-sdk/cloudantv1"
)
// section: code
service, err := cloudantv1.NewCloudantV1(
&cloudantv1.CloudantV1Options{},
)
if err != nil {
panic(err)
}

getActiveTasksOptions := service.NewGetActiveTasksOptions()

activeTask, response, err := service.GetActiveTasks(getActiveTasksOptions)
Expand Down
14 changes: 14 additions & 0 deletions examples/snippets/getActivityTrackerEvents/example_request.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
// section: code imports
import (
"encoding/json"
"fmt"

"github.com/IBM/cloudant-go-sdk/cloudantv1"
)
// section: code
service, err := cloudantv1.NewCloudantV1(
&cloudantv1.CloudantV1Options{},
)
if err != nil {
panic(err)
}

getActivityTrackerEventsOptions := service.NewGetActivityTrackerEventsOptions()

activityTrackerEvents, response, err := service.GetActivityTrackerEvents(getActivityTrackerEventsOptions)
Expand Down
14 changes: 14 additions & 0 deletions examples/snippets/getAllDbs/example_request.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
// section: code imports
import (
"encoding/json"
"fmt"

"github.com/IBM/cloudant-go-sdk/cloudantv1"
)
// section: code
service, err := cloudantv1.NewCloudantV1(
&cloudantv1.CloudantV1Options{},
)
if err != nil {
panic(err)
}

getAllDbsOptions := service.NewGetAllDbsOptions()

result, response, err := service.GetAllDbs(getAllDbsOptions)
Expand Down
17 changes: 16 additions & 1 deletion examples/snippets/getAttachment/example_request.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
// section: code imports
import (
"encoding/json"
"fmt"
"io"

"github.com/IBM/cloudant-go-sdk/cloudantv1"
)
// section: code
service, err := cloudantv1.NewCloudantV1(
&cloudantv1.CloudantV1Options{},
)
if err != nil {
panic(err)
}

getAttachmentOptions := service.NewGetAttachmentOptions(
"products",
"1000042",
Expand All @@ -10,7 +25,7 @@ if err != nil {
panic(err)
}

data, _ := ioutil.ReadAll(result)
data, _ := io.ReadAll(result)
fmt.Println("\n", string(data))
// section: markdown
// This example requires the `product_details.txt` attachment in `1000042` document to exist. To create the attachment, see [Create or modify an attachment.](#putattachment)
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
// section: code imports
import (
"encoding/json"
"fmt"

"github.com/IBM/cloudant-go-sdk/cloudantv1"
)
// section: code
service, err := cloudantv1.NewCloudantV1(
&cloudantv1.CloudantV1Options{},
)
if err != nil {
panic(err)
}

getCapacityThroughputInformationOptions := service.NewGetCapacityThroughputInformationOptions()

capacityThroughputInformation, response, err := service.GetCapacityThroughputInformation(getCapacityThroughputInformationOptions)
Expand Down
14 changes: 14 additions & 0 deletions examples/snippets/getCorsInformation/example_request.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
// section: code imports
import (
"encoding/json"
"fmt"

"github.com/IBM/cloudant-go-sdk/cloudantv1"
)
// section: code
service, err := cloudantv1.NewCloudantV1(
&cloudantv1.CloudantV1Options{},
)
if err != nil {
panic(err)
}

getCorsInformationOptions := service.NewGetCorsInformationOptions()

corsConfiguration, response, err := service.GetCorsInformation(getCorsInformationOptions)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
// section: code imports
import (
"encoding/json"
"fmt"

"github.com/IBM/cloudant-go-sdk/cloudantv1"
)
// section: code
service, err := cloudantv1.NewCloudantV1(
&cloudantv1.CloudantV1Options{},
)
if err != nil {
panic(err)
}

getCurrentThroughputInformationOptions := service.NewGetCurrentThroughputInformationOptions()

currentThroughputInformation, response, err := service.GetCurrentThroughputInformation(getCurrentThroughputInformationOptions)
Expand Down
14 changes: 14 additions & 0 deletions examples/snippets/getDatabaseInformation/example_request.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
// section: code imports
import (
"encoding/json"
"fmt"

"github.com/IBM/cloudant-go-sdk/cloudantv1"
)
// section: code
service, err := cloudantv1.NewCloudantV1(
&cloudantv1.CloudantV1Options{},
)
if err != nil {
panic(err)
}

getDatabaseInformationOptions := service.NewGetDatabaseInformationOptions(
"products",
)
Expand Down
14 changes: 14 additions & 0 deletions examples/snippets/getDbUpdates/example_request.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
// section: code imports
import (
"encoding/json"
"fmt"

"github.com/IBM/cloudant-go-sdk/cloudantv1"
)
// section: code
service, err := cloudantv1.NewCloudantV1(
&cloudantv1.CloudantV1Options{},
)
if err != nil {
panic(err)
}

getDbUpdatesOptions := service.NewGetDbUpdatesOptions()
getDbUpdatesOptions.SetFeed("normal")
getDbUpdatesOptions.SetHeartbeat(10000)
Expand Down
14 changes: 14 additions & 0 deletions examples/snippets/getDesignDocument/example_request.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
// section: code imports
import (
"encoding/json"
"fmt"

"github.com/IBM/cloudant-go-sdk/cloudantv1"
)
// section: code
service, err := cloudantv1.NewCloudantV1(
&cloudantv1.CloudantV1Options{},
)
if err != nil {
panic(err)
}

getDesignDocumentOptions := service.NewGetDesignDocumentOptions(
"products",
"appliances",
Expand Down
14 changes: 14 additions & 0 deletions examples/snippets/getDesignDocumentInformation/example_request.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
// section: code imports
import (
"encoding/json"
"fmt"

"github.com/IBM/cloudant-go-sdk/cloudantv1"
)
// section: code
service, err := cloudantv1.NewCloudantV1(
&cloudantv1.CloudantV1Options{},
)
if err != nil {
panic(err)
}

getDesignDocumentInformationOptions := service.NewGetDesignDocumentInformationOptions(
"products",
"appliances",
Expand Down
14 changes: 14 additions & 0 deletions examples/snippets/getDocument/example_request.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
// section: code imports
import (
"encoding/json"
"fmt"

"github.com/IBM/cloudant-go-sdk/cloudantv1"
)
// section: code
service, err := cloudantv1.NewCloudantV1(
&cloudantv1.CloudantV1Options{},
)
if err != nil {
panic(err)
}

getDocumentOptions := service.NewGetDocumentOptions(
"products",
"1000042",
Expand Down
14 changes: 14 additions & 0 deletions examples/snippets/getDocumentShardsInfo/example_request.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
// section: code imports
import (
"encoding/json"
"fmt"

"github.com/IBM/cloudant-go-sdk/cloudantv1"
)
// section: code
service, err := cloudantv1.NewCloudantV1(
&cloudantv1.CloudantV1Options{},
)
if err != nil {
panic(err)
}

getDocumentShardsInfoOptions := service.NewGetDocumentShardsInfoOptions(
"products",
"1000042",
Expand Down
Loading

0 comments on commit 4b36732

Please sign in to comment.