vania-janet/multiturn-rag-retrieval-data huggingface dataset:
service.deleteDesignDocument(designDocumentOptions).execute()
.getResult();

System.out.println(response);

const { CloudantV1 } = require('@ibm-cloud/cloudant');

const service = CloudantV1.newInstance({});

service.deleteDesignDocument({
db: 'users',
ddoc: 'allusers',
rev: '2-21314508552eceb0e3012429d04575da'
}).then(response => {
console.log(response.result);
});

from ibmcloudant.cloudant_v1 import CloudantV1

service = CloudantV1.new_instance()

response = service.delete_design_document(
db='users',
ddoc='allusers',
rev='2-21314508552eceb0e3012429d04575da'
).get_result()

print(response)

deleteDesignDocumentOptions := service.NewDeleteDesignDocumentOptions(
"users",
"allusers",
)
deleteDesignDocumentOptions.SetRev("2-21314508552eceb0e3012429d04575da")

documentResult, response, err := service.DeleteDesignDocument(deleteDesignDocumentOptions)
if err != nil {
panic(err)
}

b, _ := json.MarshalIndent(documentResult, "", " ")
fmt.Println(string(b))

The previous Go example requires the following import block:

import (
"encoding/json"
"fmt"
"github.com/IBM/cloudant-go-sdk/cloudantv1"
)
The bookmark of the next request becomes the bookmark of this response
request_params'bookmark'] = response'bookmark']
response = service.post_find(request_params).get_result()
findOptions := service.NewPostFindOptions(
"cities",
mapstring]interface{}{
"country": mapstring]!!! bool{
"$eq": "US",
},
},
)
findOptions.SetLimit(5)

findResult, _, err := service.PostFind(findOptions)
if err = nil {
panic(err)
}
for len(findResult.Docs) > 0 {
documents := findResult.Docs
b, err := json.MarshalIndent(documents, "", " ")
if err = nil {
panic(err)
}
fmt.Printf(string(b))
// The bookmark of the next request becomes the bookmark of this response
findOptions.Bookmark = findResult.Bookmark
findResult, _, err = service.PostFind(findOptions)
if err = nil {
panic(err)
}
}
The previous Go example requires the following import block: import (
"encoding/json"
"fmt"
"github.com/IBM/cloudant-go-sdk/cloudantv1"
)
{
"docs":
{"_id":"10104153","_rev":"1-32aab6258c65c5fc5af044a153f4b994","name":"Silver Lake","latitude":34.08668,"longitude":-118.27023,"country":"US","population":32890,"timezone":"America/Los_Angeles"},
For more details about the response of the API, see [Get a list of all resource instances](https://cloud.ibm.com/apidocs/resource-controller/resource-controllerlist-resource-instances).

Note that the returned state create succeeded indicates that the provision request was successfully accepted. However, to run applications, the instance needs to move to active state. Track the instance readiness before performing any operations on the instance. See [Tracking instance readiness](https://cloud.ibm.com/docs/AnalyticsEngine?topic=AnalyticsEngine-provisioning-serverlessinstance-readiness).
-H "Accept: application/json"
-H "servicekey: <SERVICE_KEY>"

Where <PRESET_ID> is the presetid value returned when [running the GET method to return all presets.](https://cloud.ibm.com/docs/log-analysis?topic=log-analysis-preset-apipreset-api-get-all)

A response similar to the following will be returned:

{"channels":[{"integration":"email","immediate":false,"terminal":true,"triggerlimit":1,"triggerinterval":"30","operator":"presence","emails":"MyUser@mycompany.com"],"alertid":"4991f78d6d"}],"presetid":"291a4100b0","account":"090bba4d47","name":"Email preset","_created":"2021-11-18T15:15:53.414Z","_modified":"2021-11-18T15:15:53.414Z"}





 Modifying a preset 

The following modifies a view by adding an alert.

curl --request PUT https://api.us-south.logging.cloud.ibm.com/v1/config/presetalert/<PRESET_ID> 
-H "Accept: application/json" 
-H "Content-Type: application/json" 
-H "servicekey: <SERVICE_KEY>" 
-d '{ "name": "My preset", "channels": ["<CHANNEL>"] }'

Where <PRESET_ID> is the presetid value returned when [running the GET method to return all presets.](https://cloud.ibm.com/docs/log-analysis?topic=log-analysis-preset-apipreset-api-get-all)

A response similar to the following is returned:
.build();

Response<Reclamation> response = service.runReclamationAction(runReclamationActionOptions).execute();
Reclamation reclamation = response.getResult();

System.out.printf("runReclamationAction() response:n%sn", reclamation.toString());

reclamation = resource_controller_service.run_reclamation_action(
id=reclamation_id,
action_name='reclaim'
).get_result()

print('nrun_reclamation_action() response:n',
json.dumps(reclamation, indent=2))

runReclamationActionOptions := resourceControllerService.NewRunReclamationActionOptions(
reclamationID,
"reclaim",
)

reclamation, response, err := resourceControllerService.RunReclamationAction(runReclamationActionOptions)
if err != nil {
panic(err)
}
b, _ := json.MarshalIndent(reclamation, "", " ")
fmt.Printf("nRunReclamationAction() response:n%sn", string(b))

const params = {
id: reclamationId,
actionName: 'reclaim',
};

resourceControllerService.runReclamationAction(params)
.then(res => {
console.log('runReclamationAction() response:n' + JSON.stringify(res.result, null, 2));
})
.catch(err => {
console.warn(err)
});





 Restoring a resource by using the CLI 

You can restore a resource within 7 days after you delete it.

Not all resources can be restored. You can run the ibmcloud resource reclamations command to check the resources that you can restore.
Return values Wraps EP11 error into message Grep11Error. 



Code snippets



* Golang code snippet

DigestFinalRequest := &pb.DigestFinalRequest {
State: DigestUpdateResponse.State,
}

DigestFinalResponse, err := cryptoClient.DigestFinal(context.Background(), DigestFinalRequest)
* JavaScript code snippet

client.DigestFinal({
State: state
}, (err, response) => {
callback(err, response);
});







 DigestSingle 

The DigestSingle function digests data in one pass with one call and without constructing an intermediate digest state and unnecessary roundtrips. This function is an IBM EP11 extension to the standard PKCS #11 specification and is a combination of the DigestInit and Digest functions. It enables you to complete a digesting operation with a single call instead of a series of calls.

Enterprise PKCS #11 over gRPC

Enterprise PKCS #11





 Description Binds to EP11 m_DigestSingle. 
 Parameters message DigestSingleRequest { Mechanism Mech = 1; bytes Data = 2; } message DigestSingleResponse { bytes Digest = 3; } 
 Return values Wraps EP11 error into message Grep11Error. 



Code snippets



* Golang code snippet

digestData := []byte("Create a digest for this string")
DigestSingleRequest := &pb.DigestSingleRequest {
Mech: &pb.Mechanism{Mechanism: ep11.CKM_SHA256},
Data: digestData,
}

DigestSingleResponse, err := cryptoClient.DigestSingle(context.Background(), DigestSingleRequest)
* JavaScript code snippet

client.DigestSingle({
Mech: {
Mechanism: ep11.CKM_SHA256
},
Data: Buffer.from(digestData)
email_view_map_reduce = DesignDocumentViewsMapReduce(
map='function(user) { if(user.email_verified === true){ emit(doc.email, {name: user.name, email_verified: user.email_verified, joined: user.joined}) }}'
)

design_document = DesignDocument(
views={'getVerifiedEmails': email_view_map_reduce}
)

response = service.put_design_document(
db='users',
design_document=design_document,
ddoc='allusers'
).get_result()

print(response)

emailViewMapReduce, err := service.NewDesignDocumentViewsMapReduce(
"function(user) { if(user.email_verified === true){ emit(doc.email, {name: user.name, email_verified: user.email_verified, joined: user.joined}) }}",
)
if err != nil {
panic(err)
}

designDocument := &cloudantv1.DesignDocument{
Views: map[string]cloudantv1.DesignDocumentViewsMapReduce{
"getVerifiedEmails": emailViewMapReduce,
},
}

putDesignDocumentOptions := service.NewPutDesignDocumentOptions(
"users",
"allusers",
designDocument,
)

documentResult, _, err := service.PutDesignDocument(putDesignDocumentOptions)
if err != nil {
panic(err)
}

b, _ := json.MarshalIndent(documentResult, "", " ")
fmt.Println(string(b))

The previous Go example requires the following import block:

import (
"encoding/json"
"fmt"
If you don’t get a successful response, the error response contains the errors that you need to resolve. Resolve those errors and run the script until you are able to get a valid response and generate a plan.
8. If you want to check the logs of the action, see [Retrieving action logs with Schematics API](https://cloud.ibm.com/docs/hpc-openshift?topic=hpc-openshift-retrieve-action-logs&interface=api) to retrieve the logs. The response contains the status of the action, and it appears in either a COMPLETED or FAILED state.





 Example Python request 

 Generate a plan using Schematics Python API

import json, logging

from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
from ibm_schematics.schematics_v1 import SchematicsV1

logging.basicConfig()
logging.root.setLevel(logging.NOTSET)
logging.basicConfig(level=logging.NOTSET)

authenticator = IAMAuthenticator('<ibmcloud-api-key>')

schematics_service = SchematicsV1(authenticator = authenticator)

schematics_service.set_service_url('https://us.schematics.cloud.ibm.com')

logging.info("Started Generating Schematic Plan")

workspace_activity_plan_result = schematics_service.plan_workspace_command(
    w_id='<workspace id>',
    refresh_token='<refresh-token>'
).get_result()

print(json.dumps(workspace_activity_plan_result, indent=2))

logging.info("Completed Generating Schematic Plan")





 Example Python response 

INFO:root:Started Generating Schematic Plan
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): iam.cloud.ibm.com:443
Parameters message VerifyFinalRequest { bytes State = 1; bytes Signature = 2; } message VerifyFinalResponse { } 
 Return values Wraps EP11 error into message Grep11Error. 



Code snippets



* Golang code snippet

VerifyFinalRequest := &pb.VerifyFinalRequest {
State: VerifyUpdateResponse.State,
Signature: SignResponse.Signature,
}

VerifyFinalResponse, err := cryptoClient.VerifyFinal(context.Background(), VerifyFinalRequest)
* JavaScript code snippet

client.VerifyFinal({
State: state,
Signature: signature
}, (err, response) => {
callback(err, response);
});







 VerifySingle 

The VerifySingle function signs or MACs data in one pass with one call and without constructing intermediate digest state. It does not return any state to host and returns only the verification result. This function is an IBM EP11 extension to the standard PKCS #11 specification and is a combination of the VerifyInit and Verify functions. It enables you to complete a verification operation with a single call instead of a series of calls.

Enterprise PKCS #11 over gRPC

Enterprise PKCS #11





 Description Binds to EP11 m_VerifySingle. 
 Parameters message VerifySingleRequest { bytes PubKey = 1; Mechanism Mech = 2; bytes Data = 3; bytes Signature = 4; } message VerifySingleResponse { } 
 Return values Wraps EP11 error into message Grep11Error. 



Code snippets



* Golang code snippet

VerifySingleRequest := &pb.VerifySingleRequest {
PubKey: GenerateKeyPairResponse.PubKeyByytes,
Mech: &pb.Mechanism{Mechanism: ep11.CKM_SHA256_RSA_PKCS},
Data: msgHash[:],
Signature: SignSingleResponse.Signature,
}
producer.send(new ProducerRecord<String, String>("T1", "key", "value"));
producer.close();

The send() method is asynchronous and returns a Future that you can use to check its completion:

Future<RecordMetadata> f = producer.send(new ProducerRecord<String, String>("T1", "key", "value"));
// Do some other stuff
// Now wait for the result of the send
RecordMetadata rm = f.get();
long offset = rm.offset;

Alternatively, you can supply a callback when you send the message:

producer.send(new ProducerRecord<String,String>("T1","key","value", new Callback() {
public void onCompletion(RecordMetadata metadata, Exception exception) {
// This is called when the send completes, either successfully or with an exception
}
});

For more information, see the [Javadoc for the Kafka client](https://kafka.apache.org/11/javadoc/index.html?overview-summary.html).{: external}.
Accessing protected APIs 

After a successful login flow, you can use your access and identity tokens to invoke protected backend resources that use the SDK or a networking library of your choice.



 With the Swift SDK 



1. Add the following imports to the file in which you want to invoke a protected resource request:

import BMSCore
import IBMCloudAppID
2. Invoke your protected resource

BMSClient.sharedInstance.initialize(region: <region>)
BMSClient.sharedInstance.authorizationManager = AppIDAuthorizationManager(appid: AppID.sharedInstance)
let request = Request(url: "{your protected resource url}")
request.send { (response: Response?, error: Error?) in
guard let response = response, error == null else {
print("An error occurred invoking a protected resources", error?.localizedDescription ?? "No response was received")
return;
}
// use your response object
})







 With the Android SDK 



1. Add the following imports to the file in which you want to invoke a protected resource request:

import com.ibm.mobilefirstplatform.clientsdk.android.core.api.BMSClient;
import com.ibm.cloud.appid.android.api.AppIDAuthorizationManager;
2. Invoke your protected resource

BMSClient bmsClient = BMSClient.getInstance();
bmsClient.initialize(getApplicationContext(), <region>);
AppIDAuthorizationManager appIdAuthMgr = new AppIDAuthorizationManager(AppID.getInstance())
bmsClient.setAuthorizationManager(appIdAuthMgr);
Request request = new Request("{your protected resource url}", Request.GET);
request.send(this, new ResponseListener() {
@Override
If multiple actions in a single JSON action array add the result of their programmatic call to the same context variable, then the order in which the context is updated matters. Per action type, the order in which the actions are defined in the array determines the order in which the context variable's value is set. The context variable value returned by the last action in the array overwrites the values calculated by any other actions.

The result_variable property is required. If the client action does not return any result, specify null as the value.









 Client action example 

The following example shows what a request for a call to an external weather service might look like. It is added to the JSON editor that is associated with the node response. By the time the node-level response is triggered, slots have collected and stored the date and location information from the user. This example assumes that the client action is named weather_forecast, that it takes a location parameter, and that the results are to be stored in the weather_forecast context variable.

{
"actions": [
{
"name": "get_weather",
"type": "client",
"parameters": {
"location": "$location"
},
"result_variable": "weather_forecast"
}
]
}

The client application must check for the presence of any client actions in the responses to messages it sends to the assistant. When it recognizes a request for the get_weather action, it executes the action (calling the external weather service), and it stores the result in the specified context variable (weather_forecast). It then sends a message to the service, including the updated context.

To handle this message in your dialog, create a child node following the node that requested the action. You can condition this child node on the special condition true to ensure that it is always triggered by the message that the client sends after completing the requested action. In this child node, add the response to show the user, reading the stored action result from the $my_forecast context variable:

{
"output": {
"text": {
"values": [
: Query expansion and autocomplete return the wrong error code when the collection_id is invalid. Query expansion will return a 500 error code instead of a 404. Autocomplete will return a 400 when the collection_id is invalid and the prefix parameter isn’t set. It should also return a 404.
: When crawling Microsoft SharePoint 2019 collections, only HTML documents will be crawled and indexed. This is a SharePoint issue with how it processes mime-types. See this Microsoft [blog post](https://blog.stefan-gossner.com/2018/11/30/common-issue-sp2019-items-in-document-libraries-are-downloaded-with-mime-type-application-octet-stream-rather-than-the-accurate-one/) for a workaround.
: If you delete an installation of the Discovery for Cloud Pak for Data add-on, the instance will not uninstall completely and your re-installation will fail. See the Discovery for Cloud Pak for Data Readme for post-cleanup steps.
: If a JSON document that contains nested JSON objects is ingested, the nested JSON will be indexed as a JSON string.





 2.0.0, General Availability (GA) release, 28 June 2019 

Discovery for Cloud Pak for Data now available
: The IBM Watson® Discovery for IBM Cloud Pak® for Data service brings the cognitive capabilities of IBM Watson® Discovery to the IBM Cloud Pak® for Data platform.
System.out.println(String.valueOf(responseObj));
* Return the state of an application:

ServiceCall<ApplicationGetStateResponse> getApplicationState(GetApplicationStateOptions getApplicationStateOptions)

Example request:

// Construct an instance of the GetApplicationStateOptions model
GetApplicationStateOptions getApplicationStateOptionsModel = new GetApplicationStateOptions.Builder()
.instanceId("dc0e9889-eab2-4t9e-9441-566209499546")
.applicationId("db933645-0b68-4dcb-80d8-7b71a6c8e542")
.build();

// Invoke operation with valid options model (positive test)
Response<ApplicationGetStateResponse> response = ibmAnalyticsEngineApiService.getApplicationState(getApplicationStateOptionsModel).execute();
ApplicationGetStateResponse responseObj = response.getResult();
System.out.println(String.valueOf(responseObj));
response = await service.validationInstall({ 'versionLocatorId': versionLocator, 'xAuthRefreshToken': authRefreshToken });
console.log(response);





 Publishing your software to your account by using the API 

You can programmatically publish your software to your account by calling the Catalog Management API as shown in the following sample request. For detailed information about the API, see [Catalog Management API](https://cloud.ibm.com/apidocs/resource-catalog/private-catalog?code=javaaccount-publish-version).



* Java
* Python
* Go
* Node



String versionLocator = "{versionLocator}";
AccountPublishVersionOptions publishOption = new AccountPublishVersionOptions.Builder().versionLocId(versionLocator).build();
Response<Void> response = service.accountPublishVersion(publishOption).execute();
System.out.println(response.getResult());

versionLocator = "{versionLocator}"
response = self.service.account_publish_version(version_loc_id=versionLocator)
print(response)

versionLocator := "{versionLocator}"
publishOptions := service.NewAccountPublishVersionOptions(versionLocator)
response, _ := service.AccountPublishVersion(publishOptions)
fmt.Println(response)

versionLocator = "{versionLocator}";
response = await service.accountPublishVersion({ 'versionLocId': versionLocator});
console.log(response);





 Creating a private catalog by using Terraform 

Use the following steps to create a private catalog by using Terraform.



1. Add your argument to your main.tf file. The following example creates a private catalog by using the ibm_cm_catalog resource, where label is a display name to identify the catalog.
Coding style 



  Coding conventions 

The SDK MUST adhere to coding style that is clearly documented in the SDK CONTRIBUTING file. The SDK SHOULD adopt the coding style recommendation that is given in the appropriate language-specific section of these guidelines.





  Idiomatic style 

The SDK SHOULD employ the generally accepted best practices and common idioms of the specific language. The SDK SHOULD feel "natural" to developers with experience in that language. In particular, the JSON structure of the underlying API request and response structures SHOULD be converted to native language objects with appropriately typed member variables.





  Use style checkers 

The SDK SHOULD employ a code style checker to enforce the established coding style. See [style checkers](https://cloud.ibm.com/docs/sdk-handbook?topic=sdk-handbook-devtoolsdevtools-style-checkers).
If the targeting is configured, then entityAttributes must be provided for the rule evaluation. An attribute is a parameter that is used to define a segment. The SDK uses the attribute values to determine if the specified entity satisfies the targeting rules, and returns the appropriate feature flag value.







 Get single property 

property, err := appConfigClient.GetProperty("check-in-charges")
if err == nil {
fmt.Println("Property Name", property.GetPropertyName())
fmt.Println("Property Id", property.GetPropertyID())
fmt.Println("Property Type", property.GetPropertyDataType())
}





 Get all properties 

properties, err := appConfigClient.GetProperties()
if err == nil {
property := properties["check-in-charges"]

fmt.Println("Property Name", property.GetPropertyName())
fmt.Println("Property Id", property.GetPropertyID())
fmt.Println("Property Type", property.GetPropertyDataType())
}





 Property evaluation 

You can use the property.GetCurrentValue(entityId, entityAttributes) method to evaluate the value of the property. GetCurrentValue returns the default property value or its overridden value based on the evaluation.

entityId := "john_doe"
entityAttributes := make(map[string]interface{})
entityAttributes["city"] = "Bangalore"
entityAttributes["country"] = "India"

propertyVal := property.GetCurrentValue(entityId, entityAttributes)



* entityId: entityId is a string identifier related to the Entity against which the property will be evaluated.
service.postView({
db: 'users',
ddoc: 'allusers',
view: 'getVerifiedEmails',
descending: true
}).then(response => {
console.log(response.result);
});

from ibmcloudant.cloudant_v1 import CloudantV1

service = CloudantV1.new_instance()

response = service.post_view(
db='users',
ddoc='allusers',
view='getVerifiedEmails',
descending=True
).get_result()

print(response)

postViewOptions := service.NewPostViewOptions(
"users",
"allusers",
"getVerifiedEmails",
)

postViewOptions.SetDescending(true)

viewResult, response, err := service.PostView(postViewOptions)
if err != nil {
panic(err)
}

b, _ := json.MarshalIndent(viewResult, "", " ")
fmt.Println(string(b))

The previous Go example requires the following import block:

import (
"encoding/json"
"fmt"
"github.com/IBM/cloudant-go-sdk/cloudantv1"
)

All Go examples require the service object to be initialized. For more information, see the API documentation's [Authentication section](https://cloud.ibm.com/apidocs/cloudant?code=goauthentication-with-external-configuration) for examples.

See the example response of requesting the records in reverse sort order:

{
"total_rows": 2,
"offset": 0,
"rows": [
{
"id": "abc123",
"key": "bob.smith@aol.com",
"value":
"Bob Smith",
The server MAY include a Retry-After header telling the client when it should try submitting the request again. 
 505 [HTTP Version Not Supported](https://datatracker.ietf.org/doc/html/rfc7231section-6.6.6) This code SHOULD be returned when the server does not support the HTTP protocol version used in a request. The response SHOULD contain a document describing which protocols the server does support. 





 500 and 503 errors 

Because the client can do nothing to fix a 500 or 503 status code (and can only try again later), it MUST be considered a critical application failure whenever one of those status codes is returned in production. For more information on this and error response models, see the handbook's documentation on [Errors](https://cloud.ibm.com/docs/api-handbook?topic=api-handbook-errors).