Skip to content

Commit

Permalink
[Librarian] Regenerated @ 7987bc34448d66e36aaa4f7174e25f3d57ccccef
Browse files Browse the repository at this point in the history
  • Loading branch information
twilio-dx committed Jul 14, 2021
1 parent 1af382d commit 5966227
Show file tree
Hide file tree
Showing 18 changed files with 3,383 additions and 70 deletions.
10 changes: 10 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
twilio-node changelog
=====================

[2021-07-14] Version 3.66.0
---------------------------
**Conversations**
- Changed `last_read_message_index` and `unread_messages_count` type in User Conversation's resource **(breaking change)**
- Expose UserConversations resource

**Messaging**
- Add brand_score field to brand registration responses


[2021-06-30] Version 3.65.0
---------------------------
**Conversations**
Expand Down
9 changes: 9 additions & 0 deletions lib/rest/conversations/v1/service/user.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import Page = require('../../../../base/Page');
import Response = require('../../../../http/response');
import V1 = require('../../V1');
import { SerializableClass } from '../../../../interfaces';
import { UserConversationList } from './user/userConversation';
import { UserConversationListInstance } from './user/userConversation';

type UserWebhookEnabledType = 'true'|'false';

Expand Down Expand Up @@ -251,6 +253,7 @@ interface UserResource {
identity: string;
is_notifiable: boolean;
is_online: boolean;
links: string;
role_sid: string;
sid: string;
url: string;
Expand Down Expand Up @@ -307,6 +310,7 @@ declare class UserContext {
* @param callback - Callback to handle processed record
*/
update(opts?: UserInstanceUpdateOptions, callback?: (error: Error | null, items: UserInstance) => any): Promise<UserInstance>;
userConversations: UserConversationListInstance;
}


Expand Down Expand Up @@ -337,6 +341,7 @@ declare class UserInstance extends SerializableClass {
identity: string;
isNotifiable: boolean;
isOnline: boolean;
links: string;
/**
* remove a UserInstance
*
Expand Down Expand Up @@ -370,6 +375,10 @@ declare class UserInstance extends SerializableClass {
*/
update(opts?: UserInstanceUpdateOptions, callback?: (error: Error | null, items: UserInstance) => any): Promise<UserInstance>;
url: string;
/**
* Access the userConversations
*/
userConversations(): UserConversationListInstance;
}


Expand Down
38 changes: 38 additions & 0 deletions lib/rest/conversations/v1/service/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ var Q = require('q'); /* jshint ignore:line */
var _ = require('lodash'); /* jshint ignore:line */
var util = require('util'); /* jshint ignore:line */
var Page = require('../../../../base/Page'); /* jshint ignore:line */
var UserConversationList = require(
'./user/userConversation').UserConversationList;
var deserialize = require(
'../../../../base/deserialize'); /* jshint ignore:line */
var values = require('../../../../base/values'); /* jshint ignore:line */
Expand Down Expand Up @@ -483,6 +485,7 @@ UserPage.prototype[util.inspect.custom] = function inspect(depth, options) {
* @property {Date} dateUpdated -
* The ISO 8601 date and time in GMT when the resource was last updated
* @property {string} url - An absolute URL for this user.
* @property {string} links - The links
*
* @param {V1} version - Version of the resource
* @param {UserPayload} payload - The instance payload
Expand All @@ -507,6 +510,7 @@ UserInstance = function UserInstance(version, payload, chatServiceSid, sid) {
this.dateCreated = deserialize.iso8601DateTime(payload.date_created); // jshint ignore:line
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); // jshint ignore:line
this.url = payload.url; // jshint ignore:line
this.links = payload.links; // jshint ignore:line

// Context
this._context = undefined;
Expand Down Expand Up @@ -584,6 +588,20 @@ UserInstance.prototype.fetch = function fetch(callback) {
return this._proxy.fetch(callback);
};

/* jshint ignore:start */
/**
* Access the userConversations
*
* @function userConversations
* @memberof Twilio.Conversations.V1.ServiceContext.UserInstance#
*
* @returns {Twilio.Conversations.V1.ServiceContext.UserContext.UserConversationList}
*/
/* jshint ignore:end */
UserInstance.prototype.userConversations = function userConversations() {
return this._proxy.userConversations;
};

/* jshint ignore:start */
/**
* Provide a user-friendly representation
Expand Down Expand Up @@ -615,6 +633,9 @@ UserInstance.prototype[util.inspect.custom] = function inspect(depth, options) {
*
* @constructor Twilio.Conversations.V1.ServiceContext.UserContext
*
* @property {Twilio.Conversations.V1.ServiceContext.UserContext.UserConversationList} userConversations -
* userConversations resource
*
* @param {V1} version - Version of the resource
* @param {sid} chatServiceSid -
* The SID of the Conversation Service to fetch the resource from
Expand All @@ -627,6 +648,9 @@ UserContext = function UserContext(version, chatServiceSid, sid) {
// Path Solution
this._solution = {chatServiceSid: chatServiceSid, sid: sid, };
this._uri = `/Services/${chatServiceSid}/Users/${sid}`;

// Dependents
this._userConversations = undefined;
};

/* jshint ignore:start */
Expand Down Expand Up @@ -765,6 +789,20 @@ UserContext.prototype.fetch = function fetch(callback) {
return deferred.promise;
};

Object.defineProperty(UserContext.prototype,
'userConversations', {
get: function() {
if (!this._userConversations) {
this._userConversations = new UserConversationList(
this._version,
this._solution.chatServiceSid,
this._solution.sid
);
}
return this._userConversations;
}
});

/* jshint ignore:start */
/**
* Provide a user-friendly representation
Expand Down
Loading

0 comments on commit 5966227

Please sign in to comment.