### Install quickbi-public SDK for Go with go get Source: https://github.com/alibabacloud-go/quickbi-public-20220101/blob/master/README.md Use this command to install the Alibaba Cloud quickbi-public SDK for Go version 2. Requires Go environment version greater than 1.12.0. ```sh $ go get github.com/alibabacloud-go/quickbi-public-20220101/v2 ``` -------------------------------- ### SmartqQueryAbility usage example Source: https://github.com/alibabacloud-go/quickbi-public-20220101 Example call to SmartqQueryAbility with required parameters MultipleCubeIds and UserQuestion. The response's ConclusionText is printed if no error occurs. ```go resp, err := client.SmartqQueryAbility(&quickbi.SmartqQueryAbilityRequest{ MultipleCubeIds: dara.String("7c7223ae-31d1-4d2f-b11f-3c744528014b"), UserId: dara.String("fe67f61a35a94b7da1a34ba174a7xxxx"), UserQuestion: dara.String("What were the sales by region last month?"), }) if err == nil { fmt.Println(dara.StringValue(resp.Body.Result.ConclusionText)) } ``` -------------------------------- ### Complete initialization example with openapiutil.Config Source: https://github.com/alibabacloud-go/quickbi-public-20220101 Full client initialization using openapiutil.Config with AccessKeyId, AccessKeySecret, and RegionId. Optional Endpoint and ReadTimeout are commented out. Panics on error. ```go import ( "github.com/alibabacloud-go/darabonba-openapi/v2/utils" "github.com/alibabacloud-go/tea/dara" quickbi "github.com/alibabacloud-go/quickbi-public-20220101/v2/client" ) cfg := &openapiutil.Config{ AccessKeyId: dara.String("LTAI5tXXXX"), AccessKeySecret: dara.String("secretXXXX"), RegionId: dara.String("cn-hangzhou"), // Optional: // Endpoint: dara.String("quickbi-public.cn-hangzhou.aliyuncs.com"), // ReadTimeout: dara.Int(5000), } client, err := quickbi.NewClient(cfg) if err != nil { panic(err) } ``` -------------------------------- ### AddUser usage example Source: https://github.com/alibabacloud-go/quickbi-public-20220101 Example call to AddUser with required fields. Checks for transport/server errors and business failure via Body.Success, then prints the new user ID. ```go resp, err := client.AddUser(&quickbi.AddUserRequest{ AccountId: dara.String("191476xxxxx23754"), NickName: dara.String("John"), UserType: dara.Int32(1), RoleIds: dara.String("111111113"), }) if err != nil { /* validate / transport / server error */ } if !dara.BoolValue(resp.Body.Success) { /* business failure, see resp.Body.RequestId */ } fmt.Println(dara.StringValue(resp.Body.Result.UserId)) ``` -------------------------------- ### QueryCopilotEmbedConfig usage example Source: https://github.com/alibabacloud-go/quickbi-public-20220101 Example call to QueryCopilotEmbedConfig with a Keyword filter. Returns *QueryCopilotEmbedConfigResponse; Body.Result is []*QueryCopilotEmbedConfigResponseBodyResult. ```go resp, err := client.QueryCopilotEmbedConfig(&quickbi.QueryCopilotEmbedConfigRequest{ Keyword: dara.String("sales"), }) if err == nil { for _, c := range resp.Body.Result { fmt.Println(dara.StringValue(c.CopilotId), dara.StringValue(c.ModuleName)) } } ``` -------------------------------- ### CreateDataset usage example Source: https://github.com/alibabacloud-go/quickbi-public-20220101 Example call to CreateDataset with required parameters, printing the returned dataset ID. ```go resp, err := client.CreateDataset(&quickbi.CreateDatasetRequest{ DsId: dara.String("2adf8b3f-...-b"), TableName: dara.String("orders"), UserDefineCubeName: dara.String("Orders Cube"), UserId: dara.String("fe67f61a35a94b7da1a34ba174a7xxxx"), WorkspaceId: dara.String("ab46fd8d-...-a3e5"), }) fmt.Println("cube id:", dara.StringValue(resp.Body.Result)) ``` -------------------------------- ### AllotDatasetAccelerationTask usage example Source: https://github.com/alibabacloud-go/quickbi-public-20220101 Example call to AllotDatasetAccelerationTask with a CubeId parameter. The CubeId is required and represents the dataset ID. Returns a response with Body.Result as *bool. ```go resp, err := client.AllotDatasetAccelerationTask(&quickbi.AllotDatasetAccelerationTaskRequest{ CubeId: dara.String("7c7223ae-31d1-4d2f-b11f-3c744528014b"), }) ``` -------------------------------- ### Initialize client and call QueryUserList Source: https://github.com/alibabacloud-go/quickbi-public-20220101 Shows the common usage pattern for the QuickBI client: create a client with credentials and region, then call an operation. The example uses the QueryUserList operation with PageNum and PageSize parameters. Requires importing the darabonba-openapi utils and the quickbi client package. ```go import ( "github.com/alibabacloud-go/darabonba-openapi/v2/utils" quickbi "github.com/alibabacloud-go/quickbi-public-20220101/v2/client" ) func main() { client, err := quickbi.NewClient(&openapiutil.Config{ AccessKeyId: dara.String("AKID"), AccessKeySecret: dara.String("AKSECRET"), RegionId: dara.String("cn-hangzhou"), }) // ... resp, err := client.QueryUserList(&quickbi.QueryUserListRequest{ PageNum: dara.Int32(1), PageSize: dara.Int32(10), }) } ``` -------------------------------- ### Initialize QuickBI client Source: https://github.com/alibabacloud-go/quickbi-public-20220101 Example of initializing the QuickBI client with access key, secret, and region. The NewClient function returns an error that is handled with panic. The client is assigned to _ to avoid unused variable. ```go package main import ( "github.com/alibabacloud-go/darabonba-openapi/v2/utils" "github.com/alibabacloud-go/tea/dara" quickbi "github.com/alibabacloud-go/quickbi-public-20220101/v2/client" ) func main() { client, err := quickbi.NewClient(&openapiutil.Config{ AccessKeyId: dara.String("LTAI5tXXXX"), AccessKeySecret: dara.String("secretXXXX"), RegionId: dara.String("cn-hangzhou"), }) if err != nil { panic(err) } _ = client } ``` -------------------------------- ### IpWhiteListConfig usage example Source: https://github.com/alibabacloud-go/quickbi-public-20220101 Example call to IpWhiteListConfig with Operation ADD and a comma-separated IP whitelist. The response Body.Result is of type *IpWhiteListConfigResponseBodyResult. ```go resp, err := client.IpWhiteListConfig(&quickbi.IpWhiteListConfigRequest{ Operation: dara.String("ADD"), IpWhiteList: dara.String("1.2.3.4,10.0.0.0/8"), }) ``` -------------------------------- ### ListOrganizationRoles usage example Source: https://github.com/alibabacloud-go/quickbi-public-20220101 Example of calling ListOrganizationRoles and iterating over the result to print role IDs and names. ```go resp, err := client.ListOrganizationRoles() if err == nil { for _, r := range resp.Body.Result { fmt.Println(dara.Int64Value(r.RoleId), dara.StringValue(r.RoleName)) } } ``` -------------------------------- ### SmartqAuthorize usage example Source: https://github.com/alibabacloud-go/quickbi-public-20220101 Example call to SmartqAuthorize with required UserIds and OperationType, optional CubeIds and ExpireDay. OperationType 0 grants authorization; 1 deletes. Iterates over response Body.Result to print per-user UserId and DetailMessage. ```go resp, err := client.SmartqAuthorize(&quickbi.SmartqAuthorizeRequest{ UserIds: dara.String("fe67f61a35a94b7da1a34ba174a7xxxx"), CubeIds: dara.String("7c7223ae-31d1-4d2f-b11f-3c744528014b"), OperationType: dara.Int32(0), ExpireDay: dara.String("30"), }) for _, r := range resp.Body.Result { fmt.Println(dara.StringValue(r.UserId), dara.StringValue(r.DetailMessage)) } ``` -------------------------------- ### AuthorizeMenu usage example Source: https://github.com/alibabacloud-go/quickbi-public-20220101 Example call to AuthorizeMenu with required DataPortalId and MenuIds, optional UserIds and AuthPointsValue. Prints the number of authorized menus from the response Body.Result. ```go resp, err := client.AuthorizeMenu(&quickbi.AuthorizeMenuRequest{ DataPortalId: dara.String("a4e7c2a8-...-31"), MenuIds: dara.String("50f0f04d-...-8a63, 2f2f1f1a-...-7d1d"), UserIds: dara.String("fe67f61a35a94b7da1a34ba174a7xxxx"), AuthPointsValue: dara.Int32(1), }) fmt.Println("authorized menus:", dara.Int32Value(resp.Body.Result)) ``` -------------------------------- ### AddUserTagMeta usage example Source: https://github.com/alibabacloud-go/quickbi-public-20220101 Example call to AddUserTagMeta with TagName and TagDescription. The response Body.Result contains the new tag ID. ```go resp, err := client.AddUserTagMeta(&quickbi.AddUserTagMetaRequest{ TagName: dara.String("department"), TagDescription: dara.String("Cost center department"), }) // resp.Body.Result -> new tag ID ``` -------------------------------- ### QueryUserTagMetaList example call Source: https://github.com/alibabacloud-go/quickbi-public-20220101 Example call to QueryUserTagMetaList, which takes no request parameters. Iterates over the returned tag metadata list and prints each tag's ID and name. ```go resp, err := client.QueryUserTagMetaList() if err == nil { for _, t := range resp.Body.Result { fmt.Println(dara.StringValue(t.TagId), dara.StringValue(t.TagName)) } } ``` -------------------------------- ### QueryUserList usage example Source: https://github.com/alibabacloud-go/quickbi-public-20220101 Calls QueryUserList with pagination and keyword filter, then prints user IDs and nicknames from the response. ```go resp, err := client.QueryUserList(&quickbi.QueryUserListRequest{ PageNum: dara.Int32(1), PageSize: dara.Int32(20), Keyword: dara.String("John"), }) if err == nil { for _, u := range resp.Body.Result.Data { fmt.Println(dara.StringValue(u.UserId), dara.StringValue(u.NickName)) } } ``` -------------------------------- ### ListDataSource usage example Source: https://github.com/alibabacloud-go/quickbi-public-20220101 Calls ListDataSource with a WorkspaceId and iterates over the returned data sources, printing DsId, DsName, and DsType. The example assumes the client is already configured. ```go resp, err := client.ListDataSource(&quickbi.ListDataSourceRequest{ WorkspaceId: dara.String("ab46fd8d-...-a3e5"), }) if err == nil { for _, ds := range resp.Body.Result { fmt.Println(dara.StringValue(ds.DsId), dara.StringValue(ds.DsName), dara.StringValue(ds.DsType)) } } ``` -------------------------------- ### CreateWorkspace usage example Source: https://github.com/alibabacloud-go/quickbi-public-20220101 Example call to CreateWorkspace with a workspace name and optional flags. The response Body.Result contains the new workspace ID, printed via dara.StringValue. ```go resp, err := client.CreateWorkspace(&quickbi.CreateWorkspaceRequest{ WorkspaceName: dara.String("Marketing Analytics"), AllowPublish: dara.Bool(true), AllowShare: dara.Bool(true), DefaultShareToAll: dara.Bool(true), }) fmt.Println("workspace id:", dara.StringValue(resp.Body.Result)) ``` -------------------------------- ### CreateUserGroup usage example Source: https://github.com/alibabacloud-go/quickbi-public-20220101 Example call to CreateUserGroup with a parent group ID, group name, and description. Prints the new group ID from the response body. ```go resp, err := client.CreateUserGroup(&quickbi.CreateUserGroupRequest{ ParentUserGroupId: dara.String("0d5fb19b-...-1248fc27ca51"), UserGroupName: dara.String("East-Sales"), UserGroupDescription: dara.String("East region sales team"), }) fmt.Println(dara.StringValue(resp.Body.Result)) ``` -------------------------------- ### DeleteUser usage example Source: https://github.com/alibabacloud-go/quickbi-public-20220101 Example call to DeleteUser with a UserId. The UserId is a Quick BI user ID, not the Alibaba Cloud UID. The response Body.Result is a boolean indicating success. ```go resp, err := client.DeleteUser(&quickbi.DeleteUserRequest{ UserId: dara.String("95296e95-ca98-4c2d-a714-xxxxx"), }) ``` -------------------------------- ### AddUserToWorkspace example call Source: https://github.com/alibabacloud-go/quickbi-public-20220101 Example call to AddUserToWorkspace with a workspace developer role (RoleId 26). Requires WorkspaceId, UserId, and RoleId. The response Body.Result is a *bool. ```go resp, err := client.AddUserToWorkspace(&quickbi.AddUserToWorkspaceRequest{ WorkspaceId: dara.String("ab46fd8d-...-a3e5"), UserId: dara.String("fe67f61a35a94b7da1a34ba174a7xxxx"), RoleId: dara.Int64(26), // workspace developer }) ``` -------------------------------- ### Construct openapiutil.Params for each call Source: https://github.com/alibabacloud-go/quickbi-public-20220101 Every generated call constructs this literal params value. Only Method varies: POST for 141 actions, GET for 3. The request object is built as req := &openapiutil.OpenApiRequest{Query: openapiutil.Query(query)} where query maps JSON field names to values for every non-nil request field. ```go params := &openapiutil.Params{ Action: dara.String(""), Version: dara.String("2022-01-01"), Protocol: dara.String("HTTPS"), Pathname: dara.String("/"), Method: dara.String("POST"), // or "GET" AuthType: dara.String("AK"), Style: dara.String("RPC"), ReqBodyType: dara.String("formData"), BodyType: dara.String("json"), } ``` ```go query := map[string]interface{}{} if !dara.IsNil(request.NickName) { query["NickName"] = request.NickName } ``` -------------------------------- ### CreateCubeBySql usage example Source: https://github.com/alibabacloud-go/quickbi-public-20220101 Shows how to call CreateCubeBySql with required fields: Caption, CustomSql, DsId, UserId, and WorkspaceId. The response Body.Result contains the cube ID. ```go resp, err := client.CreateCubeBySql(&quickbi.CreateCubeBySqlRequest{ Caption: dara.String("Daily Sales"), CustomSql: dara.String("SELECT region, SUM(amount) FROM orders GROUP BY region"), DsId: dara.String("2adf8b3f-...-b"), UserId: dara.String("fe67f61a35a94b7da1a34ba174a7xxxx"), WorkspaceId: dara.String("ab46fd8d-...-a3e5"), }) ``` -------------------------------- ### AddDataSource usage example Source: https://github.com/alibabacloud-go/quickbi-public-20220101 Example call to AddDataSource with a JSON AddModel payload. The payload replicates the add-data-source flow from the Quick BI console, using the restapi/datasource/detect API payload as template. The referenced userId and workspaceId must exist. The response Body.Result contains the data source ID. ```go resp, err := client.AddDataSource(&quickbi.AddDataSourceRequest{ AddModel: dara.String(`{ "userId": "fe67f61a35a94b7da1a34ba174a7****", "workspaceId": "ab46fd8d-...-a3e5", "dsType": "mysql", "dsName": "orders-db", "dbInstance": {...} }`), }) fmt.Println("ds id:", dara.StringValue(resp.Body.Result)) ``` -------------------------------- ### UpdateUserTagValue example call Source: https://github.com/alibabacloud-go/quickbi-public-20220101 Example call to UpdateUserTagValue with TagId, TagValue, and UserId parameters. The UserId is the Quick BI user ID, not the Alibaba Cloud UID. Returns a response with Body.Result as *bool. ```go resp, err := client.UpdateUserTagValue(&quickbi.UpdateUserTagValueRequest{ TagId: dara.String("d7903d4a-...-057487f8f374"), TagValue: dara.String("Finance"), UserId: dara.String("fe67f61a35a94b7da1a34ba174a7xxxx"), }) ``` -------------------------------- ### 使用 go mod 安装 quickbi-public SDK Source: https://github.com/alibabacloud-go/quickbi-public-20220101/blob/master/README-CN.md 通过 go get 命令安装 quickbi-public SDK for Go,版本为 v2。需要本地 go 环境版本大于 1.12.0。 ```sh go get github.com/alibabacloud-go/quickbi-public-20220101/v2 ``` -------------------------------- ### QueryComponentPerformance usage example Source: https://github.com/alibabacloud-go/quickbi-public-20220101 Shows a minimal call to QueryComponentPerformance with required WorkspaceId and QueryType parameters, plus optional PageNum and PageSize. The QueryType must be one of lastDay, sevenDays, or thirtyDays. ```go resp, err := client.QueryComponentPerformance(&quickbi.QueryComponentPerformanceRequest{ WorkspaceId: dara.String("ab46fd8d-...-a3e5"), QueryType: dara.String("sevenDays"), PageNum: dara.Int32(1), PageSize: dara.Int32(10), }) ``` -------------------------------- ### SetDataLevelPermissionWhiteList usage example Source: https://github.com/alibabacloud-go/quickbi-public-20220101 Shows how to call SetDataLevelPermissionWhiteList with a WhiteListModel JSON string. The example sets a ROW_LEVEL rule with user groups and users; set userGroups/users to empty to clear the whitelist. ```go resp, err := client.SetDataLevelPermissionWhiteList(&quickbi.SetDataLevelPermissionWhiteListRequest{ WhiteListModel: dara.String(`{ "ruleType": "ROW_LEVEL", "usersModel": { "userGroups": ["0d5fb19b-***-1248fc27ca51"], "users": ["fe67f61a35a94b7da1a34ba174a7****"] }, "cubeId": "7c7223ae-31d1-4d2f-b11f-3c744528014b" }`), }) ``` -------------------------------- ### QueryUserList method signatures Source: https://github.com/alibabacloud-go/quickbi-public-20220101 Three method variants for QueryUserList: WithOptions, plain, and WithContext. All use GET and send parameters as query/form data. ```go func (client *Client) QueryUserListWithOptions(request *QueryUserListRequest, runtime *dara.RuntimeOptions) (_result *QueryUserListResponse, _err error) func (client *Client) QueryUserList(request *QueryUserListRequest) (_result *QueryUserListResponse, _err error) func (client *Client) QueryUserListWithContext(ctx context.Context, request *QueryUserListRequest, runtime *dara.RuntimeOptions) (_result *QueryUserListResponse, _err error) ``` -------------------------------- ### QueryApprovalInfo Source: https://github.com/alibabacloud-go/quickbi-public-20220101 Gets approval-flow information for an approver. This method is available in three variants: with options and runtime, with just the request, and with context and runtime. ```APIDOC ## QueryApprovalInfo ### Description Gets approval-flow information for an approver. ### Method Function call (Go SDK) ### Signature ```go func (client *Client) QueryApprovalInfoWithOptions(request *QueryApprovalInfoRequest, runtime *dara.RuntimeOptions) (_result *QueryApprovalInfoResponse, _err error) func (client *Client) QueryApprovalInfo(request *QueryApprovalInfoRequest) (_result *QueryApprovalInfoResponse, _err error) func (client *Client) QueryApprovalInfoWithContext(ctx context.Context, request *QueryApprovalInfoRequest, runtime *dara.RuntimeOptions) (_result *QueryApprovalInfoResponse, _err error) ``` ### Parameters #### Request Parameters - **Page** (*int32) - Optional - Page number. Default: `1`. - **PageSize** (*int32) - Optional - Rows per page. Default: `1000`. - **Status** (*int32) - Required - Approval status (values per Alibaba docs). - **UserId** (*string) - Required - Current approver's Quick BI user ID. ### Response #### Success Response - **Body.Result** (*QueryApprovalInfoResponseBodyResult) - The result of the query. ``` -------------------------------- ### QueryOrganizationRoleConfig method signatures Source: https://github.com/alibabacloud-go/quickbi-public-20220101 Method signatures for getting the configuration (permission matrix) of an organization role. Requires a request with RoleId. ```go func (client *Client) QueryOrganizationRoleConfigWithOptions(request *QueryOrganizationRoleConfigRequest, runtime *dara.RuntimeOptions) (_result *QueryOrganizationRoleConfigResponse, _err error) func (client *Client) QueryOrganizationRoleConfig(request *QueryOrganizationRoleConfigRequest) (_result *QueryOrganizationRoleConfigResponse, _err error) func (client *Client) QueryOrganizationRoleConfigWithContext(ctx context.Context, request *QueryOrganizationRoleConfigRequest, runtime *dara.RuntimeOptions) (_result *QueryOrganizationRoleConfigResponse, _err error) ``` -------------------------------- ### Catch errors in consumer code Source: https://github.com/alibabacloud-go/quickbi-public-20220101 All Quick BI Public API methods return a response and an error. Standard Go error handling applies, and any non-nil error indicates the call did not complete. This example shows how to catch and handle errors from the AddShareReport method. ```APIDOC ## [Catch errors in consumer code] ### Description All methods return `(_result *XResponse, _err error)`. Standard Go error handling applies; because error types come from the tea family, `errors.As` against runtime error structs from `darabonba-openapi`/`tea` is the way to classify, and it is safe to treat any non-nil `_err` as "the call did not complete". ### Request Example ```go resp, err := client.AddShareReport(&quickbi.AddShareReportRequest{ WorksId: dara.String("6b407e50-e519-4b8b-8491-xxxx"), ShareToId: dara.String("95296e95-ca98-4c2d-a714-xxxx"), ShareToType: dara.Int32(0), AuthPoint: dara.Int32(2), ExpireDate: dara.Int64(1722400000000), }) if err != nil { // validation (if EnableValidate), network/signature, server, or decode error fmt.Println("call failed:", err) return } // Transport succeeded; verify API-level success. if !dara.BoolValue(resp.Body.Success) { fmt.Printf("API returned failure; RequestId=%s\n", dara.StringValue(resp.Body.RequestId)) } ``` ``` -------------------------------- ### Client Instantiation Source: https://github.com/alibabacloud-go/quickbi-public-20220101 Create a new QuickBI client instance with your Alibaba Cloud credentials and region. This is the entry point for all API operations. ```APIDOC ### Description Creates a new QuickBI client with the provided configuration. ### Method Constructor ### Endpoint N/A (SDK client) ### Parameters - **config** (openapiutil.Config) - Required - Configuration object containing AccessKeyId, AccessKeySecret, and RegionId. ### Response Returns a `*quickbi.Client` instance. ### Request Example ```go client, err := quickbi.NewClient(&openapiutil.Config{ AccessKeyId: dara.String("AKID"), AccessKeySecret: dara.String("AKSECRET"), RegionId: dara.String("cn-hangzhou"), }) ``` ``` -------------------------------- ### NewClient(config *openapiutil.Config) (*Client, error) Source: https://github.com/alibabacloud-go/quickbi-public-20220101 Creates a new Client instance for the QuickBI Public API. This constructor initializes the client with the provided configuration and returns the client along with any initialization error. ```APIDOC ## NewClient(config *openapiutil.Config) (*Client, error) ### Description Creates a new Client instance for the QuickBI Public API. This constructor initializes the client with the provided configuration and returns the client along with any initialization error. ### Method Constructor ### Parameters - **config** (*openapiutil.Config) - Required - Configuration for the client, including credentials and endpoint settings. ### Response - **client** (*Client) - The initialized client instance. - **err** (error) - Any error encountered during initialization. ### Request Example ```go config := &openapiutil.Config{ AccessKeyId: tea.String("your-access-key-id"), AccessKeySecret: tea.String("your-access-key-secret"), RegionId: tea.String("cn-hangzhou"), } client, err := NewClient(config) if err != nil { panic(err) } ``` ``` -------------------------------- ### NewClient constructor implementation Source: https://github.com/alibabacloud-go/quickbi-public-20220101 Verbatim implementation of `NewClient`. It instantiates a new `Client`, calls `Init(config)` to initialize it, and returns the client with the error from `Init`. ```go func NewClient(config *openapiutil.Config) (*Client, error) { client := new(Client) err := client.Init(config) return client, err } ``` -------------------------------- ### WithdrawAllUserGroups usage example Source: https://github.com/alibabacloud-go/quickbi-public-20220101 Example call to WithdrawAllUserGroups with a UserId. The operation is irreversible, so failure should be handled carefully. The response Body.Success indicates success. ```go resp, err := client.WithdrawAllUserGroups(&quickbi.WithdrawAllUserGroupsRequest{ UserId: dara.String("fe67f61a35a94b7da1a34ba174a7xxxx"), }) if err != nil || !dara.BoolValue(resp.Body.Success) { // "This process is irreversible" — treat failure carefully. } ``` -------------------------------- ### NewClient constructor signature Source: https://github.com/alibabacloud-go/quickbi-public-20220101 Constructor signature for creating a `Client` from an `openapiutil.Config`. It calls `Init(config)` and returns the client along with any initialization error. ```go func NewClient(config *openapiutil.Config) (*Client, error) ``` -------------------------------- ### ModifyAiproEmbedConfig usage example Source: https://github.com/alibabacloud-go/quickbi-public-20220101 Example call to ModifyAiproEmbedConfig with AIPro ID, display name, and feature flags. The response Body.Result is a *bool. ```go resp, err := client.ModifyAiproEmbedConfig(&quickbi.ModifyAiproEmbedConfigRequest{ AiProId: dara.String("aipro-xxxx"), ShowName: dara.String("Data Copilot AI"), ChatHistoryStatus: dara.Int32(1), MemoryEnabled: dara.Int32(1), UploadEnabled: dara.Int32(0), }) ``` -------------------------------- ### GetEndpoint method for Client Source: https://github.com/alibabacloud-go/quickbi-public-20220101 Resolves the endpoint in priority order: returns the provided endpoint if set, then checks the endpoint map for the region, then delegates to openapiutil.GetEndpointRules. For this SDK, the constructor passes productId "quickbi-public" and endpointRule "regional". ```go func (client *Client) GetEndpoint(productId *string, regionId *string, endpointRule *string, network *string, suffix *string, endpointMap map[string]*string, endpoint *string) (_result *string, _err error) ``` -------------------------------- ### XWithOptions Source: https://github.com/alibabacloud-go/quickbi-public-20220101 The primary method variant for any request-taking operation X. It builds the RPC query from non-nil request fields, constructs openapiutil.Params, calls the API, and decodes the response. Optionally validates the request if EnableValidate is true. ```APIDOC ## XWithOptions ### Description Builds the RPC query from non-nil request fields, constructs `openapiutil.Params`, calls `client.CallApi(params, req, runtime)`, and decodes the response via `dara.Convert(_body, &_result)`. If `EnableValidate` is true it calls `request.Validate()` first. ### Method Function call ### Signature ```go func (client *Client) XWithOptions(request *XRequest, runtime *dara.RuntimeOptions) (_result *XResponse, _err error) ``` ### Parameters - **request** (*XRequest) - Required - The request object containing operation-specific fields. - **runtime** (*dara.RuntimeOptions) - Required - Runtime options for the call. ### Response - **_result** (*XResponse) - The decoded response object. - **_err** (error) - Non-nil if the call failed. ``` -------------------------------- ### XWithContext Source: https://github.com/alibabacloud-go/quickbi-public-20220101 Identical to XWithOptions but uses a context-aware call. It calls `client.CallApiWithCtx(ctx, params, req, runtime)` instead of `CallApi`. ```APIDOC ## XWithContext ### Description Identical to `XWithOptions` but calls `client.CallApiWithCtx(ctx, params, req, runtime)` instead of `CallApi`. ### Method Function call ### Signature ```go func (client *Client) XWithContext(ctx context.Context, request *XRequest, runtime *dara.RuntimeOptions) (_result *XResponse, _err error) ``` ### Parameters - **ctx** (context.Context) - Required - The context for the call. - **request** (*XRequest) - Required - The request object containing operation-specific fields. - **runtime** (*dara.RuntimeOptions) - Required - Runtime options for the call. ### Response - **_result** (*XResponse) - The decoded response object. - **_err** (error) - Non-nil if the call failed. ``` -------------------------------- ### Init method for Client Source: https://github.com/alibabacloud-go/quickbi-public-20220101 Initializes the embedded OpenAPI client with the given config, then resolves the endpoint. EndpointRule is hard-coded to "regional" and CheckConfig validates credentials before endpoint resolution. ```go func (client *Client) Init(config *openapiutil.Config) (_err error) { _err = client.Client.Init(config) if _err != nil { return _err } client.EndpointRule = dara.String("regional") _err = client.CheckConfig(config) if _err != nil { return _err } client.Endpoint, _err = client.GetEndpoint(dara.String("quickbi-public"), client.RegionId, client.EndpointRule, client.Network, client.Suffix, client.EndpointMap, client.Endpoint) if _err != nil { return _err } return nil } ``` -------------------------------- ### QueryUserList Source: https://github.com/alibabacloud-go/quickbi-public-20220101 Retrieves a list of users from QuickBI. This is a convenience wrapper that calls the WithOptions variant with an empty RuntimeOptions. ```APIDOC ### Description Retrieves a list of users from QuickBI. This is a convenience wrapper that calls the WithOptions variant with an empty RuntimeOptions. ### Method QueryUserList ### Endpoint N/A (SDK method) ### Parameters #### Request Body - **PageNum** (*int32) - Required - Page number for pagination. - **PageSize** (*int32) - Required - Number of records per page. ### Response Returns a response object containing the user list. ### Request Example ```go resp, err := client.QueryUserList(&quickbi.QueryUserListRequest{ PageNum: dara.Int32(1), PageSize: dara.Int32(10), }) ``` ``` -------------------------------- ### CreateTicket usage example Source: https://github.com/alibabacloud-go/quickbi-public-20220101 Example call to CreateTicket with WorksId, UserId, TicketNum, ExpireTime, and GlobalParam. The returned ticket is the accessTicket value to append to the embedded report URL. ```go resp, err := client.CreateTicket(&quickbi.CreateTicketRequest{ WorksId: dara.String("6b407e50-e519-4b8b-8491-xxxx"), UserId: dara.String("fe67f61a35a94b7da1a34ba174a7xxxx"), TicketNum: dara.Int32(100), ExpireTime: dara.Int32(86400), GlobalParam: dara.String(`{"param": "value"}`), }) ticket := dara.StringValue(resp.Body.Result) // ticket is the accessTicket value to append to the embedded report URL ``` -------------------------------- ### ListOrganizationRoles Source: https://github.com/alibabacloud-go/quickbi-public-20220101 A convenience variant of ListOrganizationRolesWithOptions that creates a default RuntimeOptions. ```APIDOC ## ListOrganizationRoles ### Description Lists organization roles. This operation does not take a request parameter and uses default runtime options. ### Method Function call ### Signature ```go func (client *Client) ListOrganizationRoles() (_result *ListOrganizationRolesResponse, _err error) ``` ### Response - **_result** (*ListOrganizationRolesResponse) - The decoded response object. - **_err** (error) - Non-nil if the call failed. ``` -------------------------------- ### X Source: https://github.com/alibabacloud-go/quickbi-public-20220101 A convenience variant that creates a default RuntimeOptions and delegates to XWithOptions. It simplifies calling the operation without needing to specify runtime options. ```APIDOC ## X ### Description Creates `runtime := &dara.RuntimeOptions{}` and delegates to `XWithOptions`. ### Method Function call ### Signature ```go func (client *Client) X(request *XRequest) (_result *XResponse, _err error) ``` ### Parameters - **request** (*XRequest) - Required - The request object containing operation-specific fields. ### Response - **_result** (*XResponse) - The decoded response object. - **_err** (error) - Non-nil if the call failed. ``` -------------------------------- ### QueryAuditLog usage example Source: https://github.com/alibabacloud-go/quickbi-public-20220101 Example call to QueryAuditLog with LogType dataView and date range. Iterates over the returned Body.Result slice to print OperatorId and WorkName. ```go resp, err := client.QueryAuditLog(&quickbi.QueryAuditLogRequest{ LogType: dara.String("dataView"), StartDate: dara.String("20250101"), EndDate: dara.String("20250115"), }) if err == nil { for _, l := range resp.Body.Result { fmt.Println(dara.StringValue(l.OperatorId), dara.StringValue(l.WorkName)) } } ``` -------------------------------- ### EnableValidate validation error path Source: https://github.com/alibabacloud-go/quickbi-public-20220101 Enables client-side validation with EnableValidate and demonstrates that AddUser fails before any network request when required fields are missing. ```go client, _ := quickbi.NewClient(cfg) client.EnableValidate = dara.Bool(true) // AddUser requires NickName and UserType; leaving them nil fails Validate() before // any network request. _, err := client.AddUser(&quickbi.AddUserRequest{}) if err != nil { // err originates from request.Validate() (dara.Validate) — no HTTP call was made. fmt.Println("validation failed:", err) } ``` -------------------------------- ### GetEndpoint Source: https://github.com/alibabacloud-go/quickbi-public-20220101 Resolves the endpoint for the QuickBI Public service. The endpoint is determined in priority order: if already set, use it; otherwise check the endpoint map for the region; otherwise delegate to the OpenAPI utility rules. ```APIDOC ## GetEndpoint ### Description Resolves the endpoint for the QuickBI Public service. The endpoint is determined in priority order: if already set, use it; otherwise check the endpoint map for the region; otherwise delegate to the OpenAPI utility rules. ### Method GetEndpoint ### Signature ```go func (client *Client) GetEndpoint(productId *string, regionId *string, endpointRule *string, network *string, suffix *string, endpointMap map[string]*string, endpoint *string) (_result *string, _err error) ``` ### Parameters - **productId** (*string) - Required - The product identifier, e.g., `"quickbi-public"`. - **regionId** (*string) - Required - The region ID. - **endpointRule** (*string) - Required - The endpoint rule, e.g., `"regional"`. - **network** (*string) - Required - Network type. - **suffix** (*string) - Required - Endpoint suffix. - **endpointMap** (map[string]*string) - Required - Map of region to endpoint. - **endpoint** (*string) - Required - Pre-set endpoint. ### Returns - **string** - The resolved endpoint. - **error** - Returns an error if resolution fails. ### Notes - Priority order: 1) if `endpoint` is already set, return it; 2) if `endpointMap` contains an entry for `regionId`, return that; 3) otherwise delegate to `openapiutil.GetEndpointRules`. - For this SDK the constructor calls it with `productId = "quickbi-public"` and `endpointRule = "regional"`, so the effective host is derived by the regional rule (e.g. `quickbi-public.cn-hangzhou.aliyuncs.com`). ``` -------------------------------- ### AllotDatasetAccelerationTask method signatures Source: https://github.com/alibabacloud-go/quickbi-public-20220101 Method signatures for triggering collection acceleration (Quick engine) for a dataset. Includes WithOptions, standard, and WithContext variants. ```go func (client *Client) AllotDatasetAccelerationTaskWithOptions(request *AllotDatasetAccelerationTaskRequest, runtime *dara.RuntimeOptions) (_result *AllotDatasetAccelerationTaskResponse, _err error) func (client *Client) AllotDatasetAccelerationTask(request *AllotDatasetAccelerationTaskRequest) (_result *AllotDatasetAccelerationTaskResponse, _err error) func (client *Client) AllotDatasetAccelerationTaskWithContext(ctx context.Context, request *AllotDatasetAccelerationTaskRequest, runtime *dara.RuntimeOptions) (_result *AllotDatasetAccelerationTaskResponse, _err error) ``` -------------------------------- ### QueryUserTagMetaList Source: https://github.com/alibabacloud-go/quickbi-public-20220101 A convenience variant of QueryUserTagMetaListWithOptions that creates a default RuntimeOptions. ```APIDOC ## QueryUserTagMetaList ### Description Queries user tag metadata list. This operation does not take a request parameter and uses default runtime options. ### Method Function call ### Signature ```go func (client *Client) QueryUserTagMetaList() (_result *QueryUserTagMetaListResponse, _err error) ``` ### Response - **_result** (*QueryUserTagMetaListResponse) - The decoded response object. - **_err** (error) - Non-nil if the call failed. ``` -------------------------------- ### ListOrganizationRolesWithOptions Source: https://github.com/alibabacloud-go/quickbi-public-20220101 An operation without a request parameter. It lists organization roles using the provided runtime options. ```APIDOC ## ListOrganizationRolesWithOptions ### Description Lists organization roles. This operation does not take a request parameter. ### Method Function call ### Signature ```go func (client *Client) ListOrganizationRolesWithOptions(runtime *dara.RuntimeOptions) (_result *ListOrganizationRolesResponse, _err error) ``` ### Parameters - **runtime** (*dara.RuntimeOptions) - Required - Runtime options for the call. ### Response - **_result** (*ListOrganizationRolesResponse) - The decoded response object. - **_err** (error) - Non-nil if the call failed. ``` -------------------------------- ### AddShareReport usage example Source: https://github.com/alibabacloud-go/quickbi-public-20220101 Example call to AddShareReport with required parameters. AuthPoint `1` means view only, `3` view and export. ExpireDate is a millisecond UNIX timestamp. ShareToType `0` is user, `1` user group, `2` organization. Returns `*AddShareReportResponse` with `Body.Result` as `*bool`. ```go resp, err := client.AddShareReport(&quickbi.AddShareReportRequest{ WorksId: dara.String("6b407e50-e519-4b8b-8491-xxxx"), ShareToId: dara.String("95296e95-ca98-4c2d-a714-xxxx"), ShareToType: dara.Int32(0), AuthPoint: dara.Int32(1), ExpireDate: dara.Int64(1735689600000), }) ``` -------------------------------- ### QueryEmbeddedInfo Source: https://github.com/alibabacloud-go/quickbi-public-20220101 A convenience variant of QueryEmbeddedInfoWithOptions that creates a default RuntimeOptions. ```APIDOC ## QueryEmbeddedInfo ### Description Queries embedded information. This operation does not take a request parameter and uses default runtime options. ### Method Function call ### Signature ```go func (client *Client) QueryEmbeddedInfo() (_result *QueryEmbeddedInfoResponse, _err error) ``` ### Response - **_result** (*QueryEmbeddedInfoResponse) - The decoded response object. - **_err** (error) - Non-nil if the call failed. ``` -------------------------------- ### QueryUserTagMetaListWithOptions Source: https://github.com/alibabacloud-go/quickbi-public-20220101 An operation without a request parameter. It queries user tag metadata list using the provided runtime options. ```APIDOC ## QueryUserTagMetaListWithOptions ### Description Queries user tag metadata list. This operation does not take a request parameter. ### Method Function call ### Signature ```go func (client *Client) QueryUserTagMetaListWithOptions(runtime *dara.RuntimeOptions) (_result *QueryUserTagMetaListResponse, _err error) ``` ### Parameters - **runtime** (*dara.RuntimeOptions) - Required - Runtime options for the call. ### Response - **_result** (*QueryUserTagMetaListResponse) - The decoded response object. - **_err** (error) - Non-nil if the call failed. ``` -------------------------------- ### QueryUserRoleInfoInWorkspace Source: https://github.com/alibabacloud-go/quickbi-public-20220101 Gets the role of one member in a workspace. This method is available in three variants: WithOptions, standard, and WithContext. ```APIDOC ## QueryUserRoleInfoInWorkspace ### Description Gets the role of one member in a workspace. ### Method Function call (Go SDK) ### Endpoint `client.QueryUserRoleInfoInWorkspace` ### Parameters #### Request Parameters - **UserId** (`*string`) - Required - Quick BI user ID. - **WorkspaceId** (`*string`) - Required - Workspace ID. ### Response #### Success Response - **Body.Result** (`*QueryUserRoleInfoInWorkspaceResponseBodyResult`) - The role information of the user in the workspace. ### Function Signatures ```go func (client *Client) QueryUserRoleInfoInWorkspaceWithOptions(request *QueryUserRoleInfoInWorkspaceRequest, runtime *dara.RuntimeOptions) (_result *QueryUserRoleInfoInWorkspaceResponse, _err error) func (client *Client) QueryUserRoleInfoInWorkspace(request *QueryUserRoleInfoInWorkspaceRequest) (_result *QueryUserRoleInfoInWorkspaceResponse, _err error) func (client *Client) QueryUserRoleInfoInWorkspaceWithContext(ctx context.Context, request *QueryUserRoleInfoInWorkspaceRequest, runtime *dara.RuntimeOptions) (_result *QueryUserRoleInfoInWorkspaceResponse, _err error) ``` ``` -------------------------------- ### ListPortalMenus Source: https://github.com/alibabacloud-go/quickbi-public-20220101 Gets the hierarchical menu list of a BI portal. This method returns the menu tree as a JSON string. ```APIDOC ## ListPortalMenus ### Description Gets the hierarchical menu list of a BI portal. This method returns the menu tree as a JSON string. ### Method `ListPortalMenus` ### Signature ```go func (client *Client) ListPortalMenusWithOptions(request *ListPortalMenusRequest, runtime *dara.RuntimeOptions) (_result *ListPortalMenusResponse, _err error) func (client *Client) ListPortalMenus(request *ListPortalMenusRequest) (_result *ListPortalMenusResponse, _err error) func (client *Client) ListPortalMenusWithContext(ctx context.Context, request *ListPortalMenusRequest, runtime *dara.RuntimeOptions) (_result *ListPortalMenusResponse, _err error) ``` ### Parameters - `DataPortalId` (*string) - Required - BI portal ID. - `UserId` (*string) - Optional - Quick BI user ID; when passed, only menus the user has permission on are returned. ### Response - `*ListPortalMenusResponse` - `Body.Result` is `*string` (JSON menu tree). ``` -------------------------------- ### CreateCubeBySql method signatures Source: https://github.com/alibabacloud-go/quickbi-public-20220101 Defines the three method variants for creating a dataset from a custom SQL statement: WithOptions, standard, and WithContext. All require a CreateCubeBySqlRequest and return CreateCubeBySqlResponse. ```go func (client *Client) CreateCubeBySqlWithOptions(request *CreateCubeBySqlRequest, runtime *dara.RuntimeOptions) (_result *CreateCubeBySqlResponse, _err error) func (client *Client) CreateCubeBySql(request *CreateCubeBySqlRequest) (_result *CreateCubeBySqlResponse, _err error) func (client *Client) CreateCubeBySqlWithContext(ctx context.Context, request *CreateCubeBySqlRequest, runtime *dara.RuntimeOptions) (_result *CreateCubeBySqlResponse, _err error) ``` -------------------------------- ### CreateWorkspace API method signatures Source: https://github.com/alibabacloud-go/quickbi-public-20220101 Creates a workspace. Optional parameters include AllowPublish (default true), AllowShare (default true), AllowViewAll (default true), DefaultShareToAll (default false), OnlyAdminCreateDatasource (default false), UseComment (default true), and WorkspaceDescription. WorkspaceName is required. Returns *CreateWorkspaceResponse; Body.Result is *string (workspace ID). ```go func (client *Client) CreateWorkspaceWithOptions(request *CreateWorkspaceRequest, runtime *dara.RuntimeOptions) (_result *CreateWorkspaceResponse, _err error) func (client *Client) CreateWorkspace(request *CreateWorkspaceRequest) (_result *CreateWorkspaceResponse, _err error) func (client *Client) CreateWorkspaceWithContext(ctx context.Context, request *CreateWorkspaceRequest, runtime *dara.RuntimeOptions) (_result *CreateWorkspaceResponse, _err error) ``` -------------------------------- ### QueryWorkspaceRoleConfig Source: https://github.com/alibabacloud-go/quickbi-public-20220101 Gets the configuration (permission matrix) of a workspace role. This method is available in three variants: with options, without options, and with context. ```APIDOC ## QueryWorkspaceRoleConfig ### Description Gets the configuration (permission matrix) of a workspace role. ### Method Go function ### Endpoint `client.QueryWorkspaceRoleConfig` ### Parameters #### Request Body - **RoleId** (*int64) - Required - Workspace role ID (predefined or custom). ### Response #### Success Response - **Body.Result** (*QueryWorkspaceRoleConfigResponseBodyResult) - Configuration result. ### Code Example ```go func (client *Client) QueryWorkspaceRoleConfigWithOptions(request *QueryWorkspaceRoleConfigRequest, runtime *dara.RuntimeOptions) (_result *QueryWorkspaceRoleConfigResponse, _err error) func (client *Client) QueryWorkspaceRoleConfig(request *QueryWorkspaceRoleConfigRequest) (_result *QueryWorkspaceRoleConfigResponse, _err error) func (client *Client) QueryWorkspaceRoleConfigWithContext(ctx context.Context, request *QueryWorkspaceRoleConfigRequest, runtime *dara.RuntimeOptions) (_result *QueryWorkspaceRoleConfigResponse, _err error) ``` ```