ZenEx.Model.User (zen_ex v0.8.0)

Provides functions to operate Zendesk User.

Link to this section Summary

Functions

Create user.

Create multiple users.

Create or update user specified by id.

Create or update multiple users specified by id.

Delete (deactivate) user specified by id.

Delete (deactivate) multiple users specified by id.

List users.

Permanently delete deactivated user specified by id.

Search for users specified by query.

Show user specified by id.

Update user specified by id.

Update multiple users specified by id.

Link to this section Functions

@spec create(%ZenEx.Entity.User{
  active: term(),
  alias: term(),
  created_at: term(),
  custom_role_id: term(),
  details: term(),
  email: term(),
  external_id: term(),
  id: term(),
  last_login_at: term(),
  locale: term(),
  locale_id: term(),
  moderator: term(),
  name: term(),
  notes: term(),
  only_private_comments: term(),
  organization_id: term(),
  phone: term(),
  restricted_agent: term(),
  role: term(),
  shared: term(),
  shared_agent: term(),
  signature: term(),
  suspended: term(),
  tags: term(),
  ticket_restriction: term(),
  time_zone: term(),
  updated_at: term(),
  url: term(),
  user_fields: term(),
  verified: term()
}) ::
  {:ok,
   %ZenEx.Entity.User{
     active: term(),
     alias: term(),
     created_at: term(),
     custom_role_id: term(),
     details: term(),
     email: term(),
     external_id: term(),
     id: term(),
     last_login_at: term(),
     locale: term(),
     locale_id: term(),
     moderator: term(),
     name: term(),
     notes: term(),
     only_private_comments: term(),
     organization_id: term(),
     phone: term(),
     restricted_agent: term(),
     role: term(),
     shared: term(),
     shared_agent: term(),
     signature: term(),
     suspended: term(),
     tags: term(),
     ticket_restriction: term(),
     time_zone: term(),
     updated_at: term(),
     url: term(),
     user_fields: term(),
     verified: term()
   }}
  | {:error, any()}

Create user.

examples

Examples

iex> ZenEx.Model.User.create(%ZenEx.Entity.User{name: "xxx", email: "xxx@xxx"})
{:ok, %ZenEx.Entity.User{name: "xxx", email: "xxx@xxx", ...}}
Link to this function

create_many(users)

@spec create_many([
  %ZenEx.Entity.User{
    active: term(),
    alias: term(),
    created_at: term(),
    custom_role_id: term(),
    details: term(),
    email: term(),
    external_id: term(),
    id: term(),
    last_login_at: term(),
    locale: term(),
    locale_id: term(),
    moderator: term(),
    name: term(),
    notes: term(),
    only_private_comments: term(),
    organization_id: term(),
    phone: term(),
    restricted_agent: term(),
    role: term(),
    shared: term(),
    shared_agent: term(),
    signature: term(),
    suspended: term(),
    tags: term(),
    ticket_restriction: term(),
    time_zone: term(),
    updated_at: term(),
    url: term(),
    user_fields: term(),
    verified: term()
  }
]) ::
  {:ok,
   %ZenEx.Entity.JobStatus{
     id: term(),
     message: term(),
     progress: term(),
     results: term(),
     status: term(),
     total: term(),
     url: term()
   }}
  | {:error, any()}

Create multiple users.

examples

Examples

iex> ZenEx.Model.User.create_many([%ZenEx.Entity.User{name: "xxx"}, ...])
{:ok, %ZenEx.Entity.JobStatus{id: "xxx"}}
Link to this function

create_or_update(user)

@spec create_or_update(%ZenEx.Entity.User{
  active: term(),
  alias: term(),
  created_at: term(),
  custom_role_id: term(),
  details: term(),
  email: term(),
  external_id: term(),
  id: term(),
  last_login_at: term(),
  locale: term(),
  locale_id: term(),
  moderator: term(),
  name: term(),
  notes: term(),
  only_private_comments: term(),
  organization_id: term(),
  phone: term(),
  restricted_agent: term(),
  role: term(),
  shared: term(),
  shared_agent: term(),
  signature: term(),
  suspended: term(),
  tags: term(),
  ticket_restriction: term(),
  time_zone: term(),
  updated_at: term(),
  url: term(),
  user_fields: term(),
  verified: term()
}) ::
  {:ok,
   %ZenEx.Entity.User{
     active: term(),
     alias: term(),
     created_at: term(),
     custom_role_id: term(),
     details: term(),
     email: term(),
     external_id: term(),
     id: term(),
     last_login_at: term(),
     locale: term(),
     locale_id: term(),
     moderator: term(),
     name: term(),
     notes: term(),
     only_private_comments: term(),
     organization_id: term(),
     phone: term(),
     restricted_agent: term(),
     role: term(),
     shared: term(),
     shared_agent: term(),
     signature: term(),
     suspended: term(),
     tags: term(),
     ticket_restriction: term(),
     time_zone: term(),
     updated_at: term(),
     url: term(),
     user_fields: term(),
     verified: term()
   }}
  | {:error, any()}

Create or update user specified by id.

examples

Examples

iex> ZenEx.Model.User.create_or_update(%ZenEx.Entity.User{name: "xxx", email: "xxx@xxx"})
{:ok, %ZenEx.Entity.User{id: xxx, name: "xxx", email: "xxx@xxx", ...}}
Link to this function

create_or_update_many(users)

@spec create_or_update_many([
  %ZenEx.Entity.User{
    active: term(),
    alias: term(),
    created_at: term(),
    custom_role_id: term(),
    details: term(),
    email: term(),
    external_id: term(),
    id: term(),
    last_login_at: term(),
    locale: term(),
    locale_id: term(),
    moderator: term(),
    name: term(),
    notes: term(),
    only_private_comments: term(),
    organization_id: term(),
    phone: term(),
    restricted_agent: term(),
    role: term(),
    shared: term(),
    shared_agent: term(),
    signature: term(),
    suspended: term(),
    tags: term(),
    ticket_restriction: term(),
    time_zone: term(),
    updated_at: term(),
    url: term(),
    user_fields: term(),
    verified: term()
  }
]) ::
  {:ok,
   %ZenEx.Entity.JobStatus{
     id: term(),
     message: term(),
     progress: term(),
     results: term(),
     status: term(),
     total: term(),
     url: term()
   }}
  | {:error, any()}

Create or update multiple users specified by id.

examples

Examples

iex> ZenEx.Model.User.create_or_update_many([%ZenEx.Entity.User{id: xxx, name: "xxx"}, ...])
{:ok, %ZenEx.Entity.JobStatus{id: "xxx"}}
@spec destroy(integer()) ::
  {:ok,
   %ZenEx.Entity.User{
     active: term(),
     alias: term(),
     created_at: term(),
     custom_role_id: term(),
     details: term(),
     email: term(),
     external_id: term(),
     id: term(),
     last_login_at: term(),
     locale: term(),
     locale_id: term(),
     moderator: term(),
     name: term(),
     notes: term(),
     only_private_comments: term(),
     organization_id: term(),
     phone: term(),
     restricted_agent: term(),
     role: term(),
     shared: term(),
     shared_agent: term(),
     signature: term(),
     suspended: term(),
     tags: term(),
     ticket_restriction: term(),
     time_zone: term(),
     updated_at: term(),
     url: term(),
     user_fields: term(),
     verified: term()
   }}
  | {:error, any()}

Delete (deactivate) user specified by id.

examples

Examples

iex> ZenEx.Model.User.destroy(1)
:ok
Link to this function

destroy_many(ids)

@spec destroy_many([integer()]) ::
  {:ok,
   %ZenEx.Entity.JobStatus{
     id: term(),
     message: term(),
     progress: term(),
     results: term(),
     status: term(),
     total: term(),
     url: term()
   }}
  | {:error, any()}

Delete (deactivate) multiple users specified by id.

examples

Examples

iex> ZenEx.Model.User.destroy_many([xxx, ...])
{:ok, %ZenEx.Entity.JobStatus{id: "xxx"}}
Link to this function

list(opts \\ [])

List users.

examples

Examples

iex> ZenEx.Model.User.list
{:ok, %ZenEx.Collection{}}
Link to this function

permanently_destroy(id)

@spec permanently_destroy(integer()) ::
  {:ok,
   %ZenEx.Entity.User{
     active: term(),
     alias: term(),
     created_at: term(),
     custom_role_id: term(),
     details: term(),
     email: term(),
     external_id: term(),
     id: term(),
     last_login_at: term(),
     locale: term(),
     locale_id: term(),
     moderator: term(),
     name: term(),
     notes: term(),
     only_private_comments: term(),
     organization_id: term(),
     phone: term(),
     restricted_agent: term(),
     role: term(),
     shared: term(),
     shared_agent: term(),
     signature: term(),
     suspended: term(),
     tags: term(),
     ticket_restriction: term(),
     time_zone: term(),
     updated_at: term(),
     url: term(),
     user_fields: term(),
     verified: term()
   }}
  | {:error, any()}

Permanently delete deactivated user specified by id.

examples

Examples

iex> ZenEx.Model.User.permanently_destroy(1)
:ok
@spec search(map()) ::
  {:ok,
   %ZenEx.Collection{
     count: term(),
     decode_as: term(),
     entities: term(),
     next_page: term(),
     previous_page: term()
   }}
  | {:error, any()}
@spec search(String.t()) ::
  {:ok,
   %ZenEx.Collection{
     count: term(),
     decode_as: term(),
     entities: term(),
     next_page: term(),
     previous_page: term()
   }}
  | {:error, any()}

Search for users specified by query.

examples

Examples

iex> ZenEx.Model.User.search(%{email: "first.last@domain.com"})
{:ok, %ZenEx.Collection{}}

iex> ZenEx.Model.User.search("David"})
{:ok, %ZenEx.Collection{}}
@spec show(integer()) ::
  {:ok,
   %ZenEx.Entity.User{
     active: term(),
     alias: term(),
     created_at: term(),
     custom_role_id: term(),
     details: term(),
     email: term(),
     external_id: term(),
     id: term(),
     last_login_at: term(),
     locale: term(),
     locale_id: term(),
     moderator: term(),
     name: term(),
     notes: term(),
     only_private_comments: term(),
     organization_id: term(),
     phone: term(),
     restricted_agent: term(),
     role: term(),
     shared: term(),
     shared_agent: term(),
     signature: term(),
     suspended: term(),
     tags: term(),
     ticket_restriction: term(),
     time_zone: term(),
     updated_at: term(),
     url: term(),
     user_fields: term(),
     verified: term()
   }}
  | {:error, any()}

Show user specified by id.

examples

Examples

iex> ZenEx.Model.User.show(1)
{:ok, %ZenEx.Entity.User{id: 1, name: "xxx", ...}}
@spec update(%ZenEx.Entity.User{
  active: term(),
  alias: term(),
  created_at: term(),
  custom_role_id: term(),
  details: term(),
  email: term(),
  external_id: term(),
  id: term(),
  last_login_at: term(),
  locale: term(),
  locale_id: term(),
  moderator: term(),
  name: term(),
  notes: term(),
  only_private_comments: term(),
  organization_id: term(),
  phone: term(),
  restricted_agent: term(),
  role: term(),
  shared: term(),
  shared_agent: term(),
  signature: term(),
  suspended: term(),
  tags: term(),
  ticket_restriction: term(),
  time_zone: term(),
  updated_at: term(),
  url: term(),
  user_fields: term(),
  verified: term()
}) ::
  {:ok,
   %ZenEx.Entity.User{
     active: term(),
     alias: term(),
     created_at: term(),
     custom_role_id: term(),
     details: term(),
     email: term(),
     external_id: term(),
     id: term(),
     last_login_at: term(),
     locale: term(),
     locale_id: term(),
     moderator: term(),
     name: term(),
     notes: term(),
     only_private_comments: term(),
     organization_id: term(),
     phone: term(),
     restricted_agent: term(),
     role: term(),
     shared: term(),
     shared_agent: term(),
     signature: term(),
     suspended: term(),
     tags: term(),
     ticket_restriction: term(),
     time_zone: term(),
     updated_at: term(),
     url: term(),
     user_fields: term(),
     verified: term()
   }}
  | {:error, any()}

Update user specified by id.

examples

Examples

iex> ZenEx.Model.User.update(%ZenEx.Entity.User{id: 1, name: "xxx"})
{:ok, %ZenEx.Entity.User{id: 1, name: "xxx", ...}}
Link to this function

update_many(users)

@spec update_many([
  %ZenEx.Entity.User{
    active: term(),
    alias: term(),
    created_at: term(),
    custom_role_id: term(),
    details: term(),
    email: term(),
    external_id: term(),
    id: term(),
    last_login_at: term(),
    locale: term(),
    locale_id: term(),
    moderator: term(),
    name: term(),
    notes: term(),
    only_private_comments: term(),
    organization_id: term(),
    phone: term(),
    restricted_agent: term(),
    role: term(),
    shared: term(),
    shared_agent: term(),
    signature: term(),
    suspended: term(),
    tags: term(),
    ticket_restriction: term(),
    time_zone: term(),
    updated_at: term(),
    url: term(),
    user_fields: term(),
    verified: term()
  }
]) ::
  {:ok,
   %ZenEx.Entity.JobStatus{
     id: term(),
     message: term(),
     progress: term(),
     results: term(),
     status: term(),
     total: term(),
     url: term()
   }}
  | {:error, any()}

Update multiple users specified by id.

examples

Examples

iex> ZenEx.Model.User.update_many([%ZenEx.Entity.User{id: xxx, name: "xxx"}, ...])
{:ok, %ZenEx.Entity.JobStatus{id: "xxx"}}