Organization Level SDK Functions

v 1.3.20

imerit_ango.sdk.SDK.

create_storage(storage_data)

Create storage

Parameters:

  • storage_data: Storage

    • Storage

      • name: string

      • provider: StorageProvider

      • public_key: string

      • private_key: string

      • credentials: string

    • StorageProvider

      • {AWS, GCP, AZURE}

Returns:

  • output: dict

Example:

import os
from dotenv import load_dotenv
from imerit_ango.sdk import SDK
from imerit_ango.models.storage import Storage
from imerit_ango.models.enums import StorageProvider

load_dotenv('variables.env')
api_key = os.getenv('API_KEY')

ango_sdk = SDK(api_key)

sdk_response = ango_sdk.create_storage(Storage(name="My Storage",
                                               provider=StorageProvider.AWS,
                                               public_key='<YOUR PUBLIC KEY>',
                                               private_key='<YOUR PRIVATE KEY>',
                                               region="eu-central-1",
                                               credentials='<YOUR CREDENTIALS>'))

delete_organization_invites(organization_id, invite_emails)

Delete organization invites

Parameters:

  • organization_id: string

  • invite_emails: List[string]

Returns:

  • output: dict

Example:

import os
from dotenv import load_dotenv
from imerit_ango.sdk import SDK

load_dotenv('variables.env')
api_key = os.getenv('API_KEY')
organization_id = os.getenv('ORGANIZATION_ID')

ango_sdk = SDK(api_key)

sdk_respose = ango_sdk.delete_organization_invites(organization_id=organization_id,
                                                   invite_emails=["user@example.com"])

delete_organization_members(organization_id, member_emails)

Delete organization members

Parameters:

  • organization_id: string

  • member_emails: List[string]

Returns:

  • output: dict

Example:

import os
from dotenv import load_dotenv
from imerit_ango.sdk import SDK

load_dotenv('variables.env')
api_key = os.getenv('API_KEY')
organization_id = os.getenv('ORGANIZATION_ID')

ango_sdk = SDK(api_key)

ango_sdk.delete_organization_members(organization_id=organization_id, 
                                     member_emails=["user1@example.com", "user2@example.com"])

delete_storage(storage_id)

Delete storage

Parameters:

  • storage_id: string

Returns:

  • output: dict

Example:

import os
from dotenv import load_dotenv
from imerit_ango.sdk import SDK

load_dotenv('variables.env')
api_key = os.getenv('API_KEY')

ango_sdk = SDK(api_key)

storage_id = '<YOUR STORAGE ID>'
ango_sdk.delete_storage(storage_id=storage_id)

get_organization_invites(organization_id)

Get organization invites

Parameters:

  • organization_id: string

Returns:

  • output: dict

Example:

import os
from dotenv import load_dotenv
from imerit_ango.sdk import SDK

load_dotenv('variables.env')
api_key = os.getenv('API_KEY')
organization_id = os.getenv('ORGANIZATION_ID')

ango_sdk = SDK(api_key)

sdk_response = ango_sdk.get_organization_invites(organization_id=organization_id)
invites = sdk_response['data']['invites']

get_organization_members(organization_id)

Get organization members

Parameters:

  • organization_id: string

Returns:

  • output: dict

Example:

import os
from dotenv import load_dotenv
from imerit_ango.sdk import SDK

load_dotenv('variables.env')
api_key = os.getenv('API_KEY')
organization_id = os.getenv('ORGANIZATION_ID')

ango_sdk = SDK(api_key)

sdk_response = ango_sdk.get_organization_members(organization_id=organization_id)
members = sdk_response["data"]["users"]

get_storages(storage_id)

Get all the storages of the current organization.

Parameters:

  • storage_id: String, Optional, Default None

Returns:

  • output: dict

Example:

import os
from dotenv import load_dotenv
from imerit_ango.sdk import SDK

load_dotenv('variables.env')
api_key = os.getenv('API_KEY')

ango_sdk = SDK(api_key)

sdk_response = ango_sdk.get_storages()
storage_list = sdk_response['data']['storages']

Outputs:

{
  "status": "success",
  "data": {
    "storages": [
      {
        "id": "<STORAGE ID>",
        "name": "<STORAGE NAME>",
        "provider": "GCP",
        "createdAt": "2022-11-24T13:48:32.100Z",
        "organization": "<ORGANIZATION ID>"
      }
    ]
  }
}

invite_members_to_org(organization_id, invite_data)

Invite members to the organization

Parameters:

  • organization_id: string

  • invite_data: Invitation

    • Invitation

      • organizationRole: OrganizationRoles

      • projectId: string

      • projectRole: ProjectRoles

    • OrganizationRoles

      • {Member, Admin}

    • ProjectRoles

      • {Manager, Labeler, Reviewer, Lead}

Returns:

  • output: dict

Example:

import os
from dotenv import load_dotenv
from imerit_ango.sdk import SDK
from imerit_ango.models.invite import Invitation
from imerit_ango.models.enums import OrganizationRoles, ProjectRoles

load_dotenv('variables.env')
api_key = os.getenv('API_KEY')
organization_id = os.getenv('ORGANIZATION_ID')
project_id = os.getenv('PROJECT_ID')

ango_sdk = SDK(api_key)

ango_sdk.invite_members_to_org(organization_id=organization_id, 
                               invite_data=Invitation(to=["user@example.com"],
                                                      organizationRole=OrganizationRoles.Member,
                                                      projectId=project_id,
                                                      projectRole=ProjectRoles.Labeler))

update_organization_members_role(organization_id, role_updates)

Update organization members' role

Parameters:

  • organization_id: string

  • role_updates: List[RoleUpdate]

    • RoleUpdate

      • email: string

      • organizationRole: OrganizationRoles

    • OrganizationRoles

      • {Member, Admin}

Returns:

  • output: dict

Example:

import os
from dotenv import load_dotenv
from imerit_ango.sdk import SDK
from imerit_ango.models.invite import RoleUpdate
from imerit_ango.models.enums import OrganizationRoles

load_dotenv('variables.env')
api_key = os.getenv('API_KEY')
organization_id = os.getenv('ORGANIZATION_ID')

ango_sdk = SDK(api_key)

role_update_1 = RoleUpdate(email="user1@example.com", organizationRole=OrganizationRoles.Admin)
role_update_2 = RoleUpdate(email="user2@example.com", organizationRole=OrganizationRoles.Admin)

sdk_response = ango_sdk.update_organization_members_role(organization_id=organization_id,
                                                         role_updates=[role_update_1, role_update_2])

Last updated