Skip to content

Latest commit

 

History

History
616 lines (462 loc) · 18.1 KB

sites-zones.md

File metadata and controls

616 lines (462 loc) · 18.1 KB

Sites Zones

sitesZones := client.SitesZones()

Class Name

SitesZones

Methods

Count Site Zone Sessions

Count Site Zone Sessions

CountSiteZoneSessions(
    ctx context.Context,
    siteId uuid.UUID,
    zoneType models.ZoneTypeEnum,
    distinct *models.SiteZoneCountDistinctEnum,
    userType *models.RfClientTypeEnum,
    user *string,
    scopeId *string,
    scope *models.ZoneScopeEnum,
    start *int,
    end *int,
    duration *string,
    limit *int,
    page *int) (
    models.ApiResponse[models.RepsonseCount],
    error)

Parameters

Parameter Type Tags Description
siteId uuid.UUID Template, Required -
zoneType models.ZoneTypeEnum Template, Required -
distinct *models.SiteZoneCountDistinctEnum Query, Optional Default: "scope_id"
userType *models.RfClientTypeEnum Query, Optional user type
user *string Query, Optional client MAC / Asset MAC / SDK UUID
scopeId *string Query, Optional if scope==map/zone/rssizone, the scope id
scope *models.ZoneScopeEnum Query, Optional scope
Default: "site"
start *int Query, Optional start datetime, can be epoch or relative time like -1d, -1w; -1d if not specified
end *int Query, Optional end datetime, can be epoch or relative time like -1d, -2h; now if not specified
duration *string Query, Optional duration like 7d, 2w
Default: "1d"
limit *int Query, Optional Default: 100
Constraints: >= 0
page *int Query, Optional Default: 1
Constraints: >= 1

Response Type

models.RepsonseCount

Example Usage

ctx := context.Background()

siteId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab")

zoneType := models.ZoneTypeEnum("rssizones")

distinct := models.SiteZoneCountDistinctEnum("scope_id")







scope := models.ZoneScopeEnum("site")





duration := "10m"

limit := 100

page := 1

apiResponse, err := sitesZones.CountSiteZoneSessions(ctx, siteId, zoneType, &distinct, nil, nil, nil, &scope, nil, nil, &duration, &limit, &page)
if err != nil {
    log.Fatalln(err)
} else {
    // Printing the result and response
    fmt.Println(apiResponse.Data)
    fmt.Println(apiResponse.Response.StatusCode)
}

Example Response (as JSON)

{
  "distinct": "string",
  "end": 0,
  "limit": 0,
  "results": [
    {
      "count": 0,
      "property": "string"
    }
  ],
  "start": 0,
  "total": 0
}

Errors

HTTP Status Code Error Description Exception Class
400 Bad Syntax ResponseHttp400Exception
401 Unauthorized ResponseHttp401ErrorException
403 Permission Denied ResponseHttp403ErrorException
404 Not found. The API endpoint doesn’t exist or resource doesn’ t exist ResponseHttp404Exception
429 Too Many Request. The API Token used for the request reached the 5000 API Calls per hour threshold ResponseHttp429ErrorException

Create Site Zone

Create Site Zone

CreateSiteZone(
    ctx context.Context,
    siteId uuid.UUID,
    body *models.Zone) (
    models.ApiResponse[models.Zone],
    error)

Parameters

Parameter Type Tags Description
siteId uuid.UUID Template, Required -
body *models.Zone Body, Optional Request Body

Response Type

models.Zone

Example Usage

ctx := context.Background()

siteId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab")

body := models.Zone{
    Name:                 models.ToPointer("string"),
    Vertices:             []models.ZoneVertex{
        models.ZoneVertex{
            X:                    float64(0),
            Y:                    float64(0),
        },
    },
}

apiResponse, err := sitesZones.CreateSiteZone(ctx, siteId, &body)
if err != nil {
    log.Fatalln(err)
} else {
    // Printing the result and response
    fmt.Println(apiResponse.Data)
    fmt.Println(apiResponse.Response.StatusCode)
}

Example Response (as JSON)

{
  "created_time": 0,
  "id": "b069b358-4c97-5319-1f8c-7c5ca64d6ab1",
  "map_id": "b069b358-4c97-5319-1f8c-7c5ca64d6ab1",
  "modified_time": 0,
  "name": "string",
  "org_id": "b069b358-4c97-5319-1f8c-7c5ca64d6ab1",
  "site_id": "b069b358-4c97-5319-1f8c-7c5ca64d6ab1",
  "vertices": [
    {
      "x": 0,
      "y": 0
    }
  ]
}

Errors

HTTP Status Code Error Description Exception Class
400 Bad Syntax ResponseHttp400Exception
401 Unauthorized ResponseHttp401ErrorException
403 Permission Denied ResponseHttp403ErrorException
404 Not found. The API endpoint doesn’t exist or resource doesn’ t exist ResponseHttp404Exception
429 Too Many Request. The API Token used for the request reached the 5000 API Calls per hour threshold ResponseHttp429ErrorException

Delete Site Zone

Delete Site Zone

DeleteSiteZone(
    ctx context.Context,
    siteId uuid.UUID,
    zoneId uuid.UUID) (
    http.Response,
    error)

Parameters

Parameter Type Tags Description
siteId uuid.UUID Template, Required -
zoneId uuid.UUID Template, Required -

Response Type

``

Example Usage

ctx := context.Background()

siteId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab")

zoneId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab")

resp, err := sitesZones.DeleteSiteZone(ctx, siteId, zoneId)
if err != nil {
    log.Fatalln(err)
} else {
    fmt.Println(resp.StatusCode)
}

Errors

HTTP Status Code Error Description Exception Class
400 Bad Syntax ResponseHttp400Exception
401 Unauthorized ResponseHttp401ErrorException
403 Permission Denied ResponseHttp403ErrorException
404 Not found. The API endpoint doesn’t exist or resource doesn’ t exist ResponseHttp404Exception
429 Too Many Request. The API Token used for the request reached the 5000 API Calls per hour threshold ResponseHttp429ErrorException

Get Site Zone

Get Site Zone Details

GetSiteZone(
    ctx context.Context,
    siteId uuid.UUID,
    zoneId uuid.UUID) (
    models.ApiResponse[models.Zone],
    error)

Parameters

Parameter Type Tags Description
siteId uuid.UUID Template, Required -
zoneId uuid.UUID Template, Required -

Response Type

models.Zone

Example Usage

ctx := context.Background()

siteId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab")

zoneId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab")

apiResponse, err := sitesZones.GetSiteZone(ctx, siteId, zoneId)
if err != nil {
    log.Fatalln(err)
} else {
    // Printing the result and response
    fmt.Println(apiResponse.Data)
    fmt.Println(apiResponse.Response.StatusCode)
}

Example Response (as JSON)

{
  "created_time": 0,
  "id": "b069b358-4c97-5319-1f8c-7c5ca64d6ab1",
  "map_id": "b069b358-4c97-5319-1f8c-7c5ca64d6ab1",
  "modified_time": 0,
  "name": "string",
  "org_id": "b069b358-4c97-5319-1f8c-7c5ca64d6ab1",
  "site_id": "b069b358-4c97-5319-1f8c-7c5ca64d6ab1",
  "vertices": [
    {
      "x": 0,
      "y": 0
    }
  ]
}

Errors

HTTP Status Code Error Description Exception Class
400 Bad Syntax ResponseHttp400Exception
401 Unauthorized ResponseHttp401ErrorException
403 Permission Denied ResponseHttp403ErrorException
404 Not found. The API endpoint doesn’t exist or resource doesn’ t exist ResponseHttp404Exception
429 Too Many Request. The API Token used for the request reached the 5000 API Calls per hour threshold ResponseHttp429ErrorException

List Site Zones

Get List of Site Zones

ListSiteZones(
    ctx context.Context,
    siteId uuid.UUID,
    limit *int,
    page *int) (
    models.ApiResponse[[]models.Zone],
    error)

Parameters

Parameter Type Tags Description
siteId uuid.UUID Template, Required -
limit *int Query, Optional Default: 100
Constraints: >= 0
page *int Query, Optional Default: 1
Constraints: >= 1

Response Type

[]models.Zone

Example Usage

ctx := context.Background()

siteId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab")

limit := 100

page := 1

apiResponse, err := sitesZones.ListSiteZones(ctx, siteId, &limit, &page)
if err != nil {
    log.Fatalln(err)
} else {
    // Printing the result and response
    fmt.Println(apiResponse.Data)
    fmt.Println(apiResponse.Response.StatusCode)
}

Example Response (as JSON)

[
  {
    "created_time": 0,
    "id": "b069b358-4c97-5319-1f8c-7c5ca64d6ab1",
    "map_id": "b069b358-4c97-5319-1f8c-7c5ca64d6ab1",
    "modified_time": 0,
    "name": "string",
    "org_id": "b069b358-4c97-5319-1f8c-7c5ca64d6ab1",
    "site_id": "b069b358-4c97-5319-1f8c-7c5ca64d6ab1",
    "vertices": [
      {
        "x": 0,
        "y": 0
      }
    ]
  }
]

Errors

HTTP Status Code Error Description Exception Class
400 Bad Syntax ResponseHttp400Exception
401 Unauthorized ResponseHttp401ErrorException
403 Permission Denied ResponseHttp403ErrorException
404 Not found. The API endpoint doesn’t exist or resource doesn’ t exist ResponseHttp404Exception
429 Too Many Request. The API Token used for the request reached the 5000 API Calls per hour threshold ResponseHttp429ErrorException

Search Site Zone Sessions

Search Zone Sessions

SearchSiteZoneSessions(
    ctx context.Context,
    siteId uuid.UUID,
    zoneType models.ZoneTypeEnum,
    userType *models.RfClientTypeEnum,
    user *string,
    scopeId *string,
    scope *models.VisitsScopeEnum,
    start *int,
    end *int,
    duration *string,
    limit *int,
    page *int) (
    models.ApiResponse[models.ResponseZoneSearch],
    error)

Parameters

Parameter Type Tags Description
siteId uuid.UUID Template, Required -
zoneType models.ZoneTypeEnum Template, Required -
userType *models.RfClientTypeEnum Query, Optional user type, client (default) / sdkclient / asset
user *string Query, Optional client MAC / Asset MAC / SDK UUID
scopeId *string Query, Optional if scope==map/zone/rssizone, the scope id
scope *models.VisitsScopeEnum Query, Optional scope
Default: "site"
start *int Query, Optional start datetime, can be epoch or relative time like -1d, -1w; -1d if not specified
end *int Query, Optional end datetime, can be epoch or relative time like -1d, -2h; now if not specified
duration *string Query, Optional duration like 7d, 2w
Default: "1d"
limit *int Query, Optional Default: 100
Constraints: >= 0
page *int Query, Optional Default: 1
Constraints: >= 1

Response Type

models.ResponseZoneSearch

Example Usage

ctx := context.Background()

siteId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab")

zoneType := models.ZoneTypeEnum("rssizones")







scope := models.VisitsScopeEnum("site")





duration := "10m"

limit := 100

page := 1

apiResponse, err := sitesZones.SearchSiteZoneSessions(ctx, siteId, zoneType, nil, nil, nil, &scope, nil, nil, &duration, &limit, &page)
if err != nil {
    log.Fatalln(err)
} else {
    // Printing the result and response
    fmt.Println(apiResponse.Data)
    fmt.Println(apiResponse.Response.StatusCode)
}

Example Response (as JSON)

{
  "end": 1541705289.769911,
  "limit": 1,
  "next": "/api/v1/sites/67970e46-4e12-11e6-9188-0242ac110007/zones/visits/search?limit=2&end=1541705247.000&scope_id=85fbba9e-4e12-11e6-9188-0242ac110007&user_type=asset&start=1541618889.77",
  "results": [
    {
      "enter": 1541705254,
      "scope": "map",
      "timestamp": 1541705254,
      "user": "c4b301c81166"
    }
  ],
  "start": 1541618889.769886,
  "total": 5892
}

Errors

HTTP Status Code Error Description Exception Class
400 Bad Syntax ResponseHttp400Exception
401 Unauthorized ResponseHttp401ErrorException
403 Permission Denied ResponseHttp403ErrorException
404 Not found. The API endpoint doesn’t exist or resource doesn’ t exist ResponseHttp404Exception
429 Too Many Request. The API Token used for the request reached the 5000 API Calls per hour threshold ResponseHttp429ErrorException

Update Site Zone

Update Site Zone

UpdateSiteZone(
    ctx context.Context,
    siteId uuid.UUID,
    zoneId uuid.UUID,
    body *models.Zone) (
    models.ApiResponse[models.Zone],
    error)

Parameters

Parameter Type Tags Description
siteId uuid.UUID Template, Required -
zoneId uuid.UUID Template, Required -
body *models.Zone Body, Optional Request Body

Response Type

models.Zone

Example Usage

ctx := context.Background()

siteId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab")

zoneId := uuid.MustParse("000000ab-00ab-00ab-00ab-0000000000ab")

body := models.Zone{
    Name:                 models.ToPointer("string"),
    Vertices:             []models.ZoneVertex{
        models.ZoneVertex{
            X:                    float64(0),
            Y:                    float64(0),
        },
    },
}

apiResponse, err := sitesZones.UpdateSiteZone(ctx, siteId, zoneId, &body)
if err != nil {
    log.Fatalln(err)
} else {
    // Printing the result and response
    fmt.Println(apiResponse.Data)
    fmt.Println(apiResponse.Response.StatusCode)
}

Example Response (as JSON)

{
  "created_time": 0,
  "id": "b069b358-4c97-5319-1f8c-7c5ca64d6ab1",
  "map_id": "b069b358-4c97-5319-1f8c-7c5ca64d6ab1",
  "modified_time": 0,
  "name": "string",
  "org_id": "b069b358-4c97-5319-1f8c-7c5ca64d6ab1",
  "site_id": "b069b358-4c97-5319-1f8c-7c5ca64d6ab1",
  "vertices": [
    {
      "x": 0,
      "y": 0
    }
  ]
}

Errors

HTTP Status Code Error Description Exception Class
400 Bad Syntax ResponseHttp400Exception
401 Unauthorized ResponseHttp401ErrorException
403 Permission Denied ResponseHttp403ErrorException
404 Not found. The API endpoint doesn’t exist or resource doesn’ t exist ResponseHttp404Exception
429 Too Many Request. The API Token used for the request reached the 5000 API Calls per hour threshold ResponseHttp429ErrorException