Esempio n. 1
0
def call_api(client):
    if len(sys.argv) == 1:
        rp.process_response(client, client.fetch_inbound_custom_fields())
    else:
        print(
            "FetchInboundCustomFields (no parameters passed): Returns JSON object of Inbound Message Custom Fields"
        )
def call_api(client):
    if len(sys.argv) == 1:
        rp.process_response(client, client.fetch_account_custom_fields())
    else:
        print(
            "FetchAccountCustomFields (no parameters passed): Returns JSON object of custom fields on account objects"
        )
def call_api(client):
    if len(sys.argv) == 1:
        rp.process_response(client, client.fetch_partner_account_groups())
    else:
        print(
            "FetchPartnerAccountGroups (no parameters passed): Returns JSON object of Parther Account Groups"
        )
Esempio n. 4
0
def call_api(client):
    if len(sys.argv) == 1:
        search_request = {
            "filters": {
                "ASSET_TYPE": [
                    "PHOTO", "VIDEO", "PDF", "DOC", "EXCEL", "PRESENTATION",
                    "PSD", "TEXT", "RICH_TEXT", "LINK", "POST"
                ]
            },
            "sortList": [{
                "order": "DESC",
                "key": "createdTime"
            }],
            "rangeCondition": {
                "start": 0,
                "fieldName": "createdTime",
                "end": 1924363439363
            },
            "onlyAvailable": True,
            "start": 0,
            "rows": 2
        }
        rp.process_response(client, client.search_asset(search_request))
    else:
        print(
            "FetchWebhookTypes - Returns JSON object of assets - modify program to alter search conditions"
        )
Esempio n. 5
0
def call_api(client):
    if len(sys.argv) == 1:
        rp.process_response(client, client.fetch_accessible_users())
    else:
        print(
            "FetchAccessibleUsers (no parameters passed): Returns JSON object of accessible users"
        )
def call_api(client):
    if len(sys.argv) == 1:
        rp.process_response(client, client.fetch_all_dashboards())
    else:
        print(
            "FetchAllDashboards (no parameters passed): Returns JSON object of all dashboards accessible by current user/access token"
        )
Esempio n. 7
0
def call_api(client):
    if len(sys.argv) == 1:
        rp.process_response(client, client.fetch_macros())
    else:
        print(
            "FetchMacros (no parameters passed): Returns JSON object of macros visible to current user/access token"
        )
Esempio n. 8
0
def call_api(client):
    if len(sys.argv) == 2:
        filename = sys.argv[1]

        filename_parts = os.path.splitext(filename)
        extension = filename_parts[1][1:]

        # Attempt to determine contentType from filename. Default to FILE if not possible.
        content_type = "FILE"
        if extension in {'png', 'gif', 'jpg', 'jpeg'}:
            content_type = "IMAGE"
        elif extension in {
                'mov',
                'mpeg',
                'mp4',
                'AVI',
                'MPV',
        }:
            content_type = "VIDEO"

        print("Uploading the", content_type.lower(), filename)

        # Using uuid to generate a random tracking number. A date/time stamp or other unique tracking number would probably be better.
        rp.process_response(
            client, client.asset_upload(content_type, uuid.uuid4(), filename))

    else:
        print("Usage: UploadAsset {filename.ext}")
def call_api(client):
    if len(sys.argv) == 1:
        rp.process_response(client, client.fetch_um_statuses())
    else:
        print(
            "FetchUMStatuses - Returns JSON object of Universal Message Statuses available"
        )
def call_api(client):
    if len(sys.argv) == 3:
        rp.process_response(
            client, client.fetch_account_by_channel_id(sys.argv[1],
                                                       sys.argv[2]))
    else:
        print("Usage: FetchAccountByChannelId {account_type} {channel_id}")
def call_api(client):
    if len(sys.argv) == 1:
        rp.process_response(client, client.fetch_client_profile_lists())
    else:
        print(
            "FetchClientProfileLists (no parameters) - returns list of all Profile lists visible to the current user/access token"
        )
Esempio n. 12
0
def call_api(client):
    if len(sys.argv) == 1:
        rp.process_response(client, client.fetch_profile_custom_fields())
    else:
        print(
            "FetchProfileCustomFields (no parameters passed): Returns JSON object of Profile Custom Fields"
        )
def call_api(client):
    if len(sys.argv) == 1:
        rp.process_response(client, client.fetch_client_users())
    else:
        print(
            "FetchClientUsers (no parameters passed): Returns JSON object of all Users in the current client environment"
        )
def call_api(client):
    if len(sys.argv) == 1:
        rp.process_response(client, client.fetch_listening_topics())
    else:
        print(
            "FetchListeningTopics (no parameters passed): Returns JSON object of Listening Topics visible to current user/access token"
        )
Esempio n. 15
0
def call_api(client):
    print("Arg Count:", len(sys.argv))
    if len(sys.argv) > 3 and len(sys.argv) < 8:
        dashboard_id = sys.argv[1]
        start = sys.argv[2]
        rows = sys.argv[3]
        start_date = None
        until_date = None
        sort_order = 'snCreatedTime%20desc'

        if len(sys.argv) > 4:
            start_date = sys.argv[4]

        if len(sys.argv) > 5:
            until_date = sys.argv[5]

        if len(sys.argv) > 6:
            sort_order = sys.argv[6]
        rp.process_response(
            client,
            client.fetch_dashboard_stream(dashboard_id, start, rows,
                                          start_date, until_date, sort_order))

    else:
        print(
            "FetchDashboardStream {stream_id} {start} {rows} [from_date] [until_date] [sort_order]"
        )
def call_api(client):
    if len(sys.argv) == 1:
        rp.process_response(client, client.fetch_client_url_shortners())
    else:
        print(
            "FetchClientUrlShortners (no parameters passed): Returns JSON object of all URL Shortners accessible by current user/access token"
        )
def call_api(client):
    if len(sys.argv) == 1:
        rp.process_response(client, client.fetch_permissions())
    else:
        print(
            "FetchPermissions (no parameters passed): Returns JSON object of Permissions for current user/access token"
        )
def call_api(client):
    if len(sys.argv) == 2:
        rp.process_response(client, client.fetch_resources(sys.argv[1]))
    else:
        print("FetchResources {resource type} (one of: PARTNER_ACCOUNTS, PARTNER_CAMPAIGNS, PARTNER_ACCOUNT_GROUPS, "
        "PARTNER_USERS, CLIENT_USERS, CLIENTS, CLIENT_URL_SHORTNERS, INBOUND_CUSTOM_FIELDS, OUTBOUND_CUSTOM_FIELDS, "
        "PROFILE_CUSTOM_FIELDS, MEDIA_ASSET_CUSTOM_FIELDS, ACCOUNT_CUSTOM_FIELDS, UM_STATUSES, UM_PRIORITIES, ACCESSIBLE_USERS, "
        "APPROVAL_PATHS, PARTNER_QUEUES, CLIENT_QUEUES, PARTNER_PROFILE_LISTS, CLIENT_PROFILE_LISTS, MACROS, PERMISSIONS, USER_GROUPS)")
Esempio n. 19
0
def call_api(client):
    if len(sys.argv) == 2:
        update_request = {
         "tags":["UpdatedViaAPI"]
        }
        rp.process_response(client, client.update_asset(sys.argv[1], update_request))
    else:
        print("Usage: UpdateAsset {asset_id}")
        print("This command will add an 'UpdatedViaAPI' tag to an asset")
def call_api(client):
    if len(sys.argv) == 2:
        report_object = None
        with open(sys.argv[1]) as f_in:
            report_object = json.load(f_in)
        rp.process_response(client, client.fetch_report(report_object))
    else:
        print(
            "FetchReportByFile {filename.json} - reads and executes a report as defined in a file"
        )
Esempio n. 21
0
def call_api(client):
    # custom_field_add_option(sys.argv[2], sys.argv[3])
    if len(sys.argv) == 3:
        option_data = {"addOptions": [sys.argv[2]]}

        if client.update_custom_field_options(sys.argv[1], option_data):
            rp.process_response(client, client.fetch_custom_field(sys.argv[1]))
        else:
            print(client.raw)
    else:
        print("CustomFieldAddOption {field_id} {option_to_add}")
Esempio n. 22
0
def call_api(client):
    # create_asset(name, asset_type, description, uploaded_content_id)
    #  create_asset(sys.argv[2], sys.argv[3], sys.argv[4],sys.argv[5])
    if len(sys.argv) == 5:
        asset_data = {
            "name": sys.argv[1],
            "assetType": sys.argv[2],
            "description": sys.argv[3],
            "uploadedContentId": sys.argv[4]
        }
        rp.process_response(client, client.create_asset(asset_data))
    else:
        print(
            "Usage: CreateAsset {name}, {assetType}, {description}, {uploadedContentId}"
        )
Esempio n. 23
0
def call_api(client):
    if len(sys.argv) > 3 and len(sys.argv) < 16:
        stream_id = sys.argv[1]
        since_time = sys.argv[2]
        until_time = sys.argv[3]
        timezone_offset = 14400000
        details = "STREAM"
        dimension = "TOPIC"
        metric = "MENTIONS"
        trend_aggregation_period = None
        start = 1
        rows = 1
        echo_request = True
        tag = None
        sort_key = None
        message_format_options = None

        stream = {
            "sinceTime": since_time,
            "untilTime": until_time,
            "timezoneOffset": timezone_offset,
            "details": {
                "widgetType": details
            },
            "filters": [{
                "dimension": dimension,
                "filterValues": [stream_id]
            }],
            "metric": metric,
            "start": start,
            "rows": rows,
            "timeField": "SN_CREATED_TIME",
            "echoRequest": echo_request
        }
        rp.process_response(client, client.fetch_listening_stream(stream))
    else:
        print(
            "FetchListeningStream {id} {sinceTime} {untilTime} - returns data from listening stream (other options can be set in code)"
        )
Esempio n. 24
0
def call_api(client):
    if len(sys.argv) == 1:
        filter = {"query": "",
              "filters": [
                  {
                      "filterType": "IN",
                      "field": "channelType",
                      "values": ["SPRINKLR"]
                  },
                  {
                      "filterType": "IN",
                      "field": "archived",
                      "values": ["true"]
                  }
              ],
              "paginationInfo": {
                  "start": 0,
                  "rows": 100,
                  "sortKey": "caseModificationTime"
              }}
        rp.process_response(client, client.search_case_v1(filter))
    else:
        print("FetchArchivedCases (no parameters passed): Returns JSON object of all archived cases accessible by current user/access token")
def call_api(client):
    if len(sys.argv) == 1:
        rp.process_response(client, client.fetch_partner_campaigns())
    else:
        print("FetchPartnerCampaigns (no parameters passed): Returns JSON object of Parther Campaigns visible to current user/access token")
Esempio n. 26
0
def call_api(client):
    if len(sys.argv) == 2:
        rp.process_response(client,
                            client.fetch_dashboard_by_name(sys.argv[1]))
    else:
        print("FetchDashboardByName {name}")
def call_api(client):
    if len(sys.argv) == 3:
        rp.process_response(
            client, client.fetch_comment("CASE", sys.argv[1], sys.argv[2]))
    else:
        print("FetchCaseComment {case_number} {comment_id}")
Esempio n. 28
0
def call_api(client):
    if len(sys.argv) == 2:
        rp.process_response(client, client.fetch_message_by_UMID(sys.argv[1]))
    else:
        print("FetchMessageByUMId {case_id}")
def call_api(client):
    if len(sys.argv) == 2:
        rp.process_response(client,
                            client.fetch_case_associated_messages(sys.argv[1]))
    else:
        print("FetchCaseMessagesById {case_id}")
Esempio n. 30
0
def call_api(client):
    if len(sys.argv) == 2:
        rp.process_response(client, client.read_asset(sys.argv[1]))
    else:
        print("Usage: FetchAssetById {account_type} {channel_id}")