diff --git a/CHANGES.md b/CHANGES.md index 31c6c36f1..49c790910 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,55 @@ twilio-go changelog ==================== +[2024-11-15] Version 1.23.6 +--------------------------- +**Api** +- Added `ivr-virtual-agent-custom-voices` and `ivr-virtual-agent-genai` to `usage_record` API. +- Add open-api file tag to realtime_transcriptions + +**Taskrouter** +- Add `api-tag` property to workers reservation +- Add `api-tag` property to task reservation + + +[2024-10-24] Version 1.23.5 +--------------------------- +**Conversations** +- Expose ConversationWithParticipants resource that allows creating a conversation with participants + + +[2024-10-17] Version 1.23.4 +--------------------------- +**Api** +- Add response key `country` to fetch AvailablePhoneNumber resource by specific country. + +**Messaging** +- Make library and doc public for requestManagedCert Endpoint + + +[2024-10-03] Version 1.23.3 +--------------------------- +**Messaging** +- Add A2P external campaign CnpMigration flag + +**Numbers** +- Add address sid to portability API + +**Verify** +- Add `SnaClientToken` optional parameter on Verification check. +- Add `EnableSnaClientToken` optional parameter for Verification creation. + + +[2024-09-25] Version 1.23.2 +--------------------------- +**Accounts** +- Update docs and mounts. +- Change library visibility to public +- Enable consent and contact bulk upsert APIs in prod. + +**Serverless** +- Add is_plugin parameter in deployments api to check if it is plugins deployment + + [2024-09-18] Version 1.23.1 --------------------------- **Library - Fix** diff --git a/client/version.go b/client/version.go index 47deb4161..039d9b7d0 100644 --- a/client/version.go +++ b/client/version.go @@ -2,4 +2,4 @@ package client // LibraryVersion specifies the current version of twilio-go. -const LibraryVersion = "1.23.1" +const LibraryVersion = "1.23.6" diff --git a/rest/accounts/v1/README.md b/rest/accounts/v1/README.md index a8a9cf30f..1675df59c 100644 --- a/rest/accounts/v1/README.md +++ b/rest/accounts/v1/README.md @@ -34,6 +34,8 @@ Class | Method | HTTP request | Description *AuthTokensPromoteApi* | [**UpdateAuthTokenPromotion**](docs/AuthTokensPromoteApi.md#updateauthtokenpromotion) | **Post** /v1/AuthTokens/Promote | *AuthTokensSecondaryApi* | [**CreateSecondaryAuthToken**](docs/AuthTokensSecondaryApi.md#createsecondaryauthtoken) | **Post** /v1/AuthTokens/Secondary | *AuthTokensSecondaryApi* | [**DeleteSecondaryAuthToken**](docs/AuthTokensSecondaryApi.md#deletesecondaryauthtoken) | **Delete** /v1/AuthTokens/Secondary | +*ConsentsBulkApi* | [**CreateBulkConsents**](docs/ConsentsBulkApi.md#createbulkconsents) | **Post** /v1/Consents/Bulk | +*ContactsBulkApi* | [**CreateBulkContacts**](docs/ContactsBulkApi.md#createbulkcontacts) | **Post** /v1/Contacts/Bulk | *CredentialsAWSApi* | [**CreateCredentialAws**](docs/CredentialsAWSApi.md#createcredentialaws) | **Post** /v1/Credentials/AWS | *CredentialsAWSApi* | [**DeleteCredentialAws**](docs/CredentialsAWSApi.md#deletecredentialaws) | **Delete** /v1/Credentials/AWS/{Sid} | *CredentialsAWSApi* | [**FetchCredentialAws**](docs/CredentialsAWSApi.md#fetchcredentialaws) | **Get** /v1/Credentials/AWS/{Sid} | @@ -51,6 +53,8 @@ Class | Method | HTTP request | Description ## Documentation For Models + - [AccountsV1BulkContacts](docs/AccountsV1BulkContacts.md) + - [AccountsV1BulkConsents](docs/AccountsV1BulkConsents.md) - [ListCredentialAwsResponse](docs/ListCredentialAwsResponse.md) - [ListCredentialPublicKeyResponse](docs/ListCredentialPublicKeyResponse.md) - [AccountsV1SecondaryAuthToken](docs/AccountsV1SecondaryAuthToken.md) diff --git a/rest/accounts/v1/consents_bulk.go b/rest/accounts/v1/consents_bulk.go new file mode 100644 index 000000000..bb9607fa1 --- /dev/null +++ b/rest/accounts/v1/consents_bulk.go @@ -0,0 +1,67 @@ +/* + * This code was generated by + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + * + * Twilio - Accounts + * This is the public Twilio REST API. + * + * NOTE: This class is auto generated by OpenAPI Generator. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package openapi + +import ( + "encoding/json" + "net/url" +) + +// Optional parameters for the method 'CreateBulkConsents' +type CreateBulkConsentsParams struct { + // This is a list of objects that describes a contact's opt-in status. Each object contains the following fields: `contact_id`, which must be a string representing phone number in [E.164 format](https://www.twilio.com/docs/glossary/what-e164); `correlation_id`, a unique 32-character UUID used to uniquely map the request item with the response item; `sender_id`, which can be either a valid messaging service SID or a from phone number; `status`, a string representing the consent status. Can be one of [`opt-in`, `opt-out`]; and `source`, a string indicating the medium through which the consent was collected. Can be one of [`website`, `offline`, `opt-in-message`, `opt-out-message`, `others`]. + Items *[]interface{} `json:"Items,omitempty"` +} + +func (params *CreateBulkConsentsParams) SetItems(Items []interface{}) *CreateBulkConsentsParams { + params.Items = &Items + return params +} + +// +func (c *ApiService) CreateBulkConsents(params *CreateBulkConsentsParams) (*AccountsV1BulkConsents, error) { + path := "/v1/Consents/Bulk" + + data := url.Values{} + headers := map[string]interface{}{ + "Content-Type": "application/x-www-form-urlencoded", + } + + if params != nil && params.Items != nil { + for _, item := range *params.Items { + v, err := json.Marshal(item) + + if err != nil { + return nil, err + } + + data.Add("Items", string(v)) + } + } + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &AccountsV1BulkConsents{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err +} diff --git a/rest/accounts/v1/contacts_bulk.go b/rest/accounts/v1/contacts_bulk.go new file mode 100644 index 000000000..797905ed1 --- /dev/null +++ b/rest/accounts/v1/contacts_bulk.go @@ -0,0 +1,67 @@ +/* + * This code was generated by + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + * + * Twilio - Accounts + * This is the public Twilio REST API. + * + * NOTE: This class is auto generated by OpenAPI Generator. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package openapi + +import ( + "encoding/json" + "net/url" +) + +// Optional parameters for the method 'CreateBulkContacts' +type CreateBulkContactsParams struct { + // A list of objects where each object represents a contact's details. Each object includes the following fields: `contact_id`, which must be a string representing phone number in [E.164 format](https://www.twilio.com/docs/glossary/what-e164); `correlation_id`, a unique 32-character UUID that maps the response to the original request; `country_iso_code`, a string representing the country using the ISO format (e.g., US for the United States); and `zip_code`, a string representing the postal code. + Items *[]interface{} `json:"Items,omitempty"` +} + +func (params *CreateBulkContactsParams) SetItems(Items []interface{}) *CreateBulkContactsParams { + params.Items = &Items + return params +} + +// +func (c *ApiService) CreateBulkContacts(params *CreateBulkContactsParams) (*AccountsV1BulkContacts, error) { + path := "/v1/Contacts/Bulk" + + data := url.Values{} + headers := map[string]interface{}{ + "Content-Type": "application/x-www-form-urlencoded", + } + + if params != nil && params.Items != nil { + for _, item := range *params.Items { + v, err := json.Marshal(item) + + if err != nil { + return nil, err + } + + data.Add("Items", string(v)) + } + } + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &AccountsV1BulkContacts{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err +} diff --git a/rest/accounts/v1/docs/AccountsV1BulkConsents.md b/rest/accounts/v1/docs/AccountsV1BulkConsents.md new file mode 100644 index 000000000..fff470f37 --- /dev/null +++ b/rest/accounts/v1/docs/AccountsV1BulkConsents.md @@ -0,0 +1,11 @@ +# AccountsV1BulkConsents + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Items** | Pointer to **interface{}** | A list of objects where each object represents the result of processing a `correlation_id`. Each object contains the following fields: `correlation_id`, a unique 32-character UUID that maps the response to the original request; `error_code`, an integer where 0 indicates success and any non-zero value represents an error; and `error_messages`, an array of strings describing specific validation errors encountered. If the request is successful, the error_messages array will be empty. | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/rest/accounts/v1/docs/AccountsV1BulkContacts.md b/rest/accounts/v1/docs/AccountsV1BulkContacts.md new file mode 100644 index 000000000..f87aab91f --- /dev/null +++ b/rest/accounts/v1/docs/AccountsV1BulkContacts.md @@ -0,0 +1,11 @@ +# AccountsV1BulkContacts + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Items** | Pointer to **interface{}** | A list of objects where each object represents the result of processing a `correlation_id`. Each object contains the following fields: `correlation_id`, a unique 32-character UUID that maps the response to the original request; `error_code`, an integer where 0 indicates success and any non-zero value represents an error; and `error_messages`, an array of strings describing specific validation errors encountered. If the request is successful, the error_messages array will be empty. | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/rest/accounts/v1/docs/ConsentsBulkApi.md b/rest/accounts/v1/docs/ConsentsBulkApi.md new file mode 100644 index 000000000..28c9df0a8 --- /dev/null +++ b/rest/accounts/v1/docs/ConsentsBulkApi.md @@ -0,0 +1,48 @@ +# ConsentsBulkApi + +All URIs are relative to *https://accounts.twilio.com* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**CreateBulkConsents**](ConsentsBulkApi.md#CreateBulkConsents) | **Post** /v1/Consents/Bulk | + + + +## CreateBulkConsents + +> AccountsV1BulkConsents CreateBulkConsents(ctx, optional) + + + + + +### Path Parameters + +This endpoint does not need any path parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a CreateBulkConsentsParams struct + + +Name | Type | Description +------------- | ------------- | ------------- +**Items** | **[]interface{}** | This is a list of objects that describes a contact's opt-in status. Each object contains the following fields: `contact_id`, which must be a string representing phone number in [E.164 format](https://www.twilio.com/docs/glossary/what-e164); `correlation_id`, a unique 32-character UUID used to uniquely map the request item with the response item; `sender_id`, which can be either a valid messaging service SID or a from phone number; `status`, a string representing the consent status. Can be one of [`opt-in`, `opt-out`]; and `source`, a string indicating the medium through which the consent was collected. Can be one of [`website`, `offline`, `opt-in-message`, `opt-out-message`, `others`]. + +### Return type + +[**AccountsV1BulkConsents**](AccountsV1BulkConsents.md) + +### Authorization + +[accountSid_authToken](../README.md#accountSid_authToken) + +### HTTP request headers + +- **Content-Type**: application/x-www-form-urlencoded +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/rest/accounts/v1/docs/ContactsBulkApi.md b/rest/accounts/v1/docs/ContactsBulkApi.md new file mode 100644 index 000000000..426ab6b8b --- /dev/null +++ b/rest/accounts/v1/docs/ContactsBulkApi.md @@ -0,0 +1,48 @@ +# ContactsBulkApi + +All URIs are relative to *https://accounts.twilio.com* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**CreateBulkContacts**](ContactsBulkApi.md#CreateBulkContacts) | **Post** /v1/Contacts/Bulk | + + + +## CreateBulkContacts + +> AccountsV1BulkContacts CreateBulkContacts(ctx, optional) + + + + + +### Path Parameters + +This endpoint does not need any path parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a CreateBulkContactsParams struct + + +Name | Type | Description +------------- | ------------- | ------------- +**Items** | **[]interface{}** | A list of objects where each object represents a contact's details. Each object includes the following fields: `contact_id`, which must be a string representing phone number in [E.164 format](https://www.twilio.com/docs/glossary/what-e164); `correlation_id`, a unique 32-character UUID that maps the response to the original request; `country_iso_code`, a string representing the country using the ISO format (e.g., US for the United States); and `zip_code`, a string representing the postal code. + +### Return type + +[**AccountsV1BulkContacts**](AccountsV1BulkContacts.md) + +### Authorization + +[accountSid_authToken](../README.md#accountSid_authToken) + +### HTTP request headers + +- **Content-Type**: application/x-www-form-urlencoded +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/rest/accounts/v1/model_accounts_v1_bulk_consents.go b/rest/accounts/v1/model_accounts_v1_bulk_consents.go new file mode 100644 index 000000000..754e473ef --- /dev/null +++ b/rest/accounts/v1/model_accounts_v1_bulk_consents.go @@ -0,0 +1,21 @@ +/* + * This code was generated by + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + * + * Twilio - Accounts + * This is the public Twilio REST API. + * + * NOTE: This class is auto generated by OpenAPI Generator. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package openapi + +// AccountsV1BulkConsents struct for AccountsV1BulkConsents +type AccountsV1BulkConsents struct { + // A list of objects where each object represents the result of processing a `correlation_id`. Each object contains the following fields: `correlation_id`, a unique 32-character UUID that maps the response to the original request; `error_code`, an integer where 0 indicates success and any non-zero value represents an error; and `error_messages`, an array of strings describing specific validation errors encountered. If the request is successful, the error_messages array will be empty. + Items *interface{} `json:"items,omitempty"` +} diff --git a/rest/accounts/v1/model_accounts_v1_bulk_contacts.go b/rest/accounts/v1/model_accounts_v1_bulk_contacts.go new file mode 100644 index 000000000..daef8adb6 --- /dev/null +++ b/rest/accounts/v1/model_accounts_v1_bulk_contacts.go @@ -0,0 +1,21 @@ +/* + * This code was generated by + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + * + * Twilio - Accounts + * This is the public Twilio REST API. + * + * NOTE: This class is auto generated by OpenAPI Generator. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package openapi + +// AccountsV1BulkContacts struct for AccountsV1BulkContacts +type AccountsV1BulkContacts struct { + // A list of objects where each object represents the result of processing a `correlation_id`. Each object contains the following fields: `correlation_id`, a unique 32-character UUID that maps the response to the original request; `error_code`, an integer where 0 indicates success and any non-zero value represents an error; and `error_messages`, an array of strings describing specific validation errors encountered. If the request is successful, the error_messages array will be empty. + Items *interface{} `json:"items,omitempty"` +} diff --git a/rest/assistants/v1/README.md b/rest/assistants/v1/README.md index 05e6f6808..9a840c8e9 100644 --- a/rest/assistants/v1/README.md +++ b/rest/assistants/v1/README.md @@ -34,22 +34,31 @@ Class | Method | HTTP request | Description *AssistantsApi* | [**CreateAssistant**](docs/AssistantsApi.md#createassistant) | **Post** /v1/Assistants | Create a new assistant *AssistantsApi* | [**DeleteAssistant**](docs/AssistantsApi.md#deleteassistant) | **Delete** /v1/Assistants/{id} | Delete an assistant by ID *AssistantsApi* | [**FetchAssistant**](docs/AssistantsApi.md#fetchassistant) | **Get** /v1/Assistants/{id} | Get an assistant by ID -*AssistantsApi* | [**ListAssistant**](docs/AssistantsApi.md#listassistant) | **Get** /v1/Assistants | List all assistants +*AssistantsApi* | [**ListAssistants**](docs/AssistantsApi.md#listassistants) | **Get** /v1/Assistants | List all assistants *AssistantsApi* | [**UpdateAssistant**](docs/AssistantsApi.md#updateassistant) | **Put** /v1/Assistants/{id} | Update an assistant by ID *AssistantsFeedbacksApi* | [**CreateFeedback**](docs/AssistantsFeedbacksApi.md#createfeedback) | **Post** /v1/Assistants/{id}/Feedbacks | Create feedback *AssistantsFeedbacksApi* | [**ListFeedback**](docs/AssistantsFeedbacksApi.md#listfeedback) | **Get** /v1/Assistants/{id}/Feedbacks | List feedbacks +*AssistantsKnowledgeApi* | [**CreateAssistantKnowledgeAttachment**](docs/AssistantsKnowledgeApi.md#createassistantknowledgeattachment) | **Post** /v1/Assistants/{assistantId}/Knowledge/{id} | Attach Knowledge to Assistant +*AssistantsKnowledgeApi* | [**DeleteAssistantKnowledgeAttachment**](docs/AssistantsKnowledgeApi.md#deleteassistantknowledgeattachment) | **Delete** /v1/Assistants/{assistantId}/Knowledge/{id} | Detach Knowledge to Assistant +*AssistantsKnowledgeApi* | [**ListKnowledgeByAssistant**](docs/AssistantsKnowledgeApi.md#listknowledgebyassistant) | **Get** /v1/Assistants/{assistantId}/Knowledge | List all knowledge for an Assistant +*AssistantsMessagesApi* | [**CreateMessage**](docs/AssistantsMessagesApi.md#createmessage) | **Post** /v1/Assistants/{id}/Messages | Send a message to the assistant +*AssistantsToolsApi* | [**CreateAssistantToolAttachment**](docs/AssistantsToolsApi.md#createassistanttoolattachment) | **Post** /v1/Assistants/{assistantId}/Tools/{id} | Attach Tool to Assistant +*AssistantsToolsApi* | [**DeleteAssistantToolAttachment**](docs/AssistantsToolsApi.md#deleteassistanttoolattachment) | **Delete** /v1/Assistants/{assistantId}/Tools/{id} | Detach Tool to Assistant +*AssistantsToolsApi* | [**ListToolsByAssistant**](docs/AssistantsToolsApi.md#listtoolsbyassistant) | **Get** /v1/Assistants/{assistantId}/Tools | List tools for an Assistant *KnowledgeApi* | [**CreateKnowledge**](docs/KnowledgeApi.md#createknowledge) | **Post** /v1/Knowledge | Create knowledge *KnowledgeApi* | [**DeleteKnowledge**](docs/KnowledgeApi.md#deleteknowledge) | **Delete** /v1/Knowledge/{id} | Delete knowledge *KnowledgeApi* | [**FetchKnowledge**](docs/KnowledgeApi.md#fetchknowledge) | **Get** /v1/Knowledge/{id} | Get knowledge *KnowledgeApi* | [**ListKnowledge**](docs/KnowledgeApi.md#listknowledge) | **Get** /v1/Knowledge | List all knowledge *KnowledgeApi* | [**UpdateKnowledge**](docs/KnowledgeApi.md#updateknowledge) | **Put** /v1/Knowledge/{id} | Update knowledge *KnowledgeChunksApi* | [**ListKnowledgeChunks**](docs/KnowledgeChunksApi.md#listknowledgechunks) | **Get** /v1/Knowledge/{id}/Chunks | List knowledge chunks +*KnowledgeStatusApi* | [**FetchKnowledgeStatus**](docs/KnowledgeStatusApi.md#fetchknowledgestatus) | **Get** /v1/Knowledge/{id}/Status | Get knowledge status *PoliciesApi* | [**ListPolicies**](docs/PoliciesApi.md#listpolicies) | **Get** /v1/Policies | List policies *SessionsApi* | [**FetchSession**](docs/SessionsApi.md#fetchsession) | **Get** /v1/Sessions/{id} | Get a session by ID *SessionsApi* | [**ListSessions**](docs/SessionsApi.md#listsessions) | **Get** /v1/Sessions | List sessions *SessionsMessagesApi* | [**ListMessages**](docs/SessionsMessagesApi.md#listmessages) | **Get** /v1/Sessions/{sessionId}/Messages | List messages *ToolsApi* | [**CreateTool**](docs/ToolsApi.md#createtool) | **Post** /v1/Tools | Create tool *ToolsApi* | [**DeleteTool**](docs/ToolsApi.md#deletetool) | **Delete** /v1/Tools/{id} | Delete tool +*ToolsApi* | [**FetchTool**](docs/ToolsApi.md#fetchtool) | **Get** /v1/Tools/{id} | Get tool *ToolsApi* | [**ListTools**](docs/ToolsApi.md#listtools) | **Get** /v1/Tools | List tools *ToolsApi* | [**UpdateTool**](docs/ToolsApi.md#updatetool) | **Put** /v1/Tools/{id} | Update tool @@ -59,11 +68,11 @@ Class | Method | HTTP request | Description - [AssistantsV1CreateAssistantRequest](docs/AssistantsV1CreateAssistantRequest.md) - [AssistantsV1KnowledgeChunk](docs/AssistantsV1KnowledgeChunk.md) - [AssistantsV1AssistantSendMessageResponse](docs/AssistantsV1AssistantSendMessageResponse.md) - - [AssistantsV1SearchKnowledgeRequest](docs/AssistantsV1SearchKnowledgeRequest.md) - [AssistantsV1CreatePolicyRequest](docs/AssistantsV1CreatePolicyRequest.md) - [AssistantsV1SegmentCredential](docs/AssistantsV1SegmentCredential.md) - [AssistantsV1CustomerAi](docs/AssistantsV1CustomerAi.md) - [AssistantsV1Knowledge](docs/AssistantsV1Knowledge.md) + - [ListKnowledgeByAssistantResponse](docs/ListKnowledgeByAssistantResponse.md) - [AssistantsV1Message](docs/AssistantsV1Message.md) - [ListToolsResponse](docs/ListToolsResponse.md) - [AssistantsV1UpdateToolRequest](docs/AssistantsV1UpdateToolRequest.md) @@ -75,6 +84,7 @@ Class | Method | HTTP request | Description - [AssistantsV1Policy](docs/AssistantsV1Policy.md) - [AssistantsV1ToolWithPolicies](docs/AssistantsV1ToolWithPolicies.md) - [ListKnowledgeChunksResponse](docs/ListKnowledgeChunksResponse.md) + - [ListToolsByAssistantResponse](docs/ListToolsByAssistantResponse.md) - [AssistantsV1AssistantWithToolsAndKnowledge](docs/AssistantsV1AssistantWithToolsAndKnowledge.md) - [ListKnowledgeResponse](docs/ListKnowledgeResponse.md) - [AssistantsV1Tool](docs/AssistantsV1Tool.md) diff --git a/rest/assistants/v1/assistants.go b/rest/assistants/v1/assistants.go index 33ea89bec..0658ece10 100644 --- a/rest/assistants/v1/assistants.go +++ b/rest/assistants/v1/assistants.go @@ -112,25 +112,25 @@ func (c *ApiService) FetchAssistant(Id string) (*AssistantsV1AssistantWithToolsA return ps, err } -// Optional parameters for the method 'ListAssistant' -type ListAssistantParams struct { +// Optional parameters for the method 'ListAssistants' +type ListAssistantsParams struct { // How many resources to return in each list page. The default is 50, and the maximum is 1000. PageSize *int `json:"PageSize,omitempty"` // Max number of records to return. Limit *int `json:"limit,omitempty"` } -func (params *ListAssistantParams) SetPageSize(PageSize int) *ListAssistantParams { +func (params *ListAssistantsParams) SetPageSize(PageSize int) *ListAssistantsParams { params.PageSize = &PageSize return params } -func (params *ListAssistantParams) SetLimit(Limit int) *ListAssistantParams { +func (params *ListAssistantsParams) SetLimit(Limit int) *ListAssistantsParams { params.Limit = &Limit return params } -// Retrieve a single page of Assistant records from the API. Request is executed immediately. -func (c *ApiService) PageAssistant(params *ListAssistantParams, pageToken, pageNumber string) (*ListAssistantResponse, error) { +// Retrieve a single page of Assistants records from the API. Request is executed immediately. +func (c *ApiService) PageAssistants(params *ListAssistantsParams, pageToken, pageNumber string) (*ListAssistantResponse, error) { path := "/v1/Assistants" data := url.Values{} @@ -164,9 +164,9 @@ func (c *ApiService) PageAssistant(params *ListAssistantParams, pageToken, pageN return ps, err } -// Lists Assistant records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. -func (c *ApiService) ListAssistant(params *ListAssistantParams) ([]AssistantsV1Assistant, error) { - response, errors := c.StreamAssistant(params) +// Lists Assistants records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. +func (c *ApiService) ListAssistants(params *ListAssistantsParams) ([]AssistantsV1Assistant, error) { + response, errors := c.StreamAssistants(params) records := make([]AssistantsV1Assistant, 0) for record := range response { @@ -180,29 +180,29 @@ func (c *ApiService) ListAssistant(params *ListAssistantParams) ([]AssistantsV1A return records, nil } -// Streams Assistant records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. -func (c *ApiService) StreamAssistant(params *ListAssistantParams) (chan AssistantsV1Assistant, chan error) { +// Streams Assistants records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. +func (c *ApiService) StreamAssistants(params *ListAssistantsParams) (chan AssistantsV1Assistant, chan error) { if params == nil { - params = &ListAssistantParams{} + params = &ListAssistantsParams{} } params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) recordChannel := make(chan AssistantsV1Assistant, 1) errorChannel := make(chan error, 1) - response, err := c.PageAssistant(params, "", "") + response, err := c.PageAssistants(params, "", "") if err != nil { errorChannel <- err close(recordChannel) close(errorChannel) } else { - go c.streamAssistant(response, params, recordChannel, errorChannel) + go c.streamAssistants(response, params, recordChannel, errorChannel) } return recordChannel, errorChannel } -func (c *ApiService) streamAssistant(response *ListAssistantResponse, params *ListAssistantParams, recordChannel chan AssistantsV1Assistant, errorChannel chan error) { +func (c *ApiService) streamAssistants(response *ListAssistantResponse, params *ListAssistantsParams, recordChannel chan AssistantsV1Assistant, errorChannel chan error) { curRecord := 1 for response != nil { diff --git a/rest/assistants/v1/assistants_knowledge.go b/rest/assistants/v1/assistants_knowledge.go new file mode 100644 index 000000000..3d1d96bc8 --- /dev/null +++ b/rest/assistants/v1/assistants_knowledge.go @@ -0,0 +1,206 @@ +/* + * This code was generated by + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + * + * Twilio - Assistants + * This is the public Twilio REST API. + * + * NOTE: This class is auto generated by OpenAPI Generator. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package openapi + +import ( + "encoding/json" + "fmt" + "net/url" + "strings" + + "github.com/twilio/twilio-go/client" +) + +// Attach Knowledge to Assistant +func (c *ApiService) CreateAssistantKnowledgeAttachment(AssistantId string, Id string) error { + path := "/v1/Assistants/{assistantId}/Knowledge/{id}" + path = strings.Replace(path, "{"+"AssistantId"+"}", AssistantId, -1) + path = strings.Replace(path, "{"+"Id"+"}", Id, -1) + + data := url.Values{} + headers := map[string]interface{}{ + "Content-Type": "application/x-www-form-urlencoded", + } + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil +} + +// Detach Knowledge to Assistant +func (c *ApiService) DeleteAssistantKnowledgeAttachment(AssistantId string, Id string) error { + path := "/v1/Assistants/{assistantId}/Knowledge/{id}" + path = strings.Replace(path, "{"+"AssistantId"+"}", AssistantId, -1) + path = strings.Replace(path, "{"+"Id"+"}", Id, -1) + + data := url.Values{} + headers := map[string]interface{}{ + "Content-Type": "application/x-www-form-urlencoded", + } + + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil +} + +// Optional parameters for the method 'ListKnowledgeByAssistant' +type ListKnowledgeByAssistantParams struct { + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` +} + +func (params *ListKnowledgeByAssistantParams) SetPageSize(PageSize int) *ListKnowledgeByAssistantParams { + params.PageSize = &PageSize + return params +} +func (params *ListKnowledgeByAssistantParams) SetLimit(Limit int) *ListKnowledgeByAssistantParams { + params.Limit = &Limit + return params +} + +// Retrieve a single page of KnowledgeByAssistant records from the API. Request is executed immediately. +func (c *ApiService) PageKnowledgeByAssistant(AssistantId string, params *ListKnowledgeByAssistantParams, pageToken, pageNumber string) (*ListKnowledgeByAssistantResponse, error) { + path := "/v1/Assistants/{assistantId}/Knowledge" + + path = strings.Replace(path, "{"+"AssistantId"+"}", AssistantId, -1) + + data := url.Values{} + headers := map[string]interface{}{ + "Content-Type": "application/x-www-form-urlencoded", + } + + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListKnowledgeByAssistantResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err +} + +// Lists KnowledgeByAssistant records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. +func (c *ApiService) ListKnowledgeByAssistant(AssistantId string, params *ListKnowledgeByAssistantParams) ([]AssistantsV1Knowledge, error) { + response, errors := c.StreamKnowledgeByAssistant(AssistantId, params) + + records := make([]AssistantsV1Knowledge, 0) + for record := range response { + records = append(records, record) + } + + if err := <-errors; err != nil { + return nil, err + } + + return records, nil +} + +// Streams KnowledgeByAssistant records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. +func (c *ApiService) StreamKnowledgeByAssistant(AssistantId string, params *ListKnowledgeByAssistantParams) (chan AssistantsV1Knowledge, chan error) { + if params == nil { + params = &ListKnowledgeByAssistantParams{} + } + params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) + + recordChannel := make(chan AssistantsV1Knowledge, 1) + errorChannel := make(chan error, 1) + + response, err := c.PageKnowledgeByAssistant(AssistantId, params, "", "") + if err != nil { + errorChannel <- err + close(recordChannel) + close(errorChannel) + } else { + go c.streamKnowledgeByAssistant(response, params, recordChannel, errorChannel) + } + + return recordChannel, errorChannel +} + +func (c *ApiService) streamKnowledgeByAssistant(response *ListKnowledgeByAssistantResponse, params *ListKnowledgeByAssistantParams, recordChannel chan AssistantsV1Knowledge, errorChannel chan error) { + curRecord := 1 + + for response != nil { + responseRecords := response.Knowledge + for item := range responseRecords { + recordChannel <- responseRecords[item] + curRecord += 1 + if params.Limit != nil && *params.Limit < curRecord { + close(recordChannel) + close(errorChannel) + return + } + } + + record, err := client.GetNext(c.baseURL, response, c.getNextListKnowledgeByAssistantResponse) + if err != nil { + errorChannel <- err + break + } else if record == nil { + break + } + + response = record.(*ListKnowledgeByAssistantResponse) + } + + close(recordChannel) + close(errorChannel) +} + +func (c *ApiService) getNextListKnowledgeByAssistantResponse(nextPageUrl string) (interface{}, error) { + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListKnowledgeByAssistantResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil +} diff --git a/rest/assistants/v1/assistants_messages.go b/rest/assistants/v1/assistants_messages.go new file mode 100644 index 000000000..bc3b619be --- /dev/null +++ b/rest/assistants/v1/assistants_messages.go @@ -0,0 +1,66 @@ +/* + * This code was generated by + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + * + * Twilio - Assistants + * This is the public Twilio REST API. + * + * NOTE: This class is auto generated by OpenAPI Generator. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package openapi + +import ( + "encoding/json" + "net/url" + "strings" +) + +// Optional parameters for the method 'CreateMessage' +type CreateMessageParams struct { + // + AssistantsV1AssistantSendMessageRequest *AssistantsV1AssistantSendMessageRequest `json:"AssistantsV1AssistantSendMessageRequest,omitempty"` +} + +func (params *CreateMessageParams) SetAssistantsV1AssistantSendMessageRequest(AssistantsV1AssistantSendMessageRequest AssistantsV1AssistantSendMessageRequest) *CreateMessageParams { + params.AssistantsV1AssistantSendMessageRequest = &AssistantsV1AssistantSendMessageRequest + return params +} + +// send a message +func (c *ApiService) CreateMessage(Id string, params *CreateMessageParams) (*AssistantsV1AssistantSendMessageResponse, error) { + path := "/v1/Assistants/{id}/Messages" + path = strings.Replace(path, "{"+"Id"+"}", Id, -1) + + data := url.Values{} + headers := map[string]interface{}{ + "Content-Type": "application/json", + } + + body := []byte{} + if params != nil && params.AssistantsV1AssistantSendMessageRequest != nil { + b, err := json.Marshal(*params.AssistantsV1AssistantSendMessageRequest) + if err != nil { + return nil, err + } + body = b + } + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers, body...) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &AssistantsV1AssistantSendMessageResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err +} diff --git a/rest/assistants/v1/assistants_tools.go b/rest/assistants/v1/assistants_tools.go new file mode 100644 index 000000000..0b7a8546a --- /dev/null +++ b/rest/assistants/v1/assistants_tools.go @@ -0,0 +1,206 @@ +/* + * This code was generated by + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + * + * Twilio - Assistants + * This is the public Twilio REST API. + * + * NOTE: This class is auto generated by OpenAPI Generator. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package openapi + +import ( + "encoding/json" + "fmt" + "net/url" + "strings" + + "github.com/twilio/twilio-go/client" +) + +// Attach Tool to Assistant +func (c *ApiService) CreateAssistantToolAttachment(AssistantId string, Id string) error { + path := "/v1/Assistants/{assistantId}/Tools/{id}" + path = strings.Replace(path, "{"+"AssistantId"+"}", AssistantId, -1) + path = strings.Replace(path, "{"+"Id"+"}", Id, -1) + + data := url.Values{} + headers := map[string]interface{}{ + "Content-Type": "application/x-www-form-urlencoded", + } + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil +} + +// Detach Tool to Assistant +func (c *ApiService) DeleteAssistantToolAttachment(AssistantId string, Id string) error { + path := "/v1/Assistants/{assistantId}/Tools/{id}" + path = strings.Replace(path, "{"+"AssistantId"+"}", AssistantId, -1) + path = strings.Replace(path, "{"+"Id"+"}", Id, -1) + + data := url.Values{} + headers := map[string]interface{}{ + "Content-Type": "application/x-www-form-urlencoded", + } + + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil +} + +// Optional parameters for the method 'ListToolsByAssistant' +type ListToolsByAssistantParams struct { + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` +} + +func (params *ListToolsByAssistantParams) SetPageSize(PageSize int) *ListToolsByAssistantParams { + params.PageSize = &PageSize + return params +} +func (params *ListToolsByAssistantParams) SetLimit(Limit int) *ListToolsByAssistantParams { + params.Limit = &Limit + return params +} + +// Retrieve a single page of ToolsByAssistant records from the API. Request is executed immediately. +func (c *ApiService) PageToolsByAssistant(AssistantId string, params *ListToolsByAssistantParams, pageToken, pageNumber string) (*ListToolsByAssistantResponse, error) { + path := "/v1/Assistants/{assistantId}/Tools" + + path = strings.Replace(path, "{"+"AssistantId"+"}", AssistantId, -1) + + data := url.Values{} + headers := map[string]interface{}{ + "Content-Type": "application/x-www-form-urlencoded", + } + + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListToolsByAssistantResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err +} + +// Lists ToolsByAssistant records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. +func (c *ApiService) ListToolsByAssistant(AssistantId string, params *ListToolsByAssistantParams) ([]AssistantsV1Tool, error) { + response, errors := c.StreamToolsByAssistant(AssistantId, params) + + records := make([]AssistantsV1Tool, 0) + for record := range response { + records = append(records, record) + } + + if err := <-errors; err != nil { + return nil, err + } + + return records, nil +} + +// Streams ToolsByAssistant records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. +func (c *ApiService) StreamToolsByAssistant(AssistantId string, params *ListToolsByAssistantParams) (chan AssistantsV1Tool, chan error) { + if params == nil { + params = &ListToolsByAssistantParams{} + } + params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) + + recordChannel := make(chan AssistantsV1Tool, 1) + errorChannel := make(chan error, 1) + + response, err := c.PageToolsByAssistant(AssistantId, params, "", "") + if err != nil { + errorChannel <- err + close(recordChannel) + close(errorChannel) + } else { + go c.streamToolsByAssistant(response, params, recordChannel, errorChannel) + } + + return recordChannel, errorChannel +} + +func (c *ApiService) streamToolsByAssistant(response *ListToolsByAssistantResponse, params *ListToolsByAssistantParams, recordChannel chan AssistantsV1Tool, errorChannel chan error) { + curRecord := 1 + + for response != nil { + responseRecords := response.Tools + for item := range responseRecords { + recordChannel <- responseRecords[item] + curRecord += 1 + if params.Limit != nil && *params.Limit < curRecord { + close(recordChannel) + close(errorChannel) + return + } + } + + record, err := client.GetNext(c.baseURL, response, c.getNextListToolsByAssistantResponse) + if err != nil { + errorChannel <- err + break + } else if record == nil { + break + } + + response = record.(*ListToolsByAssistantResponse) + } + + close(recordChannel) + close(errorChannel) +} + +func (c *ApiService) getNextListToolsByAssistantResponse(nextPageUrl string) (interface{}, error) { + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListToolsByAssistantResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil +} diff --git a/rest/assistants/v1/docs/AssistantsApi.md b/rest/assistants/v1/docs/AssistantsApi.md index 48caca75f..e4c5909e2 100644 --- a/rest/assistants/v1/docs/AssistantsApi.md +++ b/rest/assistants/v1/docs/AssistantsApi.md @@ -7,7 +7,7 @@ Method | HTTP request | Description [**CreateAssistant**](AssistantsApi.md#CreateAssistant) | **Post** /v1/Assistants | Create a new assistant [**DeleteAssistant**](AssistantsApi.md#DeleteAssistant) | **Delete** /v1/Assistants/{id} | Delete an assistant by ID [**FetchAssistant**](AssistantsApi.md#FetchAssistant) | **Get** /v1/Assistants/{id} | Get an assistant by ID -[**ListAssistant**](AssistantsApi.md#ListAssistant) | **Get** /v1/Assistants | List all assistants +[**ListAssistants**](AssistantsApi.md#ListAssistants) | **Get** /v1/Assistants | List all assistants [**UpdateAssistant**](AssistantsApi.md#UpdateAssistant) | **Put** /v1/Assistants/{id} | Update an assistant by ID @@ -135,9 +135,9 @@ Name | Type | Description [[Back to README]](../README.md) -## ListAssistant +## ListAssistants -> []AssistantsV1Assistant ListAssistant(ctx, optional) +> []AssistantsV1Assistant ListAssistants(ctx, optional) List all assistants @@ -149,7 +149,7 @@ This endpoint does not need any path parameter. ### Other Parameters -Other parameters are passed through a pointer to a ListAssistantParams struct +Other parameters are passed through a pointer to a ListAssistantsParams struct Name | Type | Description diff --git a/rest/assistants/v1/docs/AssistantsKnowledgeApi.md b/rest/assistants/v1/docs/AssistantsKnowledgeApi.md new file mode 100644 index 000000000..f12a8ee9d --- /dev/null +++ b/rest/assistants/v1/docs/AssistantsKnowledgeApi.md @@ -0,0 +1,141 @@ +# AssistantsKnowledgeApi + +All URIs are relative to *https://assistants.twilio.com* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**CreateAssistantKnowledgeAttachment**](AssistantsKnowledgeApi.md#CreateAssistantKnowledgeAttachment) | **Post** /v1/Assistants/{assistantId}/Knowledge/{id} | Attach Knowledge to Assistant +[**DeleteAssistantKnowledgeAttachment**](AssistantsKnowledgeApi.md#DeleteAssistantKnowledgeAttachment) | **Delete** /v1/Assistants/{assistantId}/Knowledge/{id} | Detach Knowledge to Assistant +[**ListKnowledgeByAssistant**](AssistantsKnowledgeApi.md#ListKnowledgeByAssistant) | **Get** /v1/Assistants/{assistantId}/Knowledge | List all knowledge for an Assistant + + + +## CreateAssistantKnowledgeAttachment + +> CreateAssistantKnowledgeAttachment(ctx, AssistantIdId) + +Attach Knowledge to Assistant + +Attach Knowledge to Assistant + +### Path Parameters + + +Name | Type | Description +------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**AssistantId** | **string** | The assistant ID. +**Id** | **string** | The knowledge ID. + +### Other Parameters + +Other parameters are passed through a pointer to a CreateAssistantKnowledgeAttachmentParams struct + + +Name | Type | Description +------------- | ------------- | ------------- + +### Return type + + (empty response body) + +### Authorization + +[accountSid_authToken](../README.md#accountSid_authToken) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## DeleteAssistantKnowledgeAttachment + +> DeleteAssistantKnowledgeAttachment(ctx, AssistantIdId) + +Detach Knowledge to Assistant + +Detach Knowledge to Assistant + +### Path Parameters + + +Name | Type | Description +------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**AssistantId** | **string** | The assistant ID. +**Id** | **string** | The knowledge ID. + +### Other Parameters + +Other parameters are passed through a pointer to a DeleteAssistantKnowledgeAttachmentParams struct + + +Name | Type | Description +------------- | ------------- | ------------- + +### Return type + + (empty response body) + +### Authorization + +[accountSid_authToken](../README.md#accountSid_authToken) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## ListKnowledgeByAssistant + +> []AssistantsV1Knowledge ListKnowledgeByAssistant(ctx, AssistantIdoptional) + +List all knowledge for an Assistant + +List all knowledge for an Assistant + +### Path Parameters + + +Name | Type | Description +------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**AssistantId** | **string** | The assistant ID. + +### Other Parameters + +Other parameters are passed through a pointer to a ListKnowledgeByAssistantParams struct + + +Name | Type | Description +------------- | ------------- | ------------- +**PageSize** | **int** | How many resources to return in each list page. The default is 50, and the maximum is 1000. +**Limit** | **int** | Max number of records to return. + +### Return type + +[**[]AssistantsV1Knowledge**](AssistantsV1Knowledge.md) + +### Authorization + +[accountSid_authToken](../README.md#accountSid_authToken) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/rest/assistants/v1/docs/AssistantsMessagesApi.md b/rest/assistants/v1/docs/AssistantsMessagesApi.md new file mode 100644 index 000000000..bd7b9dd65 --- /dev/null +++ b/rest/assistants/v1/docs/AssistantsMessagesApi.md @@ -0,0 +1,52 @@ +# AssistantsMessagesApi + +All URIs are relative to *https://assistants.twilio.com* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**CreateMessage**](AssistantsMessagesApi.md#CreateMessage) | **Post** /v1/Assistants/{id}/Messages | Send a message to the assistant + + + +## CreateMessage + +> AssistantsV1AssistantSendMessageResponse CreateMessage(ctx, Idoptional) + +Send a message to the assistant + +send a message + +### Path Parameters + + +Name | Type | Description +------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**Id** | **string** | the Assistant ID. + +### Other Parameters + +Other parameters are passed through a pointer to a CreateMessageParams struct + + +Name | Type | Description +------------- | ------------- | ------------- +**AssistantsV1AssistantSendMessageRequest** | [**AssistantsV1AssistantSendMessageRequest**](AssistantsV1AssistantSendMessageRequest.md) | + +### Return type + +[**AssistantsV1AssistantSendMessageResponse**](AssistantsV1AssistantSendMessageResponse.md) + +### Authorization + +[accountSid_authToken](../README.md#accountSid_authToken) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/rest/assistants/v1/docs/AssistantsToolsApi.md b/rest/assistants/v1/docs/AssistantsToolsApi.md new file mode 100644 index 000000000..d178e0bee --- /dev/null +++ b/rest/assistants/v1/docs/AssistantsToolsApi.md @@ -0,0 +1,141 @@ +# AssistantsToolsApi + +All URIs are relative to *https://assistants.twilio.com* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**CreateAssistantToolAttachment**](AssistantsToolsApi.md#CreateAssistantToolAttachment) | **Post** /v1/Assistants/{assistantId}/Tools/{id} | Attach Tool to Assistant +[**DeleteAssistantToolAttachment**](AssistantsToolsApi.md#DeleteAssistantToolAttachment) | **Delete** /v1/Assistants/{assistantId}/Tools/{id} | Detach Tool to Assistant +[**ListToolsByAssistant**](AssistantsToolsApi.md#ListToolsByAssistant) | **Get** /v1/Assistants/{assistantId}/Tools | List tools for an Assistant + + + +## CreateAssistantToolAttachment + +> CreateAssistantToolAttachment(ctx, AssistantIdId) + +Attach Tool to Assistant + +Attach Tool to Assistant + +### Path Parameters + + +Name | Type | Description +------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**AssistantId** | **string** | The assistant ID. +**Id** | **string** | The tool ID. + +### Other Parameters + +Other parameters are passed through a pointer to a CreateAssistantToolAttachmentParams struct + + +Name | Type | Description +------------- | ------------- | ------------- + +### Return type + + (empty response body) + +### Authorization + +[accountSid_authToken](../README.md#accountSid_authToken) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## DeleteAssistantToolAttachment + +> DeleteAssistantToolAttachment(ctx, AssistantIdId) + +Detach Tool to Assistant + +Detach Tool to Assistant + +### Path Parameters + + +Name | Type | Description +------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**AssistantId** | **string** | The assistant ID. +**Id** | **string** | The tool ID. + +### Other Parameters + +Other parameters are passed through a pointer to a DeleteAssistantToolAttachmentParams struct + + +Name | Type | Description +------------- | ------------- | ------------- + +### Return type + + (empty response body) + +### Authorization + +[accountSid_authToken](../README.md#accountSid_authToken) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## ListToolsByAssistant + +> []AssistantsV1Tool ListToolsByAssistant(ctx, AssistantIdoptional) + +List tools for an Assistant + +List tools for an Assistant + +### Path Parameters + + +Name | Type | Description +------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**AssistantId** | **string** | The assistant ID. + +### Other Parameters + +Other parameters are passed through a pointer to a ListToolsByAssistantParams struct + + +Name | Type | Description +------------- | ------------- | ------------- +**PageSize** | **int** | How many resources to return in each list page. The default is 50, and the maximum is 1000. +**Limit** | **int** | Max number of records to return. + +### Return type + +[**[]AssistantsV1Tool**](AssistantsV1Tool.md) + +### Authorization + +[accountSid_authToken](../README.md#accountSid_authToken) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/rest/assistants/v1/docs/AssistantsV1Assistant.md b/rest/assistants/v1/docs/AssistantsV1Assistant.md index bb31866d1..d290976c4 100644 --- a/rest/assistants/v1/docs/AssistantsV1Assistant.md +++ b/rest/assistants/v1/docs/AssistantsV1Assistant.md @@ -10,6 +10,7 @@ Name | Type | Description | Notes **Model** | **string** | The default model used by the assistant. | **Name** | **string** | The name of the assistant. | **Owner** | **string** | The owner/company of the assistant. | +**Url** | **string** | The url of the assistant resource. |[optional] **PersonalityPrompt** | **string** | The personality prompt to be used for assistant. | **DateCreated** | [**time.Time**](time.Time.md) | The date and time in GMT when the Assistant was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. | **DateUpdated** | [**time.Time**](time.Time.md) | The date and time in GMT when the Assistant was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. | diff --git a/rest/assistants/v1/docs/AssistantsV1AssistantWithToolsAndKnowledge.md b/rest/assistants/v1/docs/AssistantsV1AssistantWithToolsAndKnowledge.md index 0585e6040..299e5ba9b 100644 --- a/rest/assistants/v1/docs/AssistantsV1AssistantWithToolsAndKnowledge.md +++ b/rest/assistants/v1/docs/AssistantsV1AssistantWithToolsAndKnowledge.md @@ -10,6 +10,7 @@ Name | Type | Description | Notes **Model** | **string** | The default model used by the assistant. | **Name** | **string** | The name of the assistant. | **Owner** | **string** | The owner/company of the assistant. | +**Url** | **string** | The url of the assistant resource. |[optional] **PersonalityPrompt** | **string** | The personality prompt to be used for assistant. | **DateCreated** | [**time.Time**](time.Time.md) | The date and time in GMT when the Assistant was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. | **DateUpdated** | [**time.Time**](time.Time.md) | The date and time in GMT when the Assistant was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. | diff --git a/rest/assistants/v1/docs/AssistantsV1Knowledge.md b/rest/assistants/v1/docs/AssistantsV1Knowledge.md index e5bb3a1e4..773a3dbc5 100644 --- a/rest/assistants/v1/docs/AssistantsV1Knowledge.md +++ b/rest/assistants/v1/docs/AssistantsV1Knowledge.md @@ -11,6 +11,7 @@ Name | Type | Description | Notes **Name** | **string** | The name of the knowledge source. |[optional] **Status** | **string** | The status of processing the knowledge source ('QUEUED', 'PROCESSING', 'COMPLETED', 'FAILED') |[optional] **Type** | **string** | The type of knowledge source ('Web', 'Database', 'Text', 'File') |[optional] +**Url** | **string** | The url of the knowledge resource. |[optional] **DateCreated** | [**time.Time**](time.Time.md) | The date and time in GMT when the Knowledge was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. |[optional] **DateUpdated** | [**time.Time**](time.Time.md) | The date and time in GMT when the Knowledge was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. |[optional] diff --git a/rest/assistants/v1/docs/AssistantsV1KnowledgeChunkWithScore.md b/rest/assistants/v1/docs/AssistantsV1KnowledgeChunkWithScore.md index 7d266da4a..1f2c0d330 100644 --- a/rest/assistants/v1/docs/AssistantsV1KnowledgeChunkWithScore.md +++ b/rest/assistants/v1/docs/AssistantsV1KnowledgeChunkWithScore.md @@ -10,6 +10,7 @@ Name | Type | Description | Notes **DateCreated** | [**time.Time**](time.Time.md) | The date and time in GMT when the Chunk was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. |[optional] **DateUpdated** | [**time.Time**](time.Time.md) | The date and time in GMT when the Chunk was updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. |[optional] **Score** | **float32** | The score associated with the chunk. |[optional] +**KnowledgeId** | **string** | The knowledge ID associated with the chunk. |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/assistants/v1/docs/AssistantsV1Tool.md b/rest/assistants/v1/docs/AssistantsV1Tool.md index 371289635..f89d690bf 100644 --- a/rest/assistants/v1/docs/AssistantsV1Tool.md +++ b/rest/assistants/v1/docs/AssistantsV1Tool.md @@ -12,6 +12,7 @@ Name | Type | Description | Notes **Name** | **string** | The name of the tool. | **RequiresAuth** | **bool** | The authentication requirement for the tool. | **Type** | **string** | The type of the tool. ('WEBHOOK') | +**Url** | **string** | The url of the tool resource. |[optional] **DateCreated** | [**time.Time**](time.Time.md) | The date and time in GMT when the Tool was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. | **DateUpdated** | [**time.Time**](time.Time.md) | The date and time in GMT when the Tool was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. | diff --git a/rest/assistants/v1/docs/AssistantsV1ToolWithPolicies.md b/rest/assistants/v1/docs/AssistantsV1ToolWithPolicies.md index 46b763afc..e78800e61 100644 --- a/rest/assistants/v1/docs/AssistantsV1ToolWithPolicies.md +++ b/rest/assistants/v1/docs/AssistantsV1ToolWithPolicies.md @@ -12,6 +12,7 @@ Name | Type | Description | Notes **Name** | **string** | The name of the tool. | **RequiresAuth** | **bool** | The authentication requirement for the tool. | **Type** | **string** | The type of the tool. ('WEBHOOK') | +**Url** | **string** | The url of the tool resource. |[optional] **DateCreated** | [**time.Time**](time.Time.md) | The date and time in GMT when the Tool was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. | **DateUpdated** | [**time.Time**](time.Time.md) | The date and time in GMT when the Tool was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. | **Policies** | [**[]AssistantsV1Policy**](AssistantsV1Policy.md) | The Policies associated with the tool. |[optional] diff --git a/rest/assistants/v1/docs/KnowledgeStatusApi.md b/rest/assistants/v1/docs/KnowledgeStatusApi.md new file mode 100644 index 000000000..bed43fbe1 --- /dev/null +++ b/rest/assistants/v1/docs/KnowledgeStatusApi.md @@ -0,0 +1,51 @@ +# KnowledgeStatusApi + +All URIs are relative to *https://assistants.twilio.com* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**FetchKnowledgeStatus**](KnowledgeStatusApi.md#FetchKnowledgeStatus) | **Get** /v1/Knowledge/{id}/Status | Get knowledge status + + + +## FetchKnowledgeStatus + +> AssistantsV1KnowledgeStatus FetchKnowledgeStatus(ctx, Id) + +Get knowledge status + +Get knowledge status + +### Path Parameters + + +Name | Type | Description +------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**Id** | **string** | the Knowledge ID. + +### Other Parameters + +Other parameters are passed through a pointer to a FetchKnowledgeStatusParams struct + + +Name | Type | Description +------------- | ------------- | ------------- + +### Return type + +[**AssistantsV1KnowledgeStatus**](AssistantsV1KnowledgeStatus.md) + +### Authorization + +[accountSid_authToken](../README.md#accountSid_authToken) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/rest/assistants/v1/docs/AssistantsV1SearchKnowledgeRequest.md b/rest/assistants/v1/docs/ListKnowledgeByAssistantResponse.md similarity index 53% rename from rest/assistants/v1/docs/AssistantsV1SearchKnowledgeRequest.md rename to rest/assistants/v1/docs/ListKnowledgeByAssistantResponse.md index 5006f99a3..b5fd76581 100644 --- a/rest/assistants/v1/docs/AssistantsV1SearchKnowledgeRequest.md +++ b/rest/assistants/v1/docs/ListKnowledgeByAssistantResponse.md @@ -1,12 +1,11 @@ -# AssistantsV1SearchKnowledgeRequest +# ListKnowledgeByAssistantResponse ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Query** | **string** | The query to search the knowledge source. | -**Top** | **int** | The topK results to return. | -**KnowledgeIds** | **[]string** | The list of knowledge IDs to search. |[optional] +**Knowledge** | [**[]AssistantsV1Knowledge**](AssistantsV1Knowledge.md) | |[optional] +**Meta** | [**ListAssistantResponseMeta**](ListAssistantResponseMeta.md) | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/assistants/v1/docs/ListToolsByAssistantResponse.md b/rest/assistants/v1/docs/ListToolsByAssistantResponse.md new file mode 100644 index 000000000..54750196f --- /dev/null +++ b/rest/assistants/v1/docs/ListToolsByAssistantResponse.md @@ -0,0 +1,12 @@ +# ListToolsByAssistantResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Tools** | [**[]AssistantsV1Tool**](AssistantsV1Tool.md) | |[optional] +**Meta** | [**ListAssistantResponseMeta**](ListAssistantResponseMeta.md) | |[optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/rest/assistants/v1/docs/ToolsApi.md b/rest/assistants/v1/docs/ToolsApi.md index 53ad5352b..5477e15a5 100644 --- a/rest/assistants/v1/docs/ToolsApi.md +++ b/rest/assistants/v1/docs/ToolsApi.md @@ -6,6 +6,7 @@ Method | HTTP request | Description ------------- | ------------- | ------------- [**CreateTool**](ToolsApi.md#CreateTool) | **Post** /v1/Tools | Create tool [**DeleteTool**](ToolsApi.md#DeleteTool) | **Delete** /v1/Tools/{id} | Delete tool +[**FetchTool**](ToolsApi.md#FetchTool) | **Get** /v1/Tools/{id} | Get tool [**ListTools**](ToolsApi.md#ListTools) | **Get** /v1/Tools | List tools [**UpdateTool**](ToolsApi.md#UpdateTool) | **Put** /v1/Tools/{id} | Update tool @@ -92,6 +93,48 @@ Name | Type | Description [[Back to README]](../README.md) +## FetchTool + +> AssistantsV1ToolWithPolicies FetchTool(ctx, Id) + +Get tool + +Get tool + +### Path Parameters + + +Name | Type | Description +------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**Id** | **string** | + +### Other Parameters + +Other parameters are passed through a pointer to a FetchToolParams struct + + +Name | Type | Description +------------- | ------------- | ------------- + +### Return type + +[**AssistantsV1ToolWithPolicies**](AssistantsV1ToolWithPolicies.md) + +### Authorization + +[accountSid_authToken](../README.md#accountSid_authToken) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + ## ListTools > []AssistantsV1Tool ListTools(ctx, optional) diff --git a/rest/assistants/v1/knowledge_status.go b/rest/assistants/v1/knowledge_status.go new file mode 100644 index 000000000..f34e75a76 --- /dev/null +++ b/rest/assistants/v1/knowledge_status.go @@ -0,0 +1,46 @@ +/* + * This code was generated by + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + * + * Twilio - Assistants + * This is the public Twilio REST API. + * + * NOTE: This class is auto generated by OpenAPI Generator. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package openapi + +import ( + "encoding/json" + "net/url" + "strings" +) + +// Get knowledge status +func (c *ApiService) FetchKnowledgeStatus(Id string) (*AssistantsV1KnowledgeStatus, error) { + path := "/v1/Knowledge/{id}/Status" + path = strings.Replace(path, "{"+"Id"+"}", Id, -1) + + data := url.Values{} + headers := map[string]interface{}{ + "Content-Type": "application/x-www-form-urlencoded", + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &AssistantsV1KnowledgeStatus{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err +} diff --git a/rest/assistants/v1/model_assistants_v1_assistant.go b/rest/assistants/v1/model_assistants_v1_assistant.go index 939b95a90..4b935f3ef 100644 --- a/rest/assistants/v1/model_assistants_v1_assistant.go +++ b/rest/assistants/v1/model_assistants_v1_assistant.go @@ -32,6 +32,8 @@ type AssistantsV1Assistant struct { Name string `json:"name"` // The owner/company of the assistant. Owner string `json:"owner"` + // The url of the assistant resource. + Url string `json:"url,omitempty"` // The personality prompt to be used for assistant. PersonalityPrompt string `json:"personality_prompt"` // The date and time in GMT when the Assistant was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. diff --git a/rest/assistants/v1/model_assistants_v1_assistant_with_tools_and_knowledge.go b/rest/assistants/v1/model_assistants_v1_assistant_with_tools_and_knowledge.go index 777d39f24..8a22d9712 100644 --- a/rest/assistants/v1/model_assistants_v1_assistant_with_tools_and_knowledge.go +++ b/rest/assistants/v1/model_assistants_v1_assistant_with_tools_and_knowledge.go @@ -32,6 +32,8 @@ type AssistantsV1AssistantWithToolsAndKnowledge struct { Name string `json:"name"` // The owner/company of the assistant. Owner string `json:"owner"` + // The url of the assistant resource. + Url string `json:"url,omitempty"` // The personality prompt to be used for assistant. PersonalityPrompt string `json:"personality_prompt"` // The date and time in GMT when the Assistant was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. diff --git a/rest/assistants/v1/model_assistants_v1_knowledge.go b/rest/assistants/v1/model_assistants_v1_knowledge.go index 73dbb749e..f64ab3d86 100644 --- a/rest/assistants/v1/model_assistants_v1_knowledge.go +++ b/rest/assistants/v1/model_assistants_v1_knowledge.go @@ -34,6 +34,8 @@ type AssistantsV1Knowledge struct { Status string `json:"status,omitempty"` // The type of knowledge source ('Web', 'Database', 'Text', 'File') Type string `json:"type,omitempty"` + // The url of the knowledge resource. + Url string `json:"url,omitempty"` // The date and time in GMT when the Knowledge was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated time.Time `json:"date_created,omitempty"` // The date and time in GMT when the Knowledge was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. diff --git a/rest/assistants/v1/model_assistants_v1_knowledge_chunk_with_score.go b/rest/assistants/v1/model_assistants_v1_knowledge_chunk_with_score.go index 81d7d70a8..a2df473c8 100644 --- a/rest/assistants/v1/model_assistants_v1_knowledge_chunk_with_score.go +++ b/rest/assistants/v1/model_assistants_v1_knowledge_chunk_with_score.go @@ -35,6 +35,8 @@ type AssistantsV1KnowledgeChunkWithScore struct { DateUpdated time.Time `json:"date_updated,omitempty"` // The score associated with the chunk. Score float32 `json:"score,omitempty"` + // The knowledge ID associated with the chunk. + KnowledgeId string `json:"knowledge_id,omitempty"` } func (response *AssistantsV1KnowledgeChunkWithScore) UnmarshalJSON(bytes []byte) (err error) { @@ -45,6 +47,7 @@ func (response *AssistantsV1KnowledgeChunkWithScore) UnmarshalJSON(bytes []byte) DateCreated time.Time `json:"date_created"` DateUpdated time.Time `json:"date_updated"` Score interface{} `json:"score"` + KnowledgeId string `json:"knowledge_id"` }{} if err = json.Unmarshal(bytes, &raw); err != nil { @@ -57,6 +60,7 @@ func (response *AssistantsV1KnowledgeChunkWithScore) UnmarshalJSON(bytes []byte) Metadata: raw.Metadata, DateCreated: raw.DateCreated, DateUpdated: raw.DateUpdated, + KnowledgeId: raw.KnowledgeId, } responseScore, err := client.UnmarshalFloat32(&raw.Score) diff --git a/rest/assistants/v1/model_assistants_v1_tool.go b/rest/assistants/v1/model_assistants_v1_tool.go index 98a52f281..17c8f3860 100644 --- a/rest/assistants/v1/model_assistants_v1_tool.go +++ b/rest/assistants/v1/model_assistants_v1_tool.go @@ -36,6 +36,8 @@ type AssistantsV1Tool struct { RequiresAuth bool `json:"requires_auth"` // The type of the tool. ('WEBHOOK') Type string `json:"type"` + // The url of the tool resource. + Url string `json:"url,omitempty"` // The date and time in GMT when the Tool was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated time.Time `json:"date_created"` // The date and time in GMT when the Tool was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. diff --git a/rest/assistants/v1/model_assistants_v1_tool_with_policies.go b/rest/assistants/v1/model_assistants_v1_tool_with_policies.go index cfbf8588f..0919c9c6e 100644 --- a/rest/assistants/v1/model_assistants_v1_tool_with_policies.go +++ b/rest/assistants/v1/model_assistants_v1_tool_with_policies.go @@ -36,6 +36,8 @@ type AssistantsV1ToolWithPolicies struct { RequiresAuth bool `json:"requires_auth"` // The type of the tool. ('WEBHOOK') Type string `json:"type"` + // The url of the tool resource. + Url string `json:"url,omitempty"` // The date and time in GMT when the Tool was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated time.Time `json:"date_created"` // The date and time in GMT when the Tool was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. diff --git a/rest/assistants/v1/model_assistants_v1_search_knowledge_request.go b/rest/assistants/v1/model_list_knowledge_by_assistant_response.go similarity index 59% rename from rest/assistants/v1/model_assistants_v1_search_knowledge_request.go rename to rest/assistants/v1/model_list_knowledge_by_assistant_response.go index 3fff5ad97..b828689c8 100644 --- a/rest/assistants/v1/model_assistants_v1_search_knowledge_request.go +++ b/rest/assistants/v1/model_list_knowledge_by_assistant_response.go @@ -14,12 +14,8 @@ package openapi -// AssistantsV1SearchKnowledgeRequest struct for AssistantsV1SearchKnowledgeRequest -type AssistantsV1SearchKnowledgeRequest struct { - // The query to search the knowledge source. - Query string `json:"query"` - // The topK results to return. - Top int `json:"top"` - // The list of knowledge IDs to search. - KnowledgeIds []string `json:"knowledge_ids,omitempty"` +// ListKnowledgeByAssistantResponse struct for ListKnowledgeByAssistantResponse +type ListKnowledgeByAssistantResponse struct { + Knowledge []AssistantsV1Knowledge `json:"knowledge,omitempty"` + Meta ListAssistantResponseMeta `json:"meta,omitempty"` } diff --git a/rest/assistants/v1/model_list_tools_by_assistant_response.go b/rest/assistants/v1/model_list_tools_by_assistant_response.go new file mode 100644 index 000000000..655952fa6 --- /dev/null +++ b/rest/assistants/v1/model_list_tools_by_assistant_response.go @@ -0,0 +1,21 @@ +/* + * This code was generated by + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + * + * Twilio - Assistants + * This is the public Twilio REST API. + * + * NOTE: This class is auto generated by OpenAPI Generator. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package openapi + +// ListToolsByAssistantResponse struct for ListToolsByAssistantResponse +type ListToolsByAssistantResponse struct { + Tools []AssistantsV1Tool `json:"tools,omitempty"` + Meta ListAssistantResponseMeta `json:"meta,omitempty"` +} diff --git a/rest/assistants/v1/tools.go b/rest/assistants/v1/tools.go index 5c70c6a67..6300e7d33 100644 --- a/rest/assistants/v1/tools.go +++ b/rest/assistants/v1/tools.go @@ -87,6 +87,31 @@ func (c *ApiService) DeleteTool(Id string) error { return nil } +// Get tool +func (c *ApiService) FetchTool(Id string) (*AssistantsV1ToolWithPolicies, error) { + path := "/v1/Tools/{id}" + path = strings.Replace(path, "{"+"Id"+"}", Id, -1) + + data := url.Values{} + headers := map[string]interface{}{ + "Content-Type": "application/x-www-form-urlencoded", + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &AssistantsV1ToolWithPolicies{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err +} + // Optional parameters for the method 'ListTools' type ListToolsParams struct { // diff --git a/rest/content/v1/docs/CallToActionActionType.md b/rest/content/v1/docs/CallToActionActionType.md index 2e94d59a3..a55a23372 100644 --- a/rest/content/v1/docs/CallToActionActionType.md +++ b/rest/content/v1/docs/CallToActionActionType.md @@ -8,6 +8,7 @@ Name | Type | Notes **PHONE_NUMBER** | string | (value: `"PHONE_NUMBER"`) **COPY_CODE** | string | (value: `"COPY_CODE"`) **VOICE_CALL** | string | (value: `"VOICE_CALL"`) +**VOICE_CALL_REQUEST** | string | (value: `"VOICE_CALL_REQUEST"`) [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/content/v1/model_call_to_action_action_type.go b/rest/content/v1/model_call_to_action_action_type.go index 58809d038..ae50e0d4b 100644 --- a/rest/content/v1/model_call_to_action_action_type.go +++ b/rest/content/v1/model_call_to_action_action_type.go @@ -19,8 +19,9 @@ type CallToActionActionType string // List of callToActionActionType const ( - CALLTOACTIONACTIONTYPE_URL CallToActionActionType = "URL" - CALLTOACTIONACTIONTYPE_PHONE_NUMBER CallToActionActionType = "PHONE_NUMBER" - CALLTOACTIONACTIONTYPE_COPY_CODE CallToActionActionType = "COPY_CODE" - CALLTOACTIONACTIONTYPE_VOICE_CALL CallToActionActionType = "VOICE_CALL" + CALLTOACTIONACTIONTYPE_URL CallToActionActionType = "URL" + CALLTOACTIONACTIONTYPE_PHONE_NUMBER CallToActionActionType = "PHONE_NUMBER" + CALLTOACTIONACTIONTYPE_COPY_CODE CallToActionActionType = "COPY_CODE" + CALLTOACTIONACTIONTYPE_VOICE_CALL CallToActionActionType = "VOICE_CALL" + CALLTOACTIONACTIONTYPE_VOICE_CALL_REQUEST CallToActionActionType = "VOICE_CALL_REQUEST" ) diff --git a/rest/conversations/v1/README.md b/rest/conversations/v1/README.md index a2da1b920..e13091794 100644 --- a/rest/conversations/v1/README.md +++ b/rest/conversations/v1/README.md @@ -40,6 +40,7 @@ Class | Method | HTTP request | Description *ConfigurationAddressesApi* | [**UpdateConfigurationAddress**](docs/ConfigurationAddressesApi.md#updateconfigurationaddress) | **Post** /v1/Configuration/Addresses/{Sid} | *ConfigurationWebhooksApi* | [**FetchConfigurationWebhook**](docs/ConfigurationWebhooksApi.md#fetchconfigurationwebhook) | **Get** /v1/Configuration/Webhooks | *ConfigurationWebhooksApi* | [**UpdateConfigurationWebhook**](docs/ConfigurationWebhooksApi.md#updateconfigurationwebhook) | **Post** /v1/Configuration/Webhooks | +*ConversationWithParticipantsApi* | [**CreateConversationWithParticipants**](docs/ConversationWithParticipantsApi.md#createconversationwithparticipants) | **Post** /v1/ConversationWithParticipants | *ConversationsApi* | [**CreateConversation**](docs/ConversationsApi.md#createconversation) | **Post** /v1/Conversations | *ConversationsApi* | [**DeleteConversation**](docs/ConversationsApi.md#deleteconversation) | **Delete** /v1/Conversations/{Sid} | *ConversationsApi* | [**FetchConversation**](docs/ConversationsApi.md#fetchconversation) | **Get** /v1/Conversations/{Sid} | @@ -86,6 +87,7 @@ Class | Method | HTTP request | Description *ServicesConfigurationNotificationsApi* | [**UpdateServiceNotification**](docs/ServicesConfigurationNotificationsApi.md#updateservicenotification) | **Post** /v1/Services/{ChatServiceSid}/Configuration/Notifications | *ServicesConfigurationWebhooksApi* | [**FetchServiceWebhookConfiguration**](docs/ServicesConfigurationWebhooksApi.md#fetchservicewebhookconfiguration) | **Get** /v1/Services/{ChatServiceSid}/Configuration/Webhooks | *ServicesConfigurationWebhooksApi* | [**UpdateServiceWebhookConfiguration**](docs/ServicesConfigurationWebhooksApi.md#updateservicewebhookconfiguration) | **Post** /v1/Services/{ChatServiceSid}/Configuration/Webhooks | +*ServicesConversationWithParticipantsApi* | [**CreateServiceConversationWithParticipants**](docs/ServicesConversationWithParticipantsApi.md#createserviceconversationwithparticipants) | **Post** /v1/Services/{ChatServiceSid}/ConversationWithParticipants | *ServicesConversationsApi* | [**CreateServiceConversation**](docs/ServicesConversationsApi.md#createserviceconversation) | **Post** /v1/Services/{ChatServiceSid}/Conversations | *ServicesConversationsApi* | [**DeleteServiceConversation**](docs/ServicesConversationsApi.md#deleteserviceconversation) | **Delete** /v1/Services/{ChatServiceSid}/Conversations/{Sid} | *ServicesConversationsApi* | [**FetchServiceConversation**](docs/ServicesConversationsApi.md#fetchserviceconversation) | **Get** /v1/Services/{ChatServiceSid}/Conversations/{Sid} | @@ -153,6 +155,7 @@ Class | Method | HTTP request | Description - [ListConversationMessageResponse](docs/ListConversationMessageResponse.md) - [ConversationsV1ConfigurationWebhook](docs/ConversationsV1ConfigurationWebhook.md) - [ConversationsV1Credential](docs/ConversationsV1Credential.md) + - [ConversationsV1ConversationWithParticipants](docs/ConversationsV1ConversationWithParticipants.md) - [ConversationsV1UserConversation](docs/ConversationsV1UserConversation.md) - [ConversationsV1Conversation](docs/ConversationsV1Conversation.md) - [ConversationsV1ServiceConversationMessageReceipt](docs/ConversationsV1ServiceConversationMessageReceipt.md) @@ -168,6 +171,7 @@ Class | Method | HTTP request | Description - [ConversationsV1ServiceUser](docs/ConversationsV1ServiceUser.md) - [ListConversationParticipantResponse](docs/ListConversationParticipantResponse.md) - [ListServiceConversationParticipantResponse](docs/ListServiceConversationParticipantResponse.md) + - [ConversationsV1ServiceConversationWithParticipants](docs/ConversationsV1ServiceConversationWithParticipants.md) - [ListCredentialResponse](docs/ListCredentialResponse.md) - [ListServiceBindingResponse](docs/ListServiceBindingResponse.md) - [ListRoleResponse](docs/ListRoleResponse.md) diff --git a/rest/conversations/v1/conversation_with_participants.go b/rest/conversations/v1/conversation_with_participants.go new file mode 100644 index 000000000..4c0702701 --- /dev/null +++ b/rest/conversations/v1/conversation_with_participants.go @@ -0,0 +1,171 @@ +/* + * This code was generated by + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + * + * Twilio - Conversations + * This is the public Twilio REST API. + * + * NOTE: This class is auto generated by OpenAPI Generator. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package openapi + +import ( + "encoding/json" + "fmt" + "net/url" + "time" +) + +// Optional parameters for the method 'CreateConversationWithParticipants' +type CreateConversationWithParticipantsParams struct { + // The X-Twilio-Webhook-Enabled HTTP request header + XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` + // The human-readable name of this conversation, limited to 256 characters. Optional. + FriendlyName *string `json:"FriendlyName,omitempty"` + // An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL. + UniqueName *string `json:"UniqueName,omitempty"` + // The date that this resource was created. + DateCreated *time.Time `json:"DateCreated,omitempty"` + // The date that this resource was last updated. + DateUpdated *time.Time `json:"DateUpdated,omitempty"` + // The unique ID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) this conversation belongs to. + MessagingServiceSid *string `json:"MessagingServiceSid,omitempty"` + // An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \\\"{}\\\" will be returned. + Attributes *string `json:"Attributes,omitempty"` + // + State *string `json:"State,omitempty"` + // ISO8601 duration when conversation will be switched to `inactive` state. Minimum value for this timer is 1 minute. + TimersInactive *string `json:"Timers.Inactive,omitempty"` + // ISO8601 duration when conversation will be switched to `closed` state. Minimum value for this timer is 10 minutes. + TimersClosed *string `json:"Timers.Closed,omitempty"` + // The default email address that will be used when sending outbound emails in this conversation. + BindingsEmailAddress *string `json:"Bindings.Email.Address,omitempty"` + // The default name that will be used when sending outbound emails in this conversation. + BindingsEmailName *string `json:"Bindings.Email.Name,omitempty"` + // The participant to be added to the conversation in JSON format. The JSON object attributes are as parameters in [Participant Resource](https://www.twilio.com/docs/conversations/api/conversation-participant-resource). The maximum number of participants that can be added in a single request is 10. + Participant *[]string `json:"Participant,omitempty"` +} + +func (params *CreateConversationWithParticipantsParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) *CreateConversationWithParticipantsParams { + params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled + return params +} +func (params *CreateConversationWithParticipantsParams) SetFriendlyName(FriendlyName string) *CreateConversationWithParticipantsParams { + params.FriendlyName = &FriendlyName + return params +} +func (params *CreateConversationWithParticipantsParams) SetUniqueName(UniqueName string) *CreateConversationWithParticipantsParams { + params.UniqueName = &UniqueName + return params +} +func (params *CreateConversationWithParticipantsParams) SetDateCreated(DateCreated time.Time) *CreateConversationWithParticipantsParams { + params.DateCreated = &DateCreated + return params +} +func (params *CreateConversationWithParticipantsParams) SetDateUpdated(DateUpdated time.Time) *CreateConversationWithParticipantsParams { + params.DateUpdated = &DateUpdated + return params +} +func (params *CreateConversationWithParticipantsParams) SetMessagingServiceSid(MessagingServiceSid string) *CreateConversationWithParticipantsParams { + params.MessagingServiceSid = &MessagingServiceSid + return params +} +func (params *CreateConversationWithParticipantsParams) SetAttributes(Attributes string) *CreateConversationWithParticipantsParams { + params.Attributes = &Attributes + return params +} +func (params *CreateConversationWithParticipantsParams) SetState(State string) *CreateConversationWithParticipantsParams { + params.State = &State + return params +} +func (params *CreateConversationWithParticipantsParams) SetTimersInactive(TimersInactive string) *CreateConversationWithParticipantsParams { + params.TimersInactive = &TimersInactive + return params +} +func (params *CreateConversationWithParticipantsParams) SetTimersClosed(TimersClosed string) *CreateConversationWithParticipantsParams { + params.TimersClosed = &TimersClosed + return params +} +func (params *CreateConversationWithParticipantsParams) SetBindingsEmailAddress(BindingsEmailAddress string) *CreateConversationWithParticipantsParams { + params.BindingsEmailAddress = &BindingsEmailAddress + return params +} +func (params *CreateConversationWithParticipantsParams) SetBindingsEmailName(BindingsEmailName string) *CreateConversationWithParticipantsParams { + params.BindingsEmailName = &BindingsEmailName + return params +} +func (params *CreateConversationWithParticipantsParams) SetParticipant(Participant []string) *CreateConversationWithParticipantsParams { + params.Participant = &Participant + return params +} + +// Create a new conversation with the list of participants in your account's default service +func (c *ApiService) CreateConversationWithParticipants(params *CreateConversationWithParticipantsParams) (*ConversationsV1ConversationWithParticipants, error) { + path := "/v1/ConversationWithParticipants" + + data := url.Values{} + headers := map[string]interface{}{ + "Content-Type": "application/x-www-form-urlencoded", + } + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.UniqueName != nil { + data.Set("UniqueName", *params.UniqueName) + } + if params != nil && params.DateCreated != nil { + data.Set("DateCreated", fmt.Sprint((*params.DateCreated).Format(time.RFC3339))) + } + if params != nil && params.DateUpdated != nil { + data.Set("DateUpdated", fmt.Sprint((*params.DateUpdated).Format(time.RFC3339))) + } + if params != nil && params.MessagingServiceSid != nil { + data.Set("MessagingServiceSid", *params.MessagingServiceSid) + } + if params != nil && params.Attributes != nil { + data.Set("Attributes", *params.Attributes) + } + if params != nil && params.State != nil { + data.Set("State", *params.State) + } + if params != nil && params.TimersInactive != nil { + data.Set("Timers.Inactive", *params.TimersInactive) + } + if params != nil && params.TimersClosed != nil { + data.Set("Timers.Closed", *params.TimersClosed) + } + if params != nil && params.BindingsEmailAddress != nil { + data.Set("Bindings.Email.Address", *params.BindingsEmailAddress) + } + if params != nil && params.BindingsEmailName != nil { + data.Set("Bindings.Email.Name", *params.BindingsEmailName) + } + if params != nil && params.Participant != nil { + for _, item := range *params.Participant { + data.Add("Participant", item) + } + } + + if params != nil && params.XTwilioWebhookEnabled != nil { + headers["X-Twilio-Webhook-Enabled"] = *params.XTwilioWebhookEnabled + } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ConversationsV1ConversationWithParticipants{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err +} diff --git a/rest/conversations/v1/docs/ConversationWithParticipantsApi.md b/rest/conversations/v1/docs/ConversationWithParticipantsApi.md new file mode 100644 index 000000000..fe6ea1149 --- /dev/null +++ b/rest/conversations/v1/docs/ConversationWithParticipantsApi.md @@ -0,0 +1,60 @@ +# ConversationWithParticipantsApi + +All URIs are relative to *https://conversations.twilio.com* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**CreateConversationWithParticipants**](ConversationWithParticipantsApi.md#CreateConversationWithParticipants) | **Post** /v1/ConversationWithParticipants | + + + +## CreateConversationWithParticipants + +> ConversationsV1ConversationWithParticipants CreateConversationWithParticipants(ctx, optional) + + + +Create a new conversation with the list of participants in your account's default service + +### Path Parameters + +This endpoint does not need any path parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a CreateConversationWithParticipantsParams struct + + +Name | Type | Description +------------- | ------------- | ------------- +**XTwilioWebhookEnabled** | **string** | The X-Twilio-Webhook-Enabled HTTP request header +**FriendlyName** | **string** | The human-readable name of this conversation, limited to 256 characters. Optional. +**UniqueName** | **string** | An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL. +**DateCreated** | **time.Time** | The date that this resource was created. +**DateUpdated** | **time.Time** | The date that this resource was last updated. +**MessagingServiceSid** | **string** | The unique ID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) this conversation belongs to. +**Attributes** | **string** | An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \\\"{}\\\" will be returned. +**State** | **string** | +**TimersInactive** | **string** | ISO8601 duration when conversation will be switched to `inactive` state. Minimum value for this timer is 1 minute. +**TimersClosed** | **string** | ISO8601 duration when conversation will be switched to `closed` state. Minimum value for this timer is 10 minutes. +**BindingsEmailAddress** | **string** | The default email address that will be used when sending outbound emails in this conversation. +**BindingsEmailName** | **string** | The default name that will be used when sending outbound emails in this conversation. +**Participant** | **[]string** | The participant to be added to the conversation in JSON format. The JSON object attributes are as parameters in [Participant Resource](https://www.twilio.com/docs/conversations/api/conversation-participant-resource). The maximum number of participants that can be added in a single request is 10. + +### Return type + +[**ConversationsV1ConversationWithParticipants**](ConversationsV1ConversationWithParticipants.md) + +### Authorization + +[accountSid_authToken](../README.md#accountSid_authToken) + +### HTTP request headers + +- **Content-Type**: application/x-www-form-urlencoded +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/rest/conversations/v1/docs/ConversationsV1ConversationWithParticipants.md b/rest/conversations/v1/docs/ConversationsV1ConversationWithParticipants.md new file mode 100644 index 000000000..c5f52b546 --- /dev/null +++ b/rest/conversations/v1/docs/ConversationsV1ConversationWithParticipants.md @@ -0,0 +1,24 @@ +# ConversationsV1ConversationWithParticipants + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**AccountSid** | Pointer to **string** | The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this conversation. | +**ChatServiceSid** | Pointer to **string** | The unique ID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) this conversation belongs to. | +**MessagingServiceSid** | Pointer to **string** | The unique ID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) this conversation belongs to. | +**Sid** | Pointer to **string** | A 34 character string that uniquely identifies this resource. | +**FriendlyName** | Pointer to **string** | The human-readable name of this conversation, limited to 256 characters. Optional. | +**UniqueName** | Pointer to **string** | An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL. | +**Attributes** | Pointer to **string** | An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \"{}\" will be returned. | +**State** | Pointer to [**string**](ConversationWithParticipantsEnumState.md) | | +**DateCreated** | Pointer to [**time.Time**](time.Time.md) | The date that this resource was created. | +**DateUpdated** | Pointer to [**time.Time**](time.Time.md) | The date that this resource was last updated. | +**Timers** | Pointer to **interface{}** | Timer date values representing state update for this conversation. | +**Links** | Pointer to **map[string]interface{}** | Contains absolute URLs to access the [participants](https://www.twilio.com/docs/conversations/api/conversation-participant-resource), [messages](https://www.twilio.com/docs/conversations/api/conversation-message-resource) and [webhooks](https://www.twilio.com/docs/conversations/api/conversation-scoped-webhook-resource) of this conversation. | +**Bindings** | Pointer to **interface{}** | | +**Url** | Pointer to **string** | An absolute API resource URL for this conversation. | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/rest/conversations/v1/docs/ConversationsV1ServiceConversationWithParticipants.md b/rest/conversations/v1/docs/ConversationsV1ServiceConversationWithParticipants.md new file mode 100644 index 000000000..116d709c8 --- /dev/null +++ b/rest/conversations/v1/docs/ConversationsV1ServiceConversationWithParticipants.md @@ -0,0 +1,24 @@ +# ConversationsV1ServiceConversationWithParticipants + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**AccountSid** | Pointer to **string** | The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this conversation. | +**ChatServiceSid** | Pointer to **string** | The unique ID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) this conversation belongs to. | +**MessagingServiceSid** | Pointer to **string** | The unique ID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) this conversation belongs to. | +**Sid** | Pointer to **string** | A 34 character string that uniquely identifies this resource. | +**FriendlyName** | Pointer to **string** | The human-readable name of this conversation, limited to 256 characters. Optional. | +**UniqueName** | Pointer to **string** | An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL. | +**Attributes** | Pointer to **string** | An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \"{}\" will be returned. | +**State** | Pointer to [**string**](ServiceConversationWithParticipantsEnumState.md) | | +**DateCreated** | Pointer to [**time.Time**](time.Time.md) | The date that this resource was created. | +**DateUpdated** | Pointer to [**time.Time**](time.Time.md) | The date that this resource was last updated. | +**Timers** | Pointer to **interface{}** | Timer date values representing state update for this conversation. | +**Links** | Pointer to **map[string]interface{}** | Contains absolute URLs to access the [participants](https://www.twilio.com/docs/conversations/api/conversation-participant-resource), [messages](https://www.twilio.com/docs/conversations/api/conversation-message-resource) and [webhooks](https://www.twilio.com/docs/conversations/api/conversation-scoped-webhook-resource) of this conversation. | +**Bindings** | Pointer to **interface{}** | | +**Url** | Pointer to **string** | An absolute API resource URL for this conversation. | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/rest/conversations/v1/docs/ServicesConversationWithParticipantsApi.md b/rest/conversations/v1/docs/ServicesConversationWithParticipantsApi.md new file mode 100644 index 000000000..df0526bad --- /dev/null +++ b/rest/conversations/v1/docs/ServicesConversationWithParticipantsApi.md @@ -0,0 +1,64 @@ +# ServicesConversationWithParticipantsApi + +All URIs are relative to *https://conversations.twilio.com* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**CreateServiceConversationWithParticipants**](ServicesConversationWithParticipantsApi.md#CreateServiceConversationWithParticipants) | **Post** /v1/Services/{ChatServiceSid}/ConversationWithParticipants | + + + +## CreateServiceConversationWithParticipants + +> ConversationsV1ServiceConversationWithParticipants CreateServiceConversationWithParticipants(ctx, ChatServiceSidoptional) + + + +Create a new conversation with the list of participants in your account's default service + +### Path Parameters + + +Name | Type | Description +------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**ChatServiceSid** | **string** | The SID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) the Conversation resource is associated with. + +### Other Parameters + +Other parameters are passed through a pointer to a CreateServiceConversationWithParticipantsParams struct + + +Name | Type | Description +------------- | ------------- | ------------- +**XTwilioWebhookEnabled** | **string** | The X-Twilio-Webhook-Enabled HTTP request header +**FriendlyName** | **string** | The human-readable name of this conversation, limited to 256 characters. Optional. +**UniqueName** | **string** | An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL. +**DateCreated** | **time.Time** | The date that this resource was created. +**DateUpdated** | **time.Time** | The date that this resource was last updated. +**MessagingServiceSid** | **string** | The unique ID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) this conversation belongs to. +**Attributes** | **string** | An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \\\"{}\\\" will be returned. +**State** | **string** | +**TimersInactive** | **string** | ISO8601 duration when conversation will be switched to `inactive` state. Minimum value for this timer is 1 minute. +**TimersClosed** | **string** | ISO8601 duration when conversation will be switched to `closed` state. Minimum value for this timer is 10 minutes. +**BindingsEmailAddress** | **string** | The default email address that will be used when sending outbound emails in this conversation. +**BindingsEmailName** | **string** | The default name that will be used when sending outbound emails in this conversation. +**Participant** | **[]string** | The participant to be added to the conversation in JSON format. The JSON object attributes are as parameters in [Participant Resource](https://www.twilio.com/docs/conversations/api/conversation-participant-resource). The maximum number of participants that can be added in a single request is 10. + +### Return type + +[**ConversationsV1ServiceConversationWithParticipants**](ConversationsV1ServiceConversationWithParticipants.md) + +### Authorization + +[accountSid_authToken](../README.md#accountSid_authToken) + +### HTTP request headers + +- **Content-Type**: application/x-www-form-urlencoded +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/rest/conversations/v1/model_conversations_v1_conversation_with_participants.go b/rest/conversations/v1/model_conversations_v1_conversation_with_participants.go new file mode 100644 index 000000000..b7fc5e7a7 --- /dev/null +++ b/rest/conversations/v1/model_conversations_v1_conversation_with_participants.go @@ -0,0 +1,49 @@ +/* + * This code was generated by + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + * + * Twilio - Conversations + * This is the public Twilio REST API. + * + * NOTE: This class is auto generated by OpenAPI Generator. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package openapi + +import ( + "time" +) + +// ConversationsV1ConversationWithParticipants struct for ConversationsV1ConversationWithParticipants +type ConversationsV1ConversationWithParticipants struct { + // The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this conversation. + AccountSid *string `json:"account_sid,omitempty"` + // The unique ID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) this conversation belongs to. + ChatServiceSid *string `json:"chat_service_sid,omitempty"` + // The unique ID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) this conversation belongs to. + MessagingServiceSid *string `json:"messaging_service_sid,omitempty"` + // A 34 character string that uniquely identifies this resource. + Sid *string `json:"sid,omitempty"` + // The human-readable name of this conversation, limited to 256 characters. Optional. + FriendlyName *string `json:"friendly_name,omitempty"` + // An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL. + UniqueName *string `json:"unique_name,omitempty"` + // An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \"{}\" will be returned. + Attributes *string `json:"attributes,omitempty"` + State *string `json:"state,omitempty"` + // The date that this resource was created. + DateCreated *time.Time `json:"date_created,omitempty"` + // The date that this resource was last updated. + DateUpdated *time.Time `json:"date_updated,omitempty"` + // Timer date values representing state update for this conversation. + Timers *interface{} `json:"timers,omitempty"` + // Contains absolute URLs to access the [participants](https://www.twilio.com/docs/conversations/api/conversation-participant-resource), [messages](https://www.twilio.com/docs/conversations/api/conversation-message-resource) and [webhooks](https://www.twilio.com/docs/conversations/api/conversation-scoped-webhook-resource) of this conversation. + Links *map[string]interface{} `json:"links,omitempty"` + Bindings *interface{} `json:"bindings,omitempty"` + // An absolute API resource URL for this conversation. + Url *string `json:"url,omitempty"` +} diff --git a/rest/conversations/v1/model_conversations_v1_service_conversation_with_participants.go b/rest/conversations/v1/model_conversations_v1_service_conversation_with_participants.go new file mode 100644 index 000000000..2cc1bde6f --- /dev/null +++ b/rest/conversations/v1/model_conversations_v1_service_conversation_with_participants.go @@ -0,0 +1,49 @@ +/* + * This code was generated by + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + * + * Twilio - Conversations + * This is the public Twilio REST API. + * + * NOTE: This class is auto generated by OpenAPI Generator. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package openapi + +import ( + "time" +) + +// ConversationsV1ServiceConversationWithParticipants struct for ConversationsV1ServiceConversationWithParticipants +type ConversationsV1ServiceConversationWithParticipants struct { + // The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this conversation. + AccountSid *string `json:"account_sid,omitempty"` + // The unique ID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) this conversation belongs to. + ChatServiceSid *string `json:"chat_service_sid,omitempty"` + // The unique ID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) this conversation belongs to. + MessagingServiceSid *string `json:"messaging_service_sid,omitempty"` + // A 34 character string that uniquely identifies this resource. + Sid *string `json:"sid,omitempty"` + // The human-readable name of this conversation, limited to 256 characters. Optional. + FriendlyName *string `json:"friendly_name,omitempty"` + // An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL. + UniqueName *string `json:"unique_name,omitempty"` + // An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \"{}\" will be returned. + Attributes *string `json:"attributes,omitempty"` + State *string `json:"state,omitempty"` + // The date that this resource was created. + DateCreated *time.Time `json:"date_created,omitempty"` + // The date that this resource was last updated. + DateUpdated *time.Time `json:"date_updated,omitempty"` + // Timer date values representing state update for this conversation. + Timers *interface{} `json:"timers,omitempty"` + // Contains absolute URLs to access the [participants](https://www.twilio.com/docs/conversations/api/conversation-participant-resource), [messages](https://www.twilio.com/docs/conversations/api/conversation-message-resource) and [webhooks](https://www.twilio.com/docs/conversations/api/conversation-scoped-webhook-resource) of this conversation. + Links *map[string]interface{} `json:"links,omitempty"` + Bindings *interface{} `json:"bindings,omitempty"` + // An absolute API resource URL for this conversation. + Url *string `json:"url,omitempty"` +} diff --git a/rest/conversations/v1/services_conversation_with_participants.go b/rest/conversations/v1/services_conversation_with_participants.go new file mode 100644 index 000000000..c5a78a40b --- /dev/null +++ b/rest/conversations/v1/services_conversation_with_participants.go @@ -0,0 +1,173 @@ +/* + * This code was generated by + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + * + * Twilio - Conversations + * This is the public Twilio REST API. + * + * NOTE: This class is auto generated by OpenAPI Generator. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package openapi + +import ( + "encoding/json" + "fmt" + "net/url" + "strings" + "time" +) + +// Optional parameters for the method 'CreateServiceConversationWithParticipants' +type CreateServiceConversationWithParticipantsParams struct { + // The X-Twilio-Webhook-Enabled HTTP request header + XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` + // The human-readable name of this conversation, limited to 256 characters. Optional. + FriendlyName *string `json:"FriendlyName,omitempty"` + // An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL. + UniqueName *string `json:"UniqueName,omitempty"` + // The date that this resource was created. + DateCreated *time.Time `json:"DateCreated,omitempty"` + // The date that this resource was last updated. + DateUpdated *time.Time `json:"DateUpdated,omitempty"` + // The unique ID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) this conversation belongs to. + MessagingServiceSid *string `json:"MessagingServiceSid,omitempty"` + // An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \\\"{}\\\" will be returned. + Attributes *string `json:"Attributes,omitempty"` + // + State *string `json:"State,omitempty"` + // ISO8601 duration when conversation will be switched to `inactive` state. Minimum value for this timer is 1 minute. + TimersInactive *string `json:"Timers.Inactive,omitempty"` + // ISO8601 duration when conversation will be switched to `closed` state. Minimum value for this timer is 10 minutes. + TimersClosed *string `json:"Timers.Closed,omitempty"` + // The default email address that will be used when sending outbound emails in this conversation. + BindingsEmailAddress *string `json:"Bindings.Email.Address,omitempty"` + // The default name that will be used when sending outbound emails in this conversation. + BindingsEmailName *string `json:"Bindings.Email.Name,omitempty"` + // The participant to be added to the conversation in JSON format. The JSON object attributes are as parameters in [Participant Resource](https://www.twilio.com/docs/conversations/api/conversation-participant-resource). The maximum number of participants that can be added in a single request is 10. + Participant *[]string `json:"Participant,omitempty"` +} + +func (params *CreateServiceConversationWithParticipantsParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) *CreateServiceConversationWithParticipantsParams { + params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled + return params +} +func (params *CreateServiceConversationWithParticipantsParams) SetFriendlyName(FriendlyName string) *CreateServiceConversationWithParticipantsParams { + params.FriendlyName = &FriendlyName + return params +} +func (params *CreateServiceConversationWithParticipantsParams) SetUniqueName(UniqueName string) *CreateServiceConversationWithParticipantsParams { + params.UniqueName = &UniqueName + return params +} +func (params *CreateServiceConversationWithParticipantsParams) SetDateCreated(DateCreated time.Time) *CreateServiceConversationWithParticipantsParams { + params.DateCreated = &DateCreated + return params +} +func (params *CreateServiceConversationWithParticipantsParams) SetDateUpdated(DateUpdated time.Time) *CreateServiceConversationWithParticipantsParams { + params.DateUpdated = &DateUpdated + return params +} +func (params *CreateServiceConversationWithParticipantsParams) SetMessagingServiceSid(MessagingServiceSid string) *CreateServiceConversationWithParticipantsParams { + params.MessagingServiceSid = &MessagingServiceSid + return params +} +func (params *CreateServiceConversationWithParticipantsParams) SetAttributes(Attributes string) *CreateServiceConversationWithParticipantsParams { + params.Attributes = &Attributes + return params +} +func (params *CreateServiceConversationWithParticipantsParams) SetState(State string) *CreateServiceConversationWithParticipantsParams { + params.State = &State + return params +} +func (params *CreateServiceConversationWithParticipantsParams) SetTimersInactive(TimersInactive string) *CreateServiceConversationWithParticipantsParams { + params.TimersInactive = &TimersInactive + return params +} +func (params *CreateServiceConversationWithParticipantsParams) SetTimersClosed(TimersClosed string) *CreateServiceConversationWithParticipantsParams { + params.TimersClosed = &TimersClosed + return params +} +func (params *CreateServiceConversationWithParticipantsParams) SetBindingsEmailAddress(BindingsEmailAddress string) *CreateServiceConversationWithParticipantsParams { + params.BindingsEmailAddress = &BindingsEmailAddress + return params +} +func (params *CreateServiceConversationWithParticipantsParams) SetBindingsEmailName(BindingsEmailName string) *CreateServiceConversationWithParticipantsParams { + params.BindingsEmailName = &BindingsEmailName + return params +} +func (params *CreateServiceConversationWithParticipantsParams) SetParticipant(Participant []string) *CreateServiceConversationWithParticipantsParams { + params.Participant = &Participant + return params +} + +// Create a new conversation with the list of participants in your account's default service +func (c *ApiService) CreateServiceConversationWithParticipants(ChatServiceSid string, params *CreateServiceConversationWithParticipantsParams) (*ConversationsV1ServiceConversationWithParticipants, error) { + path := "/v1/Services/{ChatServiceSid}/ConversationWithParticipants" + path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) + + data := url.Values{} + headers := map[string]interface{}{ + "Content-Type": "application/x-www-form-urlencoded", + } + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.UniqueName != nil { + data.Set("UniqueName", *params.UniqueName) + } + if params != nil && params.DateCreated != nil { + data.Set("DateCreated", fmt.Sprint((*params.DateCreated).Format(time.RFC3339))) + } + if params != nil && params.DateUpdated != nil { + data.Set("DateUpdated", fmt.Sprint((*params.DateUpdated).Format(time.RFC3339))) + } + if params != nil && params.MessagingServiceSid != nil { + data.Set("MessagingServiceSid", *params.MessagingServiceSid) + } + if params != nil && params.Attributes != nil { + data.Set("Attributes", *params.Attributes) + } + if params != nil && params.State != nil { + data.Set("State", *params.State) + } + if params != nil && params.TimersInactive != nil { + data.Set("Timers.Inactive", *params.TimersInactive) + } + if params != nil && params.TimersClosed != nil { + data.Set("Timers.Closed", *params.TimersClosed) + } + if params != nil && params.BindingsEmailAddress != nil { + data.Set("Bindings.Email.Address", *params.BindingsEmailAddress) + } + if params != nil && params.BindingsEmailName != nil { + data.Set("Bindings.Email.Name", *params.BindingsEmailName) + } + if params != nil && params.Participant != nil { + for _, item := range *params.Participant { + data.Add("Participant", item) + } + } + + if params != nil && params.XTwilioWebhookEnabled != nil { + headers["X-Twilio-Webhook-Enabled"] = *params.XTwilioWebhookEnabled + } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ConversationsV1ServiceConversationWithParticipants{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err +} diff --git a/rest/insights/v2/README.md b/rest/insights/v2/README.md new file mode 100644 index 000000000..cff4f9fcf --- /dev/null +++ b/rest/insights/v2/README.md @@ -0,0 +1,56 @@ +# Go API client for openapi + +This is the reference API for the rest-proxy server. + +## Overview +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project from the OpenAPI specs located at [twilio/twilio-oai](https://github.com/twilio/twilio-oai/tree/main/spec). By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. + +- API version: 1.0.0 +- Package version: 1.0.0 +- Build package: com.twilio.oai.TwilioGoGenerator + +## Installation + +Install the following dependencies: + +```shell +go get github.com/stretchr/testify/assert +go get golang.org/x/net/context +``` + +Put the package under your project folder and add the following in import: + +```golang +import "./openapi" +``` + +## Documentation for API Endpoints + +All URIs are relative to *https://insights.twilio.com* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- + + +## Documentation For Models + + + +## Documentation For Authorization + + + +## accountSid_authToken + +- **Type**: HTTP basic authentication + +Example + +```golang +auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{ + UserName: "username", + Password: "password", +}) +r, err := client.Service.Operation(auth, args) +``` + diff --git a/rest/insights/v2/api_service.go b/rest/insights/v2/api_service.go new file mode 100644 index 000000000..8e3ff873d --- /dev/null +++ b/rest/insights/v2/api_service.go @@ -0,0 +1,35 @@ +/* + * This code was generated by + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + * + * Sample/reference Twilio API. + * This is the reference API for the rest-proxy server. + * + * NOTE: This class is auto generated by OpenAPI Generator. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package openapi + +import ( + twilio "github.com/twilio/twilio-go/client" +) + +type ApiService struct { + baseURL string + requestHandler *twilio.RequestHandler +} + +func NewApiService(requestHandler *twilio.RequestHandler) *ApiService { + return &ApiService{ + requestHandler: requestHandler, + baseURL: "https://insights.twilio.com", + } +} + +func NewApiServiceWithClient(client twilio.BaseClient) *ApiService { + return NewApiService(twilio.NewRequestHandler(client)) +} diff --git a/rest/messaging/v1/README.md b/rest/messaging/v1/README.md index 8211d9ff0..d813133cd 100644 --- a/rest/messaging/v1/README.md +++ b/rest/messaging/v1/README.md @@ -47,6 +47,7 @@ Class | Method | HTTP request | Description *LinkShorteningDomainsConfigApi* | [**UpdateDomainConfig**](docs/LinkShorteningDomainsConfigApi.md#updatedomainconfig) | **Post** /v1/LinkShortening/Domains/{DomainSid}/Config | *LinkShorteningDomainsMessagingServicesApi* | [**CreateLinkshorteningMessagingService**](docs/LinkShorteningDomainsMessagingServicesApi.md#createlinkshorteningmessagingservice) | **Post** /v1/LinkShortening/Domains/{DomainSid}/MessagingServices/{MessagingServiceSid} | *LinkShorteningDomainsMessagingServicesApi* | [**DeleteLinkshorteningMessagingService**](docs/LinkShorteningDomainsMessagingServicesApi.md#deletelinkshorteningmessagingservice) | **Delete** /v1/LinkShortening/Domains/{DomainSid}/MessagingServices/{MessagingServiceSid} | +*LinkShorteningDomainsRequestManagedCertApi* | [**UpdateRequestManagedCert**](docs/LinkShorteningDomainsRequestManagedCertApi.md#updaterequestmanagedcert) | **Post** /v1/LinkShortening/Domains/{DomainSid}/RequestManagedCert | *LinkShorteningMessagingServiceDomainConfigApi* | [**FetchDomainConfigMessagingService**](docs/LinkShorteningMessagingServiceDomainConfigApi.md#fetchdomainconfigmessagingservice) | **Get** /v1/LinkShortening/MessagingService/{MessagingServiceSid}/DomainConfig | *LinkShorteningMessagingServicesDomainApi* | [**FetchLinkshorteningMessagingServiceDomainAssociation**](docs/LinkShorteningMessagingServicesDomainApi.md#fetchlinkshorteningmessagingservicedomainassociation) | **Get** /v1/LinkShortening/MessagingServices/{MessagingServiceSid}/Domain | *ServicesApi* | [**CreateService**](docs/ServicesApi.md#createservice) | **Post** /v1/Services | @@ -105,6 +106,7 @@ Class | Method | HTTP request | Description - [ListAlphaSenderResponse](docs/ListAlphaSenderResponse.md) - [ListUsAppToPersonResponse](docs/ListUsAppToPersonResponse.md) - [ListChannelSenderResponse](docs/ListChannelSenderResponse.md) + - [MessagingV1RequestManagedCert](docs/MessagingV1RequestManagedCert.md) - [MessagingV1DomainConfigMessagingService](docs/MessagingV1DomainConfigMessagingService.md) - [MessagingV1Service](docs/MessagingV1Service.md) - [MessagingV1Deactivation](docs/MessagingV1Deactivation.md) diff --git a/rest/messaging/v1/docs/LinkShorteningDomainsRequestManagedCertApi.md b/rest/messaging/v1/docs/LinkShorteningDomainsRequestManagedCertApi.md new file mode 100644 index 000000000..2842939e5 --- /dev/null +++ b/rest/messaging/v1/docs/LinkShorteningDomainsRequestManagedCertApi.md @@ -0,0 +1,51 @@ +# LinkShorteningDomainsRequestManagedCertApi + +All URIs are relative to *https://messaging.twilio.com* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**UpdateRequestManagedCert**](LinkShorteningDomainsRequestManagedCertApi.md#UpdateRequestManagedCert) | **Post** /v1/LinkShortening/Domains/{DomainSid}/RequestManagedCert | + + + +## UpdateRequestManagedCert + +> MessagingV1RequestManagedCert UpdateRequestManagedCert(ctx, DomainSid) + + + + + +### Path Parameters + + +Name | Type | Description +------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**DomainSid** | **string** | Unique string used to identify the domain that this certificate should be associated with. + +### Other Parameters + +Other parameters are passed through a pointer to a UpdateRequestManagedCertParams struct + + +Name | Type | Description +------------- | ------------- | ------------- + +### Return type + +[**MessagingV1RequestManagedCert**](MessagingV1RequestManagedCert.md) + +### Authorization + +[accountSid_authToken](../README.md#accountSid_authToken) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/rest/messaging/v1/docs/MessagingV1RequestManagedCert.md b/rest/messaging/v1/docs/MessagingV1RequestManagedCert.md new file mode 100644 index 000000000..422759a30 --- /dev/null +++ b/rest/messaging/v1/docs/MessagingV1RequestManagedCert.md @@ -0,0 +1,19 @@ +# MessagingV1RequestManagedCert + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**DomainSid** | Pointer to **string** | The unique string that we created to identify the Domain resource. | +**DateUpdated** | Pointer to [**time.Time**](time.Time.md) | Date that this Domain was last updated. | +**DateCreated** | Pointer to [**time.Time**](time.Time.md) | Date that this Domain was registered to the Twilio platform to create a new Domain object. | +**DateExpires** | Pointer to [**time.Time**](time.Time.md) | Date that the private certificate associated with this domain expires. This is the expiration date of your existing cert. | +**DomainName** | Pointer to **string** | Full url path for this domain. | +**CertificateSid** | Pointer to **string** | The unique string that we created to identify this Certificate resource. | +**Url** | Pointer to **string** | | +**Managed** | Pointer to **bool** | A boolean flag indicating if the certificate is managed by Twilio. | +**Requesting** | Pointer to **bool** | A boolean flag indicating if a managed certificate needs to be fulfilled by Twilio. | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/rest/messaging/v1/link_shortening_domains_request_managed_cert.go b/rest/messaging/v1/link_shortening_domains_request_managed_cert.go new file mode 100644 index 000000000..78c888b7c --- /dev/null +++ b/rest/messaging/v1/link_shortening_domains_request_managed_cert.go @@ -0,0 +1,46 @@ +/* + * This code was generated by + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + * + * Twilio - Messaging + * This is the public Twilio REST API. + * + * NOTE: This class is auto generated by OpenAPI Generator. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package openapi + +import ( + "encoding/json" + "net/url" + "strings" +) + +// +func (c *ApiService) UpdateRequestManagedCert(DomainSid string) (*MessagingV1RequestManagedCert, error) { + path := "/v1/LinkShortening/Domains/{DomainSid}/RequestManagedCert" + path = strings.Replace(path, "{"+"DomainSid"+"}", DomainSid, -1) + + data := url.Values{} + headers := map[string]interface{}{ + "Content-Type": "application/x-www-form-urlencoded", + } + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &MessagingV1RequestManagedCert{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err +} diff --git a/rest/messaging/v1/model_messaging_v1_request_managed_cert.go b/rest/messaging/v1/model_messaging_v1_request_managed_cert.go new file mode 100644 index 000000000..7a557dd80 --- /dev/null +++ b/rest/messaging/v1/model_messaging_v1_request_managed_cert.go @@ -0,0 +1,40 @@ +/* + * This code was generated by + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + * + * Twilio - Messaging + * This is the public Twilio REST API. + * + * NOTE: This class is auto generated by OpenAPI Generator. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package openapi + +import ( + "time" +) + +// MessagingV1RequestManagedCert struct for MessagingV1RequestManagedCert +type MessagingV1RequestManagedCert struct { + // The unique string that we created to identify the Domain resource. + DomainSid *string `json:"domain_sid,omitempty"` + // Date that this Domain was last updated. + DateUpdated *time.Time `json:"date_updated,omitempty"` + // Date that this Domain was registered to the Twilio platform to create a new Domain object. + DateCreated *time.Time `json:"date_created,omitempty"` + // Date that the private certificate associated with this domain expires. This is the expiration date of your existing cert. + DateExpires *time.Time `json:"date_expires,omitempty"` + // Full url path for this domain. + DomainName *string `json:"domain_name,omitempty"` + // The unique string that we created to identify this Certificate resource. + CertificateSid *string `json:"certificate_sid,omitempty"` + Url *string `json:"url,omitempty"` + // A boolean flag indicating if the certificate is managed by Twilio. + Managed *bool `json:"managed,omitempty"` + // A boolean flag indicating if a managed certificate needs to be fulfilled by Twilio. + Requesting *bool `json:"requesting,omitempty"` +} diff --git a/rest/numbers/v1/docs/PortingPortabilityPhoneNumberApi.md b/rest/numbers/v1/docs/PortingPortabilityPhoneNumberApi.md index 631753208..d3d70bffd 100644 --- a/rest/numbers/v1/docs/PortingPortabilityPhoneNumberApi.md +++ b/rest/numbers/v1/docs/PortingPortabilityPhoneNumberApi.md @@ -32,6 +32,7 @@ Other parameters are passed through a pointer to a FetchPortingPortabilityParams Name | Type | Description ------------- | ------------- | ------------- **TargetAccountSid** | **string** | Account Sid to which the number will be ported. This can be used to determine if a sub account already has the number in its inventory or a different sub account. If this is not provided, the authenticated account will be assumed to be the target account. +**AddressSid** | **string** | Address Sid of customer to which the number will be ported. ### Return type diff --git a/rest/numbers/v1/porting_portability_phone_number.go b/rest/numbers/v1/porting_portability_phone_number.go index 7fc6730f8..3d549986a 100644 --- a/rest/numbers/v1/porting_portability_phone_number.go +++ b/rest/numbers/v1/porting_portability_phone_number.go @@ -24,12 +24,18 @@ import ( type FetchPortingPortabilityParams struct { // Account Sid to which the number will be ported. This can be used to determine if a sub account already has the number in its inventory or a different sub account. If this is not provided, the authenticated account will be assumed to be the target account. TargetAccountSid *string `json:"TargetAccountSid,omitempty"` + // Address Sid of customer to which the number will be ported. + AddressSid *string `json:"AddressSid,omitempty"` } func (params *FetchPortingPortabilityParams) SetTargetAccountSid(TargetAccountSid string) *FetchPortingPortabilityParams { params.TargetAccountSid = &TargetAccountSid return params } +func (params *FetchPortingPortabilityParams) SetAddressSid(AddressSid string) *FetchPortingPortabilityParams { + params.AddressSid = &AddressSid + return params +} // Check if a single phone number can be ported to Twilio func (c *ApiService) FetchPortingPortability(PhoneNumber string, params *FetchPortingPortabilityParams) (*NumbersV1PortingPortability, error) { @@ -44,6 +50,9 @@ func (c *ApiService) FetchPortingPortability(PhoneNumber string, params *FetchPo if params != nil && params.TargetAccountSid != nil { data.Set("TargetAccountSid", *params.TargetAccountSid) } + if params != nil && params.AddressSid != nil { + data.Set("AddressSid", *params.AddressSid) + } resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) if err != nil { diff --git a/rest/serverless/v1/docs/ServicesEnvironmentsDeploymentsApi.md b/rest/serverless/v1/docs/ServicesEnvironmentsDeploymentsApi.md index ba9e196ce..78fa8ad11 100644 --- a/rest/serverless/v1/docs/ServicesEnvironmentsDeploymentsApi.md +++ b/rest/serverless/v1/docs/ServicesEnvironmentsDeploymentsApi.md @@ -35,6 +35,7 @@ Other parameters are passed through a pointer to a CreateDeploymentParams struct Name | Type | Description ------------- | ------------- | ------------- **BuildSid** | **string** | The SID of the Build for the Deployment. +**IsPlugin** | **bool** | Whether the Deployment is a plugin. ### Return type diff --git a/rest/serverless/v1/services_environments_deployments.go b/rest/serverless/v1/services_environments_deployments.go index 6d305d2c8..da5816e6e 100644 --- a/rest/serverless/v1/services_environments_deployments.go +++ b/rest/serverless/v1/services_environments_deployments.go @@ -27,12 +27,18 @@ import ( type CreateDeploymentParams struct { // The SID of the Build for the Deployment. BuildSid *string `json:"BuildSid,omitempty"` + // Whether the Deployment is a plugin. + IsPlugin *bool `json:"IsPlugin,omitempty"` } func (params *CreateDeploymentParams) SetBuildSid(BuildSid string) *CreateDeploymentParams { params.BuildSid = &BuildSid return params } +func (params *CreateDeploymentParams) SetIsPlugin(IsPlugin bool) *CreateDeploymentParams { + params.IsPlugin = &IsPlugin + return params +} // Create a new Deployment. func (c *ApiService) CreateDeployment(ServiceSid string, EnvironmentSid string, params *CreateDeploymentParams) (*ServerlessV1Deployment, error) { @@ -48,6 +54,9 @@ func (c *ApiService) CreateDeployment(ServiceSid string, EnvironmentSid string, if params != nil && params.BuildSid != nil { data.Set("BuildSid", *params.BuildSid) } + if params != nil && params.IsPlugin != nil { + data.Set("IsPlugin", fmt.Sprint(*params.IsPlugin)) + } resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) if err != nil { diff --git a/rest/taskrouter/v1/docs/WorkspacesTasksApi.md b/rest/taskrouter/v1/docs/WorkspacesTasksApi.md index d58ebb338..3366bb804 100644 --- a/rest/taskrouter/v1/docs/WorkspacesTasksApi.md +++ b/rest/taskrouter/v1/docs/WorkspacesTasksApi.md @@ -40,7 +40,7 @@ Name | Type | Description **TaskChannel** | **string** | When MultiTasking is enabled, specify the TaskChannel by passing either its `unique_name` or `sid`. Default value is `default`. **WorkflowSid** | **string** | The SID of the Workflow that you would like to handle routing for the new Task. If there is only one Workflow defined for the Workspace that you are posting the new task to, this parameter is optional. **Attributes** | **string** | A URL-encoded JSON string with the attributes of the new task. This value is passed to the Workflow's `assignment_callback_url` when the Task is assigned to a Worker. For example: `{ \\\"task_type\\\": \\\"call\\\", \\\"twilio_call_sid\\\": \\\"CAxxx\\\", \\\"customer_ticket_number\\\": \\\"12345\\\" }`. -**VirtualStartTime** | **time.Time** | The virtual start time to assign the new task and override the default. When supplied, the new task will have this virtual start time. When not supplied, the new task will have the virtual start time equal to `date_created`. Value can't be in the future. +**VirtualStartTime** | **time.Time** | The virtual start time to assign the new task and override the default. When supplied, the new task will have this virtual start time. When not supplied, the new task will have the virtual start time equal to `date_created`. Value can't be in the future or before the year of 1900. **RoutingTarget** | **string** | A SID of a Worker, Queue, or Workflow to route a Task to **IgnoreCapacity** | **string** | A boolean that indicates if the Task should respect a Worker's capacity and availability during assignment. This field can only be used when the `RoutingTarget` field is set to a Worker SID. By setting `IgnoreCapacity` to a value of `true`, `1`, or `yes`, the Task will be routed to the Worker without respecting their capacity and availability. Any other value will enforce the Worker's capacity and availability. The default value of `IgnoreCapacity` is `true` when the `RoutingTarget` is set to a Worker SID. **TaskQueueSid** | **string** | The SID of the TaskQueue in which the Task belongs @@ -234,7 +234,7 @@ Name | Type | Description **Reason** | **string** | The reason that the Task was canceled or completed. This parameter is required only if the Task is canceled or completed. Setting this value queues the task for deletion and logs the reason. **Priority** | **int** | The Task's new priority value. When supplied, the Task takes on the specified priority unless it matches a Workflow Target with a Priority set. Value can be 0 to 2^31^ (2,147,483,647). **TaskChannel** | **string** | When MultiTasking is enabled, specify the TaskChannel with the task to update. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`. -**VirtualStartTime** | **time.Time** | The task's new virtual start time value. When supplied, the Task takes on the specified virtual start time. Value can't be in the future. +**VirtualStartTime** | **time.Time** | The task's new virtual start time value. When supplied, the Task takes on the specified virtual start time. Value can't be in the future or before the year of 1900. ### Return type diff --git a/rest/taskrouter/v1/workspaces_tasks.go b/rest/taskrouter/v1/workspaces_tasks.go index 3aa878fc3..31e1bc236 100644 --- a/rest/taskrouter/v1/workspaces_tasks.go +++ b/rest/taskrouter/v1/workspaces_tasks.go @@ -36,7 +36,7 @@ type CreateTaskParams struct { WorkflowSid *string `json:"WorkflowSid,omitempty"` // A URL-encoded JSON string with the attributes of the new task. This value is passed to the Workflow's `assignment_callback_url` when the Task is assigned to a Worker. For example: `{ \\\"task_type\\\": \\\"call\\\", \\\"twilio_call_sid\\\": \\\"CAxxx\\\", \\\"customer_ticket_number\\\": \\\"12345\\\" }`. Attributes *string `json:"Attributes,omitempty"` - // The virtual start time to assign the new task and override the default. When supplied, the new task will have this virtual start time. When not supplied, the new task will have the virtual start time equal to `date_created`. Value can't be in the future. + // The virtual start time to assign the new task and override the default. When supplied, the new task will have this virtual start time. When not supplied, the new task will have the virtual start time equal to `date_created`. Value can't be in the future or before the year of 1900. VirtualStartTime *time.Time `json:"VirtualStartTime,omitempty"` // A SID of a Worker, Queue, or Workflow to route a Task to RoutingTarget *string `json:"RoutingTarget,omitempty"` @@ -443,7 +443,7 @@ type UpdateTaskParams struct { Priority *int `json:"Priority,omitempty"` // When MultiTasking is enabled, specify the TaskChannel with the task to update. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`. TaskChannel *string `json:"TaskChannel,omitempty"` - // The task's new virtual start time value. When supplied, the Task takes on the specified virtual start time. Value can't be in the future. + // The task's new virtual start time value. When supplied, the Task takes on the specified virtual start time. Value can't be in the future or before the year of 1900. VirtualStartTime *time.Time `json:"VirtualStartTime,omitempty"` } diff --git a/rest/verify/v2/docs/ServicesVerificationCheckApi.md b/rest/verify/v2/docs/ServicesVerificationCheckApi.md index ea8b1ec8e..567c78be0 100644 --- a/rest/verify/v2/docs/ServicesVerificationCheckApi.md +++ b/rest/verify/v2/docs/ServicesVerificationCheckApi.md @@ -36,6 +36,7 @@ Name | Type | Description **VerificationSid** | **string** | A SID that uniquely identifies the Verification Check. Either this parameter or the `to` phone number/[email](https://www.twilio.com/docs/verify/email) must be specified. **Amount** | **string** | The amount of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled. **Payee** | **string** | The payee of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled. +**SnaClientToken** | **string** | A sna client token received in sna url invocation response needs to be passed in Verification Check request and should match to get successful response. ### Return type diff --git a/rest/verify/v2/docs/ServicesVerificationsApi.md b/rest/verify/v2/docs/ServicesVerificationsApi.md index cf0cbcf94..edb1f6eb5 100644 --- a/rest/verify/v2/docs/ServicesVerificationsApi.md +++ b/rest/verify/v2/docs/ServicesVerificationsApi.md @@ -48,6 +48,7 @@ Name | Type | Description **TemplateSid** | **string** | The message [template](https://www.twilio.com/docs/verify/api/templates). If provided, will override the default template for the Service. SMS and Voice channels only. **TemplateCustomSubstitutions** | **string** | A stringified JSON object in which the keys are the template's special variables and the values are the variables substitutions. **DeviceIp** | **string** | Strongly encouraged if using the auto channel. The IP address of the client's device. If provided, it has to be a valid IPv4 or IPv6 address. +**EnableSnaClientToken** | **bool** | An optional Boolean value to indicate the requirement of sna client token in the SNA URL invocation response for added security. This token must match in the Verification Check request to confirm phone number verification. **RiskCheck** | **string** | **Tags** | **string** | A string containing a JSON map of key value pairs of tags to be recorded as metadata for the message. The object may contain up to 10 tags. Keys and values can each be up to 128 characters in length. diff --git a/rest/verify/v2/services_verification_check.go b/rest/verify/v2/services_verification_check.go index ef25df11d..6549cc554 100644 --- a/rest/verify/v2/services_verification_check.go +++ b/rest/verify/v2/services_verification_check.go @@ -32,6 +32,8 @@ type CreateVerificationCheckParams struct { Amount *string `json:"Amount,omitempty"` // The payee of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled. Payee *string `json:"Payee,omitempty"` + // A sna client token received in sna url invocation response needs to be passed in Verification Check request and should match to get successful response. + SnaClientToken *string `json:"SnaClientToken,omitempty"` } func (params *CreateVerificationCheckParams) SetCode(Code string) *CreateVerificationCheckParams { @@ -54,6 +56,10 @@ func (params *CreateVerificationCheckParams) SetPayee(Payee string) *CreateVerif params.Payee = &Payee return params } +func (params *CreateVerificationCheckParams) SetSnaClientToken(SnaClientToken string) *CreateVerificationCheckParams { + params.SnaClientToken = &SnaClientToken + return params +} // challenge a specific Verification Check. func (c *ApiService) CreateVerificationCheck(ServiceSid string, params *CreateVerificationCheckParams) (*VerifyV2VerificationCheck, error) { @@ -80,6 +86,9 @@ func (c *ApiService) CreateVerificationCheck(ServiceSid string, params *CreateVe if params != nil && params.Payee != nil { data.Set("Payee", *params.Payee) } + if params != nil && params.SnaClientToken != nil { + data.Set("SnaClientToken", *params.SnaClientToken) + } resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) if err != nil { diff --git a/rest/verify/v2/services_verifications.go b/rest/verify/v2/services_verifications.go index 45eda264e..f29c7c1c0 100644 --- a/rest/verify/v2/services_verifications.go +++ b/rest/verify/v2/services_verifications.go @@ -16,6 +16,7 @@ package openapi import ( "encoding/json" + "fmt" "net/url" "strings" ) @@ -52,6 +53,8 @@ type CreateVerificationParams struct { TemplateCustomSubstitutions *string `json:"TemplateCustomSubstitutions,omitempty"` // Strongly encouraged if using the auto channel. The IP address of the client's device. If provided, it has to be a valid IPv4 or IPv6 address. DeviceIp *string `json:"DeviceIp,omitempty"` + // An optional Boolean value to indicate the requirement of sna client token in the SNA URL invocation response for added security. This token must match in the Verification Check request to confirm phone number verification. + EnableSnaClientToken *bool `json:"EnableSnaClientToken,omitempty"` // RiskCheck *string `json:"RiskCheck,omitempty"` // A string containing a JSON map of key value pairs of tags to be recorded as metadata for the message. The object may contain up to 10 tags. Keys and values can each be up to 128 characters in length. @@ -118,6 +121,10 @@ func (params *CreateVerificationParams) SetDeviceIp(DeviceIp string) *CreateVeri params.DeviceIp = &DeviceIp return params } +func (params *CreateVerificationParams) SetEnableSnaClientToken(EnableSnaClientToken bool) *CreateVerificationParams { + params.EnableSnaClientToken = &EnableSnaClientToken + return params +} func (params *CreateVerificationParams) SetRiskCheck(RiskCheck string) *CreateVerificationParams { params.RiskCheck = &RiskCheck return params @@ -194,6 +201,9 @@ func (c *ApiService) CreateVerification(ServiceSid string, params *CreateVerific if params != nil && params.DeviceIp != nil { data.Set("DeviceIp", *params.DeviceIp) } + if params != nil && params.EnableSnaClientToken != nil { + data.Set("EnableSnaClientToken", fmt.Sprint(*params.EnableSnaClientToken)) + } if params != nil && params.RiskCheck != nil { data.Set("RiskCheck", *params.RiskCheck) } diff --git a/rest/video/v1/docs/RoomsApi.md b/rest/video/v1/docs/RoomsApi.md index 6c67cd0f2..59aa35d7f 100644 --- a/rest/video/v1/docs/RoomsApi.md +++ b/rest/video/v1/docs/RoomsApi.md @@ -33,14 +33,14 @@ Name | Type | Description **EnableTurn** | **bool** | Deprecated, now always considered to be true. **Type** | **string** | **UniqueName** | **string** | An application-defined string that uniquely identifies the resource. It can be used as a `room_sid` in place of the resource's `sid` in the URL to address the resource, assuming it does not contain any [reserved characters](https://tools.ietf.org/html/rfc3986#section-2.2) that would need to be URL encoded. This value is unique for `in-progress` rooms. SDK clients can use this name to connect to the room. REST API clients can use this name in place of the Room SID to interact with the room as long as the room is `in-progress`. -**StatusCallback** | **string** | The URL we should call using the `status_callback_method` to send status information to your application on every room event. See [Status Callbacks](https://www.twilio.com/docs/video/api/status-callbacks) for more info. -**StatusCallbackMethod** | **string** | The HTTP method we should use to call `status_callback`. Can be `POST` or `GET`. -**MaxParticipants** | **int** | The maximum number of concurrent Participants allowed in the room. Peer-to-peer rooms can have up to 10 Participants. Small Group rooms can have up to 4 Participants. Group rooms can have up to 50 Participants. -**RecordParticipantsOnConnect** | **bool** | Whether to start recording when Participants connect. ***This feature is not available in `peer-to-peer` rooms.*** -**VideoCodecs** | [**[]RoomEnumVideoCodec**](RoomEnumVideoCodec.md) | An array of the video codecs that are supported when publishing a track in the room. Can be: `VP8` and `H264`. ***This feature is not available in `peer-to-peer` rooms*** -**MediaRegion** | **string** | The region for the media server in Group Rooms. Can be: one of the [available Media Regions](https://www.twilio.com/docs/video/ip-addresses#group-rooms-media-servers). ***This feature is not available in `peer-to-peer` rooms.*** +**StatusCallback** | **string** | The URL Twilio should call using the `status_callback_method` to send status information to your application on every room event. See [Status Callbacks](https://www.twilio.com/docs/video/api/status-callbacks) for more info. +**StatusCallbackMethod** | **string** | The HTTP method Twilio should use to call `status_callback`. Can be `POST` or `GET`. +**MaxParticipants** | **int** | The maximum number of concurrent Participants allowed in the room. The maximum allowed value is 50. +**RecordParticipantsOnConnect** | **bool** | Whether to start recording when Participants connect. +**VideoCodecs** | [**[]RoomEnumVideoCodec**](RoomEnumVideoCodec.md) | An array of the video codecs that are supported when publishing a track in the room. Can be: `VP8` and `H264`. +**MediaRegion** | **string** | The region for the Room's media server. Can be one of the [available Media Regions](https://www.twilio.com/docs/video/ip-addresses#group-rooms-media-servers). **RecordingRules** | [**interface{}**](interface{}.md) | A collection of Recording Rules that describe how to include or exclude matching tracks for recording -**AudioOnly** | **bool** | When set to true, indicates that the participants in the room will only publish audio. No video tracks will be allowed. Group rooms only. +**AudioOnly** | **bool** | When set to true, indicates that the participants in the room will only publish audio. No video tracks will be allowed. **MaxParticipantDuration** | **int** | The maximum number of seconds a Participant can be connected to the room. The maximum possible value is 86400 seconds (24 hours). The default is 14400 seconds (4 hours). **EmptyRoomTimeout** | **int** | Configures how long (in minutes) a room will remain active after last participant leaves. Valid values range from 1 to 60 minutes (no fractions). **UnusedRoomTimeout** | **int** | Configures how long (in minutes) a room will remain active if no one joins. Valid values range from 1 to 60 minutes (no fractions). diff --git a/rest/video/v1/docs/VideoV1Room.md b/rest/video/v1/docs/VideoV1Room.md index 04fe51f3d..5ce3df412 100644 --- a/rest/video/v1/docs/VideoV1Room.md +++ b/rest/video/v1/docs/VideoV1Room.md @@ -4,25 +4,25 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Sid** | Pointer to **string** | The unique string that we created to identify the Room resource. | +**Sid** | Pointer to **string** | The unique string that Twilio created to identify the Room resource. | **Status** | Pointer to [**string**](RoomEnumRoomStatus.md) | | **DateCreated** | Pointer to [**time.Time**](time.Time.md) | The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. | **DateUpdated** | Pointer to [**time.Time**](time.Time.md) | The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. | **AccountSid** | Pointer to **string** | The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Room resource. | **EnableTurn** | Pointer to **bool** | Deprecated, now always considered to be true. | **UniqueName** | Pointer to **string** | An application-defined string that uniquely identifies the resource. It can be used as a `room_sid` in place of the resource's `sid` in the URL to address the resource, assuming it does not contain any [reserved characters](https://tools.ietf.org/html/rfc3986#section-2.2) that would need to be URL encoded. This value is unique for `in-progress` rooms. SDK clients can use this name to connect to the room. REST API clients can use this name in place of the Room SID to interact with the room as long as the room is `in-progress`. | -**StatusCallback** | Pointer to **string** | The URL we call using the `status_callback_method` to send status information to your application on every room event. See [Status Callbacks](https://www.twilio.com/docs/video/api/status-callbacks) for more info. | -**StatusCallbackMethod** | Pointer to **string** | The HTTP method we use to call `status_callback`. Can be `POST` or `GET` and defaults to `POST`. | +**StatusCallback** | Pointer to **string** | The URL Twilio calls using the `status_callback_method` to send status information to your application on every room event. See [Status Callbacks](https://www.twilio.com/docs/video/api/status-callbacks) for more info. | +**StatusCallbackMethod** | Pointer to **string** | The HTTP method Twilio uses to call `status_callback`. Can be `POST` or `GET` and defaults to `POST`. | **EndTime** | Pointer to [**time.Time**](time.Time.md) | The UTC end time of the room in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#UTC) format. | **Duration** | Pointer to **int** | The duration of the room in seconds. | **Type** | Pointer to [**string**](RoomEnumRoomType.md) | | **MaxParticipants** | **int** | The maximum number of concurrent Participants allowed in the room. |[optional] [default to 0] **MaxParticipantDuration** | **int** | The maximum number of seconds a Participant can be connected to the room. The maximum possible value is 86400 seconds (24 hours). The default is 14400 seconds (4 hours). |[optional] [default to 0] **MaxConcurrentPublishedTracks** | Pointer to **int** | The maximum number of published audio, video, and data tracks all participants combined are allowed to publish in the room at the same time. Check [Programmable Video Limits](https://www.twilio.com/docs/video/programmable-video-limits) for more details. If it is set to 0 it means unconstrained. | -**RecordParticipantsOnConnect** | Pointer to **bool** | Whether to start recording when Participants connect. ***This feature is not available in `peer-to-peer` rooms.*** | -**VideoCodecs** | Pointer to [**[]string**](RoomEnumVideoCodec.md) | An array of the video codecs that are supported when publishing a track in the room. Can be: `VP8` and `H264`. ***This feature is not available in `peer-to-peer` rooms*** | -**MediaRegion** | Pointer to **string** | The region for the media server in Group Rooms. Can be: one of the [available Media Regions](https://www.twilio.com/docs/video/ip-addresses#media-servers). ***This feature is not available in `peer-to-peer` rooms.*** | -**AudioOnly** | Pointer to **bool** | When set to true, indicates that the participants in the room will only publish audio. No video tracks will be allowed. Group rooms only. | +**RecordParticipantsOnConnect** | Pointer to **bool** | Whether to start recording when Participants connect. | +**VideoCodecs** | Pointer to [**[]string**](RoomEnumVideoCodec.md) | An array of the video codecs that are supported when publishing a track in the room. Can be: `VP8` and `H264`. | +**MediaRegion** | Pointer to **string** | The region for the Room's media server. Can be one of the [available Media Regions](https://www.twilio.com/docs/video/ip-addresses#media-servers). | +**AudioOnly** | Pointer to **bool** | When set to true, indicates that the participants in the room will only publish audio. No video tracks will be allowed. | **EmptyRoomTimeout** | **int** | Specifies how long (in minutes) a room will remain active after last participant leaves. Can be configured when creating a room via REST API. For Ad-Hoc rooms this value cannot be changed. |[optional] [default to 0] **UnusedRoomTimeout** | **int** | Specifies how long (in minutes) a room will remain active if no one joins. Can be configured when creating a room via REST API. For Ad-Hoc rooms this value cannot be changed. |[optional] [default to 0] **LargeRoom** | Pointer to **bool** | Indicates if this is a large room. | diff --git a/rest/video/v1/model_video_v1_room.go b/rest/video/v1/model_video_v1_room.go index 5baf59a75..7529ef2d1 100644 --- a/rest/video/v1/model_video_v1_room.go +++ b/rest/video/v1/model_video_v1_room.go @@ -20,7 +20,7 @@ import ( // VideoV1Room struct for VideoV1Room type VideoV1Room struct { - // The unique string that we created to identify the Room resource. + // The unique string that Twilio created to identify the Room resource. Sid *string `json:"sid,omitempty"` Status *string `json:"status,omitempty"` // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. @@ -33,9 +33,9 @@ type VideoV1Room struct { EnableTurn *bool `json:"enable_turn,omitempty"` // An application-defined string that uniquely identifies the resource. It can be used as a `room_sid` in place of the resource's `sid` in the URL to address the resource, assuming it does not contain any [reserved characters](https://tools.ietf.org/html/rfc3986#section-2.2) that would need to be URL encoded. This value is unique for `in-progress` rooms. SDK clients can use this name to connect to the room. REST API clients can use this name in place of the Room SID to interact with the room as long as the room is `in-progress`. UniqueName *string `json:"unique_name,omitempty"` - // The URL we call using the `status_callback_method` to send status information to your application on every room event. See [Status Callbacks](https://www.twilio.com/docs/video/api/status-callbacks) for more info. + // The URL Twilio calls using the `status_callback_method` to send status information to your application on every room event. See [Status Callbacks](https://www.twilio.com/docs/video/api/status-callbacks) for more info. StatusCallback *string `json:"status_callback,omitempty"` - // The HTTP method we use to call `status_callback`. Can be `POST` or `GET` and defaults to `POST`. + // The HTTP method Twilio uses to call `status_callback`. Can be `POST` or `GET` and defaults to `POST`. StatusCallbackMethod *string `json:"status_callback_method,omitempty"` // The UTC end time of the room in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#UTC) format. EndTime *time.Time `json:"end_time,omitempty"` @@ -48,13 +48,13 @@ type VideoV1Room struct { MaxParticipantDuration int `json:"max_participant_duration,omitempty"` // The maximum number of published audio, video, and data tracks all participants combined are allowed to publish in the room at the same time. Check [Programmable Video Limits](https://www.twilio.com/docs/video/programmable-video-limits) for more details. If it is set to 0 it means unconstrained. MaxConcurrentPublishedTracks *int `json:"max_concurrent_published_tracks,omitempty"` - // Whether to start recording when Participants connect. ***This feature is not available in `peer-to-peer` rooms.*** + // Whether to start recording when Participants connect. RecordParticipantsOnConnect *bool `json:"record_participants_on_connect,omitempty"` - // An array of the video codecs that are supported when publishing a track in the room. Can be: `VP8` and `H264`. ***This feature is not available in `peer-to-peer` rooms*** + // An array of the video codecs that are supported when publishing a track in the room. Can be: `VP8` and `H264`. VideoCodecs *[]string `json:"video_codecs,omitempty"` - // The region for the media server in Group Rooms. Can be: one of the [available Media Regions](https://www.twilio.com/docs/video/ip-addresses#media-servers). ***This feature is not available in `peer-to-peer` rooms.*** + // The region for the Room's media server. Can be one of the [available Media Regions](https://www.twilio.com/docs/video/ip-addresses#media-servers). MediaRegion *string `json:"media_region,omitempty"` - // When set to true, indicates that the participants in the room will only publish audio. No video tracks will be allowed. Group rooms only. + // When set to true, indicates that the participants in the room will only publish audio. No video tracks will be allowed. AudioOnly *bool `json:"audio_only,omitempty"` // Specifies how long (in minutes) a room will remain active after last participant leaves. Can be configured when creating a room via REST API. For Ad-Hoc rooms this value cannot be changed. EmptyRoomTimeout int `json:"empty_room_timeout,omitempty"` diff --git a/rest/video/v1/rooms.go b/rest/video/v1/rooms.go index aa1128829..f9b12cda8 100644 --- a/rest/video/v1/rooms.go +++ b/rest/video/v1/rooms.go @@ -32,21 +32,21 @@ type CreateRoomParams struct { Type *string `json:"Type,omitempty"` // An application-defined string that uniquely identifies the resource. It can be used as a `room_sid` in place of the resource's `sid` in the URL to address the resource, assuming it does not contain any [reserved characters](https://tools.ietf.org/html/rfc3986#section-2.2) that would need to be URL encoded. This value is unique for `in-progress` rooms. SDK clients can use this name to connect to the room. REST API clients can use this name in place of the Room SID to interact with the room as long as the room is `in-progress`. UniqueName *string `json:"UniqueName,omitempty"` - // The URL we should call using the `status_callback_method` to send status information to your application on every room event. See [Status Callbacks](https://www.twilio.com/docs/video/api/status-callbacks) for more info. + // The URL Twilio should call using the `status_callback_method` to send status information to your application on every room event. See [Status Callbacks](https://www.twilio.com/docs/video/api/status-callbacks) for more info. StatusCallback *string `json:"StatusCallback,omitempty"` - // The HTTP method we should use to call `status_callback`. Can be `POST` or `GET`. + // The HTTP method Twilio should use to call `status_callback`. Can be `POST` or `GET`. StatusCallbackMethod *string `json:"StatusCallbackMethod,omitempty"` - // The maximum number of concurrent Participants allowed in the room. Peer-to-peer rooms can have up to 10 Participants. Small Group rooms can have up to 4 Participants. Group rooms can have up to 50 Participants. + // The maximum number of concurrent Participants allowed in the room. The maximum allowed value is 50. MaxParticipants *int `json:"MaxParticipants,omitempty"` - // Whether to start recording when Participants connect. ***This feature is not available in `peer-to-peer` rooms.*** + // Whether to start recording when Participants connect. RecordParticipantsOnConnect *bool `json:"RecordParticipantsOnConnect,omitempty"` - // An array of the video codecs that are supported when publishing a track in the room. Can be: `VP8` and `H264`. ***This feature is not available in `peer-to-peer` rooms*** + // An array of the video codecs that are supported when publishing a track in the room. Can be: `VP8` and `H264`. VideoCodecs *[]string `json:"VideoCodecs,omitempty"` - // The region for the media server in Group Rooms. Can be: one of the [available Media Regions](https://www.twilio.com/docs/video/ip-addresses#group-rooms-media-servers). ***This feature is not available in `peer-to-peer` rooms.*** + // The region for the Room's media server. Can be one of the [available Media Regions](https://www.twilio.com/docs/video/ip-addresses#group-rooms-media-servers). MediaRegion *string `json:"MediaRegion,omitempty"` // A collection of Recording Rules that describe how to include or exclude matching tracks for recording RecordingRules *interface{} `json:"RecordingRules,omitempty"` - // When set to true, indicates that the participants in the room will only publish audio. No video tracks will be allowed. Group rooms only. + // When set to true, indicates that the participants in the room will only publish audio. No video tracks will be allowed. AudioOnly *bool `json:"AudioOnly,omitempty"` // The maximum number of seconds a Participant can be connected to the room. The maximum possible value is 86400 seconds (24 hours). The default is 14400 seconds (4 hours). MaxParticipantDuration *int `json:"MaxParticipantDuration,omitempty"` diff --git a/twilio.go b/twilio.go index 86313e9ca..2fab5127b 100644 --- a/twilio.go +++ b/twilio.go @@ -32,6 +32,7 @@ import ( FrontlineV1 "github.com/twilio/twilio-go/rest/frontline/v1" IamV1 "github.com/twilio/twilio-go/rest/iam/v1" InsightsV1 "github.com/twilio/twilio-go/rest/insights/v1" + InsightsV2 "github.com/twilio/twilio-go/rest/insights/v2" IntelligenceV2 "github.com/twilio/twilio-go/rest/intelligence/v2" IpMessagingV1 "github.com/twilio/twilio-go/rest/ip_messaging/v1" IpMessagingV2 "github.com/twilio/twilio-go/rest/ip_messaging/v2" @@ -82,6 +83,7 @@ type RestClient struct { FrontlineV1 *FrontlineV1.ApiService IamV1 *IamV1.ApiService InsightsV1 *InsightsV1.ApiService + InsightsV2 *InsightsV2.ApiService IntelligenceV2 *IntelligenceV2.ApiService IpMessagingV1 *IpMessagingV1.ApiService IpMessagingV2 *IpMessagingV2.ApiService @@ -179,6 +181,7 @@ func NewRestClientWithParams(params ClientParams) *RestClient { c.FrontlineV1 = FrontlineV1.NewApiService(c.RequestHandler) c.IamV1 = IamV1.NewApiService(c.RequestHandler) c.InsightsV1 = InsightsV1.NewApiService(c.RequestHandler) + c.InsightsV2 = InsightsV2.NewApiService(c.RequestHandler) c.IntelligenceV2 = IntelligenceV2.NewApiService(c.RequestHandler) c.IpMessagingV1 = IpMessagingV1.NewApiService(c.RequestHandler) c.IpMessagingV2 = IpMessagingV2.NewApiService(c.RequestHandler)