├── Gopkg.lock ├── Gopkg.toml ├── LICENSE ├── NOTICE ├── README.md ├── _examples ├── Accounts │ ├── change_account_plan.go │ ├── get_account_documents.go │ ├── get_account_info.go │ ├── get_account_plans.go │ ├── get_account_verifications.go │ ├── get_available_plans.go │ ├── get_children_accounts.go │ ├── get_currency_rate.go │ ├── get_money_amount_to_charge.go │ ├── get_resource_price.go │ ├── get_subscription_price.go │ ├── set_account_info.go │ └── set_child_account_info.go ├── AdminRoles │ ├── add_admin_role.go │ ├── del_admin_role.go │ ├── get_admin_roles.go │ ├── get_available_admin_role_entries.go │ └── set_admin_role_info.go ├── AdminUsers │ ├── add_admin_user.go │ ├── attach_admin_role.go │ ├── del_admin_user.go │ ├── get_admin_users.go │ └── set_admin_user_info.go ├── Applications │ ├── add_application.go │ ├── del_application.go │ ├── get_applications.go │ └── set_application_info.go ├── AuthorizedIPs │ ├── add_authorized_account_ip.go │ ├── check_authorized_account_ip.go │ ├── del_authorized_account_ip.go │ └── get_authorized_account_i_ps.go ├── CallLists │ ├── append_to_call_list.go │ ├── cancel_call_list_task.go │ ├── delete_call_list.go │ ├── edit_call_list.go │ ├── edit_call_list_task.go │ ├── get_call_list_details.go │ ├── get_call_lists.go │ ├── recover_call_list.go │ └── stop_call_list_processing.go ├── CallerIDs │ ├── activate_caller_id.go │ ├── add_caller_id.go │ ├── del_caller_id.go │ ├── get_caller_i_ds.go │ └── verify_caller_id.go ├── DialogflowCredentials │ ├── bind_dialogflow_keys.go │ ├── del_dialogflow_key.go │ └── get_dialogflow_keys.go ├── History │ ├── delete_record.go │ ├── download_history_report.go │ ├── get_acd_history.go │ ├── get_audit_log.go │ ├── get_audit_log_async.go │ ├── get_brief_call_history.go │ ├── get_call_history.go │ ├── get_call_history_async.go │ ├── get_history_reports.go │ ├── get_transaction_history.go │ └── get_transaction_history_async.go ├── Invoices │ ├── download_invoice.go │ └── get_account_invoices.go ├── KeyValueStorage │ ├── del_key_value_item.go │ ├── get_key_value_item.go │ ├── get_key_value_items.go │ ├── get_key_value_keys.go │ └── set_key_value_item.go ├── OutboundTestNumbers │ ├── activate_outbound_test_phone_number.go │ ├── add_outbound_test_phone_number.go │ ├── del_outbound_test_phone_number.go │ ├── get_outbound_test_phone_numbers.go │ └── verify_outbound_test_phone_number.go ├── PSTNBlacklist │ ├── add_pstn_black_list_item.go │ ├── del_pstn_black_list_item.go │ ├── get_pstn_black_list.go │ └── set_pstn_black_list_item.go ├── PhoneNumbers │ ├── attach_phone_number.go │ ├── bind_phone_number_to_application.go │ ├── deactivate_phone_number.go │ ├── get_account_phone_number_countries.go │ ├── get_actual_phone_number_region.go │ ├── get_new_phone_numbers.go │ ├── get_phone_number_categories.go │ ├── get_phone_number_country_states.go │ ├── get_phone_number_regions.go │ ├── get_phone_number_reports.go │ ├── get_phone_numbers.go │ ├── get_phone_numbers_async.go │ ├── is_account_phone_number.go │ └── set_phone_number_info.go ├── PushCredentials │ ├── add_push_credential.go │ ├── bind_push_credential.go │ ├── del_push_credential.go │ ├── get_push_credential.go │ └── set_push_credential.go ├── Queues │ ├── add_queue.go │ ├── bind_user_to_queue.go │ ├── del_queue.go │ ├── get_acd_operator_statistics.go │ ├── get_acd_operator_status_statistics.go │ ├── get_acd_queue_statistics.go │ ├── get_acd_state.go │ ├── get_queues.go │ └── set_queue_info.go ├── RecordStorages │ └── get_record_storages.go ├── RegulationAddress │ ├── get_available_regulations.go │ ├── get_countries.go │ ├── get_regions.go │ ├── get_regulations_address.go │ ├── get_zip_codes.go │ └── link_regulation_address.go ├── RoleSystem │ ├── add_sub_user.go │ ├── create_key.go │ ├── del_sub_user.go │ ├── delete_key.go │ ├── get_key_roles.go │ ├── get_keys.go │ ├── get_role_groups.go │ ├── get_roles.go │ ├── get_sub_user_roles.go │ ├── get_sub_users.go │ ├── remove_key_roles.go │ ├── remove_sub_user_roles.go │ ├── set_key_roles.go │ ├── set_sub_user_info.go │ ├── set_sub_user_roles.go │ └── update_key.go ├── Rules │ ├── add_rule.go │ ├── del_rule.go │ ├── get_rules.go │ ├── reorder_rules.go │ └── set_rule_info.go ├── SIPRegistration │ ├── bind_sip_registration.go │ ├── create_sip_registration.go │ ├── delete_sip_registration.go │ ├── get_sip_registrations.go │ └── update_sip_registration.go ├── SIPWhiteList │ ├── add_sip_white_list_item.go │ ├── del_sip_white_list_item.go │ ├── get_sip_white_list.go │ └── set_sip_white_list_item.go ├── SMS │ ├── a_2_p_get_sms_history.go │ ├── a_2_p_send_sms.go │ ├── control_sms.go │ ├── get_sms_history.go │ └── send_sms_message.go ├── Scenarios │ ├── add_scenario.go │ ├── bind_scenario.go │ ├── del_scenario.go │ ├── get_scenarios.go │ ├── reorder_scenarios.go │ ├── set_scenario_info.go │ ├── start_conference.go │ └── start_scenarios.go ├── Skills │ ├── add_skill.go │ ├── bind_skill.go │ ├── del_skill.go │ ├── get_skills.go │ └── set_skill_info.go ├── SmartQueue │ ├── get_smart_queue_day_history.go │ ├── get_smart_queue_realtime_metrics.go │ ├── get_sq_state.go │ ├── request_smart_queue_history.go │ ├── sq_add_queue.go │ ├── sq_add_skill.go │ ├── sq_bind_agent.go │ ├── sq_bind_skill.go │ ├── sq_del_queue.go │ ├── sq_del_skill.go │ ├── sq_delete_agent_custom_status_mapping.go │ ├── sq_get_agent_custom_status_mapping.go │ ├── sq_get_agents.go │ ├── sq_get_queues.go │ ├── sq_get_skills.go │ ├── sq_set_agent_custom_status_mapping.go │ ├── sq_set_agent_info.go │ ├── sq_set_queue_info.go │ ├── sq_set_skill_info.go │ ├── sq_unbind_agent.go │ └── sq_unbind_skill.go ├── Users │ ├── add_user.go │ ├── del_user.go │ ├── get_users.go │ └── set_user_info.go └── WABPhoneNumbers │ ├── add_wab_phone_number.go │ ├── delete_wab_phone_number.go │ ├── get_wab_phone_numbers.go │ └── set_wab_phone_number_info.go ├── config └── config.go ├── doc.go ├── go.mod ├── go.sum ├── jwt └── jwt.go ├── methods ├── Accounts.go ├── AdminRoles.go ├── AdminUsers.go ├── Applications.go ├── AuthorizedIPs.go ├── CallLists.go ├── CallerIDs.go ├── DialogflowCredentials.go ├── History.go ├── Invoices.go ├── KeyValueStorage.go ├── OutboundTestNumbers.go ├── PSTNBlacklist.go ├── PhoneNumbers.go ├── PushCredentials.go ├── Queues.go ├── RecordStorages.go ├── RegulationAddress.go ├── RoleSystem.go ├── Rules.go ├── SIPRegistration.go ├── SIPWhiteList.go ├── SMS.go ├── Scenarios.go ├── Skills.go ├── SmartQueue.go ├── Users.go ├── WABPhoneNumbers.go └── client.go ├── misc └── misc.go └── structure ├── date.go ├── error.go └── structure.go /Gopkg.lock: -------------------------------------------------------------------------------- 1 | # This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. 2 | 3 | 4 | [[projects]] 5 | digest = "1:76dc72490af7174349349838f2fe118996381b31ea83243812a97e5a0fd5ed55" 6 | name = "github.com/dgrijalva/jwt-go" 7 | packages = ["."] 8 | pruneopts = "UT" 9 | revision = "06ea1031745cb8b3dab3f6a236daf2b0aa468b7e" 10 | version = "v3.2.0" 11 | 12 | [solve-meta] 13 | analyzer-name = "dep" 14 | analyzer-version = 1 15 | input-imports = [ 16 | "github.com/dgrijalva/jwt-go", 17 | ] 18 | solver-name = "gps-cdcl" 19 | solver-version = 1 20 | -------------------------------------------------------------------------------- /Gopkg.toml: -------------------------------------------------------------------------------- 1 | # Gopkg.toml example 2 | # 3 | # Refer to https://golang.github.io/dep/docs/Gopkg.toml.html 4 | # for detailed Gopkg.toml documentation. 5 | # 6 | # required = ["github.com/user/thing/cmd/thing"] 7 | # ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"] 8 | # 9 | # [[constraint]] 10 | # name = "github.com/user/project" 11 | # version = "1.0.0" 12 | # 13 | # [[constraint]] 14 | # name = "github.com/user/project2" 15 | # branch = "dev" 16 | # source = "github.com/myfork/project2" 17 | # 18 | # [[override]] 19 | # name = "github.com/x/y" 20 | # version = "2.4.0" 21 | # 22 | # [prune] 23 | # non-go = false 24 | # go-tests = true 25 | # unused-packages = true 26 | 27 | 28 | [[constraint]] 29 | branch = "master" 30 | name = "github.com/dgrijalva/jwt-go" 31 | 32 | [prune] 33 | go-tests = true 34 | unused-packages = true 35 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | voximplant/apiclient-go/v2 2 | 3 | Copyright 2019-2025 Voximplant, Inc. All Rights Reserved 4 | 5 | Licensed under the Apache License, Version 2.0. (the "License"). 6 | You may not use the file except in compliance with the License. 7 | You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Voximplant API client library 2 | 3 | #### Version 2.6.0 4 | 5 | ## Prerequisites 6 | 7 | In order to use Voximplant SDK for the Go programming language, you need the following: 8 | 9 | 1. A developer account. If you don't have one, [sign up here](https://voximplant.com/sign-up/). 10 | 2. A private API key. There are 2 options to obtain it: 11 | 1. Either generate it in the [Voximplant Control panel](https://manage.voximplant.com/settings/service_accounts) 12 | 2. Or call the [CreateKey](https://voximplant.com/docs/references/httpapi/managing_role_system#createkey) 13 | HTTP API method with the 14 | specified [authentication parameters](https://voximplant.com/docs/references/httpapi/auth_parameters). 15 | You'll receive a response with the __result__ field in it. Save the __result__ value in a file 16 | (since we don't store the keys, save it securely on your side). 17 | 18 | ## Migration Guide (v2.3.0) 19 | 20 | Starting from [v2.3.0](https://github.com/voximplant/apiclient-go/releases/tag/v2.3.0), the import path will be: 21 | 22 | "github.com/voximplant/apiclient-go/v2" 23 | 24 | The `/v2` version can introduce several breaking changes to improve the API and add new functionality, 25 | so please take the migration carefully. 26 | 27 | You can replace all occurrences of `github.com/voximplant/apiclient-go` with `github.com/voximplant/apiclient-go/v2`, 28 | either manually or by using tools such as `sed` or `gofmt`. 29 | 30 | And then you'd typically run: 31 | 32 | ```shell 33 | go get github.com/voximplant/apiclient-go/v2 34 | go mod tidy 35 | ``` 36 | 37 | ## Getting started 38 | 39 | * The best way to start is to use `go get` to add the SDK to your Go Workspace or application using Go modules: 40 | 41 | ```shell 42 | go get github.com/voximplant/apiclient-go/v2 43 | ``` 44 | 45 | * Without Go Modules (or in a GOPATH with Go 1.11 or 1.12), use `go get` with the `/...` suffix to retrieve all the 46 | * SDK's dependencies: 47 | 48 | ```shell 49 | go get github.com/voximplant/apiclient-go/v2/... 50 | ``` 51 | 52 | ### Example 53 | 54 | This example shows how you can use the API client: 55 | 56 | ```go 57 | package main 58 | 59 | import ( 60 | "fmt" 61 | "github.com/voximplant/apiclient-go/v2/config" 62 | "github.com/voximplant/apiclient-go/v2/methods" 63 | ) 64 | 65 | func main() { 66 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 67 | // Create a Voximplant client using the Config value 68 | client, err := methods.NewClient(voxConfig) 69 | if err != nil { 70 | panic("failed to create client, " + err.Error()) 71 | } 72 | // Build input parameters 73 | params := methods.GetSubscriptionPriceParams{SubscriptionTemplateType: "SIP_REGISTRATION"} 74 | // Send the request and get the response or error back 75 | res, verr, err := client.Accounts.GetSubscriptionPrice(params) 76 | 77 | fmt.Println(res, verr, err) 78 | } 79 | ``` 80 | -------------------------------------------------------------------------------- /_examples/Accounts/change_account_plan.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.ChangeAccountPlanParams{PlanType: "IM", PlanSubscriptionTemplateId: 3} 17 | res, verr, err := client.Accounts.ChangeAccountPlan(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/Accounts/get_account_documents.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | WithDetailsRaw := true 16 | WithDetails := &WithDetailsRaw 17 | params := methods.GetAccountDocumentsParams{WithDetails: WithDetails} 18 | res, verr, err := client.Accounts.GetAccountDocuments(params) 19 | fmt.Println(res, verr, err) 20 | } 21 | -------------------------------------------------------------------------------- /_examples/Accounts/get_account_info.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.GetAccountInfoParams{} 17 | res, verr, err := client.Accounts.GetAccountInfo(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/Accounts/get_account_plans.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.GetAccountPlansParams{} 17 | res, verr, err := client.Accounts.GetAccountPlans(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/Accounts/get_account_verifications.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.GetAccountVerificationsParams{AccountId: 1} 17 | res, verr, err := client.Accounts.GetAccountVerifications(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/Accounts/get_available_plans.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.GetAvailablePlansParams{PlanType: "IM"} 17 | res, verr, err := client.Accounts.GetAvailablePlans(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/Accounts/get_children_accounts.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.GetChildrenAccountsParams{ChildAccountEmail: "mychild@gmail.com"} 17 | res, verr, err := client.Accounts.GetChildrenAccounts(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/Accounts/get_currency_rate.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.GetCurrencyRateParams{Currency: "RUR;EUR"} 17 | res, verr, err := client.Accounts.GetCurrencyRate(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/Accounts/get_money_amount_to_charge.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.GetMoneyAmountToChargeParams{Currency: "USD"} 17 | res, verr, err := client.Accounts.GetMoneyAmountToCharge(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/Accounts/get_resource_price.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.GetResourcePriceParams{ResourceType: "PSTNOUT", ResourceParam: "79263332211"} 17 | res, verr, err := client.Accounts.GetResourcePrice(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/Accounts/get_subscription_price.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.GetSubscriptionPriceParams{SubscriptionTemplateType: "SIP_REGISTRATION"} 17 | res, verr, err := client.Accounts.GetSubscriptionPrice(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/Accounts/set_account_info.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | TariffChangingNotificationsRaw := true 17 | TariffChangingNotifications := &TariffChangingNotificationsRaw 18 | NewsNotificationsRaw := true 19 | NewsNotifications := &NewsNotificationsRaw 20 | params := methods.SetAccountInfoParams{LanguageCode: "en", Location: "GMT-8", MinBalanceToNotify: 1.50, TariffChangingNotifications: TariffChangingNotifications, NewsNotifications: NewsNotifications} 21 | res, verr, err := client.Accounts.SetAccountInfo(params) 22 | fmt.Println(res, verr, err) 23 | } 24 | -------------------------------------------------------------------------------- /_examples/Accounts/set_child_account_info.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | ActiveRaw := false 17 | Active := &ActiveRaw 18 | params := methods.SetChildAccountInfoParams{ChildAccountId: "1321", Active: Active} 19 | res, verr, err := client.Accounts.SetChildAccountInfo(params) 20 | fmt.Println(res, verr, err) 21 | } 22 | -------------------------------------------------------------------------------- /_examples/AdminRoles/add_admin_role.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.AddAdminRoleParams{AdminRoleName: "read_only", AllowedEntries: "GetAccountInfo;GetCallHistory"} 17 | res, verr, err := client.AdminRoles.AddAdminRole(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/AdminRoles/del_admin_role.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.DelAdminRoleParams{AdminRoleId: "10"} 17 | res, verr, err := client.AdminRoles.DelAdminRole(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/AdminRoles/get_admin_roles.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | WithEntriesRaw := true 16 | WithEntries := &WithEntriesRaw 17 | 18 | params := methods.GetAdminRolesParams{WithEntries: WithEntries, IncludedAdminUserId: "22", ShowingAdminUserId: 11, Count: 2} 19 | res, verr, err := client.AdminRoles.GetAdminRoles(params) 20 | fmt.Println(res, verr, err) 21 | } 22 | -------------------------------------------------------------------------------- /_examples/AdminRoles/get_available_admin_role_entries.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.GetAvailableAdminRoleEntriesParams{} 17 | res, verr, err := client.AdminRoles.GetAvailableAdminRoleEntries(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/AdminRoles/set_admin_role_info.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.SetAdminRoleInfoParams{AdminRoleId: 1, EntryModificationMode: "set", AllowedEntries: "all", DeniedEntries: "DelUser;DelApplication"} 17 | res, verr, err := client.AdminRoles.SetAdminRoleInfo(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/AdminUsers/add_admin_user.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.AddAdminUserParams{NewAdminUserName: "Overseer_Campbell", AdminUserDisplayName: "Overseer_Campbell", NewAdminUserPassword: "1234567", AdminRoleId: "1"} 17 | res, verr, err := client.AdminUsers.AddAdminUser(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/AdminUsers/attach_admin_role.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.AttachAdminRoleParams{RequiredAdminUserId: "all", AdminRoleId: "1;2;3"} 17 | res, verr, err := client.AdminUsers.AttachAdminRole(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/AdminUsers/del_admin_user.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.DelAdminUserParams{RequiredAdminUserId: "1"} 17 | res, verr, err := client.AdminUsers.DelAdminUser(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/AdminUsers/get_admin_users.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | WithAccessEntriesRaw := true 16 | WithAccessEntries := &WithAccessEntriesRaw 17 | 18 | params := methods.GetAdminUsersParams{WithAccessEntries: WithAccessEntries, Count: 2} 19 | res, verr, err := client.AdminUsers.GetAdminUsers(params) 20 | fmt.Println(res, verr, err) 21 | } 22 | -------------------------------------------------------------------------------- /_examples/AdminUsers/set_admin_user_info.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.SetAdminUserInfoParams{RequiredAdminUserId: 1, NewAdminUserPassword: "7654321"} 17 | res, verr, err := client.AdminUsers.SetAdminUserInfo(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/Applications/add_application.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.AddApplicationParams{ApplicationName: "myapp1"} 17 | res, verr, err := client.Applications.AddApplication(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/Applications/del_application.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.DelApplicationParams{ApplicationId: "all"} 17 | res, verr, err := client.Applications.DelApplication(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/Applications/get_applications.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.GetApplicationsParams{Count: 2, Offset: 1} 17 | res, verr, err := client.Applications.GetApplications(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/Applications/set_application_info.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.SetApplicationInfoParams{ApplicationId: 1, ApplicationName: "myapp11"} 17 | res, verr, err := client.Applications.SetApplicationInfo(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/AuthorizedIPs/add_authorized_account_ip.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.AddAuthorizedAccountIPParams{AuthorizedIp: "92.255.220.0/24"} 17 | res, verr, err := client.AuthorizedIPs.AddAuthorizedAccountIP(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/AuthorizedIPs/check_authorized_account_ip.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.CheckAuthorizedAccountIPParams{AuthorizedIp: "92.255.220.0/24"} 17 | res, verr, err := client.AuthorizedIPs.CheckAuthorizedAccountIP(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/AuthorizedIPs/del_authorized_account_ip.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.DelAuthorizedAccountIPParams{AuthorizedIp: "92.255.220.0/24"} 17 | res, verr, err := client.AuthorizedIPs.DelAuthorizedAccountIP(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/AuthorizedIPs/get_authorized_account_i_ps.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.GetAuthorizedAccountIPsParams{} 17 | res, verr, err := client.AuthorizedIPs.GetAuthorizedAccountIPs(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/CallLists/append_to_call_list.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.AppendToCallListParams{ListId: 1} 17 | res, verr, err := client.CallLists.AppendToCallList(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/CallLists/cancel_call_list_task.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.CancelCallListTaskParams{AccountId: "1", ListId: "1"} 17 | res, verr, err := client.CallLists.CancelCallListTask(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/CallLists/delete_call_list.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.DeleteCallListParams{AccountId: 1, ListId: 1} 17 | res, verr, err := client.CallLists.DeleteCallList(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/CallLists/edit_call_list.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.EditCallListParams{ListId: 1000, IntervalSeconds: 1, NumAttempts: 2, MaxSimultaneous: 3, IpAddress: "127.0.0.1", Name: "awesome_list", Priority: 0, StartAt: "start_at", ServerLocation: "ru"} 17 | res, verr, err := client.CallLists.EditCallList(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/CallLists/edit_call_list_task.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | "github.com/voximplant/apiclient-go/v2/structure" 8 | "time" 9 | ) 10 | 11 | func main() { 12 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 13 | client, err := methods.NewClient(voxConfig) 14 | if err != nil { 15 | panic(err) 16 | } 17 | 18 | StartAtRaw := time.Date(2023, 11, 13, 18, 0, 0, 0, time.UTC) 19 | StartAt := (*structure.Timestamp)(&StartAtRaw) 20 | 21 | params := methods.EditCallListTaskParams{ListId: 1, TaskId: 1, StartAt: StartAt, AttemptsLeft: 2, CustomData: "{\"phone\":\"555111222333\",\"name\":\"Mr.Fate\"}"} 22 | res, verr, err := client.CallLists.EditCallListTask(params) 23 | fmt.Println(res, verr, err) 24 | } 25 | -------------------------------------------------------------------------------- /_examples/CallLists/get_call_list_details.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.GetCallListDetailsParams{ListId: 1, Output: "json"} 17 | res, verr, err := client.CallLists.GetCallListDetails(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/CallLists/get_call_lists.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.GetCallListsParams{} 17 | res, verr, err := client.CallLists.GetCallLists(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/CallLists/recover_call_list.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.RecoverCallListParams{ListId: 1} 17 | res, verr, err := client.CallLists.RecoverCallList(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/CallLists/stop_call_list_processing.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.StopCallListProcessingParams{ListId: 1} 17 | res, verr, err := client.CallLists.StopCallListProcessing(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/CallerIDs/activate_caller_id.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.ActivateCallerIDParams{CalleridId: 1, VerificationCode: "12345"} 17 | res, verr, err := client.CallerIDs.ActivateCallerID(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/CallerIDs/add_caller_id.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.AddCallerIDParams{CalleridNumber: "74953331122"} 17 | res, verr, err := client.CallerIDs.AddCallerID(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/CallerIDs/del_caller_id.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.DelCallerIDParams{CalleridId: 1} 17 | res, verr, err := client.CallerIDs.DelCallerID(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/CallerIDs/get_caller_i_ds.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.GetCallerIDsParams{CalleridNumber: "79997770044"} 17 | res, verr, err := client.CallerIDs.GetCallerIDs(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/CallerIDs/verify_caller_id.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.VerifyCallerIDParams{CalleridId: 1} 17 | res, verr, err := client.CallerIDs.VerifyCallerID(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/DialogflowCredentials/bind_dialogflow_keys.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.BindDialogflowKeysParams{DialogflowKeyId: 1, ApplicationId: "1"} 17 | res, verr, err := client.DialogflowCredentials.BindDialogflowKeys(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/DialogflowCredentials/del_dialogflow_key.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.DelDialogflowKeyParams{DialogflowKeyId: 1} 17 | res, verr, err := client.DialogflowCredentials.DelDialogflowKey(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/DialogflowCredentials/get_dialogflow_keys.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.GetDialogflowKeysParams{DialogflowKeyId: 1} 17 | res, verr, err := client.DialogflowCredentials.GetDialogflowKeys(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/History/delete_record.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.DeleteRecordParams{RecordId: 1} 17 | res, verr, err := client.History.DeleteRecord(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/History/download_history_report.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.DownloadHistoryReportParams{HistoryReportId: 1} 17 | res, verr, err := client.History.DownloadHistoryReport(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/History/get_acd_history.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | "github.com/voximplant/apiclient-go/v2/structure" 8 | "time" 9 | ) 10 | 11 | func main() { 12 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 13 | client, err := methods.NewClient(voxConfig) 14 | if err != nil { 15 | panic(err) 16 | } 17 | FromDateRaw := time.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC) 18 | FromDate := (*structure.Timestamp)(&FromDateRaw) 19 | ToDateRaw := time.Date(2014, 1, 1, 0, 0, 0, 0, time.UTC) 20 | ToDate := (*structure.Timestamp)(&ToDateRaw) 21 | WithEventsRaw := true 22 | WithEvents := &WithEventsRaw 23 | 24 | params := methods.GetACDHistoryParams{FromDate: FromDate, ToDate: ToDate, WithEvents: WithEvents, Count: 2} 25 | res, verr, err := client.History.GetACDHistory(params) 26 | fmt.Println(res, verr, err) 27 | } 28 | -------------------------------------------------------------------------------- /_examples/History/get_audit_log.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | "github.com/voximplant/apiclient-go/v2/structure" 8 | "time" 9 | ) 10 | 11 | func main() { 12 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 13 | client, err := methods.NewClient(voxConfig) 14 | if err != nil { 15 | panic(err) 16 | } 17 | FromDateRaw := time.Date(2018, 2, 1, 0, 0, 0, 0, time.UTC) 18 | FromDate := (*structure.Timestamp)(&FromDateRaw) 19 | ToDateRaw := time.Date(2018, 3, 1, 0, 0, 0, 0, time.UTC) 20 | ToDate := (*structure.Timestamp)(&ToDateRaw) 21 | 22 | params := methods.GetAuditLogParams{FromDate: FromDate, ToDate: ToDate, FilteredCmd: "BindSkill;AddSkill;DelSkill", AdvancedFilters: "152", Count: 3} 23 | res, verr, err := client.History.GetAuditLog(params) 24 | fmt.Println(res, verr, err) 25 | } 26 | -------------------------------------------------------------------------------- /_examples/History/get_audit_log_async.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | "github.com/voximplant/apiclient-go/v2/structure" 8 | "time" 9 | ) 10 | 11 | func main() { 12 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 13 | client, err := methods.NewClient(voxConfig) 14 | if err != nil { 15 | panic(err) 16 | } 17 | FromDateRaw := time.Date(2018, 2, 1, 0, 0, 0, 0, time.UTC) 18 | FromDate := (*structure.Timestamp)(&FromDateRaw) 19 | ToDateRaw := time.Date(2018, 3, 1, 0, 0, 0, 0, time.UTC) 20 | ToDate := (*structure.Timestamp)(&ToDateRaw) 21 | 22 | params := methods.GetAuditLogAsyncParams{FromDate: FromDate, ToDate: ToDate, FilteredCmd: "BindSkill;AddSkill;DelSkill", AdvancedFilters: "152", Output: "csv"} 23 | res, verr, err := client.History.GetAuditLogAsync(params) 24 | fmt.Println(res, verr, err) 25 | } 26 | -------------------------------------------------------------------------------- /_examples/History/get_brief_call_history.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | "github.com/voximplant/apiclient-go/v2/structure" 8 | "time" 9 | ) 10 | 11 | func main() { 12 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 13 | client, err := methods.NewClient(voxConfig) 14 | if err != nil { 15 | panic(err) 16 | } 17 | FromDateRaw := time.Date(2020, 2, 25, 0, 0, 0, 0, time.UTC) 18 | FromDate := (*structure.Timestamp)(&FromDateRaw) 19 | ToDateRaw := time.Date(2020, 2, 26, 0, 0, 0, 0, time.UTC) 20 | ToDate := (*structure.Timestamp)(&ToDateRaw) 21 | 22 | params := methods.GetBriefCallHistoryParams{FromDate: FromDate, ToDate: ToDate, Timezone: "Etc/GMT", Output: "cvs"} 23 | res, verr, err := client.History.GetBriefCallHistory(params) 24 | fmt.Println(res, verr, err) 25 | } 26 | -------------------------------------------------------------------------------- /_examples/History/get_call_history.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | "github.com/voximplant/apiclient-go/v2/structure" 8 | "time" 9 | ) 10 | 11 | func main() { 12 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 13 | client, err := methods.NewClient(voxConfig) 14 | if err != nil { 15 | panic(err) 16 | } 17 | FromDateRaw := time.Date(2020, 2, 25, 0, 0, 0, 0, time.UTC) 18 | FromDate := (*structure.Timestamp)(&FromDateRaw) 19 | ToDateRaw := time.Date(2020, 2, 26, 0, 0, 0, 0, time.UTC) 20 | ToDate := (*structure.Timestamp)(&ToDateRaw) 21 | 22 | WithCallsRaw := true 23 | WithCalls := &WithCallsRaw 24 | WithRecordsRaw := true 25 | WithRecords := &WithRecordsRaw 26 | 27 | params := methods.GetCallHistoryParams{FromDate: FromDate, ToDate: ToDate, Timezone: "Etc/GMT", WithCalls: WithCalls, WithRecords: WithRecords, Count: 1} 28 | res, verr, err := client.History.GetCallHistory(params) 29 | fmt.Println(res, verr, err) 30 | } 31 | -------------------------------------------------------------------------------- /_examples/History/get_call_history_async.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | "github.com/voximplant/apiclient-go/v2/structure" 8 | "time" 9 | ) 10 | 11 | func main() { 12 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 13 | client, err := methods.NewClient(voxConfig) 14 | if err != nil { 15 | panic(err) 16 | } 17 | FromDateRaw := time.Date(2020, 2, 25, 0, 0, 0, 0, time.UTC) 18 | FromDate := (*structure.Timestamp)(&FromDateRaw) 19 | ToDateRaw := time.Date(2020, 2, 26, 0, 0, 0, 0, time.UTC) 20 | ToDate := (*structure.Timestamp)(&ToDateRaw) 21 | 22 | WithCallsRaw := true 23 | WithCalls := &WithCallsRaw 24 | WithRecordsRaw := true 25 | WithRecords := &WithRecordsRaw 26 | 27 | params := methods.GetCallHistoryAsyncParams{FromDate: FromDate, ToDate: ToDate, Timezone: "Etc/GMT", WithCalls: WithCalls, WithRecords: WithRecords, Output: "csv"} 28 | res, verr, err := client.History.GetCallHistoryAsync(params) 29 | fmt.Println(res, verr, err) 30 | } 31 | -------------------------------------------------------------------------------- /_examples/History/get_history_reports.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.GetHistoryReportsParams{HistoryType: "all"} 17 | res, verr, err := client.History.GetHistoryReports(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/History/get_transaction_history.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | "github.com/voximplant/apiclient-go/v2/structure" 8 | "time" 9 | ) 10 | 11 | func main() { 12 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 13 | client, err := methods.NewClient(voxConfig) 14 | if err != nil { 15 | panic(err) 16 | } 17 | FromDateRaw := time.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC) 18 | FromDate := (*structure.Timestamp)(&FromDateRaw) 19 | ToDateRaw := time.Date(2014, 1, 1, 0, 0, 0, 0, time.UTC) 20 | ToDate := (*structure.Timestamp)(&ToDateRaw) 21 | 22 | params := methods.GetTransactionHistoryParams{FromDate: FromDate, ToDate: ToDate, Timezone: "Etc/GMT", TransactionType: "gift;money_distribution", Count: 3} 23 | res, verr, err := client.History.GetTransactionHistory(params) 24 | fmt.Println(res, verr, err) 25 | } 26 | -------------------------------------------------------------------------------- /_examples/History/get_transaction_history_async.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | "github.com/voximplant/apiclient-go/v2/structure" 8 | "time" 9 | ) 10 | 11 | func main() { 12 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 13 | client, err := methods.NewClient(voxConfig) 14 | if err != nil { 15 | panic(err) 16 | } 17 | FromDateRaw := time.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC) 18 | FromDate := (*structure.Timestamp)(&FromDateRaw) 19 | ToDateRaw := time.Date(2014, 1, 1, 0, 0, 0, 0, time.UTC) 20 | ToDate := (*structure.Timestamp)(&ToDateRaw) 21 | 22 | params := methods.GetTransactionHistoryAsyncParams{FromDate: FromDate, ToDate: ToDate, Timezone: "Etc/GMT", TransactionType: "gift;money_distribution", Output: "csv"} 23 | res, verr, err := client.History.GetTransactionHistoryAsync(params) 24 | fmt.Println(res, verr, err) 25 | } 26 | -------------------------------------------------------------------------------- /_examples/Invoices/download_invoice.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.DownloadInvoiceParams{InvoiceId: 1} 17 | res, verr, err := client.Invoices.DownloadInvoice(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/Invoices/get_account_invoices.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.GetAccountInvoicesParams{} 17 | res, verr, err := client.Invoices.GetAccountInvoices(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/KeyValueStorage/del_key_value_item.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.DelKeyValueItemParams{Key: "key1", ApplicationId: 1} 17 | res, verr, err := client.KeyValueStorage.DelKeyValueItem(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/KeyValueStorage/get_key_value_item.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.GetKeyValueItemParams{Key: "key1", ApplicationId: 1} 17 | res, verr, err := client.KeyValueStorage.GetKeyValueItem(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/KeyValueStorage/get_key_value_items.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.GetKeyValueItemsParams{Key: "test", ApplicationId: 1} 17 | res, verr, err := client.KeyValueStorage.GetKeyValueItems(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/KeyValueStorage/get_key_value_keys.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.GetKeyValueKeysParams{ApplicationId: 1} 17 | res, verr, err := client.KeyValueStorage.GetKeyValueKeys(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/KeyValueStorage/set_key_value_item.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.SetKeyValueItemParams{Key: "key1", Value: "value1", ApplicationId: 1, Ttl: 864000} 17 | res, verr, err := client.KeyValueStorage.SetKeyValueItem(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/OutboundTestNumbers/activate_outbound_test_phone_number.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.ActivateOutboundTestPhoneNumberParams{VerificationCode: "12345"} 17 | res, verr, err := client.OutboundTestNumbers.ActivateOutboundTestPhoneNumber(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/OutboundTestNumbers/add_outbound_test_phone_number.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.AddOutboundTestPhoneNumberParams{PhoneNumber: "12223334444"} 17 | res, verr, err := client.OutboundTestNumbers.AddOutboundTestPhoneNumber(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/OutboundTestNumbers/del_outbound_test_phone_number.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.DelOutboundTestPhoneNumberParams{} 17 | res, verr, err := client.OutboundTestNumbers.DelOutboundTestPhoneNumber(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/OutboundTestNumbers/get_outbound_test_phone_numbers.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.GetOutboundTestPhoneNumbersParams{} 17 | res, verr, err := client.OutboundTestNumbers.GetOutboundTestPhoneNumbers(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/OutboundTestNumbers/verify_outbound_test_phone_number.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.VerifyOutboundTestPhoneNumberParams{} 17 | res, verr, err := client.OutboundTestNumbers.VerifyOutboundTestPhoneNumber(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/PSTNBlacklist/add_pstn_black_list_item.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.AddPstnBlackListItemParams{PstnBlacklistPhone: "123456789"} 17 | res, verr, err := client.PSTNBlacklist.AddPstnBlackListItem(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/PSTNBlacklist/del_pstn_black_list_item.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.DelPstnBlackListItemParams{PstnBlacklistId: 1} 17 | res, verr, err := client.PSTNBlacklist.DelPstnBlackListItem(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/PSTNBlacklist/get_pstn_black_list.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.GetPstnBlackListParams{} 17 | res, verr, err := client.PSTNBlacklist.GetPstnBlackList(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/PSTNBlacklist/set_pstn_black_list_item.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.SetPstnBlackListItemParams{PstnBlacklistId: 1, PstnBlacklistPhone: "123456789"} 17 | res, verr, err := client.PSTNBlacklist.SetPstnBlackListItem(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/PhoneNumbers/attach_phone_number.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.AttachPhoneNumberParams{CountryCode: "RU", PhoneCategoryName: "GEOGRAPHIC", PhoneRegionId: 4} 17 | res, verr, err := client.PhoneNumbers.AttachPhoneNumber(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/PhoneNumbers/bind_phone_number_to_application.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.BindPhoneNumberToApplicationParams{PhoneId: "1", ApplicationId: 1} 17 | res, verr, err := client.PhoneNumbers.BindPhoneNumberToApplication(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/PhoneNumbers/deactivate_phone_number.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.DeactivatePhoneNumberParams{PhoneId: "1"} 17 | res, verr, err := client.PhoneNumbers.DeactivatePhoneNumber(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/PhoneNumbers/get_account_phone_number_countries.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.GetAccountPhoneNumberCountriesParams{ApplicationId: "1"} 17 | res, verr, err := client.PhoneNumbers.GetAccountPhoneNumberCountries(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/PhoneNumbers/get_actual_phone_number_region.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.GetActualPhoneNumberRegionParams{CountryCode: "DE", PhoneCategoryName: "GEOGRAPHIC", PhoneRegionId: 1} 17 | res, verr, err := client.PhoneNumbers.GetActualPhoneNumberRegion(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/PhoneNumbers/get_new_phone_numbers.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.GetNewPhoneNumbersParams{CountryCode: "RU", PhoneCategoryName: "GEOGRAPHIC", PhoneRegionId: 1, Count: 2} 17 | res, verr, err := client.PhoneNumbers.GetNewPhoneNumbers(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/PhoneNumbers/get_phone_number_categories.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.GetPhoneNumberCategoriesParams{CountryCode: "RU"} 17 | res, verr, err := client.PhoneNumbers.GetPhoneNumberCategories(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/PhoneNumbers/get_phone_number_country_states.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.GetPhoneNumberCountryStatesParams{CountryCode: "US", PhoneCategoryName: "GEOGRAPHIC", CountryState: "AL"} 17 | res, verr, err := client.PhoneNumbers.GetPhoneNumberCountryStates(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/PhoneNumbers/get_phone_number_regions.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.GetPhoneNumberRegionsParams{CountryCode: "RU", PhoneCategoryName: "GEOGRAPHIC"} 17 | res, verr, err := client.PhoneNumbers.GetPhoneNumberRegions(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/PhoneNumbers/get_phone_number_reports.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.GetPhoneNumberReportsParams{} 17 | res, verr, err := client.PhoneNumbers.GetPhoneNumberReports(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/PhoneNumbers/get_phone_numbers.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.GetPhoneNumbersParams{Count: 2} 17 | res, verr, err := client.PhoneNumbers.GetPhoneNumbers(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/PhoneNumbers/get_phone_numbers_async.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.GetPhoneNumbersAsyncParams{} 17 | res, verr, err := client.PhoneNumbers.GetPhoneNumbersAsync(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/PhoneNumbers/is_account_phone_number.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.IsAccountPhoneNumberParams{PhoneNumber: "79991234567"} 17 | res, verr, err := client.PhoneNumbers.IsAccountPhoneNumber(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/PhoneNumbers/set_phone_number_info.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | AutoChargeRaw := true 17 | AutoCharge := &AutoChargeRaw 18 | params := methods.SetPhoneNumberInfoParams{PhoneId: "1", AutoCharge: AutoCharge} 19 | res, verr, err := client.PhoneNumbers.SetPhoneNumberInfo(params) 20 | fmt.Println(res, verr, err) 21 | } 22 | -------------------------------------------------------------------------------- /_examples/PushCredentials/add_push_credential.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.AddPushCredentialParams{PushProviderName: "GOOGLE"} 17 | res, verr, err := client.PushCredentials.AddPushCredential(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/PushCredentials/bind_push_credential.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.BindPushCredentialParams{PushCredentialId: "1", ApplicationId: "1"} 17 | res, verr, err := client.PushCredentials.BindPushCredential(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/PushCredentials/del_push_credential.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.DelPushCredentialParams{PushCredentialId: 1} 17 | res, verr, err := client.PushCredentials.DelPushCredential(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/PushCredentials/get_push_credential.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.GetPushCredentialParams{PushCredentialId: 1} 17 | res, verr, err := client.PushCredentials.GetPushCredential(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/PushCredentials/set_push_credential.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.SetPushCredentialParams{PushCredentialId: 1, CertPassword: "1234567"} 17 | res, verr, err := client.PushCredentials.SetPushCredential(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/Queues/add_queue.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.AddQueueParams{ApplicationId: 1, AcdQueueName: "myqueue"} 17 | res, verr, err := client.Queues.AddQueue(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/Queues/bind_user_to_queue.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | BindRaw := true 16 | Bind := &BindRaw 17 | 18 | params := methods.BindUserToQueueParams{Bind: Bind, ApplicationId: 1, UserId: "12;987;456", AcdQueueName: "myqueue"} 19 | res, verr, err := client.Queues.BindUserToQueue(params) 20 | fmt.Println(res, verr, err) 21 | } 22 | -------------------------------------------------------------------------------- /_examples/Queues/del_queue.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.DelQueueParams{AcdQueueId: "1"} 17 | res, verr, err := client.Queues.DelQueue(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/Queues/get_acd_operator_statistics.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | "github.com/voximplant/apiclient-go/v2/structure" 8 | "time" 9 | ) 10 | 11 | func main() { 12 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 13 | client, err := methods.NewClient(voxConfig) 14 | if err != nil { 15 | panic(err) 16 | } 17 | FromDateRaw := time.Date(2021, 4, 8, 0, 0, 0, 0, time.UTC) 18 | FromDate := (*structure.Timestamp)(&FromDateRaw) 19 | ToDateRaw := time.Date(2021, 4, 10, 0, 0, 0, 0, time.UTC) 20 | ToDate := (*structure.Timestamp)(&ToDateRaw) 21 | 22 | params := methods.GetACDOperatorStatisticsParams{FromDate: FromDate, ToDate: ToDate, AcdQueueId: "54", Aggregation: "day"} 23 | res, verr, err := client.Queues.GetACDOperatorStatistics(params) 24 | fmt.Println(res, verr, err) 25 | } 26 | -------------------------------------------------------------------------------- /_examples/Queues/get_acd_operator_status_statistics.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | "github.com/voximplant/apiclient-go/v2/structure" 8 | "time" 9 | ) 10 | 11 | func main() { 12 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 13 | client, err := methods.NewClient(voxConfig) 14 | if err != nil { 15 | panic(err) 16 | } 17 | FromDateRaw := time.Date(2019, 5, 20, 11, 0, 0, 0, time.UTC) 18 | FromDate := (*structure.Timestamp)(&FromDateRaw) 19 | ToDateRaw := time.Date(2019, 5, 20, 13, 0, 0, 0, time.UTC) 20 | ToDate := (*structure.Timestamp)(&ToDateRaw) 21 | 22 | params := methods.GetACDOperatorStatusStatisticsParams{FromDate: FromDate, ToDate: ToDate, AcdStatus: "READY;ONLINE", UserId: "all", Aggregation: "hour", Group: "user"} 23 | res, verr, err := client.Queues.GetACDOperatorStatusStatistics(params) 24 | fmt.Println(res, verr, err) 25 | } 26 | -------------------------------------------------------------------------------- /_examples/Queues/get_acd_queue_statistics.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | "github.com/voximplant/apiclient-go/v2/structure" 8 | "time" 9 | ) 10 | 11 | func main() { 12 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 13 | client, err := methods.NewClient(voxConfig) 14 | if err != nil { 15 | panic(err) 16 | } 17 | FromDateRaw := time.Date(2021, 4, 8, 0, 0, 0, 0, time.UTC) 18 | FromDate := (*structure.Timestamp)(&FromDateRaw) 19 | ToDateRaw := time.Date(2021, 4, 10, 0, 0, 0, 0, time.UTC) 20 | ToDate := (*structure.Timestamp)(&ToDateRaw) 21 | 22 | params := methods.GetACDQueueStatisticsParams{FromDate: FromDate, ToDate: ToDate, AcdQueueId: "54", Aggregation: "day"} 23 | res, verr, err := client.Queues.GetACDQueueStatistics(params) 24 | fmt.Println(res, verr, err) 25 | } 26 | -------------------------------------------------------------------------------- /_examples/Queues/get_acd_state.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.GetACDStateParams{AcdQueueId: "1"} 17 | res, verr, err := client.Queues.GetACDState(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/Queues/get_queues.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.GetQueuesParams{Count: 2} 17 | res, verr, err := client.Queues.GetQueues(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/Queues/set_queue_info.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.SetQueueInfoParams{AcdQueueId: 1, NewAcdQueueName: "support"} 17 | res, verr, err := client.Queues.SetQueueInfo(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/RecordStorages/get_record_storages.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.GetRecordStoragesParams{RecordStorageName: "ru1"} 17 | res, verr, err := client.RecordStorages.GetRecordStorages(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/RegulationAddress/get_available_regulations.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.GetAvailableRegulationsParams{CountryCode: "DE", PhoneCategoryName: "GEOGRAPHIC", PhoneRegionCode: "643"} 17 | res, verr, err := client.RegulationAddress.GetAvailableRegulations(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/RegulationAddress/get_countries.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.GetCountriesParams{CountryCode: "DE"} 17 | res, verr, err := client.RegulationAddress.GetCountries(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/RegulationAddress/get_regions.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.GetRegionsParams{CountryCode: "DE", PhoneCategoryName: "GEOGRAPHIC", CityName: "AACHEN"} 17 | res, verr, err := client.RegulationAddress.GetRegions(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/RegulationAddress/get_regulations_address.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.GetRegulationsAddressParams{RegulationAddressId: 1} 17 | res, verr, err := client.RegulationAddress.GetRegulationsAddress(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/RegulationAddress/get_zip_codes.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.GetZIPCodesParams{CountryCode: "DE", Count: 1} 17 | res, verr, err := client.RegulationAddress.GetZIPCodes(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/RegulationAddress/link_regulation_address.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.LinkRegulationAddressParams{RegulationAddressId: 1, PhoneId: 1} 17 | res, verr, err := client.RegulationAddress.LinkRegulationAddress(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/RoleSystem/add_sub_user.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.AddSubUserParams{NewSubuserName: "John_McClane", NewSubuserPassword: "pssw0rd"} 17 | res, verr, err := client.RoleSystem.AddSubUser(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/RoleSystem/create_key.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.CreateKeyParams{} 17 | res, verr, err := client.RoleSystem.CreateKey(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/RoleSystem/del_sub_user.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.DelSubUserParams{SubuserId: 12} 17 | res, verr, err := client.RoleSystem.DelSubUser(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/RoleSystem/delete_key.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.DeleteKeyParams{KeyId: "ab81c66e-570e-4446-9af9-105269dfafca"} 17 | res, verr, err := client.RoleSystem.DeleteKey(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/RoleSystem/get_key_roles.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.GetKeyRolesParams{KeyId: "ab81c50e-573e-4446-9af9-105269dfafca"} 17 | res, verr, err := client.RoleSystem.GetKeyRoles(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/RoleSystem/get_keys.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.GetKeysParams{} 17 | res, verr, err := client.RoleSystem.GetKeys(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/RoleSystem/get_role_groups.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.GetRoleGroupsParams{} 17 | res, verr, err := client.RoleSystem.GetRoleGroups(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/RoleSystem/get_roles.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.GetRolesParams{} 17 | res, verr, err := client.RoleSystem.GetRoles(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/RoleSystem/get_sub_user_roles.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.GetSubUserRolesParams{SubuserId: 12} 17 | res, verr, err := client.RoleSystem.GetSubUserRoles(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/RoleSystem/get_sub_users.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.GetSubUsersParams{} 17 | res, verr, err := client.RoleSystem.GetSubUsers(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/RoleSystem/remove_key_roles.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.RemoveKeyRolesParams{KeyId: "ab81c90e-543e-4446-9af9-105269dfafca"} 17 | res, verr, err := client.RoleSystem.RemoveKeyRoles(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/RoleSystem/remove_sub_user_roles.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.RemoveSubUserRolesParams{SubuserId: 12} 17 | res, verr, err := client.RoleSystem.RemoveSubUserRoles(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/RoleSystem/set_key_roles.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.SetKeyRolesParams{KeyId: "ab81c76e-573e-4046-9af9-105269dfafca"} 17 | res, verr, err := client.RoleSystem.SetKeyRoles(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/RoleSystem/set_sub_user_info.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.SetSubUserInfoParams{SubuserId: 12, OldSubuserPassword: "old_test_password", NewSubuserPassword: "test_pass", Description: "test_desc"} 17 | res, verr, err := client.RoleSystem.SetSubUserInfo(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/RoleSystem/set_sub_user_roles.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.SetSubUserRolesParams{SubuserId: 12} 17 | res, verr, err := client.RoleSystem.SetSubUserRoles(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/RoleSystem/update_key.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.UpdateKeyParams{KeyId: "ab98c70e-573e-4446-9af9-105269dfafca", Description: "test_desc"} 17 | res, verr, err := client.RoleSystem.UpdateKey(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/Rules/add_rule.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.AddRuleParams{ApplicationId: 1, RuleName: "allowall", RulePattern: ".*"} 17 | res, verr, err := client.Rules.AddRule(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/Rules/del_rule.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.DelRuleParams{RuleId: "all", ApplicationId: "all"} 17 | res, verr, err := client.Rules.DelRule(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/Rules/get_rules.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | WithScenariosRaw := true 17 | WithScenarios := &WithScenariosRaw 18 | 19 | params := methods.GetRulesParams{ApplicationId: 1, Template: "74951234567", WithScenarios: WithScenarios, Count: 1} 20 | res, verr, err := client.Rules.GetRules(params) 21 | fmt.Println(res, verr, err) 22 | } 23 | -------------------------------------------------------------------------------- /_examples/Rules/reorder_rules.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.ReorderRulesParams{RuleId: "1;7;3"} 17 | res, verr, err := client.Rules.ReorderRules(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/Rules/set_rule_info.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.SetRuleInfoParams{RuleId: 1, RuleName: "denyall", RulePatternExclude: ".*"} 17 | res, verr, err := client.Rules.SetRuleInfo(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/SIPRegistration/bind_sip_registration.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | BindRaw := false 17 | Bind := &BindRaw 18 | params := methods.BindSipRegistrationParams{UserId: 123, Bind: Bind} 19 | res, verr, err := client.SIPRegistration.BindSipRegistration(params) 20 | fmt.Println(res, verr, err) 21 | } 22 | -------------------------------------------------------------------------------- /_examples/SIPRegistration/create_sip_registration.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.CreateSipRegistrationParams{SipUsername: "JohnGalt", Proxy: "localhost"} 17 | res, verr, err := client.SIPRegistration.CreateSipRegistration(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/SIPRegistration/delete_sip_registration.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.DeleteSipRegistrationParams{SipRegistrationId: 1} 17 | res, verr, err := client.SIPRegistration.DeleteSipRegistration(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/SIPRegistration/get_sip_registrations.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.GetSipRegistrationsParams{} 17 | res, verr, err := client.SIPRegistration.GetSipRegistrations(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/SIPRegistration/update_sip_registration.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.UpdateSipRegistrationParams{SipRegistrationId: 1, ApplicationId: 123} 17 | res, verr, err := client.SIPRegistration.UpdateSipRegistration(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/SIPWhiteList/add_sip_white_list_item.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.AddSipWhiteListItemParams{SipWhitelistNetwork: "192.168.1.5/16"} 17 | res, verr, err := client.SIPWhiteList.AddSipWhiteListItem(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/SIPWhiteList/del_sip_white_list_item.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.DelSipWhiteListItemParams{SipWhitelistId: 1} 17 | res, verr, err := client.SIPWhiteList.DelSipWhiteListItem(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/SIPWhiteList/get_sip_white_list.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.GetSipWhiteListParams{Count: 2, Offset: 1} 17 | res, verr, err := client.SIPWhiteList.GetSipWhiteList(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/SIPWhiteList/set_sip_white_list_item.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.SetSipWhiteListItemParams{SipWhitelistId: 1, SipWhitelistNetwork: "192.168.1.5/16"} 17 | res, verr, err := client.SIPWhiteList.SetSipWhiteListItem(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/SMS/a_2_p_get_sms_history.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | "github.com/voximplant/apiclient-go/v2/structure" 8 | "time" 9 | ) 10 | 11 | func main() { 12 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 13 | client, err := methods.NewClient(voxConfig) 14 | if err != nil { 15 | panic(err) 16 | } 17 | 18 | FromDateRaw := time.Date(2019, 3, 1, 0, 0, 0, 0, time.UTC) 19 | FromDate := (*structure.Timestamp)(&FromDateRaw) 20 | params := methods.A2PGetSmsHistoryParams{DestinationNumber: "12345678222", FromDate: FromDate} 21 | res, verr, err := client.SMS.A2PGetSmsHistory(params) 22 | fmt.Println(res, verr, err) 23 | } 24 | -------------------------------------------------------------------------------- /_examples/SMS/a_2_p_send_sms.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.A2PSendSmsParams{SrcNumber: "447443332211", Text: "Test message"} 17 | res, verr, err := client.SMS.A2PSendSms(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/SMS/control_sms.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.ControlSmsParams{PhoneNumber: "447443332211", Command: "disable"} 17 | res, verr, err := client.SMS.ControlSms(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/SMS/get_sms_history.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | "github.com/voximplant/apiclient-go/v2/structure" 8 | "time" 9 | ) 10 | 11 | func main() { 12 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 13 | client, err := methods.NewClient(voxConfig) 14 | if err != nil { 15 | panic(err) 16 | } 17 | 18 | FromDateRaw := time.Date(2019, 3, 1, 0, 0, 0, 0, time.UTC) 19 | FromDate := (*structure.Timestamp)(&FromDateRaw) 20 | params := methods.GetSmsHistoryParams{DestinationNumber: "12345678222", FromDate: FromDate} 21 | res, verr, err := client.SMS.GetSmsHistory(params) 22 | fmt.Println(res, verr, err) 23 | } 24 | -------------------------------------------------------------------------------- /_examples/SMS/send_sms_message.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.SendSmsMessageParams{Source: "447443332211", Destination: "447443332212", SmsBody: "Test message"} 17 | res, verr, err := client.SMS.SendSmsMessage(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/Scenarios/add_scenario.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.AddScenarioParams{ScenarioName: "call_scenario", ScenarioScript: "var s=\"hello\";"} 17 | res, verr, err := client.Scenarios.AddScenario(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/Scenarios/bind_scenario.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.BindScenarioParams{ScenarioId: "1;2;3", RuleId: 1} 17 | res, verr, err := client.Scenarios.BindScenario(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/Scenarios/del_scenario.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.DelScenarioParams{ScenarioId: "all"} 17 | res, verr, err := client.Scenarios.DelScenario(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/Scenarios/get_scenarios.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.GetScenariosParams{Count: 2, Offset: 1} 17 | res, verr, err := client.Scenarios.GetScenarios(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/Scenarios/reorder_scenarios.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.ReorderScenariosParams{RuleId: 2, ScenarioId: "17;15;20"} 17 | res, verr, err := client.Scenarios.ReorderScenarios(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/Scenarios/set_scenario_info.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.SetScenarioInfoParams{ScenarioId: 1, ScenarioName: "call_scenario", ScenarioScript: "var s=\"hello world\";"} 17 | res, verr, err := client.Scenarios.SetScenarioInfo(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/Scenarios/start_conference.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.StartConferenceParams{ConferenceName: "boss", RuleId: 1, UserId: 1, ScriptCustomData: "mystr"} 17 | res, verr, err := client.Scenarios.StartConference(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/Scenarios/start_scenarios.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.StartScenariosParams{UserId: 1, RuleId: 1, ScriptCustomData: "mystr"} 17 | res, verr, err := client.Scenarios.StartScenarios(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/Skills/add_skill.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.AddSkillParams{SkillName: "English"} 17 | res, verr, err := client.Skills.AddSkill(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/Skills/bind_skill.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.BindSkillParams{SkillId: "1;6", UserId: "all", AcdQueueId: "11;12"} 17 | res, verr, err := client.Skills.BindSkill(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/Skills/del_skill.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.DelSkillParams{SkillId: 1} 17 | res, verr, err := client.Skills.DelSkill(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/Skills/get_skills.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.GetSkillsParams{Count: 2, Offset: 1} 17 | res, verr, err := client.Skills.GetSkills(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/Skills/set_skill_info.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.SetSkillInfoParams{SkillId: 1, NewSkillName: "Support"} 17 | res, verr, err := client.Skills.SetSkillInfo(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/SmartQueue/get_smart_queue_day_history.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.GetSmartQueueDayHistoryParams{ApplicationId: 1, ReportType: "sum_agents_online_time"} 17 | res, verr, err := client.SmartQueue.GetSmartQueueDayHistory(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/SmartQueue/get_smart_queue_realtime_metrics.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.GetSmartQueueRealtimeMetricsParams{ApplicationId: 1, ReportType: "sum_agents_dialing_time"} 17 | res, verr, err := client.SmartQueue.GetSmartQueueRealtimeMetrics(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/SmartQueue/get_sq_state.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.GetSQStateParams{ApplicationId: 1, SqQueueId: "1"} 17 | res, verr, err := client.SmartQueue.GetSQState(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/SmartQueue/request_smart_queue_history.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | "github.com/voximplant/apiclient-go/v2/structure" 8 | "time" 9 | ) 10 | 11 | func main() { 12 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 13 | client, err := methods.NewClient(voxConfig) 14 | if err != nil { 15 | panic(err) 16 | } 17 | 18 | FromDateRaw := time.Date(2021, 3, 17, 0, 0, 0, 0, time.UTC) 19 | FromDate := (*structure.Timestamp)(&FromDateRaw) 20 | ToDateRaw := time.Date(2021, 3, 17, 22, 0, 0, 0, time.UTC) 21 | ToDate := (*structure.Timestamp)(&ToDateRaw) 22 | 23 | params := methods.RequestSmartQueueHistoryParams{ApplicationId: 1, SqQueueId: "1", FromDate: FromDate, ToDate: ToDate, ReportType: "service_level", MaxWaitingSec: 6} 24 | res, verr, err := client.SmartQueue.RequestSmartQueueHistory(params) 25 | fmt.Println(res, verr, err) 26 | } 27 | -------------------------------------------------------------------------------- /_examples/SmartQueue/sq_add_queue.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.SQAddQueueParams{ApplicationId: 1, SqQueueName: "smartQueue1", CallAgentSelection: "MOST_QUALIFIED", CallTaskSelection: "MAX_WAITING_TIME"} 17 | res, verr, err := client.SmartQueue.SQAddQueue(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/SmartQueue/sq_add_skill.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.SQAddSkillParams{ApplicationId: 1, SqSkillName: "mySkill"} 17 | res, verr, err := client.SmartQueue.SQAddSkill(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/SmartQueue/sq_bind_agent.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.SQBindAgentParams{ApplicationId: 1, SqQueueId: "1"} 17 | res, verr, err := client.SmartQueue.SQBindAgent(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/SmartQueue/sq_bind_skill.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.SQBindSkillParams{ApplicationId: 1, UserId: "all", SqSkills: []interface{}{map[string]interface{}{"sq_skill_id": 1, "sq_skill_level": 1}, map[string]interface{}{"sq_skill_id": 2, "sq_skill_level": 5}}} 17 | res, verr, err := client.SmartQueue.SQBindSkill(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/SmartQueue/sq_del_queue.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.SQDelQueueParams{ApplicationId: 1, SqQueueId: "3"} 17 | res, verr, err := client.SmartQueue.SQDelQueue(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/SmartQueue/sq_del_skill.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.SQDelSkillParams{ApplicationId: 1, SqSkillId: "5"} 17 | res, verr, err := client.SmartQueue.SQDelSkill(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/SmartQueue/sq_delete_agent_custom_status_mapping.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.SQDeleteAgentCustomStatusMappingParams{SqStatusName: "READY", ApplicationId: 1} 17 | res, verr, err := client.SmartQueue.SQDeleteAgentCustomStatusMapping(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/SmartQueue/sq_get_agent_custom_status_mapping.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.SQGetAgentCustomStatusMappingParams{ApplicationId: 1} 17 | res, verr, err := client.SmartQueue.SQGetAgentCustomStatusMapping(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/SmartQueue/sq_get_agents.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | WithSqStatusesRaw := true 17 | WithSqStatuses := &WithSqStatusesRaw 18 | HandleCallsRaw := false 19 | HandleCalls := &HandleCallsRaw 20 | params := methods.SQGetAgentsParams{ApplicationId: 1, WithSqStatuses: WithSqStatuses, HandleCalls: HandleCalls} 21 | res, verr, err := client.SmartQueue.SQGetAgents(params) 22 | fmt.Println(res, verr, err) 23 | } 24 | -------------------------------------------------------------------------------- /_examples/SmartQueue/sq_get_queues.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.SQGetQueuesParams{ApplicationId: 1} 17 | res, verr, err := client.SmartQueue.SQGetQueues(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/SmartQueue/sq_get_skills.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.SQGetSkillsParams{ApplicationId: 1} 17 | res, verr, err := client.SmartQueue.SQGetSkills(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/SmartQueue/sq_set_agent_custom_status_mapping.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.SQSetAgentCustomStatusMappingParams{SqStatusName: "READY", CustomStatusName: "ReadyForCall", ApplicationId: 1} 17 | res, verr, err := client.SmartQueue.SQSetAgentCustomStatusMapping(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/SmartQueue/sq_set_agent_info.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | HandleCallsRaw := true 17 | HandleCalls := &HandleCallsRaw 18 | params := methods.SQSetAgentInfoParams{ApplicationId: 1, UserId: "2", HandleCalls: HandleCalls} 19 | res, verr, err := client.SmartQueue.SQSetAgentInfo(params) 20 | fmt.Println(res, verr, err) 21 | } 22 | -------------------------------------------------------------------------------- /_examples/SmartQueue/sq_set_queue_info.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.SQSetQueueInfoParams{ApplicationId: 1, SqQueueId: 1, NewSqQueueName: "myNewSmartQueue"} 17 | res, verr, err := client.SmartQueue.SQSetQueueInfo(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/SmartQueue/sq_set_skill_info.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.SQSetSkillInfoParams{ApplicationId: 1, SqSkillId: 1, NewSqSkillName: "newSkill"} 17 | res, verr, err := client.SmartQueue.SQSetSkillInfo(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/SmartQueue/sq_unbind_agent.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.SQUnbindAgentParams{ApplicationId: 1, SqQueueId: "all", UserId: "1"} 17 | res, verr, err := client.SmartQueue.SQUnbindAgent(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/SmartQueue/sq_unbind_skill.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.SQUnbindSkillParams{ApplicationId: 1, UserId: "1", SqSkillId: "1"} 17 | res, verr, err := client.SmartQueue.SQUnbindSkill(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/Users/add_user.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.AddUserParams{UserName: "GordonFreeman", UserDisplayName: "GordonFreeman", UserPassword: "1234567", ApplicationId: 1} 17 | res, verr, err := client.Users.AddUser(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/Users/del_user.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.DelUserParams{UserId: "all", ApplicationName: "myapp1"} 17 | res, verr, err := client.Users.DelUser(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/Users/get_users.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.GetUsersParams{ApplicationId: 1, Count: 2} 17 | res, verr, err := client.Users.GetUsers(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/Users/set_user_info.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.SetUserInfoParams{UserId: 1, UserPassword: "7654321"} 17 | res, verr, err := client.Users.SetUserInfo(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/WABPhoneNumbers/add_wab_phone_number.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.AddWABPhoneNumberParams{WabPhoneNumber: "12126367890", VoicePassword: "abc", ApplicationId: 1234, RuleId: 5678} 17 | res, verr, err := client.WABPhoneNumbers.AddWABPhoneNumber(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/WABPhoneNumbers/delete_wab_phone_number.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.DeleteWABPhoneNumberParams{WabPhoneNumber: "12126367890"} 17 | res, verr, err := client.WABPhoneNumbers.DeleteWABPhoneNumber(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/WABPhoneNumbers/get_wab_phone_numbers.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.GetWABPhoneNumbersParams{} 17 | res, verr, err := client.WABPhoneNumbers.GetWABPhoneNumbers(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /_examples/WABPhoneNumbers/set_wab_phone_number_info.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "github.com/voximplant/apiclient-go/v2/config" 6 | "github.com/voximplant/apiclient-go/v2/methods" 7 | ) 8 | 9 | func main() { 10 | voxConfig := config.NewConfig().WithEndpoint("https://api.voximplant.com/platform_api/").WithKeyPath("vox_key_jwt.json") 11 | client, err := methods.NewClient(voxConfig) 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | params := methods.SetWABPhoneNumberInfoParams{WabPhoneNumber: "12126367890", Description: "my number"} 17 | res, verr, err := client.WABPhoneNumbers.SetWABPhoneNumberInfo(params) 18 | fmt.Println(res, verr, err) 19 | } 20 | -------------------------------------------------------------------------------- /config/config.go: -------------------------------------------------------------------------------- 1 | package config 2 | 3 | import ( 4 | "net/http" 5 | ) 6 | 7 | type Config struct { 8 | KeyPath string 9 | Endpoint string 10 | AccountID int 11 | HTTPClient *http.Client 12 | } 13 | 14 | func NewConfig() *Config { 15 | return &Config{} 16 | } 17 | 18 | func (conf *Config) WithKeyPath(path string) *Config { 19 | conf.KeyPath = path 20 | return conf 21 | } 22 | 23 | func (conf *Config) WithHTTPClient(client *http.Client) *Config { 24 | conf.HTTPClient = client 25 | return conf 26 | } 27 | 28 | func (conf *Config) WithAccountID(accountID int) *Config { 29 | conf.AccountID = accountID 30 | return conf 31 | } 32 | 33 | func (conf *Config) WithEndpoint(endpoint string) *Config { 34 | conf.Endpoint = endpoint 35 | return conf 36 | } 37 | -------------------------------------------------------------------------------- /doc.go: -------------------------------------------------------------------------------- 1 | // Voximplant SDK for the Go programming language. 2 | // 3 | // See README.md for more information. 4 | 5 | package src 6 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/voximplant/apiclient-go/v2 2 | 3 | go 1.12 4 | 5 | require github.com/dgrijalva/jwt-go v3.2.0+incompatible 6 | -------------------------------------------------------------------------------- /go.sum: -------------------------------------------------------------------------------- 1 | github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM= 2 | github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= 3 | github.com/iancoleman/strcase v0.0.0-20180726023541-3605ed457bf7 h1:ux/56T2xqZO/3cP1I2F86qpeoYPCOzk+KF/UH/Ar+lk= 4 | github.com/iancoleman/strcase v0.0.0-20180726023541-3605ed457bf7/go.mod h1:SK73tn/9oHe+/Y0h39VT4UCxmurVJkR5NA7kMEAOgSE= 5 | -------------------------------------------------------------------------------- /jwt/jwt.go: -------------------------------------------------------------------------------- 1 | package jwt 2 | 3 | import ( 4 | "encoding/json" 5 | "fmt" 6 | "github.com/dgrijalva/jwt-go" 7 | "io/ioutil" 8 | "os" 9 | "time" 10 | ) 11 | 12 | const expireTime = 30 13 | 14 | type KeyPair struct { 15 | Path string 16 | ByteDataValue []byte 17 | Token string 18 | Result KeyPairResult `json:"result"` 19 | } 20 | 21 | type KeyPairResult struct { 22 | AccountEmail string `json:"account_email"` 23 | AccountId int `json:"account_id"` 24 | KeyId string `json:"key_id"` 25 | PrivateKey string `json:"private_key"` 26 | } 27 | 28 | func NewKeyPair(path string) *KeyPair { 29 | if path == "" { 30 | path = os.Getenv("VOXIMPLANT_CREDENTIALS") 31 | } 32 | return &KeyPair{Path: path} 33 | } 34 | 35 | func (kp *KeyPair) validate() bool { 36 | if kp.Path == "" { 37 | return false 38 | } 39 | return true 40 | } 41 | 42 | func (kp *KeyPair) Parse() error { 43 | if !kp.validate() { 44 | return fmt.Errorf("key path is required") 45 | } 46 | if err := kp.parseFile(); err != nil { 47 | return fmt.Errorf("error parse key file: %s", err) 48 | } 49 | return nil 50 | } 51 | 52 | func (kp *KeyPair) parseFile() error { 53 | byteValue, err := ioutil.ReadFile(kp.Path) 54 | if err != nil { 55 | return err 56 | } 57 | if err := json.Unmarshal(byteValue, &kp.Result); err != nil { 58 | return err 59 | } 60 | return nil 61 | } 62 | 63 | func (kp *KeyPair) Valid() error { 64 | parsedToken, _ := jwt.Parse(kp.Token, func(token *jwt.Token) (interface{}, error) { 65 | return kp.ByteDataValue, nil 66 | }) 67 | return parsedToken.Claims.Valid() 68 | } 69 | 70 | func (kp *KeyPair) GenerateToken(accountID int) error { 71 | issAccountID := kp.Result.AccountId 72 | if accountID != 0 { 73 | issAccountID = accountID 74 | } 75 | jwtNewWithClaims := jwt.NewWithClaims(jwt.GetSigningMethod("RS256"), jwt.MapClaims{ 76 | "iat": time.Now().Unix(), 77 | "iss": issAccountID, 78 | "exp": time.Now().Add(time.Second * expireTime).Unix(), 79 | }) 80 | jwtNewWithClaims.Header["kid"] = kp.Result.KeyId 81 | 82 | privateKeyByte := []byte(kp.Result.PrivateKey) 83 | privateKey, err := jwt.ParseRSAPrivateKeyFromPEM(privateKeyByte) 84 | 85 | token, err := jwtNewWithClaims.SignedString(privateKey) 86 | 87 | kp.Token = token 88 | 89 | return err 90 | } 91 | -------------------------------------------------------------------------------- /methods/Applications.go: -------------------------------------------------------------------------------- 1 | package methods 2 | 3 | import ( 4 | "github.com/voximplant/apiclient-go/v2/structure" 5 | ) 6 | 7 | type ApplicationsService struct { 8 | client *Client 9 | } 10 | 11 | type AddApplicationParams struct { 12 | // The short application name in format \[a-z\]\[a-z0-9-\]{1,64} 13 | ApplicationName string `json:"application_name"` 14 | // Whether to enable secure storage for all logs and records of the application 15 | SecureRecordStorage *bool `json:"secure_record_storage,string,omitempty"` 16 | } 17 | 18 | type AddApplicationReturn struct { 19 | // 1 20 | Result int `json:"result"` 21 | // The application ID 22 | ApplicationId int `json:"application_id"` 23 | // The full application name 24 | ApplicationName string `json:"application_name"` 25 | // Whether a secure storage for logs and records is enabled or not 26 | SecureRecordStorage *bool `json:"secure_record_storage"` 27 | } 28 | 29 | // Adds a new account's application. 30 | func (s *ApplicationsService) AddApplication(params AddApplicationParams) (*AddApplicationReturn, *structure.VError, error) { 31 | req, err := s.client.NewRequest("POST", "AddApplication", params) 32 | if err != nil { 33 | return nil, nil, err 34 | } 35 | response := &AddApplicationReturn{} 36 | verr, err := s.client.MakeResponse(req, response) 37 | if verr != nil || err != nil { 38 | return nil, verr, err 39 | } 40 | return response, nil, nil 41 | } 42 | 43 | type DelApplicationParams struct { 44 | // The application ID list separated by semicolons (;). Use the 'all' value to select all applications 45 | ApplicationId string `json:"application_id"` 46 | // The application name list separated by semicolons (;). Can be used instead of application_id 47 | ApplicationName string `json:"application_name"` 48 | } 49 | 50 | type DelApplicationReturn struct { 51 | // 1 52 | Result int `json:"result"` 53 | } 54 | 55 | // Deletes the account's application. 56 | func (s *ApplicationsService) DelApplication(params DelApplicationParams) (*DelApplicationReturn, *structure.VError, error) { 57 | req, err := s.client.NewRequest("POST", "DelApplication", params) 58 | if err != nil { 59 | return nil, nil, err 60 | } 61 | response := &DelApplicationReturn{} 62 | verr, err := s.client.MakeResponse(req, response) 63 | if verr != nil || err != nil { 64 | return nil, verr, err 65 | } 66 | return response, nil, nil 67 | } 68 | 69 | type SetApplicationInfoParams struct { 70 | // The application ID 71 | ApplicationId int `json:"application_id,string"` 72 | // The application name that can be used instead of application_id 73 | RequiredApplicationName string `json:"required_application_name"` 74 | // The new short application name in format [a-z][a-z0-9-]{1,79} 75 | ApplicationName string `json:"application_name,omitempty"` 76 | // Whether to enable secure storage for all logs and records of the application 77 | SecureRecordStorage *bool `json:"secure_record_storage,string,omitempty"` 78 | } 79 | 80 | type SetApplicationInfoReturn struct { 81 | // 1 82 | Result int `json:"result"` 83 | // The new full application name 84 | ApplicationName string `json:"application_name"` 85 | // Whether a secure storage for logs and records is enabled or not 86 | SecureRecordStorage *bool `json:"secure_record_storage"` 87 | } 88 | 89 | // Edits the account's application. 90 | func (s *ApplicationsService) SetApplicationInfo(params SetApplicationInfoParams) (*SetApplicationInfoReturn, *structure.VError, error) { 91 | req, err := s.client.NewRequest("POST", "SetApplicationInfo", params) 92 | if err != nil { 93 | return nil, nil, err 94 | } 95 | response := &SetApplicationInfoReturn{} 96 | verr, err := s.client.MakeResponse(req, response) 97 | if verr != nil || err != nil { 98 | return nil, verr, err 99 | } 100 | return response, nil, nil 101 | } 102 | 103 | type GetApplicationsParams struct { 104 | // The application ID to filter 105 | ApplicationId int `json:"application_id,string,omitempty"` 106 | // The application name part to filter 107 | ApplicationName string `json:"application_name,omitempty"` 108 | // Whether to get bound rules info 109 | WithRules *bool `json:"with_rules,string,omitempty"` 110 | // Whether to get bound rules and scenarios info 111 | WithScenarios *bool `json:"with_scenarios,string,omitempty"` 112 | // The max returning record count 113 | Count int `json:"count,string,omitempty"` 114 | // The first N records are skipped in the output 115 | Offset int `json:"offset,string,omitempty"` 116 | } 117 | 118 | type GetApplicationsReturn struct { 119 | Result []*structure.ApplicationInfoType `json:"result"` 120 | // The total found application count 121 | TotalCount int `json:"total_count"` 122 | // The returned application count 123 | Count int `json:"count"` 124 | } 125 | 126 | // Gets the account's applications. 127 | func (s *ApplicationsService) GetApplications(params GetApplicationsParams) (*GetApplicationsReturn, *structure.VError, error) { 128 | req, err := s.client.NewRequest("POST", "GetApplications", params) 129 | if err != nil { 130 | return nil, nil, err 131 | } 132 | response := &GetApplicationsReturn{} 133 | verr, err := s.client.MakeResponse(req, response) 134 | if verr != nil || err != nil { 135 | return nil, verr, err 136 | } 137 | return response, nil, nil 138 | } 139 | -------------------------------------------------------------------------------- /methods/AuthorizedIPs.go: -------------------------------------------------------------------------------- 1 | package methods 2 | 3 | import ( 4 | "github.com/voximplant/apiclient-go/v2/structure" 5 | ) 6 | 7 | type AuthorizedIPsService struct { 8 | client *Client 9 | } 10 | 11 | type AddAuthorizedAccountIPParams struct { 12 | // The authorized IP4 or network 13 | AuthorizedIp string `json:"authorized_ip"` 14 | // Whether to remove the IP from the blacklist 15 | Allowed *bool `json:"allowed,string,omitempty"` 16 | // The IP address description 17 | Description string `json:"description,omitempty"` 18 | } 19 | 20 | type AddAuthorizedAccountIPReturn struct { 21 | // 1 22 | Result int `json:"result"` 23 | } 24 | 25 | // Adds a new authorized IP4 or network to the white/black list. 26 | func (s *AuthorizedIPsService) AddAuthorizedAccountIP(params AddAuthorizedAccountIPParams) (*AddAuthorizedAccountIPReturn, *structure.VError, error) { 27 | req, err := s.client.NewRequest("POST", "AddAuthorizedAccountIP", params) 28 | if err != nil { 29 | return nil, nil, err 30 | } 31 | response := &AddAuthorizedAccountIPReturn{} 32 | verr, err := s.client.MakeResponse(req, response) 33 | if verr != nil || err != nil { 34 | return nil, verr, err 35 | } 36 | return response, nil, nil 37 | } 38 | 39 | type DelAuthorizedAccountIPParams struct { 40 | // The authorized IP4 or network to remove. Set to 'all' to remove all items 41 | AuthorizedIp string `json:"authorized_ip"` 42 | // Specify the parameter to remove the networks that contains the particular IP4. Can be used instead of authorized_ip 43 | ContainsIp string `json:"contains_ip"` 44 | // Whether to remove the network from the white list. Set false to remove the network from the black list. Omit the parameter to remove the network from all lists 45 | Allowed *bool `json:"allowed,string,omitempty"` 46 | } 47 | 48 | type DelAuthorizedAccountIPReturn struct { 49 | // The removed network count 50 | Result int `json:"result"` 51 | } 52 | 53 | // Removes the authorized IP4 or network from the white/black list. 54 | func (s *AuthorizedIPsService) DelAuthorizedAccountIP(params DelAuthorizedAccountIPParams) (*DelAuthorizedAccountIPReturn, *structure.VError, error) { 55 | req, err := s.client.NewRequest("POST", "DelAuthorizedAccountIP", params) 56 | if err != nil { 57 | return nil, nil, err 58 | } 59 | response := &DelAuthorizedAccountIPReturn{} 60 | verr, err := s.client.MakeResponse(req, response) 61 | if verr != nil || err != nil { 62 | return nil, verr, err 63 | } 64 | return response, nil, nil 65 | } 66 | 67 | type GetAuthorizedAccountIPsParams struct { 68 | // The authorized IP4 or network to filter 69 | AuthorizedIp string `json:"authorized_ip,omitempty"` 70 | // Whether the IP is allowed 71 | Allowed *bool `json:"allowed,string,omitempty"` 72 | // Specify the parameter to filter the networks that contains the particular IP4 73 | ContainsIp string `json:"contains_ip,omitempty"` 74 | // The max returning record count 75 | Count int `json:"count,string,omitempty"` 76 | // The first N records are skipped in the output 77 | Offset int `json:"offset,string,omitempty"` 78 | // The IP address description 79 | Description string `json:"description,omitempty"` 80 | } 81 | 82 | type GetAuthorizedAccountIPsReturn struct { 83 | Result []*structure.AuthorizedAccountIPType `json:"result"` 84 | // The total found network count 85 | TotalCount int `json:"total_count"` 86 | // The returned network count 87 | Count int `json:"count"` 88 | } 89 | 90 | // Gets the authorized IP4 or network. 91 | func (s *AuthorizedIPsService) GetAuthorizedAccountIPs(params GetAuthorizedAccountIPsParams) (*GetAuthorizedAccountIPsReturn, *structure.VError, error) { 92 | req, err := s.client.NewRequest("POST", "GetAuthorizedAccountIPs", params) 93 | if err != nil { 94 | return nil, nil, err 95 | } 96 | response := &GetAuthorizedAccountIPsReturn{} 97 | verr, err := s.client.MakeResponse(req, response) 98 | if verr != nil || err != nil { 99 | return nil, verr, err 100 | } 101 | return response, nil, nil 102 | } 103 | 104 | type CheckAuthorizedAccountIPParams struct { 105 | // The IP4 to test 106 | AuthorizedIp string `json:"authorized_ip"` 107 | } 108 | 109 | type CheckAuthorizedAccountIPReturn struct { 110 | // Whether the IP is allowed 111 | Result *bool `json:"result"` 112 | // The matched authorized IP or network (if found) 113 | AuthorizedIp string `json:"authorized_ip,omitempty"` 114 | } 115 | 116 | // Tests whether the IP4 is banned or allowed. 117 | func (s *AuthorizedIPsService) CheckAuthorizedAccountIP(params CheckAuthorizedAccountIPParams) (*CheckAuthorizedAccountIPReturn, *structure.VError, error) { 118 | req, err := s.client.NewRequest("POST", "CheckAuthorizedAccountIP", params) 119 | if err != nil { 120 | return nil, nil, err 121 | } 122 | response := &CheckAuthorizedAccountIPReturn{} 123 | verr, err := s.client.MakeResponse(req, response) 124 | if verr != nil || err != nil { 125 | return nil, verr, err 126 | } 127 | return response, nil, nil 128 | } 129 | -------------------------------------------------------------------------------- /methods/CallerIDs.go: -------------------------------------------------------------------------------- 1 | package methods 2 | 3 | import ( 4 | "github.com/voximplant/apiclient-go/v2/structure" 5 | ) 6 | 7 | type CallerIDsService struct { 8 | client *Client 9 | } 10 | 11 | type AddCallerIDParams struct { 12 | // The callerID number in E.164 format 13 | CalleridNumber string `json:"callerid_number"` 14 | } 15 | 16 | type AddCallerIDReturn struct { 17 | // 1 18 | Result int `json:"result"` 19 | // ID of the callerID object 20 | CalleridId int `json:"callerid_id"` 21 | } 22 | 23 | // Adds a new caller ID. Caller ID is the phone that is displayed to the called user. This number can be used for call back. 24 | func (s *CallerIDsService) AddCallerID(params AddCallerIDParams) (*AddCallerIDReturn, *structure.VError, error) { 25 | req, err := s.client.NewRequest("POST", "AddCallerID", params) 26 | if err != nil { 27 | return nil, nil, err 28 | } 29 | response := &AddCallerIDReturn{} 30 | verr, err := s.client.MakeResponse(req, response) 31 | if verr != nil || err != nil { 32 | return nil, verr, err 33 | } 34 | return response, nil, nil 35 | } 36 | 37 | type ActivateCallerIDParams struct { 38 | // ID of the callerID object 39 | CalleridId int `json:"callerid_id,string"` 40 | // The callerID number that can be used instead of callerid_id 41 | CalleridNumber string `json:"callerid_number"` 42 | // The verification code, see the VerifyCallerID function 43 | VerificationCode string `json:"verification_code"` 44 | } 45 | 46 | type ActivateCallerIDReturn struct { 47 | // 1 48 | Result int `json:"result"` 49 | } 50 | 51 | // Activates the CallerID by the verification code. 52 | func (s *CallerIDsService) ActivateCallerID(params ActivateCallerIDParams) (*ActivateCallerIDReturn, *structure.VError, error) { 53 | req, err := s.client.NewRequest("POST", "ActivateCallerID", params) 54 | if err != nil { 55 | return nil, nil, err 56 | } 57 | response := &ActivateCallerIDReturn{} 58 | verr, err := s.client.MakeResponse(req, response) 59 | if verr != nil || err != nil { 60 | return nil, verr, err 61 | } 62 | return response, nil, nil 63 | } 64 | 65 | type DelCallerIDParams struct { 66 | // ID of the callerID object 67 | CalleridId int `json:"callerid_id,string"` 68 | // The callerID number that can be used instead of callerid_id 69 | CalleridNumber string `json:"callerid_number"` 70 | } 71 | 72 | type DelCallerIDReturn struct { 73 | // 1 74 | Result int `json:"result"` 75 | } 76 | 77 | // Deletes the CallerID. Note: you cannot delete a CID permanently (the antispam defence). 78 | func (s *CallerIDsService) DelCallerID(params DelCallerIDParams) (*DelCallerIDReturn, *structure.VError, error) { 79 | req, err := s.client.NewRequest("POST", "DelCallerID", params) 80 | if err != nil { 81 | return nil, nil, err 82 | } 83 | response := &DelCallerIDReturn{} 84 | verr, err := s.client.MakeResponse(req, response) 85 | if verr != nil || err != nil { 86 | return nil, verr, err 87 | } 88 | return response, nil, nil 89 | } 90 | 91 | type GetCallerIDsParams struct { 92 | // ID of the callerID object to filter 93 | CalleridId int `json:"callerid_id,string,omitempty"` 94 | // The phone number to filter 95 | CalleridNumber string `json:"callerid_number,omitempty"` 96 | // Whether the account is active to filter 97 | Active *bool `json:"active,string,omitempty"` 98 | // The following values are available: 'caller_number' (ascent order), 'verified_until' (ascent order) 99 | OrderBy string `json:"order_by,omitempty"` 100 | // The max returning record count 101 | Count int `json:"count,string,omitempty"` 102 | // The first N records are skipped in the output 103 | Offset int `json:"offset,string,omitempty"` 104 | } 105 | 106 | type GetCallerIDsReturn struct { 107 | Result []*structure.CallerIDInfoType `json:"result"` 108 | // The total found record count 109 | TotalCount int `json:"total_count"` 110 | // The returned record count 111 | Count int `json:"count"` 112 | } 113 | 114 | // Gets the account callerIDs. 115 | func (s *CallerIDsService) GetCallerIDs(params GetCallerIDsParams) (*GetCallerIDsReturn, *structure.VError, error) { 116 | req, err := s.client.NewRequest("POST", "GetCallerIDs", params) 117 | if err != nil { 118 | return nil, nil, err 119 | } 120 | response := &GetCallerIDsReturn{} 121 | verr, err := s.client.MakeResponse(req, response) 122 | if verr != nil || err != nil { 123 | return nil, verr, err 124 | } 125 | return response, nil, nil 126 | } 127 | 128 | type VerifyCallerIDParams struct { 129 | // ID of the callerID object 130 | CalleridId int `json:"callerid_id,string"` 131 | // The callerID number that can be used instead of callerid_id 132 | CalleridNumber string `json:"callerid_number"` 133 | } 134 | 135 | type VerifyCallerIDReturn struct { 136 | // 1 137 | Result int `json:"result"` 138 | } 139 | 140 | // Gets a verification code via phone call to the **callerid_number**. 141 | func (s *CallerIDsService) VerifyCallerID(params VerifyCallerIDParams) (*VerifyCallerIDReturn, *structure.VError, error) { 142 | req, err := s.client.NewRequest("POST", "VerifyCallerID", params) 143 | if err != nil { 144 | return nil, nil, err 145 | } 146 | response := &VerifyCallerIDReturn{} 147 | verr, err := s.client.MakeResponse(req, response) 148 | if verr != nil || err != nil { 149 | return nil, verr, err 150 | } 151 | return response, nil, nil 152 | } 153 | -------------------------------------------------------------------------------- /methods/DialogflowCredentials.go: -------------------------------------------------------------------------------- 1 | package methods 2 | 3 | import ( 4 | "github.com/voximplant/apiclient-go/v2/structure" 5 | ) 6 | 7 | type DialogflowCredentialsService struct { 8 | client *Client 9 | } 10 | 11 | type AddDialogflowKeyParams struct { 12 | // The application ID 13 | ApplicationId string `json:"application_id"` 14 | // The application name. Can be used instead of application_id 15 | ApplicationName string `json:"application_name,omitempty"` 16 | // Dialogflow credentials, provided by JWK (Json web key) 17 | JsonCredentials string `json:"json_credentials"` 18 | // The Dialogflow key's description 19 | Description string `json:"description,omitempty"` 20 | } 21 | 22 | type AddDialogflowKeyReturn struct { 23 | Result int `json:"result"` 24 | DialogflowKeyId int `json:"dialogflow_key_id"` 25 | } 26 | 27 | // Adds a Dialogflow key. 28 | func (s *DialogflowCredentialsService) AddDialogflowKey(params AddDialogflowKeyParams) (*AddDialogflowKeyReturn, *structure.VError, error) { 29 | req, err := s.client.NewRequest("POST", "AddDialogflowKey", params) 30 | if err != nil { 31 | return nil, nil, err 32 | } 33 | response := &AddDialogflowKeyReturn{} 34 | verr, err := s.client.MakeResponse(req, response) 35 | if verr != nil || err != nil { 36 | return nil, verr, err 37 | } 38 | return response, nil, nil 39 | } 40 | 41 | type SetDialogflowKeyParams struct { 42 | // The Dialogflow key's ID 43 | DialogflowKeyId int `json:"dialogflow_key_id,string"` 44 | // The Dialogflow key's description. To clear previously set description leave the parameter blank or put whitespaces only 45 | Description string `json:"description"` 46 | } 47 | 48 | type SetDialogflowKeyReturn struct { 49 | Result int `json:"result"` 50 | } 51 | 52 | // Edits a Dialogflow key. 53 | func (s *DialogflowCredentialsService) SetDialogflowKey(params SetDialogflowKeyParams) (*SetDialogflowKeyReturn, *structure.VError, error) { 54 | req, err := s.client.NewRequest("POST", "SetDialogflowKey", params) 55 | if err != nil { 56 | return nil, nil, err 57 | } 58 | response := &SetDialogflowKeyReturn{} 59 | verr, err := s.client.MakeResponse(req, response) 60 | if verr != nil || err != nil { 61 | return nil, verr, err 62 | } 63 | return response, nil, nil 64 | } 65 | 66 | type DelDialogflowKeyParams struct { 67 | // The Dialogflow key's ID 68 | DialogflowKeyId int `json:"dialogflow_key_id,string"` 69 | } 70 | 71 | type DelDialogflowKeyReturn struct { 72 | Result int `json:"result"` 73 | } 74 | 75 | // Removes a Dialogflow key. 76 | func (s *DialogflowCredentialsService) DelDialogflowKey(params DelDialogflowKeyParams) (*DelDialogflowKeyReturn, *structure.VError, error) { 77 | req, err := s.client.NewRequest("POST", "DelDialogflowKey", params) 78 | if err != nil { 79 | return nil, nil, err 80 | } 81 | response := &DelDialogflowKeyReturn{} 82 | verr, err := s.client.MakeResponse(req, response) 83 | if verr != nil || err != nil { 84 | return nil, verr, err 85 | } 86 | return response, nil, nil 87 | } 88 | 89 | type GetDialogflowKeysParams struct { 90 | // Dialogflow key's ID 91 | DialogflowKeyId int `json:"dialogflow_key_id,string,omitempty"` 92 | // Name of the bound application 93 | ApplicationName string `json:"application_name,omitempty"` 94 | // ID of the bound application 95 | ApplicationId int `json:"application_id,string,omitempty"` 96 | // Whether to get the json web key 97 | WithSecretInfo *bool `json:"with_secret_info,string,omitempty"` 98 | } 99 | 100 | type GetDialogflowKeysReturn struct { 101 | Result []*structure.DialogflowKeyInfo `json:"result"` 102 | } 103 | 104 | // Gets Dialogflow keys. 105 | func (s *DialogflowCredentialsService) GetDialogflowKeys(params GetDialogflowKeysParams) (*GetDialogflowKeysReturn, *structure.VError, error) { 106 | req, err := s.client.NewRequest("POST", "GetDialogflowKeys", params) 107 | if err != nil { 108 | return nil, nil, err 109 | } 110 | response := &GetDialogflowKeysReturn{} 111 | verr, err := s.client.MakeResponse(req, response) 112 | if verr != nil || err != nil { 113 | return nil, verr, err 114 | } 115 | return response, nil, nil 116 | } 117 | 118 | type BindDialogflowKeysParams struct { 119 | // The Dialogflow key's ID 120 | DialogflowKeyId int `json:"dialogflow_key_id,string"` 121 | // The application ID list separated by semicolons (;). Use the 'all' value to select all applications 122 | ApplicationId string `json:"application_id"` 123 | // Whether to bind or unbind (set true or false respectively) 124 | Bind *bool `json:"bind,string,omitempty"` 125 | } 126 | 127 | type BindDialogflowKeysReturn struct { 128 | Result int `json:"result"` 129 | } 130 | 131 | // Binds a Dialogflow key to the specified applications. 132 | func (s *DialogflowCredentialsService) BindDialogflowKeys(params BindDialogflowKeysParams) (*BindDialogflowKeysReturn, *structure.VError, error) { 133 | req, err := s.client.NewRequest("POST", "BindDialogflowKeys", params) 134 | if err != nil { 135 | return nil, nil, err 136 | } 137 | response := &BindDialogflowKeysReturn{} 138 | verr, err := s.client.MakeResponse(req, response) 139 | if verr != nil || err != nil { 140 | return nil, verr, err 141 | } 142 | return response, nil, nil 143 | } 144 | -------------------------------------------------------------------------------- /methods/Invoices.go: -------------------------------------------------------------------------------- 1 | package methods 2 | 3 | import ( 4 | "github.com/voximplant/apiclient-go/v2/structure" 5 | "io" 6 | ) 7 | 8 | type InvoicesService struct { 9 | client *Client 10 | } 11 | 12 | type GetAccountInvoicesParams struct { 13 | // Status to filter invoices. Possible values: new, taxed, accepted, committed, cancelled, numbered 14 | Status string `json:"status,omitempty"` 15 | // Number of invoices to show per page. Default value is 20 16 | Count int `json:"count,string,omitempty"` 17 | // Number of invoices to skip (e.g. if you set count = 20 and offset = 0 the first time, the next time, offset has to be equal to 20 to skip the items shown earlier). Default value is 0 18 | Offset int `json:"offset,string,omitempty"` 19 | } 20 | 21 | type GetAccountInvoicesReturn struct { 22 | // Array of the account invoices 23 | Result *structure.AccountInvoice `json:"result"` 24 | // Total number of invoices matching the query parameters 25 | TotalCount int `json:"total_count"` 26 | // Number of returned invoices matching the query parameters 27 | Count int `json:"count"` 28 | } 29 | 30 | // Gets all invoices for the specified USD or EUR account. 31 | func (s *InvoicesService) GetAccountInvoices(params GetAccountInvoicesParams) (*GetAccountInvoicesReturn, *structure.VError, error) { 32 | req, err := s.client.NewRequest("POST", "GetAccountInvoices", params) 33 | if err != nil { 34 | return nil, nil, err 35 | } 36 | response := &GetAccountInvoicesReturn{} 37 | verr, err := s.client.MakeResponse(req, response) 38 | if verr != nil || err != nil { 39 | return nil, verr, err 40 | } 41 | return response, nil, nil 42 | } 43 | 44 | type DownloadInvoiceParams struct { 45 | // Invoice ID 46 | InvoiceId int `json:"invoice_id,string"` 47 | } 48 | 49 | func (s *DownloadInvoiceReturn) SetFileContent(r io.Reader) { 50 | s.FileContent = r 51 | } 52 | 53 | type DownloadInvoiceReturn struct { 54 | // The method returns a raw data, there is no 'file_content' parameter in fact 55 | FileContent io.Reader `json:"file_content"` 56 | } 57 | 58 | // Downloads the specified invoice. 59 | func (s *InvoicesService) DownloadInvoice(params DownloadInvoiceParams) (*DownloadInvoiceReturn, *structure.VError, error) { 60 | req, err := s.client.NewRequest("POST", "DownloadInvoice", params) 61 | if err != nil { 62 | return nil, nil, err 63 | } 64 | response := &DownloadInvoiceReturn{} 65 | verr, err := s.client.MakeResponse(req, response) 66 | if verr != nil || err != nil { 67 | return nil, verr, err 68 | } 69 | return response, nil, nil 70 | } 71 | -------------------------------------------------------------------------------- /methods/KeyValueStorage.go: -------------------------------------------------------------------------------- 1 | package methods 2 | 3 | import ( 4 | "github.com/voximplant/apiclient-go/v2/structure" 5 | ) 6 | 7 | type KeyValueStorageService struct { 8 | client *Client 9 | } 10 | 11 | type SetKeyValueItemParams struct { 12 | // Key, up to 200 characters. A key can contain a namespace that is written before the ':' symbol, for example, test:1234. Thus, namespace 'test' can be used as a pattern in the [GetKeyValueItems](/docs/references/httpapi/keyvaluestorage#getkeyvalueitems) and [GetKeyValueKeys](/docs/references/httpapi/keyvaluestorage#getkeyvaluekeys) methods to find the keys with the same namespace.

The key should match the following regular expression: `^[a-zA-Z0-9а-яА-ЯёЁ_\-:;.#+]*$` 13 | Key string `json:"key"` 14 | // Value for the specified key, up to 2000 characters 15 | Value string `json:"value"` 16 | // Application ID 17 | ApplicationId int `json:"application_id,string"` 18 | // Application name 19 | ApplicationName string `json:"application_name,omitempty"` 20 | // Key expiry time in seconds. The value is in range of 0..7,776,000 (90 days), the default value is 30 days (2,592,000 seconds). The TTL is converted to an **expires_at** Unix timestamp field as part of the storage object. Note that one of the two parameters (ttl or expires_at) must be set 21 | Ttl int `json:"ttl,string,omitempty"` 22 | // Expiration date based on **ttl** (timestamp without milliseconds). Note that one of the two parameters (ttl or expires_at) must be set 23 | ExpiresAt int `json:"expires_at,string,omitempty"` 24 | } 25 | 26 | type SetKeyValueItemReturn struct { 27 | // The key-value item 28 | Result *structure.KeyValueItems `json:"result"` 29 | } 30 | 31 | // Creates or updates a key-value pair. If an existing key is passed, the method returns the existing item and changes the value if needed. The keys should be unique within a Voximplant application. 32 | func (s *KeyValueStorageService) SetKeyValueItem(params SetKeyValueItemParams) (*SetKeyValueItemReturn, *structure.VError, error) { 33 | req, err := s.client.NewRequest("POST", "SetKeyValueItem", params) 34 | if err != nil { 35 | return nil, nil, err 36 | } 37 | response := &SetKeyValueItemReturn{} 38 | verr, err := s.client.MakeResponse(req, response) 39 | if verr != nil || err != nil { 40 | return nil, verr, err 41 | } 42 | return response, nil, nil 43 | } 44 | 45 | type DelKeyValueItemParams struct { 46 | // Key, up to 200 characters 47 | Key string `json:"key"` 48 | // The application ID 49 | ApplicationId int `json:"application_id,string"` 50 | // The application name 51 | ApplicationName string `json:"application_name,omitempty"` 52 | } 53 | 54 | type DelKeyValueItemReturn struct { 55 | Result int `json:"result"` 56 | } 57 | 58 | // Deletes the specified key-value pair from the storage. 59 | func (s *KeyValueStorageService) DelKeyValueItem(params DelKeyValueItemParams) (*DelKeyValueItemReturn, *structure.VError, error) { 60 | req, err := s.client.NewRequest("POST", "DelKeyValueItem", params) 61 | if err != nil { 62 | return nil, nil, err 63 | } 64 | response := &DelKeyValueItemReturn{} 65 | verr, err := s.client.MakeResponse(req, response) 66 | if verr != nil || err != nil { 67 | return nil, verr, err 68 | } 69 | return response, nil, nil 70 | } 71 | 72 | type GetKeyValueItemParams struct { 73 | // Key, up to 200 characters 74 | Key string `json:"key"` 75 | // The application ID 76 | ApplicationId int `json:"application_id,string"` 77 | // The application name 78 | ApplicationName string `json:"application_name,omitempty"` 79 | } 80 | 81 | type GetKeyValueItemReturn struct { 82 | // The key-value item 83 | Result *structure.KeyValueItems `json:"result"` 84 | } 85 | 86 | // Gets the specified key-value pair from the storage. 87 | func (s *KeyValueStorageService) GetKeyValueItem(params GetKeyValueItemParams) (*GetKeyValueItemReturn, *structure.VError, error) { 88 | req, err := s.client.NewRequest("POST", "GetKeyValueItem", params) 89 | if err != nil { 90 | return nil, nil, err 91 | } 92 | response := &GetKeyValueItemReturn{} 93 | verr, err := s.client.MakeResponse(req, response) 94 | if verr != nil || err != nil { 95 | return nil, verr, err 96 | } 97 | return response, nil, nil 98 | } 99 | 100 | type GetKeyValueItemsParams struct { 101 | // Namespace that keys should contain, up to 200 characters 102 | Key string `json:"key"` 103 | // Number of items to show per page with a maximum value of 50. Default value is 10 104 | Count int `json:"count,string,omitempty"` 105 | // Number of items to skip (e.g. if you set count = 20 and offset = 0 the first time, the next time, offset has to be equal to 20 to skip the items shown earlier). Default value is 0 106 | Offset int `json:"offset,string,omitempty"` 107 | // The application ID 108 | ApplicationId int `json:"application_id,string"` 109 | // The application name 110 | ApplicationName string `json:"application_name,omitempty"` 111 | } 112 | 113 | type GetKeyValueItemsReturn struct { 114 | // The key-value pairs 115 | Result *structure.KeyValueItems `json:"result"` 116 | } 117 | 118 | // Gets all the key-value pairs in which the keys begin with a pattern. 119 | func (s *KeyValueStorageService) GetKeyValueItems(params GetKeyValueItemsParams) (*GetKeyValueItemsReturn, *structure.VError, error) { 120 | req, err := s.client.NewRequest("POST", "GetKeyValueItems", params) 121 | if err != nil { 122 | return nil, nil, err 123 | } 124 | response := &GetKeyValueItemsReturn{} 125 | verr, err := s.client.MakeResponse(req, response) 126 | if verr != nil || err != nil { 127 | return nil, verr, err 128 | } 129 | return response, nil, nil 130 | } 131 | 132 | type GetKeyValueKeysParams struct { 133 | // Namespace that keys should contain, up to 200 characters 134 | Key string `json:"key,omitempty"` 135 | // Number of items to show per page with a maximum value of 50. Default value is 10 136 | Count int `json:"count,string,omitempty"` 137 | // Number of items to skip (e.g. if you set count = 20 and offset = 0 the first time, the next time, offset has to be equal to 20 to skip the items shown earlier). Default value is 0 138 | Offset int `json:"offset,string,omitempty"` 139 | // The application ID 140 | ApplicationId int `json:"application_id,string"` 141 | // The application name 142 | ApplicationName string `json:"application_name,omitempty"` 143 | } 144 | 145 | type GetKeyValueKeysReturn struct { 146 | // The key-value keys 147 | Result *structure.KeyValueKeys `json:"result"` 148 | } 149 | 150 | // Gets all the keys of key-value pairs. 151 | func (s *KeyValueStorageService) GetKeyValueKeys(params GetKeyValueKeysParams) (*GetKeyValueKeysReturn, *structure.VError, error) { 152 | req, err := s.client.NewRequest("POST", "GetKeyValueKeys", params) 153 | if err != nil { 154 | return nil, nil, err 155 | } 156 | response := &GetKeyValueKeysReturn{} 157 | verr, err := s.client.MakeResponse(req, response) 158 | if verr != nil || err != nil { 159 | return nil, verr, err 160 | } 161 | return response, nil, nil 162 | } 163 | -------------------------------------------------------------------------------- /methods/OutboundTestNumbers.go: -------------------------------------------------------------------------------- 1 | package methods 2 | 3 | import ( 4 | "github.com/voximplant/apiclient-go/v2/structure" 5 | ) 6 | 7 | type OutboundTestNumbersService struct { 8 | client *Client 9 | } 10 | 11 | type AddOutboundTestPhoneNumberParams struct { 12 | // The personal phone number in the E.164 format 13 | PhoneNumber string `json:"phone_number"` 14 | } 15 | 16 | type AddOutboundTestPhoneNumberReturn struct { 17 | // 1 18 | Result int `json:"result"` 19 | } 20 | 21 | // Adds a personal phone number to test outgoing calls. Only one personal phone number can be used. To replace it with another, delete the existing one first. 22 | func (s *OutboundTestNumbersService) AddOutboundTestPhoneNumber(params AddOutboundTestPhoneNumberParams) (*AddOutboundTestPhoneNumberReturn, *structure.VError, error) { 23 | req, err := s.client.NewRequest("POST", "AddOutboundTestPhoneNumber", params) 24 | if err != nil { 25 | return nil, nil, err 26 | } 27 | response := &AddOutboundTestPhoneNumberReturn{} 28 | verr, err := s.client.MakeResponse(req, response) 29 | if verr != nil || err != nil { 30 | return nil, verr, err 31 | } 32 | return response, nil, nil 33 | } 34 | 35 | type VerifyOutboundTestPhoneNumberParams struct { 36 | } 37 | 38 | type VerifyOutboundTestPhoneNumberReturn struct { 39 | // The number of attempts left for the day. The number is reset every day at 00:00 UTC 40 | DailyAttemptsLeft int `json:"daily_attempts_left"` 41 | } 42 | 43 | // Starts a call to the added phone number and pronounces a verification code. You have only 5 verification attempts per day and 100 in total. 1 minute should pass between 2 attempts. 44 | func (s *OutboundTestNumbersService) VerifyOutboundTestPhoneNumber(params VerifyOutboundTestPhoneNumberParams) (*VerifyOutboundTestPhoneNumberReturn, *structure.VError, error) { 45 | req, err := s.client.NewRequest("POST", "VerifyOutboundTestPhoneNumber", params) 46 | if err != nil { 47 | return nil, nil, err 48 | } 49 | response := &VerifyOutboundTestPhoneNumberReturn{} 50 | verr, err := s.client.MakeResponse(req, response) 51 | if verr != nil || err != nil { 52 | return nil, verr, err 53 | } 54 | return response, nil, nil 55 | } 56 | 57 | type ActivateOutboundTestPhoneNumberParams struct { 58 | // The verification code, see the [VerifyOutboundTestPhoneNumber] function 59 | VerificationCode string `json:"verification_code"` 60 | } 61 | 62 | type ActivateOutboundTestPhoneNumberReturn struct { 63 | // 1 64 | Result int `json:"result"` 65 | } 66 | 67 | // Activates the phone number by the verification code. 68 | func (s *OutboundTestNumbersService) ActivateOutboundTestPhoneNumber(params ActivateOutboundTestPhoneNumberParams) (*ActivateOutboundTestPhoneNumberReturn, *structure.VError, error) { 69 | req, err := s.client.NewRequest("POST", "ActivateOutboundTestPhoneNumber", params) 70 | if err != nil { 71 | return nil, nil, err 72 | } 73 | response := &ActivateOutboundTestPhoneNumberReturn{} 74 | verr, err := s.client.MakeResponse(req, response) 75 | if verr != nil || err != nil { 76 | return nil, verr, err 77 | } 78 | return response, nil, nil 79 | } 80 | 81 | type DelOutboundTestPhoneNumberParams struct { 82 | } 83 | 84 | type DelOutboundTestPhoneNumberReturn struct { 85 | // 1 86 | Result int `json:"result"` 87 | } 88 | 89 | // Deletes the existing phone number. 90 | func (s *OutboundTestNumbersService) DelOutboundTestPhoneNumber(params DelOutboundTestPhoneNumberParams) (*DelOutboundTestPhoneNumberReturn, *structure.VError, error) { 91 | req, err := s.client.NewRequest("POST", "DelOutboundTestPhoneNumber", params) 92 | if err != nil { 93 | return nil, nil, err 94 | } 95 | response := &DelOutboundTestPhoneNumberReturn{} 96 | verr, err := s.client.MakeResponse(req, response) 97 | if verr != nil || err != nil { 98 | return nil, verr, err 99 | } 100 | return response, nil, nil 101 | } 102 | 103 | type GetOutboundTestPhoneNumbersParams struct { 104 | } 105 | 106 | type GetOutboundTestPhoneNumbersReturn struct { 107 | Result []*structure.OutboundTestPhonenumberInfoType `json:"result"` 108 | } 109 | 110 | // Shows the phone number info. 111 | func (s *OutboundTestNumbersService) GetOutboundTestPhoneNumbers(params GetOutboundTestPhoneNumbersParams) (*GetOutboundTestPhoneNumbersReturn, *structure.VError, error) { 112 | req, err := s.client.NewRequest("POST", "GetOutboundTestPhoneNumbers", params) 113 | if err != nil { 114 | return nil, nil, err 115 | } 116 | response := &GetOutboundTestPhoneNumbersReturn{} 117 | verr, err := s.client.MakeResponse(req, response) 118 | if verr != nil || err != nil { 119 | return nil, verr, err 120 | } 121 | return response, nil, nil 122 | } 123 | -------------------------------------------------------------------------------- /methods/PSTNBlacklist.go: -------------------------------------------------------------------------------- 1 | package methods 2 | 3 | import ( 4 | "github.com/voximplant/apiclient-go/v2/structure" 5 | ) 6 | 7 | type PSTNBlacklistService struct { 8 | client *Client 9 | } 10 | 11 | type AddPstnBlackListItemParams struct { 12 | // The phone number in format e164 or regex pattern 13 | PstnBlacklistPhone string `json:"pstn_blacklist_phone"` 14 | } 15 | 16 | type AddPstnBlackListItemReturn struct { 17 | // 1 18 | Result int `json:"result"` 19 | // The PSTN black list item ID 20 | PstnBlacklistId int `json:"pstn_blacklist_id"` 21 | } 22 | 23 | // Add a new phone number to the PSTN blacklist. Use blacklist to block incoming calls from specified phone numbers to numbers purchased from Voximplant. Since we have no control over exact phone number format for calls from SIP integrations, blacklisting such numbers should be done via JavaScript scenarios. 24 | func (s *PSTNBlacklistService) AddPstnBlackListItem(params AddPstnBlackListItemParams) (*AddPstnBlackListItemReturn, *structure.VError, error) { 25 | req, err := s.client.NewRequest("POST", "AddPstnBlackListItem", params) 26 | if err != nil { 27 | return nil, nil, err 28 | } 29 | response := &AddPstnBlackListItemReturn{} 30 | verr, err := s.client.MakeResponse(req, response) 31 | if verr != nil || err != nil { 32 | return nil, verr, err 33 | } 34 | return response, nil, nil 35 | } 36 | 37 | type SetPstnBlackListItemParams struct { 38 | // The PSTN black list item ID 39 | PstnBlacklistId int `json:"pstn_blacklist_id,string"` 40 | // The new phone number in format e164 41 | PstnBlacklistPhone string `json:"pstn_blacklist_phone"` 42 | } 43 | 44 | type SetPstnBlackListItemReturn struct { 45 | // 1 46 | Result int `json:"result"` 47 | } 48 | 49 | // Update the PSTN blacklist item. BlackList works for numbers that are purchased from Voximplant only. Since we have no control over exact phone number format for calls from SIP integrations, blacklisting such numbers should be done via JavaScript scenarios. 50 | func (s *PSTNBlacklistService) SetPstnBlackListItem(params SetPstnBlackListItemParams) (*SetPstnBlackListItemReturn, *structure.VError, error) { 51 | req, err := s.client.NewRequest("POST", "SetPstnBlackListItem", params) 52 | if err != nil { 53 | return nil, nil, err 54 | } 55 | response := &SetPstnBlackListItemReturn{} 56 | verr, err := s.client.MakeResponse(req, response) 57 | if verr != nil || err != nil { 58 | return nil, verr, err 59 | } 60 | return response, nil, nil 61 | } 62 | 63 | type DelPstnBlackListItemParams struct { 64 | // The PSTN black list item ID 65 | PstnBlacklistId int `json:"pstn_blacklist_id,string"` 66 | } 67 | 68 | type DelPstnBlackListItemReturn struct { 69 | // 1 70 | Result int `json:"result"` 71 | } 72 | 73 | // Remove phone number from the PSTN blacklist. 74 | func (s *PSTNBlacklistService) DelPstnBlackListItem(params DelPstnBlackListItemParams) (*DelPstnBlackListItemReturn, *structure.VError, error) { 75 | req, err := s.client.NewRequest("POST", "DelPstnBlackListItem", params) 76 | if err != nil { 77 | return nil, nil, err 78 | } 79 | response := &DelPstnBlackListItemReturn{} 80 | verr, err := s.client.MakeResponse(req, response) 81 | if verr != nil || err != nil { 82 | return nil, verr, err 83 | } 84 | return response, nil, nil 85 | } 86 | 87 | type GetPstnBlackListParams struct { 88 | // The PSTN black list item ID for filter 89 | PstnBlacklistId int `json:"pstn_blacklist_id,string,omitempty"` 90 | // The phone number in format e164 for filter 91 | PstnBlacklistPhone string `json:"pstn_blacklist_phone,omitempty"` 92 | // The max returning record count 93 | Count int `json:"count,string,omitempty"` 94 | // The first N records are skipped in the output 95 | Offset int `json:"offset,string,omitempty"` 96 | } 97 | 98 | type GetPstnBlackListReturn struct { 99 | Result []*structure.PstnBlackListInfoType `json:"result"` 100 | // The total found phone numbers count 101 | TotalCount int `json:"total_count"` 102 | // The returned phone numbers count 103 | Count int `json:"count"` 104 | } 105 | 106 | // Get the whole PSTN blacklist. 107 | func (s *PSTNBlacklistService) GetPstnBlackList(params GetPstnBlackListParams) (*GetPstnBlackListReturn, *structure.VError, error) { 108 | req, err := s.client.NewRequest("POST", "GetPstnBlackList", params) 109 | if err != nil { 110 | return nil, nil, err 111 | } 112 | response := &GetPstnBlackListReturn{} 113 | verr, err := s.client.MakeResponse(req, response) 114 | if verr != nil || err != nil { 115 | return nil, verr, err 116 | } 117 | return response, nil, nil 118 | } 119 | -------------------------------------------------------------------------------- /methods/RecordStorages.go: -------------------------------------------------------------------------------- 1 | package methods 2 | 3 | import ( 4 | "github.com/voximplant/apiclient-go/v2/structure" 5 | ) 6 | 7 | type RecordStoragesService struct { 8 | client *Client 9 | } 10 | 11 | type GetRecordStoragesParams struct { 12 | // The record storage ID list separated by semicolons (;) 13 | RecordStorageId string `json:"record_storage_id,omitempty"` 14 | // The record storage name list separated by semicolons (;) 15 | RecordStorageName string `json:"record_storage_name,omitempty"` 16 | // Whether to get the private record storages. If set to true, there is the __is_public : bool__ parameter in a response 17 | WithPrivate *bool `json:"with_private,string,omitempty"` 18 | } 19 | 20 | type GetRecordStoragesReturn struct { 21 | Result *structure.RecordStorageInfoType `json:"result"` 22 | } 23 | 24 | // Gets the record storages. 25 | func (s *RecordStoragesService) GetRecordStorages(params GetRecordStoragesParams) (*GetRecordStoragesReturn, *structure.VError, error) { 26 | req, err := s.client.NewRequest("POST", "GetRecordStorages", params) 27 | if err != nil { 28 | return nil, nil, err 29 | } 30 | response := &GetRecordStoragesReturn{} 31 | verr, err := s.client.MakeResponse(req, response) 32 | if verr != nil || err != nil { 33 | return nil, verr, err 34 | } 35 | return response, nil, nil 36 | } 37 | -------------------------------------------------------------------------------- /methods/Rules.go: -------------------------------------------------------------------------------- 1 | package methods 2 | 3 | import ( 4 | "github.com/voximplant/apiclient-go/v2/structure" 5 | ) 6 | 7 | type RulesService struct { 8 | client *Client 9 | } 10 | 11 | type AddRuleParams struct { 12 | // The application ID 13 | ApplicationId int `json:"application_id,string"` 14 | // The application name, can be used instead of application_id 15 | ApplicationName string `json:"application_name"` 16 | // The rule name. The length must be less than 100 17 | RuleName string `json:"rule_name"` 18 | // The rule pattern regex. The length must be less than 64 KB 19 | RulePattern string `json:"rule_pattern"` 20 | // The exclude pattern regex. The length must be less than 64 KB 21 | RulePatternExclude string `json:"rule_pattern_exclude,omitempty"` 22 | // Whether video conference is required 23 | VideoConference *bool `json:"video_conference,string,omitempty"` 24 | // The service account ID to bind to the rule. Read more in the [guide](/docs/guides/voxengine/management-api) 25 | BindKeyId string `json:"bind_key_id,omitempty"` 26 | // The scenario ID list separated by semicolons (;) 27 | ScenarioId string `json:"scenario_id"` 28 | // The scenario name list separated by semicolons (;). Can be used instead of scenario_id 29 | ScenarioName string `json:"scenario_name"` 30 | } 31 | 32 | type AddRuleReturn struct { 33 | // 1 34 | Result int `json:"result"` 35 | // The new rule ID 36 | RuleId int `json:"rule_id"` 37 | } 38 | 39 | // Adds a new rule for the application. 40 | func (s *RulesService) AddRule(params AddRuleParams) (*AddRuleReturn, *structure.VError, error) { 41 | req, err := s.client.NewRequest("POST", "AddRule", params) 42 | if err != nil { 43 | return nil, nil, err 44 | } 45 | response := &AddRuleReturn{} 46 | verr, err := s.client.MakeResponse(req, response) 47 | if verr != nil || err != nil { 48 | return nil, verr, err 49 | } 50 | return response, nil, nil 51 | } 52 | 53 | type DelRuleParams struct { 54 | // The rule ID list separated by semicolons (;). Use the 'all' value to select all rules 55 | RuleId string `json:"rule_id"` 56 | // The rule name list separated by semicolons (;). Can be used instead of rule_id 57 | RuleName string `json:"rule_name"` 58 | // The application ID list separated by semicolons (;). Use the 'all' value to select all applications 59 | ApplicationId string `json:"application_id"` 60 | // The application name list separated by semicolons (;). Can be used instead of application_id 61 | ApplicationName string `json:"application_name"` 62 | } 63 | 64 | type DelRuleReturn struct { 65 | // 1 66 | Result int `json:"result"` 67 | } 68 | 69 | // Deletes the rule. 70 | func (s *RulesService) DelRule(params DelRuleParams) (*DelRuleReturn, *structure.VError, error) { 71 | req, err := s.client.NewRequest("POST", "DelRule", params) 72 | if err != nil { 73 | return nil, nil, err 74 | } 75 | response := &DelRuleReturn{} 76 | verr, err := s.client.MakeResponse(req, response) 77 | if verr != nil || err != nil { 78 | return nil, verr, err 79 | } 80 | return response, nil, nil 81 | } 82 | 83 | type SetRuleInfoParams struct { 84 | // The rule ID 85 | RuleId int `json:"rule_id,string"` 86 | // The new rule name. The length must be less than 100 87 | RuleName string `json:"rule_name,omitempty"` 88 | // The new rule pattern regex. The length must be less than 64 KB 89 | RulePattern string `json:"rule_pattern,omitempty"` 90 | // The new exclude pattern regex. The length must be less than 64 KB 91 | RulePatternExclude string `json:"rule_pattern_exclude,omitempty"` 92 | // Whether video conference is required 93 | VideoConference *bool `json:"video_conference,string,omitempty"` 94 | // The service account ID to bind to the rule. Read more in the [guide](/docs/guides/voxengine/management-api) 95 | BindKeyId string `json:"bind_key_id,omitempty"` 96 | } 97 | 98 | type SetRuleInfoReturn struct { 99 | // 1 100 | Result int `json:"result"` 101 | } 102 | 103 | // Edits the rule. 104 | func (s *RulesService) SetRuleInfo(params SetRuleInfoParams) (*SetRuleInfoReturn, *structure.VError, error) { 105 | req, err := s.client.NewRequest("POST", "SetRuleInfo", params) 106 | if err != nil { 107 | return nil, nil, err 108 | } 109 | response := &SetRuleInfoReturn{} 110 | verr, err := s.client.MakeResponse(req, response) 111 | if verr != nil || err != nil { 112 | return nil, verr, err 113 | } 114 | return response, nil, nil 115 | } 116 | 117 | type GetRulesParams struct { 118 | // The application ID 119 | ApplicationId int `json:"application_id,string"` 120 | // The application name that can be used instead of application_id 121 | ApplicationName string `json:"application_name"` 122 | // The rule ID to filter 123 | RuleId int `json:"rule_id,string,omitempty"` 124 | // The rule name part to filter 125 | RuleName string `json:"rule_name,omitempty"` 126 | // Whether it is a video conference to filter 127 | VideoConference *bool `json:"video_conference,string,omitempty"` 128 | // The service account ID bound to the rule. Read more in the [guide](/docs/guides/voxengine/management-api) 129 | AttachedKeyId string `json:"attached_key_id,omitempty"` 130 | // Search for template matching 131 | Template string `json:"template,omitempty"` 132 | // Whether to get bound scenarios info 133 | WithScenarios *bool `json:"with_scenarios,string,omitempty"` 134 | // The max returning record count 135 | Count int `json:"count,string,omitempty"` 136 | // The first N records are skipped in the output 137 | Offset int `json:"offset,string,omitempty"` 138 | } 139 | 140 | type GetRulesReturn struct { 141 | Result []*structure.RuleInfoType `json:"result"` 142 | // The total found rule count 143 | TotalCount int `json:"total_count"` 144 | // The returned rule count 145 | Count int `json:"count"` 146 | } 147 | 148 | // Gets the rules. 149 | func (s *RulesService) GetRules(params GetRulesParams) (*GetRulesReturn, *structure.VError, error) { 150 | req, err := s.client.NewRequest("POST", "GetRules", params) 151 | if err != nil { 152 | return nil, nil, err 153 | } 154 | response := &GetRulesReturn{} 155 | verr, err := s.client.MakeResponse(req, response) 156 | if verr != nil || err != nil { 157 | return nil, verr, err 158 | } 159 | return response, nil, nil 160 | } 161 | 162 | type ReorderRulesParams struct { 163 | // The rule ID list separated by semicolons (;) 164 | RuleId string `json:"rule_id"` 165 | } 166 | 167 | type ReorderRulesReturn struct { 168 | // 1 169 | Result int `json:"result"` 170 | } 171 | 172 | // Configures the rules' order in the Applications section of Control panel. Note: the rules must belong to the same application! 173 | func (s *RulesService) ReorderRules(params ReorderRulesParams) (*ReorderRulesReturn, *structure.VError, error) { 174 | req, err := s.client.NewRequest("POST", "ReorderRules", params) 175 | if err != nil { 176 | return nil, nil, err 177 | } 178 | response := &ReorderRulesReturn{} 179 | verr, err := s.client.MakeResponse(req, response) 180 | if verr != nil || err != nil { 181 | return nil, verr, err 182 | } 183 | return response, nil, nil 184 | } 185 | -------------------------------------------------------------------------------- /methods/SIPWhiteList.go: -------------------------------------------------------------------------------- 1 | package methods 2 | 3 | import ( 4 | "github.com/voximplant/apiclient-go/v2/structure" 5 | ) 6 | 7 | type SIPWhiteListService struct { 8 | client *Client 9 | } 10 | 11 | type AddSipWhiteListItemParams struct { 12 | // The network address in format A.B.C.D/L or A.B.C.D/a.b.c.d (example 192.168.1.5/16) 13 | SipWhitelistNetwork string `json:"sip_whitelist_network"` 14 | // The network address description 15 | Description string `json:"description,omitempty"` 16 | } 17 | 18 | type AddSipWhiteListItemReturn struct { 19 | // 1 20 | Result int `json:"result"` 21 | // The SIP white list item ID 22 | SipWhitelistId int `json:"sip_whitelist_id"` 23 | } 24 | 25 | // Adds a new network address to the SIP white list. 26 | func (s *SIPWhiteListService) AddSipWhiteListItem(params AddSipWhiteListItemParams) (*AddSipWhiteListItemReturn, *structure.VError, error) { 27 | req, err := s.client.NewRequest("POST", "AddSipWhiteListItem", params) 28 | if err != nil { 29 | return nil, nil, err 30 | } 31 | response := &AddSipWhiteListItemReturn{} 32 | verr, err := s.client.MakeResponse(req, response) 33 | if verr != nil || err != nil { 34 | return nil, verr, err 35 | } 36 | return response, nil, nil 37 | } 38 | 39 | type DelSipWhiteListItemParams struct { 40 | // The SIP white list item ID to delete 41 | SipWhitelistId int `json:"sip_whitelist_id,string"` 42 | } 43 | 44 | type DelSipWhiteListItemReturn struct { 45 | // 1 46 | Result int `json:"result"` 47 | } 48 | 49 | // Deletes the network address from the SIP white list. 50 | func (s *SIPWhiteListService) DelSipWhiteListItem(params DelSipWhiteListItemParams) (*DelSipWhiteListItemReturn, *structure.VError, error) { 51 | req, err := s.client.NewRequest("POST", "DelSipWhiteListItem", params) 52 | if err != nil { 53 | return nil, nil, err 54 | } 55 | response := &DelSipWhiteListItemReturn{} 56 | verr, err := s.client.MakeResponse(req, response) 57 | if verr != nil || err != nil { 58 | return nil, verr, err 59 | } 60 | return response, nil, nil 61 | } 62 | 63 | type SetSipWhiteListItemParams struct { 64 | // The SIP white list item ID 65 | SipWhitelistId int `json:"sip_whitelist_id,string"` 66 | // The new network address in format A.B.C.D/L or A.B.C.D/a.b.c.d (example 192.168.1.5/16) 67 | SipWhitelistNetwork string `json:"sip_whitelist_network"` 68 | // The network address description 69 | Description string `json:"description,omitempty"` 70 | } 71 | 72 | type SetSipWhiteListItemReturn struct { 73 | // 1 74 | Result int `json:"result"` 75 | } 76 | 77 | // Edits the SIP white list. 78 | func (s *SIPWhiteListService) SetSipWhiteListItem(params SetSipWhiteListItemParams) (*SetSipWhiteListItemReturn, *structure.VError, error) { 79 | req, err := s.client.NewRequest("POST", "SetSipWhiteListItem", params) 80 | if err != nil { 81 | return nil, nil, err 82 | } 83 | response := &SetSipWhiteListItemReturn{} 84 | verr, err := s.client.MakeResponse(req, response) 85 | if verr != nil || err != nil { 86 | return nil, verr, err 87 | } 88 | return response, nil, nil 89 | } 90 | 91 | type GetSipWhiteListParams struct { 92 | // The SIP white list item ID to filter 93 | SipWhitelistId int `json:"sip_whitelist_id,string,omitempty"` 94 | // The max returning record count 95 | Count int `json:"count,string,omitempty"` 96 | // The first N records are skipped in the output 97 | Offset int `json:"offset,string,omitempty"` 98 | } 99 | 100 | type GetSipWhiteListReturn struct { 101 | Result []*structure.SipWhiteListInfoType `json:"result"` 102 | // The total found networks count 103 | TotalCount int `json:"total_count"` 104 | // The returned networks count 105 | Count int `json:"count"` 106 | } 107 | 108 | // Gets the SIP white list. 109 | func (s *SIPWhiteListService) GetSipWhiteList(params GetSipWhiteListParams) (*GetSipWhiteListReturn, *structure.VError, error) { 110 | req, err := s.client.NewRequest("POST", "GetSipWhiteList", params) 111 | if err != nil { 112 | return nil, nil, err 113 | } 114 | response := &GetSipWhiteListReturn{} 115 | verr, err := s.client.MakeResponse(req, response) 116 | if verr != nil || err != nil { 117 | return nil, verr, err 118 | } 119 | return response, nil, nil 120 | } 121 | -------------------------------------------------------------------------------- /methods/Skills.go: -------------------------------------------------------------------------------- 1 | package methods 2 | 3 | import ( 4 | "github.com/voximplant/apiclient-go/v2/structure" 5 | ) 6 | 7 | type SkillsService struct { 8 | client *Client 9 | } 10 | 11 | type AddSkillParams struct { 12 | // The ACD operator skill name. The length must be less than 512 13 | SkillName string `json:"skill_name"` 14 | } 15 | 16 | type AddSkillReturn struct { 17 | // 1 18 | Result int `json:"result"` 19 | // The skill ID 20 | SkillId int `json:"skill_id"` 21 | } 22 | 23 | // Adds a new operator's skill. Works only for ACDv1. For SmartQueue/ACDv2, use this reference. 24 | func (s *SkillsService) AddSkill(params AddSkillParams) (*AddSkillReturn, *structure.VError, error) { 25 | req, err := s.client.NewRequest("POST", "AddSkill", params) 26 | if err != nil { 27 | return nil, nil, err 28 | } 29 | response := &AddSkillReturn{} 30 | verr, err := s.client.MakeResponse(req, response) 31 | if verr != nil || err != nil { 32 | return nil, verr, err 33 | } 34 | return response, nil, nil 35 | } 36 | 37 | type DelSkillParams struct { 38 | // The skill ID 39 | SkillId int `json:"skill_id,string"` 40 | // The skill name that can be used instead of skill_id 41 | SkillName string `json:"skill_name"` 42 | } 43 | 44 | type DelSkillReturn struct { 45 | // 1 46 | Result int `json:"result"` 47 | } 48 | 49 | // Deletes an operator's skill. Works only for ACDv1. For SmartQueue/ACDv2, use this reference. 50 | func (s *SkillsService) DelSkill(params DelSkillParams) (*DelSkillReturn, *structure.VError, error) { 51 | req, err := s.client.NewRequest("POST", "DelSkill", params) 52 | if err != nil { 53 | return nil, nil, err 54 | } 55 | response := &DelSkillReturn{} 56 | verr, err := s.client.MakeResponse(req, response) 57 | if verr != nil || err != nil { 58 | return nil, verr, err 59 | } 60 | return response, nil, nil 61 | } 62 | 63 | type SetSkillInfoParams struct { 64 | // The skill ID 65 | SkillId int `json:"skill_id,string"` 66 | // The skill name that can be used instead of skill_id 67 | SkillName string `json:"skill_name"` 68 | // The new skill name. The length must be less than 512 69 | NewSkillName string `json:"new_skill_name"` 70 | } 71 | 72 | type SetSkillInfoReturn struct { 73 | // 1 74 | Result int `json:"result"` 75 | } 76 | 77 | // Edits an operator's skill. Works only for ACDv1. For SmartQueue/ACDv2, use this reference. 78 | func (s *SkillsService) SetSkillInfo(params SetSkillInfoParams) (*SetSkillInfoReturn, *structure.VError, error) { 79 | req, err := s.client.NewRequest("POST", "SetSkillInfo", params) 80 | if err != nil { 81 | return nil, nil, err 82 | } 83 | response := &SetSkillInfoReturn{} 84 | verr, err := s.client.MakeResponse(req, response) 85 | if verr != nil || err != nil { 86 | return nil, verr, err 87 | } 88 | return response, nil, nil 89 | } 90 | 91 | type GetSkillsParams struct { 92 | // The skill ID to filter 93 | SkillId int `json:"skill_id,string,omitempty"` 94 | // The skill name part to filter 95 | SkillName string `json:"skill_name,omitempty"` 96 | // The max returning record count 97 | Count int `json:"count,string,omitempty"` 98 | // The first N records are skipped in the output 99 | Offset int `json:"offset,string,omitempty"` 100 | } 101 | 102 | type GetSkillsReturn struct { 103 | Result []*structure.SkillInfoType `json:"result"` 104 | // The total found skill count 105 | TotalCount int `json:"total_count"` 106 | // The returned skill count 107 | Count int `json:"count"` 108 | } 109 | 110 | // Gets the skills of an operator. Works only for ACDv1. For SmartQueue/ACDv2, use this reference. 111 | func (s *SkillsService) GetSkills(params GetSkillsParams) (*GetSkillsReturn, *structure.VError, error) { 112 | req, err := s.client.NewRequest("POST", "GetSkills", params) 113 | if err != nil { 114 | return nil, nil, err 115 | } 116 | response := &GetSkillsReturn{} 117 | verr, err := s.client.MakeResponse(req, response) 118 | if verr != nil || err != nil { 119 | return nil, verr, err 120 | } 121 | return response, nil, nil 122 | } 123 | 124 | type BindSkillParams struct { 125 | // The skill ID list separated by semicolons (;). Use the 'all' value to select all skills 126 | SkillId string `json:"skill_id"` 127 | // The skill name list separated by semicolons (;). Can be used instead of skill_id 128 | SkillName string `json:"skill_name"` 129 | // The user ID list separated by semicolons (;). Use the 'all' value to select all users 130 | UserId string `json:"user_id"` 131 | // The user name list separated by semicolons (;). user_name can be used instead of user_id 132 | UserName string `json:"user_name"` 133 | // The ACD queue ID list separated by semicolons (;). Use the 'all' value to select all ACD queues 134 | AcdQueueId string `json:"acd_queue_id"` 135 | // The ACD queue name that can be used instead of acd_queue_id. The ACD queue name list separated by semicolons (;) 136 | AcdQueueName string `json:"acd_queue_name"` 137 | // The application ID. It is required if the user_name is specified 138 | ApplicationId int `json:"application_id,string,omitempty"` 139 | // The application name that can be used instead of application_id 140 | ApplicationName string `json:"application_name,omitempty"` 141 | // Whether to bind or unbind (set true or false respectively) 142 | Bind *bool `json:"bind,string,omitempty"` 143 | } 144 | 145 | type BindSkillReturn struct { 146 | // 1 147 | Result int `json:"result"` 148 | } 149 | 150 | // Binds the specified skills to the users (ACD operators) and/or the ACD queues. Works only for ACDv1. For SmartQueue/ACDv2, use this reference. 151 | func (s *SkillsService) BindSkill(params BindSkillParams) (*BindSkillReturn, *structure.VError, error) { 152 | req, err := s.client.NewRequest("POST", "BindSkill", params) 153 | if err != nil { 154 | return nil, nil, err 155 | } 156 | response := &BindSkillReturn{} 157 | verr, err := s.client.MakeResponse(req, response) 158 | if verr != nil || err != nil { 159 | return nil, verr, err 160 | } 161 | return response, nil, nil 162 | } 163 | -------------------------------------------------------------------------------- /methods/WABPhoneNumbers.go: -------------------------------------------------------------------------------- 1 | package methods 2 | 3 | import ( 4 | "github.com/voximplant/apiclient-go/v2/structure" 5 | ) 6 | 7 | type WABPhoneNumbersService struct { 8 | client *Client 9 | } 10 | 11 | type AddWABPhoneNumberParams struct { 12 | // WhatsApp Business phone number 13 | WabPhoneNumber string `json:"wab_phone_number"` 14 | // WhatsApp Business SIP password 15 | VoicePassword string `json:"voice_password"` 16 | // WhatsApp Business phone number description 17 | Description string `json:"description,omitempty"` 18 | // Bound application ID 19 | ApplicationId int `json:"application_id,string,omitempty"` 20 | // Bound application name that can be used instead of application_id 21 | ApplicationName string `json:"application_name,omitempty"` 22 | // Bound rule ID 23 | RuleId int `json:"rule_id,string,omitempty"` 24 | // Bound rule name that can be used instead of rule_id 25 | RuleName string `json:"rule_name,omitempty"` 26 | } 27 | 28 | type AddWABPhoneNumberReturn struct { 29 | // 1 30 | Result int `json:"result"` 31 | } 32 | 33 | // Adds a new WhatsApp Business phone number. 34 | func (s *WABPhoneNumbersService) AddWABPhoneNumber(params AddWABPhoneNumberParams) (*AddWABPhoneNumberReturn, *structure.VError, error) { 35 | req, err := s.client.NewRequest("POST", "AddWABPhoneNumber", params) 36 | if err != nil { 37 | return nil, nil, err 38 | } 39 | response := &AddWABPhoneNumberReturn{} 40 | verr, err := s.client.MakeResponse(req, response) 41 | if verr != nil || err != nil { 42 | return nil, verr, err 43 | } 44 | return response, nil, nil 45 | } 46 | 47 | type DeleteWABPhoneNumberParams struct { 48 | // WhatsApp Business phone number to delete 49 | WabPhoneNumber string `json:"wab_phone_number"` 50 | } 51 | 52 | type DeleteWABPhoneNumberReturn struct { 53 | // 1 54 | Result int `json:"result"` 55 | } 56 | 57 | // Deletes a WhatsApp Business phone number. 58 | func (s *WABPhoneNumbersService) DeleteWABPhoneNumber(params DeleteWABPhoneNumberParams) (*DeleteWABPhoneNumberReturn, *structure.VError, error) { 59 | req, err := s.client.NewRequest("POST", "DeleteWABPhoneNumber", params) 60 | if err != nil { 61 | return nil, nil, err 62 | } 63 | response := &DeleteWABPhoneNumberReturn{} 64 | verr, err := s.client.MakeResponse(req, response) 65 | if verr != nil || err != nil { 66 | return nil, verr, err 67 | } 68 | return response, nil, nil 69 | } 70 | 71 | type SetWABPhoneNumberInfoParams struct { 72 | // WhatsApp Business phone number to change details for 73 | WabPhoneNumber string `json:"wab_phone_number"` 74 | // New WhatsApp Business SIP password 75 | VoicePassword string `json:"voice_password,omitempty"` 76 | // New WhatsApp Business phone number description 77 | Description string `json:"description,omitempty"` 78 | // Bound application ID 79 | ApplicationId int `json:"application_id,string,omitempty"` 80 | // Bound application name that can be used instead of application_id 81 | ApplicationName string `json:"application_name,omitempty"` 82 | // Bound rule ID 83 | RuleId int `json:"rule_id,string,omitempty"` 84 | // Bound rule name that can be used instead of rule_id 85 | RuleName string `json:"rule_name,omitempty"` 86 | } 87 | 88 | type SetWABPhoneNumberInfoReturn struct { 89 | // 1 90 | Result int `json:"result"` 91 | } 92 | 93 | // Sets details for the specified WhatsApp Business phone number. 94 | func (s *WABPhoneNumbersService) SetWABPhoneNumberInfo(params SetWABPhoneNumberInfoParams) (*SetWABPhoneNumberInfoReturn, *structure.VError, error) { 95 | req, err := s.client.NewRequest("POST", "SetWABPhoneNumberInfo", params) 96 | if err != nil { 97 | return nil, nil, err 98 | } 99 | response := &SetWABPhoneNumberInfoReturn{} 100 | verr, err := s.client.MakeResponse(req, response) 101 | if verr != nil || err != nil { 102 | return nil, verr, err 103 | } 104 | return response, nil, nil 105 | } 106 | 107 | type GetWABPhoneNumbersParams struct { 108 | // WhatsApp Business phone number 109 | WabPhoneNumber string `json:"wab_phone_number,omitempty"` 110 | // Application ID that is bound to the WhatsApp Business phone number 111 | ApplicationId int `json:"application_id,string,omitempty"` 112 | // Bound application name that can be used instead of application_id 113 | ApplicationName string `json:"application_name,omitempty"` 114 | // Country code filter (2 symbols) for the WhatsApp Business phone number 115 | CountryCode string `json:"country_code,omitempty"` 116 | // Maximum returning records count 117 | Count int `json:"count,string,omitempty"` 118 | // Number of records to be skipped in the result 119 | Offset int `json:"offset,string,omitempty"` 120 | } 121 | 122 | type GetWABPhoneNumbersReturn struct { 123 | // WhatsApp Business phone numbers info 124 | Result []*structure.WABPhoneInfoType `json:"result"` 125 | // Number of total records found 126 | TotalCount int `json:"total_count"` 127 | // Number of returned records 128 | Count int `json:"count"` 129 | } 130 | 131 | // Gets the account's WhatsApp Business phone numbers. 132 | func (s *WABPhoneNumbersService) GetWABPhoneNumbers(params GetWABPhoneNumbersParams) (*GetWABPhoneNumbersReturn, *structure.VError, error) { 133 | req, err := s.client.NewRequest("POST", "GetWABPhoneNumbers", params) 134 | if err != nil { 135 | return nil, nil, err 136 | } 137 | response := &GetWABPhoneNumbersReturn{} 138 | verr, err := s.client.MakeResponse(req, response) 139 | if verr != nil || err != nil { 140 | return nil, verr, err 141 | } 142 | return response, nil, nil 143 | } 144 | -------------------------------------------------------------------------------- /misc/misc.go: -------------------------------------------------------------------------------- 1 | package misc 2 | 3 | import ( 4 | "fmt" 5 | "reflect" 6 | "strings" 7 | "unicode" 8 | ) 9 | 10 | func StructToMap(s interface{}) (map[string]interface{}, error) { 11 | result := make(map[string]interface{}) 12 | val := reflect.ValueOf(s) 13 | if val.Kind() != reflect.Struct { 14 | return nil, fmt.Errorf("expected a struct but got %s", val.Kind()) 15 | } 16 | typ := val.Type() 17 | for i := 0; i < val.NumField(); i++ { 18 | field := typ.Field(i) 19 | value := val.Field(i) 20 | result[field.Name] = value.Interface() 21 | } 22 | return result, nil 23 | } 24 | 25 | func ToCamelCase(s string) string { 26 | words := strings.Fields(s) 27 | for i := range words { 28 | words[i] = strings.ToUpper(string(words[i][0])) + strings.ToLower(words[i][1:]) 29 | } 30 | return strings.Join(words, "") 31 | } 32 | 33 | func ToSnakeCase(s string) string { 34 | var result []string 35 | var word []rune 36 | for _, r := range s { 37 | if unicode.IsUpper(r) && len(word) > 0 { 38 | result = append(result, string(word)) 39 | word = nil // Reset the word 40 | } 41 | word = append(word, unicode.ToLower(r)) // Always append the lowercase version 42 | } 43 | if len(word) > 0 { 44 | result = append(result, string(word)) 45 | } 46 | return strings.Join(result, "_") 47 | } 48 | -------------------------------------------------------------------------------- /structure/date.go: -------------------------------------------------------------------------------- 1 | package structure 2 | 3 | import "time" 4 | 5 | type Timestamp time.Time 6 | 7 | //type Date time.Time 8 | 9 | type Date struct { 10 | time.Time 11 | } 12 | 13 | // UnmarshalJSON will transform the JIRA date into a time.Time 14 | // during the transformation of the JIRA JSON response 15 | func (t *Timestamp) UnmarshalJSON(b []byte) error { 16 | // Ignore null, like in the main JSON package. 17 | if string(b) == "null" { 18 | return nil 19 | } 20 | ti, err := time.Parse("\"2006-01-02 15:04:05\"", string(b)) 21 | if err != nil { 22 | return err 23 | } 24 | *t = Timestamp(ti) 25 | return nil 26 | } 27 | 28 | // MarshalJSON will transform the Date object into a short 29 | // date string as JIRA expects during the creation of a 30 | // JIRA request 31 | func (t Timestamp) MarshalJSON() ([]byte, error) { 32 | timestamp := time.Time(t) 33 | return []byte(timestamp.Format("\"2006-01-02 15:04:05\"")), nil 34 | } 35 | 36 | // UnmarshalJSON will transform the JIRA date into a time.Time 37 | // during the transformation of the JIRA JSON response 38 | func (t *Date) UnmarshalJSON(b []byte) error { 39 | // Ignore null, like in the main JSON package. 40 | if string(b) == "null" { 41 | return nil 42 | } 43 | ti, err := time.Parse("\"2006-01-02\"", string(b)) 44 | if err != nil { 45 | return err 46 | } 47 | *t = Date{ti} 48 | return nil 49 | } 50 | 51 | var nilTime = (time.Time{}).UnixNano() 52 | 53 | // MarshalJSON will transform the Date object into a short 54 | // date string as JIRA expects during the creation of a 55 | // JIRA request 56 | func (t Date) MarshalJSON() ([]byte, error) { 57 | if t.Time.UnixNano() == nilTime { 58 | return []byte("null"), nil 59 | } 60 | date := time.Time(t.Time) 61 | return []byte(date.Format("\"2006-01-02\"")), nil 62 | } 63 | -------------------------------------------------------------------------------- /structure/error.go: -------------------------------------------------------------------------------- 1 | package structure 2 | 3 | type VError struct { 4 | Error APIError `json:"error"` 5 | Errors []APIError `json:"errors"` 6 | } 7 | --------------------------------------------------------------------------------