## EOAuth2Services EOAuth2Services — An extensible object holding all known OAuth2 services |

## Functions

gboolean | e_oauth2_services_is_supported ()
EOAuth2Services * | e_oauth2_services_new ()
void | e_oauth2_services_add ()
void | e_oauth2_services_remove ()
GSList * | e_oauth2_services_list ()
EOAuth2Service * | e_oauth2_services_find ()
EOAuth2Service * | e_oauth2_services_guess ()
gboolean | e_oauth2_services_is_oauth2_alias ()
gboolean | e_oauth2_services_is_oauth2_alias_static ()

## Types and Values

struct | EOAuth2Services

## Object Hierarchy

        GObject
        ╰── EOAuth2Services

## Implemented Interfaces

EOAuth2Services implements

## Includes

    #include <libedataserver/libedataserver.h>

## Description

The extensible object, which holds all known OAuth2 services. Each EOAuth2Service extends this object and adds itself to it with `e_oauth2_services_add()`. The services can be later searched for with `e_oauth2_services_find()`, which returns the service suitable for the given protocol and/or host name.

## Functions

### e_oauth2_services_is_supported ()

    gboolean
    e_oauth2_services_is_supported (void);

#### Returns

`TRUE`, when evolution-data-server had been compiled with OAuth2 authentication enabled, `FALSE` otherwise.

Since: 3.28

### e_oauth2_services_new ()

    EOAuth2Services *
    e_oauth2_services_new (void);

Creates a new EOAuth2Services instance.

#### Returns

an EOAuth2Services.

[transfer full]

Since: 3.28

### e_oauth2_services_add ()

    void
    e_oauth2_services_add (EOAuth2Services *services,
                           EOAuth2Service *service);

Adds the `service` to the list of known OAuth2 services into `services` . It also adds a reference to `service` .

#### Parameters

services | an EOAuth2Services |
service | an EOAuth2Service to add |

Since: 3.28

### e_oauth2_services_remove ()

    void
    e_oauth2_services_remove (EOAuth2Services *services,
                              EOAuth2Service *service);

Removes the `service` from the list of known services in `services` . The function does nothing, if the `service` had not been added.

#### Parameters

services | an EOAuth2Services |
service | an EOAuth2Service to remove |

Since: 3.28

### e_oauth2_services_list ()

    GSList *
    e_oauth2_services_list (EOAuth2Services *services);

Lists all currently known services, which had been added with `e_oauth2_services_add()`. Free the returned GSList with g_slist_remove_full (known_services, g_object_unref); when no longer needed.

#### Parameters

services | an EOAuth2Services |

#### Returns

a newly allocated GSList with all currently known EOAuth2Service referenced instances.

[transfer full][element-type EOAuth2Service]

Since: 3.28

### e_oauth2_services_find ()

    EOAuth2Service *
    e_oauth2_services_find (EOAuth2Services *services,
                            ESource *source);

Searches the list of currently known OAuth2 services for the one which can be used with the given `source` .

The returned EOAuth2Service is referenced for thread safety, if found.

#### Parameters

services | an EOAuth2Services |
source | an ESource |

#### Returns

a referenced EOAuth2Service, which can be used with given `source` , or `NULL`, when none was found.

[transfer full][nullable]

Since: 3.28

### e_oauth2_services_guess ()

    EOAuth2Service *
    e_oauth2_services_guess (EOAuth2Services *services,
                             const gchar *protocol,
                             const gchar *hostname);

Searches the list of currently known OAuth2 services for the one which can be used with the given `protocol` and/or `hostname` . Any of `protocol` and `hostname` can be `NULL`, but not both. It's up to each EOAuth2Service to decide, which of the arguments are important and whether all or only any of them can be required.

The returned EOAuth2Service is referenced for thread safety, if found.

#### Parameters

services | an EOAuth2Services |
protocol | a protocol to search the service for, like "imap", or `NULL`. | [nullable]
hostname | a host name to search the service for, like "server.example.com", or `NULL`. | [nullable]

#### Returns

a referenced EOAuth2Service, which can be used with given constraints, or `NULL`, when none was found.

[transfer full][nullable]

Since: 3.28

### e_oauth2_services_is_oauth2_alias ()

    gboolean
    e_oauth2_services_is_oauth2_alias (EOAuth2Services *services,
                                       const gchar *auth_method);

#### Parameters

services | an EOAuth2Services |
auth_method | an authentication method, or `NULL`. | [nullable]

#### Returns

whether exists any EOAuth2Service, with the same name as `auth_method` .

See: `e_oauth2_services_is_oauth2_alias_static()`

Since: 3.28

### e_oauth2_services_is_oauth2_alias_static ()

    gboolean
    e_oauth2_services_is_oauth2_alias_static
                                   (const gchar *auth_method);

This is the same as `e_oauth2_services_is_oauth2_alias()`, except it creates its own EOAuth2Services instance and frees it at the end. The EOAuth2Services is implemented as a singleton, thus it won't be much trouble, as long as there is something else having created one instance.

#### Parameters

auth_method | an authentication method, or `NULL`. | [nullable]

#### Returns

whether exists any EOAuth2Service, with the same name as `auth_method` .

Since: 3.28

## Types and Values

### struct EOAuth2Services

    struct EOAuth2Services;

Contains only private data that should be read and manipulated using the functions below.

Since: 3.28